:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #c2410c;          /* GQMATH orange, darkened for 5:1 contrast with white text */
  --accent-text: #ffffff;
  --ok-bg: #e8f5ee;
  --ok-text: #146c43;
  --err-bg: #fdecec;
  --err-text: #b42318;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --text: #e6e8eb;
    --muted: #98a2b3;
    --line: #2b313a;
    --accent: #ff8a3d;
    --accent-text: #111418;     /* dark text on orange reads better than white */
    --ok-bg: #12301f;
    --ok-text: #7dd3a5;
    --err-bg: #3a1616;
    --err-text: #f7a1a1;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 12px 0 4px; }
h2 { font-size: 17px; margin: 28px 0 12px; }
code { font-size: 13px; background: var(--line); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: normal; }
.hidden { display: none; }
.nowrap { white-space: nowrap; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); display: inline-flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand .logo img { height: 28px; width: auto; display: block; }
.brand span { padding-left: 10px; border-left: 1px solid var(--line); }
.login-logo .logo img { height: 40px; width: auto; display: block; margin: 0 auto 8px; }
@media (max-width: 480px) { .brand .logo img { height: 22px; } }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.page { max-width: 1280px; margin: 0 auto; padding: 16px 20px 60px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

input, button { font: inherit; color: inherit; }
input {
  width: 100%; padding: 9px 11px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; margin-bottom: 14px; font-size: 14px; }
label.check { display: flex; gap: 6px; align-items: center; }
label.check input { width: auto; margin: 0; }
button {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .6; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); padding: 10px 16px; }
button.danger { color: var(--err-text); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card.login { width: 100%; max-width: 360px; }
.card.login button.primary { width: 100%; margin-top: 4px; }
.card.narrow { max-width: 420px; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.flash.ok { background: var(--ok-bg); color: var(--ok-text); }
.flash.err { background: var(--err-bg); color: var(--err-text); }
.empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* library */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.vcard { color: var(--text); display: block; }
.vcard:hover { text-decoration: none; }
.vcard:hover img { filter: brightness(1.08); }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dur { position: absolute; right: 8px; bottom: 10px; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; padding: 1px 6px; border-radius: 4px; }
.badge { position: absolute; left: 8px; top: 8px; font-size: 12px; padding: 1px 7px; border-radius: 4px; }
.badge.done { background: var(--ok-bg); color: var(--ok-text); }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.35); }
.bar i { display: block; height: 100%; background: #e5484d; }
.bar.inline-bar { position: static; display: inline-block; width: 80px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); vertical-align: middle; margin-right: 6px; }
.vmeta { padding: 8px 2px; display: flex; flex-direction: column; gap: 2px; }

/* watch */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); display: block; }
aside h2 { margin-top: 0; }
.side-item { display: flex; gap: 10px; padding: 6px; border-radius: 8px; color: var(--text); font-size: 14px; }
.side-item:hover { background: var(--surface); text-decoration: none; }
.side-item.current { background: var(--surface); outline: 1px solid var(--line); }
.side-item img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
@media (max-width: 900px) { .watch { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 16px 0; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 13px; }
.stats.big b { font-size: 24px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }
tr.inactive td { opacity: .55; }
td.actions { white-space: nowrap; }
td.actions input { width: 130px; margin: 0; padding: 5px 8px; }
.edit-row { display: flex; gap: 6px; margin-bottom: 4px; }
.edit-row input { margin: 0; padding: 5px 8px; min-width: 140px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.section-head h2 { margin-bottom: 4px; }
.create-user { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; margin-bottom: 14px; }
.create-user label { margin: 0; flex: 1 1 160px; }
.create-user label.check { flex: 0 0 auto; padding-bottom: 9px; }

/* admin: video preview */
.badge.private { background: var(--err-bg); color: var(--err-text); }
.badge.done + .badge.private { top: 32px; }
tr.private td:not(:last-child):not(:nth-child(3)) { opacity: .6; }
.thumb-btn { position: relative; display: block; padding: 0; border: 0; background: var(--line); border-radius: 6px; overflow: hidden; width: 120px; aspect-ratio: 16 / 9; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-btn .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 20px; background: rgba(0,0,0,.35); opacity: 0; transition: opacity .15s; }
.thumb-btn:hover .play, .thumb-btn:focus-visible .play { opacity: 1; }
.pill { border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.pill.on { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.pill.off { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
dialog.preview { width: min(960px, calc(100vw - 32px)); padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
dialog.preview::backdrop { background: rgba(0,0,0,.6); }
.preview-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.preview-actions a { margin-left: auto; }

/* admin: upload */
.card.upload { max-width: 720px; }
.drop { position: relative; display: grid; place-items: center; min-height: 120px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; cursor: pointer; }
.drop.over, .drop:hover { border-color: var(--accent); color: var(--text); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.queue { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.queue li { font-size: 14px; }
.q-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.q-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-state { white-space: nowrap; }
.q-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.q-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.queue li.done .q-bar i { background: var(--ok-text); }
.queue li.fail .q-state { color: var(--err-text); }
.upload-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; }
a.button { display: inline-block; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
a.button:hover { text-decoration: none; border-color: var(--muted); }
a.button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* admin: chatbot test */
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .chat-layout { grid-template-columns: 1fr; } }
.chat { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 520px; padding: 16px; }
.chat-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.inline-label { display: flex; gap: 8px; align-items: center; margin: 0; }
select { font: inherit; color: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 2px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.6; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.pending { color: var(--muted); }
.msg.error { color: var(--err-text); background: var(--err-bg); border-color: transparent; }
.msg-meta { align-self: flex-start; font-size: 12px; color: var(--muted); margin: -4px 0 4px 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button { border-radius: 999px; font-size: 13px; padding: 5px 11px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
textarea { width: 100%; font: inherit; color: inherit; padding: 9px 11px; margin-top: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); resize: vertical; line-height: 1.5; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.composer textarea { margin: 0; resize: none; min-height: 44px; max-height: 160px; }
.chat-side { display: flex; flex-direction: column; gap: 16px; }
.chat-settings { padding: 16px; }
.chat-settings textarea { font-size: 13px; }
.row-actions { display: flex; gap: 12px; align-items: center; }
.chat-logs { padding: 16px; max-height: 420px; overflow-y: auto; }
.chat-logs h2 { margin-top: 0; }
.chat-logs details { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.chat-logs summary { cursor: pointer; }
.log-answer { white-space: pre-wrap; color: var(--muted); margin: 6px 0 0; }

/* admin: knowledge docs (RAG) */
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .docs-layout { grid-template-columns: 1fr; } }
tr.selected td { background: var(--bg); }
.doc-editor, .search-test { padding: 16px; }
.doc-editor h2, .search-test h2 { margin-top: 0; }
.search-test { margin-top: 16px; }
.search-test .composer input { margin: 0; }
.hit { display: flex; gap: 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.hit .score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ok-text); min-width: 40px; }
.hit.weak { opacity: .5; }
.hit.weak .score { color: var(--muted); }
.hit pre { margin: 0; white-space: pre-wrap; font: inherit; font-size: 13px; }
.msg-sources { align-self: flex-start; max-width: 80%; font-size: 12px; color: var(--muted); margin: -2px 0 6px 6px; }
.msg-sources summary { cursor: pointer; }
.msg-sources p { white-space: pre-wrap; margin: 6px 0; padding: 6px 8px; background: var(--bg); border-radius: 6px; }

/* mobile fixes: long model names must not widen the page; button labels never wrap per character */
button, a.button { white-space: nowrap; }
.section-head { flex-wrap: wrap; gap: 8px 12px; }
.chat-layout > *, .docs-layout > * { min-width: 0; }
.chat-top .inline-label { flex: 1; min-width: 0; }
.chat-top select { flex: 1; min-width: 0; width: 100%; text-overflow: ellipsis; }
.chat-top button, .composer button { flex: none; }
.chat { height: calc(100dvh - 170px); }
@media (max-width: 600px) {
  .page { padding: 12px 12px 40px; }
  .chat { height: calc(100dvh - 120px); min-height: 460px; padding: 12px; }
  .msg, .msg-sources { max-width: 90%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: none; }
  .topbar { padding: 10px 12px; }
  .topbar nav { gap: 12px; }
  .brand span { display: none; }
}

/* admin: bots */
.bot-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.bot-tab { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); }
.bot-tab:hover { text-decoration: none; border-color: var(--muted); }
.bot-tab.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bot-tab img { width: 26px; height: 26px; border-radius: 50%; }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--ok-bg); color: var(--ok-text); }
.tag.off { background: var(--err-bg); color: var(--err-text); }
.bot-summary { padding: 16px; }
.bot-head { display: flex; align-items: center; gap: 12px; }
.bot-head img { width: 48px; height: 48px; border-radius: 50%; }
.bot-head h2 { margin: 0; }
.bot-head > div { flex: 1; }
.bot-summary dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; margin: 14px 0; }
.bot-summary dt { color: var(--muted); }
.bot-summary dd { margin: 0; }
.msg-row { display: flex; gap: 8px; align-items: flex-end; align-self: flex-start; max-width: 88%; }
.msg-row .msg { max-width: 100%; }
.msg-row img { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.bot-form { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.bot-form .card { padding: 16px; }
.bot-form h2 { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
.checks, .radios { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.checks label, .radios label, .doc-picks label { margin: 0; }
.doc-picks { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.doc-picks.disabled { opacity: .45; pointer-events: none; }
.danger-zone { margin-top: 28px; }

/* admin: transcript review */
.page.wide { max-width: 1500px; }
.tr-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; margin-top: 12px; }
@media (max-width: 1000px) { .tr-layout { grid-template-columns: 1fr; } }
.tr-player { position: sticky; top: 70px; }
.tr-player video::cue { font-size: 18px; background: rgba(0,0,0,.7); }
.tr-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.tr-filter button { border-radius: 999px; font-size: 13px; padding: 4px 12px; }
.tr-filter button.on { border-color: var(--accent); color: var(--accent); }
.tr-filter input { width: auto; flex: 1; min-width: 140px; margin: 0; padding: 5px 10px; }
.tr-rows { max-height: calc(100vh - 220px); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tr-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 36px; gap: 4px 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.tr-row.now { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tr-row.done .tr-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.tr-row.saving { opacity: .6; }
.tr-time { font-variant-numeric: tabular-nums; font-size: 13px; padding: 4px 6px; }
.tr-text { margin: 0; padding: 5px 8px; font-size: 14px; }
.tr-ok { padding: 4px 0; font-size: 14px; }
.tr-meta, .tr-sugg { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tr-meta:empty, .tr-sugg:empty { display: none; }
.tr-sugg-item { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--bg); border: 1px dashed var(--accent); width: 100%; }
.tr-sugg-text { font-weight: 600; }
.tr-sugg-item button { padding: 3px 10px; font-size: 13px; }

/* admin: network */
.net-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.net-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.net-card b { font-size: 18px; font-variant-numeric: tabular-nums; }
.net-topo-card { padding: 16px; margin-bottom: 20px; }
.net-topo-card h2 { margin: 0; }
.net-topo-wrap { overflow-x: auto; }
#topo { min-width: 980px; display: block; max-width: none; }
#topo .ln { fill: none; stroke: var(--line); stroke-linecap: round; }
#topo .ln.vpn { stroke: color-mix(in srgb, var(--accent) 45%, var(--line)); }
#topo .ln.dash, #topo .ln.off { stroke-dasharray: 4 5; }
#topo .ln.off { opacity: .5; }
#topo .flow { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 2 14; animation: netflow 2s linear infinite; }
@keyframes netflow { to { stroke-dashoffset: -32; } }
@media (prefers-reduced-motion: reduce) { #topo .flow { animation: none; } }
#topo .nb rect { fill: var(--surface); stroke: var(--line); }
#topo .nb.router rect, #topo .nb.inet rect { stroke: var(--accent); stroke-width: 1.5; }
#topo .nb.hub rect { fill: var(--bg); }
#topo .nb.node rect { stroke: #8b5cf6; }
#topo .nb.me rect { stroke: var(--ok-text); }
#topo .nb.busy rect { stroke: #d97706; stroke-width: 1.5; }
#topo .nb.off { opacity: .45; }
#topo .nb-t { fill: var(--text); font-size: 13px; }
#topo .nb-s { fill: var(--muted); font-size: 11px; }
#topo .rate { fill: var(--accent); font-size: 11px; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-line; }
td.warn { color: #d97706; font-weight: 700; }
.net-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-top: 20px; }
.net-charts .card { padding: 14px 16px; }
.net-charts h2 { margin: 0 0 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); }
.chart .axis, .chart .muted-t { fill: var(--muted); font-size: 11px; }
.chart .legend { font-size: 12px; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; }
.net-events { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.net-events li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.net-events li.new { color: #d97706; }
.net-events li.offline { color: var(--muted); }
.net-toggles { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.net-toggles label { margin: 0; }
#topo .ping { font-size: 10px; font-variant-numeric: tabular-nums; }
#topo .p-ok { fill: var(--ok-text); } #topo .p-mid { fill: #d97706; } #topo .p-bad { fill: var(--err-text); }
.dev-name { display: flex; align-items: center; gap: 8px; }
.dev-thumb { width: 40px; height: 40px; object-fit: contain; flex: none; }
.dev-form { display: flex; flex-direction: column; gap: 4px; min-width: min(420px, 80vw); }
.dev-form select { width: 100%; margin-top: 4px; }
.dev-photo-preview img { width: 120px; height: 120px; object-fit: contain; }
.wifi path { fill: none; stroke-width: 2; stroke-linecap: round; }
.wifi .on { stroke: var(--ok-text); fill: var(--ok-text); }
.wifi path.on { fill: none; }
.wifi .off { stroke: var(--line); fill: none; }
.wifi circle.on { stroke: none; }
.wifi-i { width: 26px; height: 17px; vertical-align: -3px; margin-right: 4px; display: inline-block; }
#topo .nb.switch rect { stroke: #0891b2; stroke-dasharray: 3 3; cursor: pointer; }
#topo .tile-bg { fill: var(--surface); stroke: var(--line); }
#topo .tile.router .tile-bg, #topo .tile.inet .tile-bg { stroke: var(--accent); stroke-width: 1.5; }
#topo .tile.node .tile-bg { stroke: #8b5cf6; }
#topo .tile.switch .tile-bg { stroke: #0891b2; stroke-dasharray: 3 3; cursor: pointer; }
#topo .tile.me .tile-bg { stroke: var(--ok-text); }
#topo .tile.busy .tile-bg { stroke: #d97706; stroke-width: 1.5; }
#topo .tile.off { opacity: .45; }
#topo .tile-t { fill: var(--text); font-size: 12px; }
.chart .mark { stroke: #d97706; stroke-width: 1.5; stroke-dasharray: 3 3; }
.net-events li.wifi_leave, .net-events li.offline { color: var(--err-text); }
.net-events li.wifi_join, .net-events li.online { color: var(--ok-text); }
.net-events li.router, .net-events li.port, .net-events li.wan { color: #d97706; }
.net-topo-wrap { color-scheme: light dark; }
#topo .band rect { stroke: none; }
#topo .band text { font-size: 10px; font-weight: 700; fill: #fff; }
#topo .band.b24 rect { fill: #16a34a; } #topo .band.b5 rect { fill: #0891b2; } #topo .band.b6 rect { fill: #8b5cf6; } #topo .band.blan rect { fill: #64748b; }

/* admin: floor plan */
#floor-wrap { overflow-x: auto; }
#floor { width: 100%; min-width: 760px; display: block; touch-action: none; }
#floor .wall { stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
#floor .dim { fill: var(--muted); font-size: 13px; }
#floor .est-ring { fill: color-mix(in srgb, #0891b2 6%, transparent); stroke: #0891b2; stroke-dasharray: 4 5; opacity: .7; }
#floor .est-line { stroke: #0891b2; stroke-width: 1; opacity: .5; }
#floor .thing { cursor: grab; }
#floor .thing .bg { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
#floor .thing.ap .bg { stroke: var(--accent); stroke-width: 2.5; }
#floor .thing.est .bg { stroke: #0891b2; }
#floor .thing.pinned .bg { stroke: var(--ok-text); }
#floor .lbl { fill: var(--text); font-size: 12px; }
#floor .lbl-s { fill: var(--muted); font-size: 10px; }
#floor .dot-t { fill: var(--muted); font-size: 14px; }

/* network: details dialog */
dialog.info-dialog { width: min(720px, calc(100vw - 32px)); }
.info-body { display: flex; gap: 16px; align-items: flex-start; }
.info-body img { width: 120px; height: 120px; object-fit: contain; background: #fff1; border-radius: 12px; flex: none; }
.info-rows { flex: 1; min-width: 0; }
.info-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.info-dl dt { color: var(--muted); font-size: .88em; }
.info-dl dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.info-sec { border-top: 1px solid var(--line); padding: 6px 0; }
.info-sec:first-child { border-top: 0; padding-top: 0; }
.info-sec > summary { cursor: pointer; font-weight: 700; padding: 6px 0; list-style-position: inside; }
.info-sec[open] > summary { margin-bottom: 6px; }
#topo .nb, #topo .tile { cursor: pointer; }


/* QR admin */
.qr-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.qr-card { display: flex; flex-direction: column; gap: 10px; }
.qr-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1.1em; }
.qr-form { display: flex; flex-direction: column; gap: 10px; }
.qr-form label { display: flex; flex-direction: column; gap: 4px; }
.qr-form input { width: 100%; font-size: 16px; }   /* 16px keeps iOS from zooming in on focus */
.qr-form button.primary { width: 100%; padding: 12px; }
.qr-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--accent, #ff6600); }
.qr-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; font-size: 14px; }

/* academy (students / classes / lectures) */
.class-grid, .lecture-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.class-card, .lecture-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.class-card:hover, .lecture-card:hover { border-color: var(--accent, #ff6600); }
.class-card .pill { align-self: flex-start; }
.class-card.inactive { opacity: .6; }
.mini-bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; min-width: 60px; }
.mini-bar i { display: block; height: 100%; background: var(--accent, #ff6600); }
.mini-bar.big { height: 10px; margin: 10px 0 14px; }
.check-list { display: grid; gap: 4px; max-height: 320px; overflow: auto; margin: 8px 0 12px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.check-list label { display: flex; flex-direction: row; justify-content: flex-start; gap: 8px; align-items: center; text-align: left; font-weight: 400; }
.check-list label input { width: auto; flex: none; margin: 0; }
.toc-admin { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.toc-admin li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.toc-admin li.group { background: var(--surface-2, rgba(255,102,0,.06)); font-weight: 700; }
.toc-admin li.video { margin-left: 22px; }
.toc-admin .toc-actions { margin-left: auto; display: flex; gap: 6px; }
.toc-group-input { font-weight: 700; min-width: 240px; }
.board td, .board th { text-align: center; }
.board td:first-child, .board th:first-child { text-align: left; }
.cell-done { color: #16a34a; font-weight: 700; }
.lecture-head h1 { margin: 4px 0 12px; }
.lh-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.lh-stats div { display: flex; flex-direction: column; }
.lh-stats b { font-size: 1.4em; }
.toc { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.toc li.group { font-weight: 800; margin-top: 12px; padding: 4px 2px; border-bottom: 2px solid var(--accent, #ff6600); }
.toc li a { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; }
.toc li a:hover { border-color: var(--accent, #ff6600); }
.toc .no { width: 28px; height: 28px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-size: 13px; flex: none; }
.toc .t { flex: 1; display: flex; flex-direction: column; }
.toc .st { font-size: 13px; color: var(--muted); white-space: nowrap; }
.toc .st.done { color: #16a34a; font-weight: 700; }
/* network page: Wi-Fi history inside the device dialog (2026-10-11) */
.info-wifi { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.info-wifi h3 { font-size: .95em; margin: 12px 0 6px; }
.info-wifi .chart .mark { stroke: #e05050; stroke-dasharray: 4 3; }
.wifi-findings, .wifi-log { margin: 0; padding-left: 18px; font-size: .9em; }
.wifi-findings li { margin: 3px 0; }
.wifi-findings li.bad { color: #e05050; font-weight: 600; }
.wifi-findings li.warn { color: #d97706; }
.wifi-log li { color: var(--muted); margin: 2px 0; font-variant-numeric: tabular-nums; }

/* network page on phones (2026-10-11): list instead of the wide diagram, cards instead of the 9-column table,
   full-screen details with foldable sections */
.topo-list { display: none; }
.tl-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; background: none; border: 0; border-bottom: 1px solid var(--line);
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tl-row.off { opacity: .5; }
.tl-ico { width: 30px; height: 30px; flex: none; object-fit: contain; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.tl-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-name small { color: var(--muted); font-size: .8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { display: flex; gap: 6px; align-items: center; flex: none; font-size: .8em; font-variant-numeric: tabular-nums; }
.tl-band { padding: 1px 6px; border-radius: 999px; color: #fff; background: #888; }
.tl-band.b24 { background: #16a34a; } .tl-band.b5 { background: #0891b2; } .tl-band.b6 { background: #8b5cf6; } .tl-band.blan { background: #64748b; } .tl-band.bwait { background: #94a3b8; }
.tl-rssi.ok { color: #3cb878; } .tl-rssi.mid { color: #d97706; } .tl-rssi.bad { color: #e05050; font-weight: 700; }
.tl-rate { color: var(--accent); }
.tl-count { flex: none; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--line); font-size: .75em; text-align: center; }
.tl-group > summary { list-style: none; } .tl-group > summary::-webkit-details-marker { display: none; }
.tl-group > summary .tl-row::before { content: "▸"; color: var(--muted); width: 10px; flex: none; }
.tl-group[open] > summary .tl-row::before { content: "▾"; }
.tl-kids { padding-left: 14px; border-left: 2px solid var(--line); margin-left: 8px; }

@media (max-width: 700px) {
  .net-topo-wrap { display: none; }
  .topo-list { display: block; }
  /* device table -> one card per device */
  #dev-table thead { display: none; }
  #dev-table, #dev-table tbody, #dev-table tr, #dev-table td { display: block; width: auto; }
  #dev-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  #dev-table td { padding: 0; border: 0; min-width: 0; }
  #dev-table td:first-child { grid-column: 1 / -1; }
  #dev-table td:not(:first-child)::before { content: attr(data-label); display: block; color: var(--muted); font-size: .72em; }
  #dev-table td:nth-child(3), #dev-table td:nth-child(9) { display: none; }   /* MAC·제조사 / 처음 본 때 → 자세히 창에 있음 */
  .table-wrap { overflow-x: visible; }
  /* details dialog as a full-screen sheet with a sticky title bar */
  dialog.info-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; inset: 0; border: 0; border-radius: 0; padding: 0 14px 16px; }
  dialog.info-dialog .preview-head { position: sticky; top: 0; z-index: 2; background: var(--surface); margin: 0 -14px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
  dialog.info-dialog .preview-head h2 { font-size: 1.05em; margin: 0; }
  .info-body { display: block; }
  .info-body img { float: right; width: 52px; height: 52px; margin: 0 0 6px 10px; }
  .info-dl { grid-template-columns: 1fr; gap: 0; }
  .info-dl dt { margin-top: 8px; }
  .info-wifi .chart { min-height: 160px; }
}

#topo .band.bwait rect { fill: #94a3b8; }

/* 방문자 (admin/visitors) */
.chip.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.visit-days { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding: 16px; }
.visit-day { flex: 1 0 22px; display: flex; flex-direction: column; align-items: center; font-size: 12px; }
.visit-day .bar { position: relative; width: 100%; max-width: 36px; height: 120px; }
.visit-day .bar i, .visit-day .bar em { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 3px 3px 0 0; }
.visit-day .bar i { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.visit-day .bar em { background: var(--accent); }
.visit-day small { color: var(--muted); white-space: nowrap; }
.visit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; margin: 16px 0; }
.visit-grid h2, .card > h2 { font-size: 16px; margin: 0 0 8px; }
td.wrap { word-break: break-all; }
td.nowrap { white-space: nowrap; }
