:root {
  --bg: #080a0f;
  --bg2: #0c0f17;
  --panel: #11151f;
  --panel2: #151a26;
  --line: rgba(255, 255, 255, .075);
  --line2: rgba(255, 255, 255, .12);
  --text: #eef0f7;
  --muted: #8b91a7;
  --muted2: #6d7388;
  --accent: #7c5cff;
  --accent2: #4f7cff;
  --green: #35d98b;
  --yellow: #f4c65d;
  --red: #ff647c;
  --cyan: #4fd1e0;
  --radius: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .45);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
::selection { background: rgba(124, 92, 255, .35); }
code { font-family: var(--mono); }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(124, 92, 255, .18), transparent 60%),
    radial-gradient(700px 400px at 90% 100%, rgba(79, 124, 255, .12), transparent 60%),
    var(--bg);
}
.login-card {
  width: min(430px, 100%); background: linear-gradient(180deg, rgba(23, 27, 40, .96), rgba(13, 16, 24, .98));
  border: 1px solid var(--line2); border-radius: 22px; padding: 30px; box-shadow: var(--shadow);
}
.brand-lg { display: flex; align-items: center; gap: 13px; margin-bottom: 28px; }
.brand-lg strong { display: block; font-size: 15px; letter-spacing: 2.6px; }
.brand-lg small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; letter-spacing: .5px; }
.mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, #7c5cff, #3b82f6); color: #fff;
  box-shadow: 0 10px 28px rgba(92, 86, 255, .35); flex: none;
}
.mark svg { width: 22px; height: 22px; }
.mark.small { width: 34px; height: 34px; border-radius: 10px; }
.mark.small svg { width: 18px; height: 18px; }
.login h1 { font-size: 24px; margin: 0 0 8px; letter-spacing: -.5px; }
.login p { color: var(--muted); line-height: 1.6; margin: 0 0 22px; font-size: 13px; }
.login p code { color: #b9aeff; background: rgba(124, 92, 255, .1); padding: 1px 5px; border-radius: 5px; }
label { display: block; color: #b7bccd; font-size: 12px; font-weight: 600; letter-spacing: .2px; }
label input, .field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 7px; background: #0a0d14; color: var(--text);
  border: 1px solid var(--line2); border-radius: 10px; padding: 11px 12px; outline: none;
  transition: border .15s, box-shadow .15s;
}
label input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(124, 92, 255, .7); box-shadow: 0 0 0 3px rgba(124, 92, 255, .13);
}
.login form { display: grid; gap: 14px; }
.btn {
  border: 1px solid var(--line2); background: rgba(255, 255, 255, .05); color: var(--text);
  border-radius: 10px; padding: 9px 13px; cursor: pointer; font-weight: 600; font-size: 13px;
  transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn:hover { background: rgba(255, 255, 255, .09); }
.btn.primary { background: linear-gradient(135deg, #7c5cff, #4f7cff); border: 0; box-shadow: 0 10px 26px rgba(92, 86, 255, .25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(255, 100, 124, .12); border-color: rgba(255, 100, 124, .3); color: #ff9cad; }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 9px; font-size: 11px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: default; }
.login .btn { padding: 12px 14px; border-radius: 11px; }
.error { color: #ff9cad; font-size: 12px; min-height: 16px; }
.login-foot { display: flex; align-items: center; gap: 7px; color: var(--muted2); font-size: 11px; margin-top: 18px; }

/* ---------- shell ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar {
  border-right: 1px solid var(--line); background: linear-gradient(180deg, #0b0e16, #090b11);
  padding: 20px 14px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 20px; }
.brand strong { display: block; font-size: 13px; letter-spacing: 2.2px; }
.brand small { display: block; color: var(--muted2); font-size: 10px; margin-top: 2px; letter-spacing: .4px; }
#nav { display: grid; gap: 3px; }
#nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: #9aa0b5; font-size: 13px; font-weight: 550; transition: .14s; position: relative;
}
#nav a:hover { background: rgba(255, 255, 255, .045); color: #d7dae7; }
#nav a.active { background: rgba(124, 92, 255, .13); color: #dcd6ff; }
#nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(#7c5cff, #4f7cff); border-radius: 2px;
}
#nav a i { width: 17px; height: 17px; display: block; opacity: .8; }
#nav a i svg { width: 17px; height: 17px; }
#nav a b { margin-left: auto; font-size: 10px; color: var(--muted); background: rgba(255, 255, 255, .06); padding: 2px 6px; border-radius: 999px; }
.nav-label { color: #4f556b; font-size: 9.5px; font-weight: 750; letter-spacing: 1.4px; text-transform: uppercase; padding: 15px 10px 5px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.statusline { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted2); display: inline-block; }
.dot.live { background: var(--green); box-shadow: 0 0 10px rgba(53, 217, 139, .7); }
.dot.warn { background: var(--yellow); box-shadow: 0 0 10px rgba(244, 198, 93, .55); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 26px; position: sticky; top: 0; z-index: 20;
  background: rgba(8, 10, 15, .78); backdrop-filter: blur(14px);
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.crumbs #crumb::before { content: "/"; margin-right: 8px; color: #3f4457; }
.crumbs #crumb:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.icon-btn svg { width: 15px; height: 15px; }
.who { color: var(--muted); font-size: 11.5px; }
.view { padding: 24px 26px 50px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; letter-spacing: -.6px; margin: 0; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(19, 23, 34, .9), rgba(13, 16, 24, .92));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.card.pad { padding: 20px; }
.stat { position: relative; overflow: hidden; }
.stat .k { color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .7px; }
.stat .v { font-size: 27px; font-weight: 750; letter-spacing: -.8px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .s { color: var(--muted2); font-size: 11px; margin-top: 4px; }
.stat .ico { position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(124, 92, 255, .1); color: #b9aeff; }
.stat .ico svg { width: 16px; height: 16px; }
.stat.green .ico { background: rgba(53, 217, 139, .1); color: #7ff0b5; }
.stat.blue .ico { background: rgba(79, 124, 255, .12); color: #9db8ff; }
.stat.yellow .ico { background: rgba(244, 198, 93, .1); color: #f4d58a; }
.stat.red .ico { background: rgba(255, 100, 124, .1); color: #ff9cad; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { font-size: 14px; margin: 0; letter-spacing: -.1px; }
.section-title span { color: var(--muted2); font-size: 11px; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 10px 2px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; height: 100%; }
.chart .bars { width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; flex: 1; }
.chart .bar { width: 10px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, #8d72ff, #5b4bd6); min-height: 2px; }
.chart .bar.b2 { background: linear-gradient(180deg, #4fd1e0, #2c8e9a); }
.chart .bar.b3 { background: linear-gradient(180deg, #35d98b, #1f8b5b); }
.chart .lbl { color: var(--muted2); font-size: 9.5px; }
.legend { display: flex; gap: 12px; color: var(--muted2); font-size: 10.5px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: rgba(10, 13, 20, .55); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; color: var(--muted2); font-size: 10px; text-transform: uppercase; letter-spacing: .7px; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .018); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid rgba(255, 255, 255, .045); color: #c6cad9; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .022); }
tr.click { cursor: pointer; }
.mono { font-family: var(--mono); font-size: 11px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.trunc { max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 650; background: rgba(255, 255, 255, .06); color: var(--muted); white-space: nowrap; }
.pill.green { background: rgba(53, 217, 139, .1); color: #7ff0b5; }
.pill.yellow { background: rgba(244, 198, 93, .1); color: #f4d58a; }
.pill.red { background: rgba(255, 100, 124, .1); color: #ff9cad; }
.pill.blue { background: rgba(79, 124, 255, .12); color: #9db8ff; }
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 13px; }
.toolbar .search { flex: 1; min-width: 180px; position: relative; }
.toolbar .search input { width: 100%; background: #0a0d14; border: 1px solid var(--line2); border-radius: 9px; padding: 9px 12px 9px 32px; color: var(--text); outline: none; }
.toolbar .search svg { position: absolute; left: 10px; top: 10px; width: 14px; height: 14px; color: var(--muted2); }
select, .select { background: #0a0d14; border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; color: var(--text); outline: none; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted2); font-size: 12px; }
.empty svg { width: 28px; height: 28px; opacity: .4; display: block; margin: 0 auto 8px; }
.tabs { display: flex; gap: 4px; overflow: auto; padding: 4px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 14px; }
.tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1; }
.tabs button svg { width: 14px; height: 14px; flex: 0 0 14px; }
.tabs button:hover { color: #d8dbe7; }
.tabs button.active { background: rgba(124, 92, 255, .16); color: #dcd6ff; }
.tabs button b { margin-left: 5px; font-size: 9.5px; color: var(--muted2); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 2px 0; color: var(--muted); font-size: 11px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px 18px; }
.kv div { min-width: 0; }
.kv .k { color: var(--muted2); font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.kv .v { color: #d7dae7; margin-top: 3px; overflow-wrap: anywhere; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; }
.field small { color: var(--muted2); font-size: 10.5px; display: block; margin-top: 5px; line-height: 1.45; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t { font-size: 12.5px; font-weight: 600; }
.toggle .d { color: var(--muted2); font-size: 10.5px; margin-top: 3px; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #2a2f40; border-radius: 999px; transition: .18s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #8b91a7; transition: .18s; }
.switch input:checked + span { background: rgba(124, 92, 255, .5); }
.switch input:checked + span::after { transform: translateX(16px); background: #fff; }
.codebox { background: #07090e; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: 11px/1.6 var(--mono); color: #9ee6b8; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.note { border: 1px solid rgba(79, 124, 255, .2); background: rgba(79, 124, 255, .07); color: #b9c9ff; padding: 11px 13px; border-radius: 10px; font-size: 12px; line-height: 1.55; }
.warnbox { border: 1px solid rgba(244, 198, 93, .22); background: rgba(244, 198, 93, .07); color: #f4d58a; padding: 11px 13px; border-radius: 10px; font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; background: #171c29; border: 1px solid var(--line2); color: var(--text); padding: 11px 14px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; max-width: 380px; }
.toast.show { opacity: 1; transform: none; }
.toast.err { border-color: rgba(255, 100, 124, .35); color: #ffb2bf; }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.15); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.fp { background: #07090e; border: 1px solid var(--line); border-radius: 10px; padding: 13px; font: 10.5px/1.55 var(--mono); color: #aab3c8; max-height: 420px; overflow: auto; white-space: pre-wrap; }
.list { display: grid; gap: 8px; }
.list-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.015); }
.list-item .ic { width: 28px; height: 28px; border-radius: 8px; background: rgba(124,92,255,.1); color: #b9aeff; display: grid; place-items: center; flex: none; }
.list-item .ic svg { width: 14px; height: 14px; }
.list-item .body { min-width: 0; flex: 1; }
.list-item .title { font-size: 12px; color: #d7dae7; }
.list-item .meta { color: var(--muted2); font-size: 10.5px; margin-top: 2px; }
.bars { display: grid; gap: 9px; }
.barline { display: grid; grid-template-columns: 90px minmax(0,1fr) 46px; gap: 10px; align-items: center; font-size: 11px; color: var(--muted); }
.barline .track { height: 7px; background: rgba(255,255,255,.06); border-radius: 99px; overflow: hidden; }
.barline .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #7c5cff, #4f7cff); }
.barline .num { text-align: right; color: #cfd2df; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .brand { padding: 4px 4px 12px; }
  #nav { display: flex; overflow: auto; gap: 2px; }
  #nav a { padding: 7px 9px; white-space: nowrap; }
  #nav a.active::before { display: none; }
  #nav a span { display: none; }
  #nav a b { display: none; }
  .side-foot { display: none; }
  .view { padding: 18px 14px 40px; }
  .topbar { padding: 0 14px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } .page-head h1 { font-size: 22px; } }
