:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --sunk: #10131a;
  --line: #2a2f3a;
  --line-soft: #232833;
  --text: #e9ecf2;
  --muted: #9aa2b1;
  --dim: #6f7889;
  --accent: #5b9dff;
  --accent-soft: rgba(91, 157, 255, .12);
  --ok: #47c08a;
  --bad: #ef6b6b;
  --warn: #e3b341;
  --radius: 14px;
  --radius-sm: 10px;
  /* 화면을 띄워 보이게 하는 그늘. 카드가 배경에 파묻히면 값싸 보인다. */
  --lift: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 30px -24px rgba(0, 0, 0, .9);
  --ring: 0 0 0 3px rgba(91, 157, 255, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
        "Noto Sans KR", Segoe UI, Roboto, sans-serif;
  /* 한국어는 낱말 가운데서 끊으면 읽기 나쁘다('말합니 / 다.'). 어절을 지키고,
     한 낱말이 칸보다 길 때만 어쩔 수 없이 끊는다. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 20, 26, .88);
  backdrop-filter: saturate(140%) blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 19px; color: var(--text); letter-spacing: -0.3px;
}
.brand:hover { text-decoration: none; }
.brand img { display: block; }
.brand span { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: -2px; }
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar .who { color: var(--muted); font-size: 13px; }
/* 좁은 화면에서는 머리띠가 세 줄까지 늘어난다. 누구로 들어와 있는지는 '내 채팅'에서도
   알 수 있으니 여기서는 접어 두고, 화면은 본문에 내준다. */
@media (max-width: 520px) { .topbar .who { display: none; } }
.ghost {
  border: 1px solid var(--line); padding: 5px 12px; border-radius: 8px;
  color: var(--muted) !important;
}
.topbar .start {
  padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: 13.5px;
  background: var(--accent); color: #08111f !important;
}
.topbar .start:hover { text-decoration: none; filter: brightness(1.08); }

main { max-width: 1060px; margin: 0 auto; padding: 26px 22px 60px; }

footer {
  border-top: 1px solid var(--line); padding: 18px 22px;
  color: var(--muted); font-size: 12px; text-align: center;
}

h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -0.5px; font-weight: 700; }
h2 { font-size: 16.5px; margin: 0 0 12px; letter-spacing: -0.2px; }
h3 { font-size: 13.5px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }
p.lead { color: var(--muted); margin: 0 0 22px; }

/* 여러 카드를 묶는 머리말. 설정처럼 긴 화면에서 어디를 보고 있는지 알게 한다. */
.sectionhead {
  display: flex; align-items: center; gap: 12px;
  margin: 30px 0 12px; font-size: 12.5px; font-weight: 700;
  color: var(--dim); letter-spacing: .4px;
}
.sectionhead::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--lift);
}
.card > h2 { margin-bottom: 6px; }
/* 카드 제목 밑에 한 줄. 이 자리가 무엇을 하는 자리인지 먼저 알려 준다. */
.card > .sub, .card > h2 + .muted { margin: 0 0 16px; max-width: 76ch; }
.card > .sub { color: var(--muted); font-size: 13.5px; }
.card p { max-width: 82ch; }
/* 입력칸을 화면 끝까지 늘여 놓으면 무엇을 적는 칸인지 가늠이 안 된다. 적을 만큼만 준다. */
.card input[type=text], .card input[type=email], .card input[type=password],
.card input[type=number], .card input[type=url], .card select, .card textarea {
  max-width: 560px;
}
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 820px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }
/* 칸 안의 표나 코드가 길다고 칸이 늘어나면 화면 전체가 좌우로 밀린다. 칸은 화면에 맞춘다. */
.grid > * { min-width: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--sunk); color: var(--text);
  font: inherit; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: rgba(91, 157, 255, .6); box-shadow: var(--ring);
}
/* 여러 줄을 적는 칸이다. 세 줄은 보여야 무엇을 어떻게 적는 자리인지 알 수 있다
   (안내로 넣어 둔 보기 글이 두 줄에서 잘려 나가고 있었다). */
textarea { min-height: 92px; resize: vertical; }
input[type=file] { color: var(--muted); font-size: 13px; }

button, .btn {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 16px;
  background: var(--accent); color: #08111f; font: inherit; font-weight: 600;
  cursor: pointer; margin-top: 14px; transition: filter .12s, background .12s, border-color .12s;
}
button:hover, .btn:hover { filter: brightness(1.07); }
button:active { filter: brightness(.96); }
button:disabled { opacity: .55; cursor: default; filter: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, label.drop:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
/* 링크를 단추처럼 쓰는 자리도 있다. 모양이 같아야 눌러도 되는지 헷갈리지 않는다. */
.btn { display: inline-block; text-decoration: none; }
.btn:hover { text-decoration: none; }
button.sub, .btn.sub {
  background: var(--panel-2); color: var(--text) !important; border-color: var(--line);
}
button.sub:hover, .btn.sub:hover { border-color: #3f4a5e; filter: none; background: #232833; }
button.danger { background: transparent; color: var(--bad); border-color: #4a333c; }
button.danger:hover { filter: none; background: rgba(239, 107, 107, .1); border-color: #61414c; }
button.tiny, .btn.tiny { padding: 5px 10px; font-size: 12px; margin: 0; }
/* 입력칸 폭을 줄인 뒤로 저장 단추가 칸 옆에 따라붙는다. 늘 아래 줄에 세운다. */
.card > form > button:not(.tiny) { display: block; }

/* 설정처럼 읽고 적는 화면은 한 폭으로 모아 둔다. 눈이 좌우로 멀리 뛰지 않게. */
.col { max-width: 900px; margin: 0 auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  color: var(--dim); font-weight: 600; font-size: 12px; white-space: nowrap;
  border-bottom-color: var(--line);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, table tr:hover td:not(:only-child) { background: rgba(255, 255, 255, .014); }
td.right, th.right { text-align: right; white-space: nowrap; }
/* 좁은 칸에서 '조 각', '삭 제' 처럼 글자가 쪼개지지 않게 한다. */
td.right form { display: inline-block; }
.pill { white-space: nowrap; }
button.tiny { white-space: nowrap; }
td .note:empty { display: none; }
/* 좁은 화면에서는 표를 억지로 접지 않는다. 접으면 어느 값이 어느 칸인지 알 수 없다.
   대신 표만 좌우로 밀어 볼 수 있게 하고, 화면 전체는 제자리에 둔다. 글은 그대로 접히니
   제목이 길어도 몇 칸만 밀면 상태와 관리 단추에 닿는다. */
@media (max-width: 640px) {
  .card table { display: block; overflow-x: auto; }
  .card table > tbody { display: table; width: 100%; min-width: 560px; }
  /* 답변 안에 든 표는 손대지 않는다. 머리줄만 따로 떨어져 나가 어느 값이 어느 칸인지
     어긋난다. 표가 넓으면 답변 덩이째 밀어 보게 한다. */
  .rich { overflow-x: auto; }
  .rich table { display: table; }
  .rich table > tbody { display: table-row-group; min-width: 0; }
}

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: rgba(71,192,138,.12); border: 1px solid rgba(71,192,138,.35); }
.flash.bad { background: rgba(239,107,107,.12); border: 1px solid rgba(239,107,107,.35); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; border: 1px solid var(--line); color: var(--muted);
}
.pill.ready { color: var(--ok); border-color: rgba(71,192,138,.4); }
.pill.failed { color: var(--bad); border-color: rgba(239,107,107,.4); }
.pill.queued, .pill.processing { color: #e3b341; border-color: rgba(227,179,65,.4); }

/* 아직 처리 중인 자료는 돌아가는 표시를 달아 멈춘 것처럼 보이지 않게 한다. */
.pill .spin {
  display: inline-block; width: 9px; height: 9px; margin-right: 5px;
  vertical-align: -1px; border-radius: 50%;
  border: 1.5px solid currentColor; border-top-color: transparent;
  animation: spin .75s linear infinite;
}
.pill.queued, .pill.processing { animation: pulse 1.6s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .pill .spin { animation-duration: 2.4s; }
  .pill.queued, .pill.processing { animation: none; }
}

/* 붙이는 코드는 한 줄이 길다. 옆으로 밀어 읽게 하면 끝을 못 본 채 베끼게 되니 줄을 접어
   다 보이게 한다. 접힘은 보이기만 그런 것이라 베껴 붙이는 데는 지장이 없다. */
pre.snippet {
  background: #0c0e13; border: 1px solid var(--line); border-radius: 10px;
  padding: 13px; font-size: 12.5px; color: #cbd3e1;
  white-space: pre-wrap; word-break: break-all;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* 숫자는 칸을 갈라 담는다. 줄줄이 늘어놓으면 어느 숫자가 무엇인지 헷갈린다. */
.stat { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.stat div {
  flex: 1 1 128px; padding: 12px 14px; font-size: 12.5px; color: var(--muted);
  background: var(--sunk); border: 1px solid var(--line-soft); border-radius: 12px;
}
.stat b {
  display: block; margin-bottom: 1px; font-size: 21px; font-weight: 700;
  color: var(--text); letter-spacing: -0.5px;
}
/* 숫자가 아니라 이름이 들어오는 칸. 21px 로 크게 쓰면 몇 줄로 접혀 흉하다. */
.stat div.text b { font-size: 15px; letter-spacing: 0; line-height: 1.45; }
.stat div.ok b { color: var(--ok); }
.stat div.warn b { color: var(--warn); }
.stat div.bad b { color: var(--bad); }

/* 등급·상태를 한 마디로 보여 주는 알약 */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--accent-soft); border: 1px solid rgba(91, 157, 255, .32); color: #a8c9ff;
}

/* 지키는 약속을 적는 자리. 자물쇠·방패를 앞에 둔다. */
.trust {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--muted); font-size: 12.5px; line-height: 1.6;
}
.trust svg { flex: 0 0 auto; margin-top: 2px; color: var(--ok); }
.trust.row-tight { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft); }

/* 등급과 사용료를 한 줄에 나란히 */
.planline {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.planline .price { font-size: 19px; font-weight: 700; letter-spacing: -0.4px; }

/* 항목과 값을 마주 놓는 표. 숫자에 단위를 붙여 오해를 없앤다. */
.kv { margin: 0; max-width: 640px; }
.kv div {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 9px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13.5px;
}
.kv div:last-child { border-bottom: 0; }
.kv dt, .kv .k { color: var(--muted); }
.kv dd, .kv .v { margin: 0; color: var(--text); text-align: right; }

/* 다룰 수 있는 파일 종류처럼, 짧은 낱말이 여럿일 때 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chips span {
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; color: var(--muted);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line-soft);
}

.answer {
  white-space: pre-wrap; background: #0c0e13; border: 1px solid var(--line);
  border-radius: 10px; padding: 15px; line-height: 1.7;
}
/* 마크다운을 그린 답변. 서식이 살아 있으므로 pre-wrap 을 끈다. */
.answer.rich, .rich { white-space: normal; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 10px; }
.rich ul, .rich ol { margin: 0 0 10px; padding-left: 22px; }
.rich h1, .rich h2, .rich h3 { font-size: 15px; margin: 16px 0 8px; }
.rich code { background: #1b2030; padding: 1px 5px; border-radius: 4px; }
.rich pre { background: #1b2030; padding: 12px; border-radius: 8px; overflow-x: auto; }
.rich pre code { background: none; padding: 0; }
.rich table { border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.rich th, .rich td { border: 1px solid var(--line); padding: 6px 10px; }
.rich th { background: var(--panel-2); }
.rich blockquote {
  margin: 10px 0; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--muted);
}
.sources { list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.sources li { padding: 4px 0; border-bottom: 1px dashed var(--line); }

form.inline { display: inline; }
form.inline select { width: auto; margin: 0; padding: 4px 8px; font-size: 12.5px; }

/* ── 용량 막대 ─────────────────────────────────────── */
.gauge { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.gauge.tight { max-width: 640px; }
.gauge-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 8px;
}
.gauge-bar {
  height: 9px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}
.gauge-bar span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #4f8ff5, #7db4ff);
  transition: width .4s ease;
}
.gauge[data-percent="100"] .gauge-bar span { background: var(--bad); }
.gauge .note { margin: 7px 0 0; font-size: 12px; }

/* ── 파일 올리기 (끌어다 놓기) ─────────────────────── */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; padding: 34px 20px; margin: 0;
  border: 1.5px dashed #3d4657; border-radius: 12px;
  background: rgba(255, 255, 255, .015); transition: border-color .12s, background .12s;
}
.drop.ready { cursor: pointer; }
.drop.ready input[type="file"] { display: none; }
.drop:hover { border-color: #4d5a70; background: rgba(255, 255, 255, .03); }
.drop.over { border-color: var(--accent); background: rgba(96, 165, 250, .09); }
.drop .dz-mark {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-bottom: 4px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid rgba(91, 157, 255, .26);
  color: #9dc2ff;
}
.drop .dz-main { font-size: 15px; font-weight: 600; }
.drop .dz-sub { font-size: 13px; color: var(--muted); }
.drop .chips { margin-top: 8px; }
.drop.over .dz-main { color: var(--accent); }
.drop.over .dz-mark { border-color: var(--accent); }

/* hidden 을 붙여 감춘 자리는 어떤 규칙보다 감추기가 먼저다. 브라우저 기본값은
   display 를 정한 우리 규칙에 밀린다. 끌어다 놓기 덮개가 대화창을 늘 덮고 있던 까닭. */
[hidden] { display: none !important; }

.picked { list-style: none; margin: 14px 0 0; padding: 0; }
.picked li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 8px 11px; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.picked li:last-child { border-bottom: 0; }
.picked .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .sz { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.picked .x {
  margin: 0; padding: 3px 8px; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 16px; line-height: 1; border-radius: 6px;
}
.picked .x:hover { color: var(--bad); background: rgba(239,107,107,.1); }

.dz-error { margin: 10px 0 0; font-size: 13px; color: var(--bad); }

label.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; color: var(--text); margin-bottom: 4px;
}
label.check input { width: auto; margin: 0; }

/* 되돌릴 수 없는 자리는 눈에 띄게 갈라 둔다. */
.card.danger-zone { border-color: rgba(239, 107, 107, .38); }
.card.danger-zone h2 { color: var(--bad); }
.card.danger-zone button.danger { margin-top: 14px; }

.bar {
  margin-top: 14px; height: 6px; border-radius: 99px;
  background: var(--panel-2); overflow: hidden;
}
.bar span {
  display: block; height: 100%; width: 0;
  background: var(--accent); transition: width .15s;
}

/* ── 페이지 머리와 탭 ─────────────────────────────── */
.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft);
}
.pagehead h1 { margin-bottom: 4px; }
.pagehead p.lead { margin: 0; }
/* 화면을 오가는 단추는 한 덩이로 묶어 둔다. 흩어 두면 눌러도 되는지 망설이게 된다. */
.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.tabs a {
  padding: 7px 15px; border-radius: 9px; font-size: 13.5px; color: var(--muted);
}
.tabs a:hover { text-decoration: none; color: var(--text); background: rgba(255, 255, 255, .03); }
.tabs a.on {
  background: var(--panel-2); color: var(--text); font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line);
}

.steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.steps li { margin-bottom: 8px; }

/* ── 채팅 ─────────────────────────────────────────── */
.chatwrap {
  display: grid; grid-template-columns: 248px 1fr; gap: 16px;
  height: calc(100vh - 244px); min-height: 460px;
}
@media (max-width: 820px) {
  .chatwrap { grid-template-columns: 1fr; height: auto; }
  .rooms { max-height: 230px; }
  .chatmain { height: 70vh; }
}

.rooms {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; overflow-y: auto; box-shadow: var(--lift);
}
.rooms .roomshead {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px; font-size: 12.5px; color: var(--dim); font-weight: 700;
}
.rooms ul { list-style: none; margin: 12px 0 0; padding: 0; }
.rooms li {
  position: relative; display: flex; align-items: center; gap: 4px;
  border-radius: var(--radius-sm); padding: 2px 4px 2px 0; margin-bottom: 2px;
}
.rooms li:hover { background: rgba(255, 255, 255, .03); }
.rooms li.on { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
/* 지금 보고 있는 방은 왼쪽에 줄을 세워 눈에 띄게 한다. */
.rooms li.on::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 2px; border-radius: 2px; background: var(--accent);
}
.rooms li a { flex: 1; padding: 8px 10px; color: var(--text); overflow: hidden; }
.rooms li a:hover { text-decoration: none; }
.rooms li .t {
  display: block; font-size: 13.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.rooms li.on .t { font-weight: 600; }
.rooms li .n { display: block; font-size: 11.5px; color: var(--dim); }
.rooms li form { margin: 0; }
.rooms .x {
  margin: 0; background: none; border: 0; color: var(--dim);
  font-size: 17px; line-height: 1; padding: 4px 7px; cursor: pointer; border-radius: 6px;
  opacity: 0; transition: opacity .12s;
}
.rooms li:hover .x, .rooms li.on .x, .rooms .x:focus-visible { opacity: 1; }
.rooms .x:hover { color: var(--bad); background: rgba(239, 107, 107, .1); }
button.full { width: 100%; margin-top: 0; }

.chatmain {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--lift);
}
/* 대화창 머리말. 어느 방인지, 무엇을 근거로 답하는지 여기서 한눈에 밝힌다. */
.chathead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.chathead .who-room { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 앤써 표식을 담는 네모. 채팅 머리말과 빈 화면에서 같은 얼굴로 쓴다. */
.mark {
  display: flex; align-items: center; justify-content: center; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid rgba(91, 157, 255, .28);
}
.chathead .mark { width: 30px; height: 30px; flex: 0 0 auto; }
.chathead .t {
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 42ch;
}
.chathead .n { display: block; font-size: 11.5px; color: var(--dim); font-weight: 400; }

/* 무엇을 근거로 답하는지 대화 바로 위에 늘 적어 둔다. */
.chatnote {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 18px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .022);
  color: var(--muted); font-size: 12px; line-height: 1.6;
}
.chatnote svg { flex: 0 0 auto; margin-top: 2px; color: var(--ok); }

.log {
  flex: 1; overflow-y: auto; padding: 20px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
/* 말이 몇 마디뿐일 때 위에 붙어 뜨면 채팅창처럼 보이지 않는다. 입력창 바로 위에
   쌓이게 아래로 밀어 둔다. justify-content 로 밀면 넘칠 때 위쪽을 못 올려 보게 된다. */
.log > :first-child { margin-top: auto; }
.log .empty { margin: auto; text-align: center; color: var(--text); max-width: 46ch; }
.log .empty .mark { width: 46px; height: 46px; border-radius: 15px; margin: 0 auto 14px; }
.log .empty .mark img { width: 24px; height: 24px; }
.log .empty p { margin: 6px 0; }
.log .empty .muted { line-height: 1.7; }

/* 날이 바뀌면 줄을 그어 알려 준다. 기록을 믿게 하는 것은 이런 표시다. */
.daymark {
  display: flex; align-items: center; gap: 12px; margin: 6px 0 2px;
  font-size: 11.5px; color: var(--dim);
}
.daymark::before, .daymark::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px; border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; min-height: 46px; max-height: 160px; margin: 0;
  resize: none; line-height: 1.55; padding: 12px 14px; border-radius: 12px;
}
.composer button { margin: 0; padding: 12px 20px; border-radius: 12px; }
.composer-hint {
  margin: -6px 0 0; padding: 0 16px 12px;
  font-size: 11.5px; color: var(--dim); text-align: center;
}

/* 한 마디를 보낸이 이름·시각과 함께 묶는다. */
.turn { display: flex; flex-direction: column; gap: 5px; max-width: 84%; }
.turn.me { align-self: flex-end; align-items: flex-end; }
.turn.bot { align-self: flex-start; align-items: flex-start; }
.turn .who {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); padding-left: 2px;
}
.turn .who img { display: block; opacity: .9; }
.turn .stamp { font-size: 11px; color: var(--dim); padding: 0 3px; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { padding: 12px 15px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; }
.turn .bubble { max-width: 100%; }
.turn.me .bubble, .bubble.me {
  align-self: flex-end; background: #21344a; border: 1px solid #2d4463;
  border-bottom-right-radius: 5px;
}
/* 답변은 HTML 이다. pre-wrap 을 두면 태그 사이 줄바꿈이 빈 줄로 벌어진다. */
.turn.bot .bubble, .bubble.bot {
  align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line);
  white-space: normal; border-bottom-left-radius: 5px;
}
.bubble .meta {
  margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--muted);
}
.bubble .meta + .meta { margin-top: 6px; padding-top: 0; border-top: 0; }
.bubble .meta .src {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--ok); font-weight: 600; margin-right: 4px;
}
.bubble .kept {
  margin-top: 9px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px;
  background: rgba(71,192,138,.1); border: 1px solid rgba(71,192,138,.3); color: var(--ok);
}
.bubble .remind {
  margin-top: 9px; padding: 6px 10px; border-radius: 8px; font-size: 12.5px;
  background: rgba(91,157,255,.12); border: 1px solid rgba(91,157,255,.35); color: var(--accent);
}
.bubble .remind.warn {
  background: rgba(227,179,65,.12); border-color: rgba(227,179,65,.35); color: var(--warn);
}
/* 대화창에 끌어다 놓기 */
.chatmain { position: relative; }
.chatmain .veil {
  position: absolute; inset: 0; z-index: 5; display: flex;
  align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--accent); border-radius: 12px;
  background: rgba(11,13,18,.86); pointer-events: none;
}
.chatmain .veil b { display: block; font-size: 15px; margin-bottom: 6px; }
.chatmain .veil .muted { font-size: 12.5px; }
.chatmain.over .veil { border-color: var(--ok); }

.composer .clip {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 auto; cursor: pointer;
  border: 1px solid var(--line); border-radius: 9px; color: var(--muted);
  font-size: 19px; line-height: 1;
}
.composer .clip:hover { border-color: var(--accent); color: var(--text); }

.notice {
  align-self: center; max-width: 78%; margin: 4px 0;
  padding: 8px 13px; border-radius: 9px; font-size: 12.5px;
  color: var(--muted); background: var(--panel); border: 1px solid var(--line);
}
.notice.ok { color: var(--ok); border-color: rgba(71,192,138,.35); background: rgba(71,192,138,.08); }
.notice.bad { color: var(--bad); border-color: rgba(229,90,90,.35); background: rgba(229,90,90,.08); }

.bubble .clash {
  margin-top: 10px; padding: 10px 12px; border-radius: 9px; font-size: 12.5px;
  background: rgba(227,179,65,.08); border: 1px solid rgba(227,179,65,.35);
}
.bubble .clash .q { color: #e3b341; margin-bottom: 7px; }
.bubble .clash .opt { color: var(--text); padding: 2px 0; }
.bubble .clash .row { display: flex; gap: 8px; margin-top: 9px; }
.bubble .clash button { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > * { margin-top: 0; }
.row input { flex: 1; }

/* 단추 두 개를 나란히. 카드 안 button 은 기본이 블록이라 그냥 두면 위아래로 쌓인다. */
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btnrow button { margin: 0; }
