/* JJAK admin WebUI — design B 'sidebar cards' (B75), theme graphite (B75 Q2), density normal.
   Taken from the approved mock-up (P4WebWS site/assets common.css + vb.css + extra.css): only what the sign-in,
   first-login and shell screens use. Colour token names and graphite values = P4-C1 §7.11.3 (C6 §6 '시각');
   contrast pairs are checked by web_theme_contrast. CSP: this file is the only style source (no inline style). */
:root {
  --window-bg: #16181D; --titlebar-bg: #101216; --surface: #1C1F25; --control-bg: #252930; --control-active: #2E333B;
  --popup-bg: #24282F; --menu-hi: #1766CD; --line: #2F343C; --line-strong: #2E333B; --text: #E8EAED;
  --text-secondary: #A3A9B3; --text-muted: #737B87; --accent: #1A72E6; --accent-text: #5AA2FF; --on-accent: #FFFFFF;
  --select: #5AA2FF; --state-ok: #3FB950; --sev-error: #F2564D; --sev-warn: #D6A23A; --focus: #FFFFFF;
  /* web-only derived values (mock-up B) */
  --input-bg: #16181D; --brand-grad: #0E2A55;
  --ok-bg: rgba(63, 185, 80, .14); --info-bg: rgba(90, 162, 255, .13);
  --fs: 13.5px; --btn-h: 32px; --btn-px: 12px; --card-p: 16px; --gap: 10px;
  --r-card: 8px; --r-control: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: "Segoe UI", "Malgun Gothic", "Microsoft YaHei", sans-serif;
  background: var(--window-bg); color: var(--text);
  font-size: var(--fs); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
:lang(zh) body, body:lang(zh) { font-family: "Segoe UI", "Microsoft YaHei", "Malgun Gothic", sans-serif; }
a { color: var(--accent-text); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: .92em; letter-spacing: .01em; }
.muted { color: var(--text-muted); }
.sec { color: var(--text-secondary); }
.spacer { flex: 1; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: var(--gap); }
.wrap-row { flex-wrap: wrap; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- buttons · inputs ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--btn-h); padding: 0 var(--btn-px);
  border-radius: var(--r-control); border: 1px solid var(--line-strong); background: var(--control-bg);
  color: var(--text); font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.btn:hover { background: var(--control-active); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: var(--control-active); color: var(--text); }
.btn.sm { height: calc(var(--btn-h) - 6px); padding: 0 8px; font-size: .92em; }
.btn:focus-visible, .in:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.in {
  height: var(--btn-h); padding: 0 10px; border-radius: var(--r-control); border: 1px solid var(--line-strong);
  background: var(--input-bg); color: var(--text); font: inherit; min-width: 0;
}
.in::placeholder { color: var(--text-muted); }
label.field { display: flex; flex-direction: column; gap: 4px; color: var(--text-secondary); font-size: .92em; }
label.field > .in { color: var(--text); font-size: 1.08em; }
.otp-in { font-family: "Cascadia Mono", Consolas, monospace; letter-spacing: .35em; font-size: 1.3em; }

/* ---- notes · cards ---- */
.note { padding: 10px 12px; border-radius: var(--r-control); background: var(--control-bg); color: var(--text); border-left: 3px solid var(--sev-warn); }
.note.err { border-left-color: var(--sev-error); }
.note.info { border-left-color: var(--accent-text); }
.msg:empty { display: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--card-p); min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.card > .ch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card > .ch h2 { font-size: 1.1em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-secondary); }
.kv dd { margin: 0; min-width: 0; }

/* ---- shell (sidebar · page head · content) ---- */
body.vb { display: flex; min-height: 100vh; word-break: keep-all; overflow-wrap: break-word; }
.side { width: 232px; flex: none; background: var(--titlebar-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.side .logo img { width: 30px; height: 30px; }
.side .logo b { font-size: 16px; display: block; }
.side .logo span { color: var(--text-muted); font-size: .86em; }
.side > a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
.side > a.on { background: var(--menu-hi); color: var(--text); box-shadow: inset 3px 0 0 var(--select); }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.side .who { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: .92em; min-width: 0; }
.side .who-t { display: flex; flex-direction: column; min-width: 0; }
.side .who-t .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.side .who .av { width: 28px; height: 28px; border-radius: 14px; background: var(--control-active); display: inline-flex; align-items: center; justify-content: center; color: var(--text); font-weight: 700; flex: none; }
.side .foot .btn { justify-content: flex-start; }
.langform { display: flex; flex: 1; min-width: 0; }
.langform .in { flex: 1; min-width: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pagehead { display: flex; align-items: center; gap: 12px; padding: 18px 28px 14px; border-bottom: 1px solid var(--line); }
.pagehead h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.content { padding: 20px 28px 28px; display: flex; flex-direction: column; gap: 16px; flex: 1; max-width: 1180px; }
.mtop { display: none; }

/* ---- sign-in / first login (login-split) ---- */
.login-split { display: flex; min-height: 100vh; width: 100%; }
.login-split .brandside { flex: 1.1; background: linear-gradient(150deg, var(--brand-grad) 0%, var(--window-bg) 70%); display: flex; flex-direction: column; justify-content: center; padding: 64px; gap: 18px; border-right: 1px solid var(--line); }
.login-split .brandside img { width: 88px; height: 88px; }
.login-split .brandside h1 { font-size: 34px; }
.login-split .brandside p { color: var(--text-secondary); max-width: 420px; font-size: 15px; }
.login-split .formside { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-form { width: 360px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
.login-form h2 { font-size: 1.3em; }
.step, .stack-form { display: flex; flex-direction: column; gap: 16px; }
.donefield { display: flex; align-items: center; gap: 8px; padding: 0 0 0 10px; min-height: var(--btn-h); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); }
.donefield .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stepper { display: flex; gap: 8px; align-items: center; color: var(--text-muted); font-size: .9em; white-space: nowrap; }
.stepper > span:not(.line) { display: inline-flex; align-items: center; gap: 6px; }
.stepper .n { width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--control-active); font-weight: 700; font-size: .85em; flex: none; }
.stepper .n svg.i { width: 13px; height: 13px; stroke-width: 2.4; vertical-align: 0; display: none; }
.stepper .done .n { background: var(--state-ok); color: var(--window-bg); }
.stepper .done .n .num { display: none; }
.stepper .done .n svg.i { display: inline; }
.stepper .cur .n { background: var(--accent); color: var(--on-accent); }
.stepper .cur { color: var(--text); font-weight: 600; }
.stepper .line { width: 28px; height: 1px; background: var(--line-strong); flex: none; }
.foot-row { border-top: 1px solid var(--line); padding-top: 12px; }
.qr { display: flex; justify-content: center; }
.qr-img { width: 216px; height: 216px; image-rendering: pixelated; background: var(--on-accent); border-radius: var(--r-control); }
.secret-box { display: flex; flex-direction: column; gap: 4px; }
.secret { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 8px 10px; border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 1.05em; }

/* ---- S4-W2 screens: accounts · account detail · settings (C6 §6 + C8 §5) ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.card h3 { font-size: 1em; font-weight: 600; color: var(--text-secondary); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--gap); }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: end; }
.grid-form .span2 { grid-column: 1 / -1; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.pager { justify-content: flex-end; }
.num { font-variant-numeric: tabular-nums; }
.warn { color: var(--sev-warn); font-weight: 600; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--control-bg); color: var(--text); font-size: .86em; font-weight: 600; white-space: nowrap; }
.badge.okb { border-color: var(--state-ok); background: var(--ok-bg); }
.badge.warnb { border-color: var(--sev-warn); }
.badge.off { border-color: var(--sev-error); }
.badge svg.i { width: 13px; height: 13px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: .9em; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.over td { background: var(--control-bg); }
.tbl tr.over td:first-child { box-shadow: inset 3px 0 0 var(--sev-warn); }
.btn.danger { border-color: var(--sev-error); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.danger-card { border-color: var(--sev-error); }
label.check { display: flex; align-items: flex-start; gap: 8px; color: var(--text); cursor: pointer; }
label.check input { margin-top: 3px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
details.fold > summary { cursor: pointer; color: var(--accent-text); padding: 4px 0; }
details.fold[open] > summary { margin-bottom: 8px; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.quote .kv { margin-top: 6px; }
.tabbar { display: none; }

/* ---- S4-W3 screens: dashboard · server power (C6 §2.6 · §6 — mock-up B) ---- */
.livehead { color: var(--text-secondary); }
.dot-live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--state-ok); margin-right: 6px; vertical-align: 1px; }
.seg { display: inline-flex; gap: 2px; }
.seg .btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.alertband { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-card); border: 1px solid var(--sev-warn); background: var(--control-bg); }
.hidden-band { display: none; } /* after .alertband: the same specificity, so this wins */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi .lbl { color: var(--text-secondary); font-size: .92em; }
.kpi .val { font-size: 1.7em; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: .5em; color: var(--text-muted); font-weight: 400; }
.grid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack-tight { display: flex; flex-direction: column; gap: 4px; }
.chart { width: 100%; height: 160px; background: var(--input-bg); border-radius: var(--r-control); }
.chart .ln { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.chart .axis { fill: var(--text-muted); font-size: 11px; }
.ln.s1 { stroke: var(--accent-text); } .ln.s2 { stroke: var(--state-ok); } .ln.s3 { stroke: var(--sev-warn); } .ln.s4 { stroke: var(--sev-error); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--text-secondary); font-size: .92em; }
.legend i { display: inline-block; width: 10px; height: 3px; margin-right: 5px; vertical-align: 3px; }
.legend i.s1 { background: var(--accent-text); } .legend i.s2 { background: var(--state-ok); }
.legend i.s3 { background: var(--sev-warn); } .legend i.s4 { background: var(--sev-error); }
.alist { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.al { padding: 8px 10px; border-radius: var(--r-control); background: var(--control-bg); display: flex; flex-direction: column; gap: 4px; }
.al.dim { opacity: .6; }
.almsg { overflow-wrap: anywhere; }
meter { width: 90px; height: 10px; vertical-align: middle; }
.server-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-fold > summary { color: var(--sev-error); }
.wrap { overflow-wrap: anywhere; white-space: pre-wrap; }
.r { text-align: right; }
.badge.plain { border-color: var(--line-strong); }

/* ---- S4-W4 screens: resellers · billing · reseller home (C6 §6 — same cards / folds / tables) ---- */
.kpi a.val { color: var(--text); display: block; }
.kpi .muted { font-size: .9em; }

/* ---- phone (≥ 360 px — C6 §6): no overflow, one-line buttons, touch targets ≥ 44 px ---- */
@media (max-width: 640px) {
  .grid12 { grid-template-columns: minmax(0, 1fr); }
  .c8, .c6, .c4 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root { --fs: 15px; --btn-h: 44px; --btn-px: 14px; --card-p: 14px; }
  body.vb { display: block; }
  .side { display: none; }
  .mtop { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--titlebar-bg); border-bottom: 1px solid var(--line); }
  .mtop img { width: 24px; height: 24px; }
  .mtop b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .pagehead { padding: 12px 14px; }
  .pagehead h1 { font-size: 19px; }
  .content { padding: 12px 14px; gap: 12px; }
  .card > .ch h2 { font-size: 16px; }
  .kv { grid-template-columns: 112px minmax(0, 1fr); }
  .cards, .grid-form { grid-template-columns: minmax(0, 1fr); }
  /* tables fold into cards: one row = one card, each cell labelled from data-label */
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { border: 1px solid var(--line); border-radius: var(--r-card); padding: 6px 10px; margin-bottom: 10px; background: var(--surface); }
  .tbl td { border: 0; padding: 5px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .tbl td::before { content: attr(data-label); color: var(--text-secondary); font-size: 13px; min-width: 104px; }
  .tbl tr.over td:first-child { box-shadow: none; }
  .tbl tr.over { border-color: var(--sev-warn); }
  .main { padding-bottom: 64px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--titlebar-bg); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 52px; color: var(--text-secondary); font-size: 12px; min-width: 0; }
  .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a.on { color: var(--text); box-shadow: inset 0 3px 0 var(--select); }
  .vb label.field, .vb .muted, .vb .sec { font-size: 13px; }
  .btn, .btn.sm { height: auto; min-height: 44px; font-size: 15px; padding: 0 14px; }
  .in { height: 44px; font-size: 15px; }
  .login-split { flex-direction: column; }
  .login-split .brandside { flex: none; padding: 24px 20px 18px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-split .brandside img { width: 52px; height: 52px; }
  .login-split .brandside h1 { font-size: 24px; white-space: nowrap; }
  .login-split .brandside p { font-size: 14px; }
  .login-split .formside { padding: 20px; align-items: flex-start; }
  .login-form { width: 100%; }
  .stepper { font-size: 13px; gap: 6px; }
  .stepper .line { width: 16px; }
}
@media (min-width: 641px) { .monly { display: none !important; } }
