:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #1d4ed8;
  --primary-soft: #dbeafe;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #c2410c;
  --warn-soft: #ffedd5;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --card: #181b21; --text: #e5e7eb; --muted: #9ca3af; --line: #2a2f38;
    --primary: #60a5fa; --primary-soft: #1e3a5f; --danger: #f87171; --danger-soft: #451a1a;
    --warn: #fb923c; --warn-soft: #43260f; --ok: #4ade80; --ok-soft: #12351f; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard", -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

header.top {
  position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; color: var(--text); }
nav.main { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
nav.main a { padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500; }
nav.main a.active { background: var(--primary-soft); color: var(--primary); }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 120px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .grid.two { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .stat b { font-size: 20px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 10px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .main-col { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 16px 0; text-align: center; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.gray { background: var(--line); color: var(--muted); }
.tier { color: #fff; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
textarea { min-height: 90px; resize: vertical; }
textarea.transcript { min-height: 200px; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { border-left: 3px solid var(--primary-soft); padding: 4px 0 16px 14px; margin-left: 4px; }
.timeline .when { font-size: 13px; color: var(--muted); }
.timeline .body { white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; white-space: pre-wrap; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
pre.transcript { white-space: pre-wrap; background: var(--bg); padding: 12px; border-radius: 8px; font-size: 13px; max-height: 300px; overflow: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.recorder-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.meter { width: 120px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .1s; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .3s; }
.hint { background: var(--primary-soft); color: var(--text); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }

.proposal { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.proposal.off { opacity: .45; }
.proposal .form-grid { margin-top: 8px; }

.fab { position: fixed; right: 16px; bottom: 16px; display: flex; gap: 8px; z-index: 20; }
.fab .btn { box-shadow: 0 4px 14px rgba(0,0,0,.18); }

dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .d-head { padding: 16px 18px 0; font-weight: 700; font-size: 17px; }
dialog .d-body { padding: 14px 18px; max-height: 70vh; overflow: auto; }
dialog .d-foot { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; font-size: 14px; }
.toast.err { background: var(--danger); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); }
