:root {
  --bg: #f4f6fa; --card: #ffffff; --text: #191f28; --muted: #6b7684; --line: #e5e8eb;
  --primary: #3182f6; --primary-d: #1b64da; --good: #12b886; --bad: #f04452; --warn: #f59f00;
  --live: #f04452; --paper: #3182f6; --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101317; --card: #1b1f25; --text: #e9ecef; --muted: #98a2b3; --line: #2b313a; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  font-size: 15px; line-height: 1.5; }
a { color: var(--primary); }
header.top { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
header.top h1 { font-size: 17px; margin: 0; white-space: nowrap; }
header.top .clock { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card);
  border-bottom: 1px solid var(--line); scrollbar-width: none; }
nav.tabs button { flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); padding: 8px 14px;
  border-radius: 999px; font-size: 14px; cursor: pointer; font-weight: 600; }
nav.tabs button.active { background: var(--primary); color: #fff; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  margin-bottom: 16px; border: 1px solid var(--line); }
.card h2 { margin: 0 0 12px; font-size: 17px; }
.card h3 { margin: 16px 0 8px; font-size: 15px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { background: var(--bg); border-radius: 10px; padding: 12px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 2px; word-break: break-all; }
.good { color: var(--good); } .bad { color: var(--bad); } .muted { color: var(--muted); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
input, select { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 15px; }
input:disabled { opacity: .55; }
input[type=checkbox] { width: auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 140px; }
button.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-size: 15px; font-weight: 700; cursor: pointer;
  background: var(--primary); color: #fff; }
button.btn:hover { background: var(--primary-d); }
button.btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
button.btn.danger { background: var(--bad); }
button.btn.small { padding: 6px 10px; font-size: 13px; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice .opt { border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--card); }
.choice .opt.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--card)); }
.choice .opt b { display: block; margin-bottom: 4px; }
.choice .opt span { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.RUNNING { background: #e6fcf5; color: #087f5b; }
.badge.STOPPED, .badge.DRAFT { background: #f1f3f5; color: #495057; }
.badge.NEEDS_ATTENTION { background: #fff4e6; color: #d9480f; }
.badge.live { background: #ffe3e3; color: #c92a2a; } .badge.paper { background: #e7f5ff; color: #1971c2; }
.bot { border-left: 5px solid var(--paper); }
.bot.live { border-left-color: var(--live); }
.banner { background: #fff4e6; color: #a6410b; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .banner { background: #3b2a12; color: #ffc078; } }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--card); }
.tablewrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 10px; }
.progress { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); }
details summary { cursor: pointer; color: var(--primary); font-weight: 600; margin: 10px 0; }
.chartbox { position: relative; height: 300px; }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #191f28; color: #fff;
  padding: 12px 18px; border-radius: 12px; z-index: 100; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border-radius: 16px; padding: 20px; max-width: 460px; width: 100%; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0; }
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { max-width: 400px; width: 100%; }
.qr { display: flex; justify-content: center; margin: 12px 0; background: #fff; padding: 12px; border-radius: 12px; }
code.secret { word-break: break-all; background: var(--bg); padding: 4px 8px; border-radius: 6px; }
.logline { font-family: ui-monospace, Menlo, monospace; font-size: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.logline .ERROR { color: var(--bad); } .logline .WARN { color: var(--warn); }
