:root {
  --bg: #07090d;
  --bg-2: #0b0f15;
  --panel: #0f141b;
  --panel-2: #141a23;
  --panel-3: #1a2230;
  --border: #1f2733;
  --border-2: #2a3444;
  --text: #e6ebf2;
  --muted: #8592a3;
  --dim: #5b6676;
  --accent: #4c8dff;
  --accent-2: #7aa9ff;
  --accent-bg: rgba(76, 141, 255, .12);
  --up: #22c983;
  --up-bg: rgba(34, 201, 131, .12);
  --down: #ff5d6c;
  --down-bg: rgba(255, 93, 108, .12);
  --warn: #f4b740;
  --warn-bg: rgba(244, 183, 64, .12);
  --violet: #a68bff;
  --radius: 10px;
  --radius-sm: 6px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --sidebar: 224px;
  --topbar: 58px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, .num { font-family: var(--mono); font-feature-settings: "tnum"; }
.num { text-align: right; white-space: nowrap; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); } .dim { color: var(--dim); }
.warn { color: var(--warn); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
::selection { background: var(--accent-bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1d2530; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .18em; font-size: 13px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; letter-spacing: 0; }
.brand-lg { font-size: 18px; justify-content: center; }
.brand-lg .brand-mark { width: 40px; height: 40px; font-size: 20px; border-radius: 10px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; overflow: hidden; padding: 16px; }
.login-grid { position: fixed; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px),
  linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 48px 48px; opacity: .35;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%); }
.login-card { position: relative; width: min(380px, 100%); background: rgba(15, 20, 27, .92); border: 1px solid var(--border-2);
  border-radius: 16px; padding: 36px 32px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.6); backdrop-filter: blur(8px); }
.login-sub { text-align: center; color: var(--muted); margin: 10px 0 28px; }
.pin { font-family: var(--mono); font-size: 26px; letter-spacing: .6em; text-align: center; padding: 12px; }
.login-err { color: var(--down); min-height: 20px; text-align: center; margin: 12px 0 0; }
.login-foot { color: var(--dim); font-size: 10px; text-align: center; margin-top: 18px; letter-spacing: .08em; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- controls ---------- */
.label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.input.mono { font-family: var(--mono); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-2);
  background: var(--panel-2); color: var(--text); padding: 7px 12px; border-radius: var(--radius-sm); font: 500 12.5px var(--sans);
  cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--panel-3); border-color: #3a4558; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d7ef0; border-color: #3d7ef0; }
.btn-danger { color: var(--down); border-color: rgba(255,93,108,.35); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }
.btn-block { width: 100%; margin-top: 16px; padding: 10px; font-size: 14px; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 5px 10px; border-radius: 6px; font: 500 12px var(--sans); cursor: pointer; }
.seg button.active { background: var(--panel-3); color: var(--text); }
.seg button:hover:not(.active) { color: var(--text); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--topbar) 1fr; height: 100vh; }
.sidebar { grid-row: 1 / 3; background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar .brand { height: var(--topbar); padding: 0 18px; border-bottom: 1px solid var(--border); }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; color: var(--muted); border-radius: 7px; font-weight: 500;
  margin-bottom: 1px; text-decoration: none; position: relative; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.active { color: var(--text); background: var(--panel-2); }
.nav a.active::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .kbd { margin-left: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.live { background: var(--up); box-shadow: 0 0 0 3px var(--up-bg); }
.dot.err { background: var(--down); }

.topbar { display: flex; align-items: center; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--border); background: var(--bg); min-width: 0; }
.topbar .kpis { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.topbar .kpis::-webkit-scrollbar { display: none; }
.tkpi { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.tkpi .k { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.tkpi .v { font: 500 14px var(--mono); }
.cmdk { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--dim); cursor: pointer; min-width: 210px; font-size: 12px; }
.cmdk:hover { border-color: var(--border-2); color: var(--muted); }
.kbd { font: 10.5px var(--mono); border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); background: var(--bg-2); }
.menu-btn { display: none; }

.main { overflow-y: auto; min-width: 0; min-height: 0; }
.view { padding: 20px 22px 40px; max-width: 1680px; margin: 0 auto; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font-size: 20px; }
.view-head p { margin: 4px 0 0; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; display: flex; flex-direction: column; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); min-height: 46px; }
.card-h h3 { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-h .sub { color: var(--dim); font-size: 11.5px; font-weight: 400; }
.card-b { padding: 14px; flex: 1; min-height: 0; }
.card-b.flush { padding: 0; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 340px; } .chart-box.short { height: 190px; }

.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; min-width: 0; }
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.stat .v { font: 500 21px var(--mono); margin-top: 4px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font: 11.5px var(--mono); color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { font-family: var(--mono); text-align: right; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-width: 100%; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.t th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 500; color: var(--muted); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .07em; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: default; user-select: none; z-index: 1; }
.t th.sortable { cursor: pointer; } .t th.sortable:hover { color: var(--text); }
.t th.num { text-align: right; }
.t td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t tbody tr:hover td { background: rgba(255,255,255,.018); }
.t tr:last-child td { border-bottom: 0; }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--border-2); background: var(--panel-2); }
.sym { font-weight: 600; font-family: var(--mono); letter-spacing: .02em; }
.sym-name { color: var(--dim); font-size: 11px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bar { position: relative; height: 6px; background: var(--panel-3); border-radius: 3px; min-width: 60px; overflow: hidden; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.bar.neg > span { background: var(--down); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.pill.ok { color: var(--up); background: var(--up-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.breach { color: var(--down); background: var(--down-bg); }
.pill.na, .pill.neutral { color: var(--muted); background: var(--panel-3); }
.pill.info { color: var(--accent-2); background: var(--accent-bg); }
.tag { display: inline-block; font: 500 10.5px var(--mono); padding: 1px 6px; border-radius: 4px; background: var(--panel-3); color: var(--muted); margin-right: 4px; cursor: pointer; }
.tag:hover { color: var(--text); }

/* ---------- heatmap ---------- */
.heat { border-collapse: separate; border-spacing: 2px; font: 10.5px var(--mono); }
.heat td, .heat th { width: 38px; height: 26px; text-align: center; border-radius: 3px; }
.heat th { color: var(--muted); font-weight: 500; }
.heat th.row { text-align: right; padding-right: 6px; width: auto; }
.months td { width: auto; min-width: 46px; padding: 0 4px; }

/* ---------- news ---------- */
.news-list { display: flex; flex-direction: column; }
.news-item { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: 0; }
.news-item .sent { border-radius: 2px; background: var(--panel-3); }
.news-item .sent.pos { background: var(--up); } .news-item .sent.neg { background: var(--down); }
.news-item h4 { font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.news-item h4 a { color: var(--text); }
.news-item h4 a:hover { color: var(--accent-2); text-decoration: none; }
.news-meta { color: var(--dim); font-size: 11.5px; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.news-item p { color: var(--muted); margin: 6px 0 0; font-size: 12.5px; }
.news-compact .news-item { padding: 10px 14px; }
.news-compact .news-item h4 { font-size: 12.5px; }

/* ---------- terminal ---------- */
.term { background: #05070a; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; height: calc(100vh - var(--topbar) - 150px); min-height: 420px; }
.term-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.term-out { flex: 1; overflow-y: auto; padding: 12px 14px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.term-out .in { color: var(--accent-2); }
.term-out .err { color: var(--down); }
.term-out .sys { color: var(--dim); }
.term-out .ok { color: var(--up); }
.term-out .res { color: #d6e2f0; }
.term-out table { border-collapse: collapse; margin: 4px 0; }
.term-out td, .term-out th { padding: 1px 12px 1px 0; text-align: right; }
.term-out th { color: var(--muted); font-weight: 500; text-align: right; }
.term-out td:first-child, .term-out th:first-child { text-align: left; }
.term-chart { height: 240px; position: relative; margin: 6px 0 10px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.term-in { display: flex; align-items: flex-start; gap: 8px; border-top: 1px solid var(--border); padding: 10px 14px; }
.term-in .prompt { font: 12.5px/1.6 var(--mono); color: var(--accent); padding-top: 1px; white-space: nowrap; }
.term-in textarea { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font: 12.5px/1.6 var(--mono); resize: none; min-height: 21px; max-height: 260px; }
.snips { display: flex; flex-direction: column; gap: 6px; }
.snip { text-align: left; background: var(--bg-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; cursor: pointer; color: var(--text); font: 11.5px var(--mono); }
.snip:hover { border-color: var(--accent); }
.snip small { display: block; color: var(--dim); font-family: var(--sans); margin-bottom: 2px; }

/* ---------- misc ---------- */
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--text); font-size: 18px; margin-bottom: 8px; }
.hero-empty { max-width: 560px; margin: 8vh auto; text-align: center; }
.hero-empty .brand-mark { width: 56px; height: 56px; font-size: 26px; border-radius: 14px; margin: 0 auto 18px; }
.hero-empty h1 { font-size: 24px; margin-bottom: 8px; }
.hero-empty p { color: var(--muted); font-size: 14px; }
.steps { text-align: left; margin: 24px 0; display: grid; gap: 10px; }
.steps div { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; gap: 12px; }
.steps b { font-family: var(--mono); color: var(--accent); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 60px 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 4px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.banner { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 12.5px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(244,183,64,.25); }
.banner.err { background: var(--down-bg); color: var(--down); border: 1px solid rgba(255,93,108,.25); }
.banner.info { background: var(--accent-bg); color: var(--accent-2); border: 1px solid rgba(76,141,255,.25); }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.help { color: var(--dim); font-size: 11.5px; margin-top: 6px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.spark { width: 80px; height: 24px; display: block; }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 10px 14px; z-index: 100; box-shadow: 0 12px 40px rgba(0,0,0,.5); animation: fade .2s; max-width: 380px; }
.toast.err { border-color: rgba(255,93,108,.5); }

/* command palette */
.palette-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 0; backdrop-filter: blur(2px); }
.palette { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.palette input { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--border); padding: 14px 16px; color: var(--text); font: 15px var(--sans); outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.palette li { padding: 9px 12px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.palette li.sel { background: var(--panel-3); }
.palette li span:last-child { color: var(--dim); font-size: 11.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 260px; height: 100%; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .menu-btn { display: inline-flex; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3 { grid-column: auto; }
  .cmdk { min-width: 0; } .cmdk .txt { display: none; }
  .view { padding: 16px 16px 40px; }
}
.card .card { border: 0; border-radius: 0; background: transparent; }

/* neural lab: compact two-column form in the narrow settings column */
.nn-form .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* multi-step login */
.login-card { width: min(440px, 100%); }
.step[hidden] { display: none; }
.login-q { text-align: center; margin: 0 0 16px; color: var(--text); font-weight: 500; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.level-list { display: grid; gap: 10px; }
.choice { text-align: left; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 14px; color: var(--text);
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; transition: border-color .15s, background .15s; }
.choice:hover, .choice:focus-visible { border-color: var(--accent); background: var(--accent-bg); outline: none; }
.choice b { font-size: 14px; }
.choice span { color: var(--muted); font-size: 12px; }
.demo-box { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-2); text-align: center; }
.demo-hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.pin-sm { font-size: 20px; max-width: 160px; margin: 0 auto; padding: 8px; }
@media (max-width: 420px) { .choice-grid { grid-template-columns: 1fr; } }

/* account chip, level switch */
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.me-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-seg button { padding: 4px 9px; font-weight: 600; }
.level-seg .lvl-full { display: none; }
@media (min-width: 1500px) { .level-seg .lvl-full { display: inline; font-weight: 500; } }
.has-def { text-decoration: underline dotted rgba(133,146,163,.6); text-underline-offset: 3px; cursor: help; }
.explain { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); background: rgba(76,141,255,.04); }
.page-guide { justify-content: space-between; }
.page-guide span { line-height: 1.5; }
.demo-banner a { color: inherit; text-decoration: underline; font-weight: 600; }
body[data-level="beginner"] .stat .k { text-transform: none; letter-spacing: 0; font-size: 12px; }

/* guided tour */
.tour-shade { position: fixed; inset: 0; z-index: 80; background: transparent; }
.tour-shade.solid { background: rgba(0,0,0,.6); }
.tour-spot { position: fixed; z-index: 81; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0,0,0,.6); outline: 2px solid var(--accent);
  pointer-events: none; transition: all .25s ease; }
.tour-pop { position: fixed; z-index: 82; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); transition: top .25s ease, left .25s ease; }
.tour-pop h4 { font-size: 15px; margin: 4px 0 6px; }
.tour-pop p { margin: 0 0 14px; color: var(--muted); line-height: 1.55; }
.tour-step { font: 11px var(--mono); color: var(--accent-2); }
.tour-btns { display: flex; gap: 6px; align-items: center; }
.tour-loading { display: flex; justify-content: center; padding: 16px; }
.choice.active { border-color: var(--accent); background: var(--accent-bg); }
.sec-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.sec-badges span { font-size: 10.5px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px 9px; cursor: help; }

/* security center */
.sec-hero { flex-direction: row; align-items: center; gap: 22px; padding: 18px; }
.sec-shield { position: relative; width: 140px; height: 150px; flex: none; display: grid; place-items: center; }
.sec-shield svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: rgba(34,201,131,.08); stroke: var(--up); stroke-width: 1; }
.sec-shield.warn svg { fill: rgba(244,183,64,.08); stroke: var(--warn); }
.sec-shield svg path:last-child { display: none; }
.sec-shield b { font: 600 34px var(--mono); margin-top: -10px; }
.sec-shield span { position: absolute; bottom: -4px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.sec-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; flex: 1; }
.sec-check { display: flex; gap: 10px; align-items: flex-start; }
.sec-check > span { font-weight: 700; width: 18px; text-align: center; }
.sec-check b { display: block; font-size: 12.5px; }
.sec-check small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.keyflow { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kf-node { border: 1px solid var(--border-2); background: var(--bg-2); border-radius: 8px; padding: 7px 14px; text-align: center; font-weight: 600; font-size: 12.5px; min-width: 70%; }
.kf-node small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.kf-node.accent { border-color: rgba(76,141,255,.5); background: var(--accent-bg); }
.kf-node.vault { border-color: rgba(34,201,131,.5); background: var(--up-bg); }
.kf-arrow { font: 10.5px var(--mono); color: var(--dim); }
.kf-arrow::before { content: '↓ '; }
@media (max-width: 960px) { .sec-hero { flex-direction: column; } .sec-checks { grid-template-columns: 1fr; } }

/* admin */
.toggle { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; }
.rule-list { margin-top: 10px; border-top: 1px solid var(--border); }
.rule { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.ref-code { margin-top: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--accent-bg); border: 1px dashed var(--accent); border-radius: 8px; padding: 12px 14px; }
.ref-code span { font-size: 17px; letter-spacing: .06em; color: var(--text); }

.remember { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; margin-top: 14px; font-size: 12.5px; cursor: pointer; }
.remember input { width: 15px; height: 15px; accent-color: var(--accent); }
.remember small { grid-column: 2; color: var(--dim); font-size: 11px; }

/* ---- privacy mode: blur numbers (toggle in the top bar, or press H) ---- */
.privacy-btn.on { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
body.privacy :is(.tkpi .v, .stat .v, .stat .s, .kv .v, td.num, td.up, td.down, .pill b, span.up, span.down, b.up, b.down, :not(th).num, .model-value, .model-native td, .model-md, .model-stdout, .term-out, .spark, .cv-row .mono, .hero-num),
body.privacy .main canvas, body.privacy .main svg text {
  filter: blur(7px); transition: filter .15s;
}
body.privacy .main canvas { filter: blur(10px); }
body.privacy .main input[type="number"] { color: transparent; text-shadow: 0 0 8px var(--text); }

/* ---- imported models ---- */
.models-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.models-list { position: sticky; top: 0; }
.model-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.model-item:last-child { border-bottom: 0; }
.model-item:hover { background: var(--panel-2); }
.model-item.active { background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
.model-item.off .mi-text { opacity: .55; }
.mi-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mi-text b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-text small { color: var(--dim); font-size: 11px; }
.switch { position: relative; width: 30px; height: 17px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--panel-3); border: 1px solid var(--border-2); border-radius: 99px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--up-bg); border-color: var(--up); }
.switch input:checked + span::after { transform: translateX(13px); background: var(--up); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-bg); }
.model-status { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }
.live-badge { color: var(--up); font-weight: 600; letter-spacing: .05em; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.model-view { min-height: 120px; }
.model-view.is-off { opacity: .6; }
.model-view.preview { border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 8px; min-height: 260px; }
.model-frame { display: block; width: 100%; border: 0; border-radius: var(--radius-sm); background: transparent; }
.model-native { overflow-x: auto; }
.model-note { font-size: 11px; color: var(--up); margin-bottom: 6px; }
.model-md { line-height: 1.6; } .model-md h2, .model-md h3, .model-md h4 { margin: 10px 0 6px; }
.model-md code { font-family: var(--mono); background: var(--bg-2); padding: 0 4px; border-radius: 4px; }
.model-stdout { font: 12px/1.5 var(--mono); white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-top: 10px; }
.model-stdout.err { color: var(--down); }
.model-value { font: 500 42px var(--mono); padding: 24px 6px; letter-spacing: -.02em; }
.input.input-sm { width: auto; padding: 4px 8px; font-size: 12px; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.drop { border: 1.5px dashed var(--border-2); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 4px; align-items: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-bg); }
.drop small { color: var(--dim); font-size: 11px; }
.link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.code-input { min-height: 220px; font-size: 12px; line-height: 1.45; resize: vertical; white-space: pre; }
.help-box { margin-top: 14px; font-size: 12px; color: var(--muted); }
.help-box summary { cursor: pointer; color: var(--text); }
.help-box p { margin: 8px 0; }
.convert-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.convert-head { display: flex; align-items: center; gap: 10px; } .convert-head .btn { margin-left: auto; }
.cv-row { display: grid; grid-template-columns: minmax(70px, auto) 1fr auto auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.cv-row:last-of-type { border-bottom: 0; }
.cv-row select { max-width: 200px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 11.5px; }
.example-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.example-grid .choice { display: flex; flex-direction: column; gap: 4px; }
body.kiosk .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
body.kiosk .sidebar, body.kiosk .topbar { display: none; }
body.kiosk .view { max-width: none; padding: 0; }
.kiosk-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-2); }
.kiosk-bar .btn { margin-left: auto; }
.kiosk-view { padding: 12px 16px; }
@media (max-width: 960px) {
  .models-layout, .import-grid { grid-template-columns: 1fr; }
  .models-list { position: static; }
  .privacy-btn { padding: 4px 8px; }
}
.models-search { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.models-search .input { width: 100%; }
.models-list #m-list { max-height: calc(100vh - var(--topbar) - 190px); overflow-y: auto; }
.big-file { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 12px; font-size: 12.5px; }
.big-file pre { font: 11px/1.45 var(--mono); color: var(--muted); max-height: 160px; overflow: hidden; margin: 8px 0; white-space: pre-wrap; word-break: break-all; }
.model-more { margin-top: 10px; }
.model-view { position: relative; }
.model-wait { position: absolute; inset: 0; background: var(--panel); border-radius: var(--radius-sm); }
