:root {
  --bg: #f5f3ee; --surface: #ffffff; --ink: #1d2a2f; --muted: #5f6b70; --line: #e2ddd3;
  --brand: #1f4e5f; --brand-ink: #ffffff; --brand-soft: #e3eef0; --accent: #f2b84b;
  --green: #2e7d55; --green-soft: #e3f3ea; --amber: #a86a00; --amber-soft: #fbf0d9;
  --red: #b23b3b; --red-soft: #f8e3e1; --info-soft: #e6eef8;
  --radius: 14px; --shadow: 0 1px 2px rgba(30, 40, 45, .06), 0 4px 16px rgba(30, 40, 45, .05);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.55; font-size: 15px; }
a { color: var(--brand); }
h1 { font-size: 1.55rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0; }
input, textarea, select { font: inherit; color: inherit; width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; }
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
textarea[readonly] { background: #faf9f6; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
label small, .small { font-weight: 400; color: var(--muted); font-size: .84rem; }
fieldset { border: 0; padding: 0; margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--red); border-color: #e8c3bf; }
.btn.primary.danger, .btn.danger.big { background: var(--red); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.big { padding: 14px 24px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 4px; }
.link:hover { color: var(--ink); }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; color: var(--brand); text-decoration: none; letter-spacing: -.01em; }
.brand b { color: var(--accent); }
.brand.big { font-size: 1.8rem; }
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--brand); position: relative; }
.brand-dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; }
.nav a.on, .nav a:hover { background: var(--brand-soft); color: var(--brand); }
.user { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.user span { color: var(--ink); font-weight: 600; margin-right: 6px; }
.main { max-width: 1180px; margin: 0 auto; padding: 24px 28px 64px; display: grid; gap: 18px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.wrap input { width: auto; flex: 1 1 200px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col.wide-left { grid-template-columns: 1.6fr 1fr; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.muted { color: var(--muted); }
.footnote { color: var(--muted); font-size: .82rem; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }
.error-text { color: var(--red); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 36px 16px; display: grid; gap: 12px; justify-items: center; }
.boot { padding: 80px; text-align: center; color: var(--muted); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eeebe4; color: var(--muted); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }

.banner { border-radius: 10px; padding: 10px 14px; background: var(--info-soft); font-size: .9rem; }
.banner.warn { background: var(--amber-soft); color: #6b4800; }
.banner.error { background: var(--red-soft); color: var(--red); }
.banner.ok { background: var(--green-soft); color: var(--green); }
.banner.small { font-size: .82rem; padding: 6px 10px; }
.topbar + .banner { border-radius: 0; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .2); z-index: 50; max-width: min(560px, 92vw); }
.toast[data-kind="error"] { background: var(--red); }
dialog { border: 0; border-radius: var(--radius); padding: 8px 24px 24px; width: min(480px, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(20, 30, 35, .45); }
dialog h2 { margin-bottom: 10px; }
dialog p { margin-bottom: 12px; }
.modal-close-row { display: flex; justify-content: flex-end; }
.credential { background: var(--brand-soft); border-radius: 10px; padding: 14px; display: grid; gap: 6px; margin-bottom: 10px; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #e3eef0, transparent 50%), var(--bg); }
.auth-card { width: min(400px, 100%); display: grid; gap: 16px; padding: 32px; }

.search { max-width: 420px; }
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.case-card { text-decoration: none; color: inherit; display: grid; gap: 8px; transition: border-color .15s; }
.case-card:hover { border-color: var(--brand); }
.session-list { display: grid; gap: 6px; margin-top: 12px; }
.session-row { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: inherit; border: 1px solid var(--line); }
.session-row:hover { border-color: var(--brand); background: #fbfaf7; }
.inline-date { width: auto; padding: 2px 6px; border-radius: 6px; font-size: .9rem; }

.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps button { border: 1px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 999px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.steps button.done { color: var(--green); border-color: #bfe0cc; }
.steps button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.timer-card { display: grid; gap: 14px; text-align: center; justify-items: center; }
.timer-card.active { border-color: #e7b7b2; }
.timer-label { font-weight: 700; color: var(--muted); }
.timer-card.active .timer-label { color: var(--red); }
.timer { font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rec-box { width: 100%; display: grid; gap: 8px; text-align: left; }
.rec-dot.recording { color: var(--red); font-weight: 700; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .45; } }
.level { height: 8px; border-radius: 99px; background: #eeebe4; overflow: hidden; }
.level i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--accent)); transition: width .08s; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 10px; align-content: start; }
.mode-card.disabled { opacity: .7; }
.mode-card ul { margin: 0; padding-left: 18px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; }
.check input { width: auto; margin-top: 4px; }

.speaker-map { display: flex; gap: 12px; flex-wrap: wrap; }
.speaker-map label { flex: 0 1 160px; }
.replace input { width: auto; flex: 1; }
.record-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.record-field.hypotheses textarea { background: #fffbf0; }
.record-field.agreements textarea { background: #f3faf6; }

.rating { display: flex; gap: 14px; align-items: center; }
.rating legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.rating label { display: flex; gap: 4px; font-weight: 500; }
.rating input { width: auto; }
.metrics { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.metrics dt { color: var(--muted); }
.metrics dd { margin: 0; font-weight: 700; }
.stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat { display: grid; gap: 4px; padding: 16px; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.5rem; }
.table-wrap { overflow-x: auto; padding: 0; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #faf9f6; color: var(--muted); font-weight: 700; }
details summary { cursor: pointer; font-weight: 700; }
details[open] { display: grid; gap: 12px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .two-col, .two-col.wide-left, .mode-grid, .record-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .main { padding: 16px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .timer { font-size: 2.6rem; }
  .session-row { grid-template-columns: auto 1fr auto; }
  .session-row span:nth-of-type(2) { display: none; }
}

.drop { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 26px 16px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; background: #fbfaf7; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop strong { color: var(--brand); font-size: 1.02rem; }
