:root {
  --bg: #0a0e1a; --panel: #121829; --panel2: #182038; --line: #243050; --text: #e8ecff; --muted: #8a96bd;
  --brand: #5b8cff; --brand2: #8b5cf6; --ok: #2ecc8f; --warn: #f5b942; --bad: #f2566b; --info: #4cc9f0;
  --radius: 12px; --shadow: 0 10px 34px rgba(0,0,0,.4);
  --glass: rgba(255,255,255,.045); --glass-brd: rgba(255,255,255,.09); --glass-hi: rgba(255,255,255,.06); --glass-blur: 18px;
  --grid-dot: rgba(255,255,255,.055); --glow: rgba(91,140,255,.12);
  font-family: Pretendard, 'Segoe UI', system-ui, -apple-system, 'Malgun Gothic', sans-serif;
}
:root[data-theme="light"] {
  --bg: #f1f3f9; --panel: #ffffff; --panel2: #eef1fa; --line: #dde3f3; --text: #151b33; --muted: #5d6a92; --shadow: 0 10px 34px rgba(30,40,90,.12);
  --glass: rgba(255,255,255,.55); --glass-brd: rgba(25,35,70,.09); --glass-hi: rgba(255,255,255,.5);
  --grid-dot: rgba(20,30,70,.05); --glow: rgba(91,140,255,.09);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(640px 420px at 85% -10%, var(--glow), transparent 60%),
    radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
  color: var(--text); font-size: 14px; line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; } .gap-s { gap: 6px; }

/* layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--glass); backdrop-filter: blur(var(--glass-blur)) saturate(140%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%); border-right: 1px solid var(--glass-brd); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 4px 8px 16px; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 4px 14px rgba(91,140,255,.3); }
.logo .ic, .logo svg { width: 60%; height: 60%; }
.nav-group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text); opacity: .8; }
.nav a:hover { background: var(--glass-hi); text-decoration: none; opacity: 1; }
.nav a.active { background: color-mix(in srgb, var(--brand) 16%, transparent); opacity: 1; font-weight: 600; }
.nav .ic-slot { width: 18px; flex: none; display: inline-flex; justify-content: center; } .nav .cnt { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 9px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--glass-brd); background: var(--glass); backdrop-filter: blur(var(--glass-blur)) saturate(140%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%); position: sticky; top: 0; z-index: 5; }
.content { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }
.menu-btn { display: none; }

/* icons */
.ic { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.ic.xl { width: 38px; height: 38px; }

/* components */
.card { background: var(--glass); border: 1px solid var(--glass-brd); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(var(--glass-blur)) saturate(150%); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%); box-shadow: inset 0 1px 0 var(--glass-hi), 0 10px 26px rgba(0,0,0,.22); }
.card.flat { padding: 0; overflow: hidden; }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat { padding: 16px 18px; } .stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; } .stat .l { color: var(--muted); font-size: 12.5px; }
.stat .s { font-size: 12px; margin-top: 4px; }
.btn { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: var(--text); border: 1px solid var(--glass-brd); padding: 7px 14px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--brand); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border: 0; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 18px rgba(91,140,255,.28); }
.btn.primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn.danger { color: var(--bad); } .btn.danger:hover { border-color: var(--bad); } .btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(91,140,255,.45); border-color: var(--brand); }
input[type=checkbox] { width: auto; } input[type=range] { padding: 0; accent-color: var(--brand); }
label.f { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12.5px; color: var(--muted); }
label.f > :not(span) { font-weight: 400; color: var(--text); }
label.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--glass); border: 1px solid var(--glass-brd); }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.b-ok { color: var(--ok); } .b-ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.b-warn { color: var(--warn); } .b-warn::before { background: var(--warn); }
.b-bad { color: var(--bad); } .b-bad::before { background: var(--bad); }
.b-info { color: var(--info); } .b-info::before { background: var(--info); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.tag { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; } tbody tr:hover { background: rgba(91,140,255,.05); }
.table-wrap { overflow-x: auto; }
.bar { height: 7px; background: var(--panel2); border-radius: 9px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 9px; transition: width .5s; }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 9px 14px; cursor: pointer; font: inherit; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-color: var(--brand); }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { display: flex; justify-content: center; margin-bottom: 10px; color: var(--muted); opacity: .7; }
.pill-status { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-brd); font-weight: 600; }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(4,7,16,.5); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(5px); }
.modal { background: var(--glass); backdrop-filter: blur(28px) saturate(150%); -webkit-backdrop-filter: blur(28px) saturate(150%); border: 1px solid var(--glass-brd); border-radius: 16px; width: min(620px, 100%); max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow); }
.modal h2 { font-size: 18px; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-brd); border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 340px; animation: in .2s; }
.toast.err { border-left-color: var(--bad); } .toast.ok { border-left-color: var(--ok); }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

/* misc */
.terminal { background: #05070f; color: #cfd7ff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; height: 420px; overflow: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.terminal .l { white-space: pre-wrap; word-break: break-all; } .terminal .ts { color: #5a6590; } .terminal .src { color: #7aa2ff; } .terminal .sys { color: #2ecc8f; } .terminal .stderr { color: #ff9aa8; }
.cmd { background: #05070f; color: #cfd7ff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; word-break: break-all; }
.choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice > label { border: 1px solid var(--glass-brd); border-radius: 11px; padding: 11px 13px; cursor: pointer; background: var(--glass); display: block; }
.choice > label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--glass)); }
.choice input { display: none; } .choice b { display: block; } .choice span { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); } .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
svg text { fill: var(--muted); font-size: 10px; }
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.authcard { width: min(420px, 100%); } .hero { text-align: center; margin-bottom: 18px; } .hero h1 { font-size: 26px; }
.sub-input { display: flex; align-items: stretch; } .sub-input input { border-radius: 9px 0 0 9px; } .sub-input span { background: var(--panel2); border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; padding: 8px 11px; color: var(--muted); white-space: nowrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; } .kv > :nth-child(odd) { color: var(--muted); }

@media (max-width: 980px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; } .side { position: fixed; left: -260px; width: 250px; z-index: 40; transition: left .2s; box-shadow: var(--shadow); } .side.open { left: 0; }
  .menu-btn { display: inline-flex; } .content { padding: 18px 16px 60px; } .top { padding: 10px 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; }
}
