/* Lakshmi v2 — the design system (DESIGN2.md section 10).
   One stylesheet for every page: tokens, the shell (sidebar / icon rail / bottom tab bar, top bar), components
   (panels, KPI tiles, tables, tabs, badges, buttons, forms, modals, toasts, skeletons) and the Dashboard + Login
   pages. CSP is self-only (section 9): no inline styles anywhere — dynamic values are set from JS via element.style.
   Usage guide for page authors: lakshmi/web/static/UI.md. */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #0b0e11;
  --panel: #12161c;
  --panel-2: #181d24;
  --hover: #1e242c;
  --border: #232a33;
  --border-2: #2c3440;
  --text: #e6e8ea;
  --muted: #8a94a3;
  --faint: #5b6573;
  --up: #16c784;
  --down: #ea3943;
  --accent: #f0b90b;
  --accent-2: #f6cb45;
  --paper: #3b82f6;
  --paper-text: #8cb8ff;
  --live: #ff5b3a;
  --live-text: #ffab98;
  --warn: #f5a524;

  --up-bg: rgba(22, 199, 132, .12);
  --down-bg: rgba(234, 57, 67, .12);
  --accent-bg: rgba(240, 185, 11, .12);
  --paper-bg: rgba(59, 130, 246, .14);
  --live-bg: rgba(255, 91, 58, .13);
  --warn-bg: rgba(245, 165, 36, .12);

  --r-panel: 8px;
  --r-ctl: 6px;
  --font: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", Menlo, monospace;

  --side-w: 224px;
  --rail-w: 64px;
  --top-h: 52px;
  --tab-h: 58px;
  --row-h: 34px;
  --gap: 16px;
  --focus: 0 0 0 2px rgba(240, 185, 11, .40);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "calt";
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--accent); cursor: pointer; }
a.link:hover, .link:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(240, 185, 11, .28); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-ctl); }
* { scrollbar-width: thin; scrollbar-color: #2c3440 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a313c; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4351; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .accent { color: var(--accent); }
.c-live { color: var(--live); } .c-paper { color: var(--paper-text); } .c-warn { color: var(--warn); }
.label { font-size: 11px; line-height: 1.3; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.right { text-align: right; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.spacer { flex: 1 1 auto; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.w-full { width: 100%; }
.sep-v { width: 1px; align-self: stretch; background: var(--border); }
time[title], [data-utc] { cursor: default; }

/* ------------------------------------------------------------------ icons */
.ico { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.ico-sm { width: 14px; height: 14px; vertical-align: -2px; }
.ico-xs { width: 12px; height: 12px; vertical-align: -1px; }
.ico-lg { width: 20px; height: 20px; }
.ico-xl { width: 28px; height: 28px; }

/* ------------------------------------------------------------------ shell grid */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content {
  width: 100%; max-width: 1760px; padding: 16px 20px 32px;
  display: flex; flex-direction: column; gap: var(--gap); min-width: 0;
}

/* sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; min-width: 0;
  background: var(--panel); border-right: 1px solid var(--border);
}
.brand {
  height: var(--top-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  border-bottom: 1px solid var(--border); color: var(--text); overflow: hidden;
}
.brand-mark { width: 24px; height: 24px; flex: none; display: block; }
.brand-word { font-size: 16px; font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.brand-word b { color: var(--accent); font-weight: 650; }
.nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { margin: 12px 10px 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--r-ctl); background: none; color: var(--muted); font-weight: 500;
  text-align: left; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s;
}
.nav-item .ico { width: 18px; height: 18px; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--panel-2); color: var(--text); }
.nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item.active .ico { color: var(--accent); }
.nav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-caret { width: 14px; height: 14px; color: var(--faint); transition: transform .15s; }
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 1px; margin: 2px 0 6px 19px; padding-left: 10px; border-left: 1px solid var(--border); }
.nav-group.open .nav-sub { display: flex; }
.nav-bot {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--r-ctl);
  color: var(--muted); font-size: 12.5px; white-space: nowrap; transition: background .12s, color .12s;
}
.nav-bot:hover { background: var(--hover); color: var(--text); }
.nav-bot.active { background: var(--panel-2); color: var(--text); }
.nav-bot .nav-label { flex: 1 1 auto; }
.nav-bot-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; color: var(--live); }
.nav-bot-tag.is-paused { color: var(--faint); }
.nav-bot .bot-avatar { display: none; }
.nav-empty { padding: 6px 8px; font-size: 12px; color: var(--faint); }
.sidebar-foot { flex: none; padding: 8px; border-top: 1px solid var(--border); }
.sidebar-foot .nav-item { color: var(--faint); }

.bot-avatar {
  position: relative; width: 30px; height: 30px; flex: none; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
}
.bot-avatar .dot { position: absolute; right: -3px; top: -3px; border: 2px solid var(--panel); width: 10px; height: 10px; }
.bot-avatar.is-live { border-color: rgba(255, 91, 58, .55); }
.bot-avatar.is-ref { color: var(--accent); }

/* icon rail (< 1280px, or collapsed by the user) */
.app.is-rail { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.app.is-rail .brand { justify-content: center; padding: 0; }
.app.is-rail .brand-word,
.app.is-rail .nav-label,
.app.is-rail .nav-count,
.app.is-rail .nav-caret,
.app.is-rail .nav-section,
.app.is-rail .nav-bot-tag,
.app.is-rail .nav-bot > .dot { display: none; }
.app.is-rail .nav { padding: 10px 8px; align-items: center; }
.app.is-rail .nav-item { justify-content: center; padding: 0; width: 44px; height: 38px; }
.app.is-rail .nav-item.active::before { left: -8px; }
.app.is-rail .nav-sub { display: flex; margin: 2px 0 6px; padding: 4px 0 0; border-left: 0; border-top: 1px solid var(--border); align-items: center; gap: 4px; }
.app.is-rail .nav-bot { padding: 0; height: auto; width: 44px; justify-content: center; }
.app.is-rail .nav-bot .bot-avatar { display: flex; }
.app.is-rail .nav-bot.active .bot-avatar { border-color: var(--accent); }
.app.is-rail .sidebar-foot { display: flex; justify-content: center; }
.app.is-rail .sidebar-foot .nav-item { width: 44px; }
.app.is-rail .nav-empty { display: none; }
@media (max-width: 1279.98px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
}

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); flex: none;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: rgba(11, 14, 17, .88); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(140%) blur(10px); backdrop-filter: saturate(140%) blur(10px);
}
.topbar-brand { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; font-size: 15px; font-weight: 600; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--text); }
.crumb-sep { color: var(--faint); font-weight: 400; }
.crumb-cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .badge { margin-left: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 10px; border-radius: 15px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); font-size: 12px; white-space: nowrap;
  font-variant-numeric: tabular-nums; transition: border-color .12s, background .12s;
}
.pill:hover { border-color: var(--border-2); background: var(--panel-2); }
.pill-main { font-weight: 600; }
.pill-sub { color: var(--muted); }
.pill-short, .pill-cd { display: none; }
@media (min-width: 768px) and (max-width: 1099.98px) {
  .pill-long { display: none; }
  .pill-cd { display: inline; }
  .real-chip-text { display: none; }
  .real-chip-short { display: inline; }
}
.pill.is-ok .dot { background: var(--up); box-shadow: 0 0 0 3px rgba(22, 199, 132, .16); }
.pill.is-late { border-color: rgba(245, 165, 36, .38); }
.pill.is-late .pill-main { color: var(--warn); }
.pill.is-late .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 165, 36, .16); }
.pill.is-bad { border-color: rgba(234, 57, 67, .45); background: rgba(234, 57, 67, .08); }
.pill.is-bad .pill-main { color: #ff7a82; }
.pill.is-bad .dot { background: var(--down); box-shadow: 0 0 0 3px rgba(234, 57, 67, .18); }
.pill.is-off .dot { background: var(--faint); }
.pill.is-off .pill-main { color: var(--muted); }

.real-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 15px;
  background: var(--live-bg); border: 1px solid rgba(255, 91, 58, .45); color: var(--live-text);
  font-size: 11px; font-weight: 700; letter-spacing: .05em; white-space: nowrap;
}
.real-chip:hover { background: rgba(255, 91, 58, .2); }
.real-chip .pulse { color: var(--live); }
.real-chip-short { display: none; }

.clock { display: inline-flex; align-items: baseline; gap: 5px; padding: 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-time { font-size: 13px; font-weight: 500; color: var(--text); }
.clock-zone { font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--faint); }

.usermenu { position: relative; }
.avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--panel-2);
  color: var(--text); font-size: 12px; font-weight: 650; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { border-color: var(--accent); }

/* dropdown menu */
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: var(--r-panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); animation: lk-pop .12s ease-out;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-name { font-weight: 600; }
.menu-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-ctl);
  background: none; color: var(--text); cursor: pointer; text-align: left; white-space: nowrap;
}
.menu-item .ico { color: var(--muted); }
.menu-item:hover { background: var(--hover); }
.menu-item.is-danger { color: #ff8a80; }
.menu-item.is-danger .ico { color: inherit; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* bottom tab bar (< 768px) */
.tabbar { display: none; }

@media (max-width: 767.98px) {
  :root { --gap: 12px; }
  .app, .app.is-rail { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-brand { display: flex; align-items: center; flex: none; }
  .topbar-brand img { width: 24px; height: 24px; display: block; }
  .crumbs { font-size: 14px; }
  .crumbs a, .crumb-sep { display: none; }
  .pill { padding: 0 10px 0 9px; gap: 6px; }
  .pill-long, .pill-main { display: none; }
  .pill-short { display: inline; font-weight: 600; }
  .real-chip { padding: 0 9px; }
  .real-chip-text { display: none; }
  .real-chip-short { display: inline; }
  .content { padding: 12px 12px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom);
    background: rgba(18, 22, 28, .96); border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .tab {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: 0; background: none; color: var(--faint); font-size: 10.5px; font-weight: 500; cursor: pointer; position: relative;
  }
  .tab .ico { width: 20px; height: 20px; }
  .tab.active { color: var(--text); }
  .tab.active .ico { color: var(--accent); }
  .tab .tab-dot { position: absolute; top: 9px; left: calc(50% + 7px); width: 8px; height: 8px; }
}
@media (max-width: 479.98px) {
  .clock { display: none; }
}

/* ------------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head-main { min-width: 0; flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.page-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 22px; font-weight: 650; }
.page-sub { color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; gap: 10px; min-height: 28px; flex-wrap: wrap; }
.section-title { font-size: 14px; font-weight: 600; }
.section-count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ panels */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-panel); min-width: 0; display: flex; flex-direction: column; }
.panel.is-live { box-shadow: inset 0 2px 0 var(--live); }
.panel-head {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-title .ico { color: var(--muted); }
.panel-sub { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.panel-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-body { padding: 16px; min-width: 0; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--gap); align-items: start; }
@media (max-width: 1439.98px) { .grid-main-side { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 1099.98px) {
  .grid-main-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899.98px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* key/value list (ticket panels, health panels) */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0; font-variant-numeric: tabular-nums; }
.kv > dt, .kv > dd { margin: 0; padding: 7px 0; border-bottom: 1px solid rgba(35, 42, 51, .7); }
.kv > dt { color: var(--muted); padding-right: 16px; white-space: nowrap; }
.kv > dd { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }

/* ------------------------------------------------------------------ KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpis.is-strip { gap: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-panel); }
.kpi {
  position: relative; min-width: 0; padding: 14px 16px 13px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-panel);
}
.kpis.is-strip .kpi { border: 0; border-radius: 0; background: none; }
.kpis.is-strip .kpi + .kpi { box-shadow: inset 1px 0 0 var(--border); }
.kpi.is-live::before {
  content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--live);
  border-radius: var(--r-panel) 0 0 var(--r-panel);
}
.kpi.is-paper::before {
  content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; background: var(--paper);
  border-radius: var(--r-panel) 0 0 var(--r-panel);
}
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label .ico { width: 13px; height: 13px; }
.kpi-value {
  margin-top: 7px; font-size: 22px; line-height: 1.15; font-weight: 600; letter-spacing: -.015em;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-value.is-empty { color: var(--faint); font-weight: 500; }
.kpi-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-sub { margin-top: 5px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub b { font-weight: 600; }
.kpi-sm .kpi-value { font-size: 17px; }
@media (max-width: 767.98px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi-value { font-size: 18px; }
  .kpis.is-strip .kpi + .kpi { box-shadow: none; }
  .kpis.is-strip .kpi { border-bottom: 1px solid var(--border); }
}

/* ------------------------------------------------------------------ badges, chips, dots */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px;
  border: 1px solid transparent; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; line-height: 1;
  text-transform: uppercase; white-space: nowrap; vertical-align: middle; flex: none;
  background: var(--panel-2); color: var(--muted); border-color: var(--border-2);
}
.badge-lg { height: 24px; padding: 0 9px; font-size: 11.5px; }
.badge-paper { color: var(--paper-text); background: var(--paper-bg); border-color: rgba(59, 130, 246, .38); }
.badge-real { color: #fff; background: var(--live); border-color: var(--live); }
.badge-real .pulse { color: #fff; }
.badge-ref { color: var(--accent); background: var(--accent-bg); border-color: rgba(240, 185, 11, .35); }
.badge-up { color: var(--up); background: var(--up-bg); border-color: rgba(22, 199, 132, .32); }
.badge-down { color: #ff7a82; background: var(--down-bg); border-color: rgba(234, 57, 67, .35); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(245, 165, 36, .35); }
.badge-muted { color: var(--muted); background: transparent; border-color: var(--border-2); }
.badge-legacy { color: #b6a3e6; background: rgba(167, 139, 250, .1); border-color: rgba(167, 139, 250, .3); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border-2);
}
.chip .ico { width: 12px; height: 12px; flex: none; }
.chip-warn { background: var(--warn-bg); color: #f7c06a; border-color: rgba(245, 165, 36, .3); }
.chip-down { background: var(--down-bg); color: #ff8d93; border-color: rgba(234, 57, 67, .3); }
.chip-live { background: var(--live-bg); color: var(--live-text); border-color: rgba(255, 91, 58, .35); }
.chip-info { background: var(--paper-bg); color: var(--paper-text); border-color: rgba(59, 130, 246, .3); }
.chip-up { background: var(--up-bg); color: var(--up); border-color: rgba(22, 199, 132, .3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot-paper { background: var(--paper); }
.dot-live { background: var(--live); animation: lk-ring 1.8s ease-out infinite; }
.dot-ok { background: var(--up); } .dot-warn { background: var(--warn); } .dot-down { background: var(--down); }
.dot-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.dot-ref { background: var(--accent); }

.pulse { position: relative; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor;
  animation: lk-pulse 1.6s ease-out infinite;
}
@keyframes lk-pulse { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(3.2); opacity: 0; } }
@keyframes lk-ring { 0% { box-shadow: 0 0 0 0 rgba(255, 91, 58, .55); } 100% { box-shadow: 0 0 0 6px rgba(255, 91, 58, 0); } }

/* ------------------------------------------------------------------ alerts / strips */
.strip {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-ctl);
  font-size: 12px; line-height: 1.4; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--muted);
}
.strip .ico { width: 14px; height: 14px; flex: none; }
.strip-live { background: var(--live-bg); border-color: rgba(255, 91, 58, .38); color: var(--live-text); }
.strip-live b { color: #fff; }
.strip-warn { background: var(--warn-bg); border-color: rgba(245, 165, 36, .32); color: #f7c06a; }
.strip-down { background: var(--down-bg); border-color: rgba(234, 57, 67, .35); color: #ff9aa0; }
.strip-info { background: var(--paper-bg); border-color: rgba(59, 130, 246, .32); color: var(--paper-text); }
.strip-up { background: var(--up-bg); border-color: rgba(22, 199, 132, .3); color: #5fe0ad; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 14px;
  border-radius: var(--r-ctl); border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  position: relative; transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:hover { background: var(--hover); border-color: #3a4351; }
.btn:active { transform: translateY(.5px); }
.btn .ico { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #17130a; font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger, .btn-real { background: var(--live); border-color: var(--live); color: #fff; font-weight: 600; }
.btn-danger:hover, .btn-real:hover { background: #ff7255; border-color: #ff7255; }
.btn-paper { background: var(--paper); border-color: var(--paper); color: #fff; font-weight: 600; }
.btn-paper:hover { background: #5a96f7; border-color: #5a96f7; }
.btn-outline-real { background: transparent; border-color: rgba(255, 91, 58, .55); color: var(--live-text); }
.btn-outline-real:hover { background: var(--live-bg); border-color: var(--live); }
.btn-outline-paper { background: transparent; border-color: rgba(59, 130, 246, .5); color: var(--paper-text); }
.btn-outline-paper:hover { background: var(--paper-bg); border-color: var(--paper); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; gap: 5px; }
.btn-sm .ico { width: 13px; height: 13px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 26px; }
.btn[disabled], .btn.is-disabled { opacity: .42; cursor: not-allowed; pointer-events: none; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: lk-spin .7s linear infinite;
}
.btn-primary.is-busy::after { border-color: rgba(23, 19, 10, .3); border-top-color: #17130a; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); }
.btn-group .btn:last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--r-ctl);
  border: 0; background: none; color: var(--faint); cursor: pointer; transition: color .12s, background .12s;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn.is-on { color: var(--accent); }
@keyframes lk-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ segmented control + tabs */
.seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px; height: 30px; border-radius: var(--r-ctl);
  background: var(--bg); border: 1px solid var(--border); max-width: 100%; overflow-x: auto;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border: 0; border-radius: 4px;
  background: none; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--border-2); }
.seg-btn .count { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11px; }
.seg-btn.active .count { color: var(--muted); }
.seg-sm { height: 26px; } .seg-sm .seg-btn { height: 20px; padding: 0 8px; font-size: 11.5px; }

.tabs { display: flex; align-items: stretch; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; min-width: 0; }
.tab-btn {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 0;
  background: none; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); }
.tab-btn.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.tab-btn .count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--panel-2); color: var(--muted);
  font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.tab-btn.has-alert .count { background: var(--live); color: #fff; }
.panel > .tabs { padding: 0 8px; }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 14px; }
.field > label, .field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--r-ctl);
  background: var(--bg); border: 1px solid var(--border-2); color: var(--text); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #38414d; }
.input:focus { border-color: var(--accent); box-shadow: var(--focus); }
.input.is-invalid { border-color: var(--down); }
.input-sm { height: 30px; font-size: 12.5px; padding: 0 9px; }
textarea.input { height: auto; min-height: 88px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 40px; }
.input-wrap .input-icon { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.input-wrap .input-icon + .input { padding-left: 32px; }
.input-wrap .input-btn { position: absolute; right: 4px; }
.input-affix { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.input-affix + .input { padding-left: 24px; }
.field-hint { font-size: 12px; color: var(--faint); }
.field-error { font-size: 12px; color: #ff8d93; display: flex; align-items: center; gap: 6px; }
.form-error {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; margin-top: 14px; border-radius: var(--r-ctl);
  background: var(--down-bg); border: 1px solid rgba(234, 57, 67, .35); color: #ffa3a8; font-size: 12.5px; line-height: 1.4;
}
.form-error .ico { flex: none; margin-top: 1px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filterbar .input, .filterbar select.input { width: auto; min-width: 120px; height: 30px; font-size: 12.5px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { position: relative; overflow: auto; max-width: 100%; min-width: 0; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.tbl th {
  position: sticky; top: 0; z-index: 2; height: 32px; padding: 0 12px; text-align: left; white-space: nowrap;
  background: var(--panel); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); user-select: none;
}
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .th-in { display: inline-flex; align-items: center; gap: 4px; }
.tbl th .sort-ind { width: 10px; height: 10px; opacity: 0; transition: opacity .12s, transform .12s; }
.tbl th.sortable:hover .sort-ind { opacity: .45; }
.tbl th.is-sorted { color: var(--text); }
.tbl th.is-sorted .sort-ind { opacity: 1; color: var(--accent); }
.tbl th.is-asc .sort-ind { transform: rotate(180deg); }
.tbl td {
  height: var(--row-h); padding: 0 12px; white-space: nowrap; border-bottom: 1px solid rgba(35, 42, 51, .65);
  vertical-align: middle;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.is-live td:first-child { box-shadow: inset 2px 0 0 var(--live); }
.tbl tbody tr.is-dim td { color: var(--faint); }
.tbl tbody tr.is-alert td { background: rgba(234, 57, 67, .06); }
.tbl .r, .tbl th.r { text-align: right; }
.tbl th.r .th-in { flex-direction: row-reverse; }
.tbl .c, .tbl th.c { text-align: center; }
.tbl .wrap { white-space: normal; min-width: 180px; }
.tbl .sym { font-weight: 600; color: var(--text); }
.tbl .sub { color: var(--faint); font-size: 11.5px; }
.tbl-compact td { height: 30px; }
.tbl .skel { height: 10px; }
.cell-stack { display: flex; flex-direction: column; line-height: 1.25; }
.cell-stack .sub { font-size: 11px; }
.coin { display: inline-flex; align-items: center; gap: 8px; }
.coin-ico {
  width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #0b0e11; letter-spacing: 0;
}
.coin-quote { color: var(--faint); font-weight: 400; }
.coin-c0 { background: #f0b90b; } .coin-c1 { background: #4ea8ff; } .coin-c2 { background: #a78bfa; }
.coin-c3 { background: #2dd4bf; } .coin-c4 { background: #f472b6; } .coin-c5 { background: #a3e635; }
.coin-c6 { background: #fb923c; } .coin-c7 { background: #e879f9; } .coin-c8 { background: #38bdf8; }
.coin-c9 { background: #facc15; } .coin-c10 { background: #34d399; } .coin-c11 { background: #c4b5fd; }

/* ------------------------------------------------------------------ empty + skeleton */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 36px 16px; text-align: center; color: var(--muted); }
.empty .ico { width: 28px; height: 28px; color: var(--faint); margin-bottom: 4px; }
.empty-title { color: var(--text); font-weight: 500; }
.empty-sub { color: var(--faint); font-size: 12px; max-width: 360px; }
.empty-sm { padding: 20px 12px; }
.skel {
  display: block; height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, var(--panel-2) 0%, #20262f 45%, var(--panel-2) 90%); background-size: 220% 100%;
  animation: lk-shimmer 1.3s linear infinite;
}
.skel-text { height: 10px; width: 60%; }
.skel-num { height: 20px; width: 70%; margin-top: 8px; }
.skel-block { height: 100%; min-height: 80px; border-radius: var(--r-panel); }
@keyframes lk-shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }

/* ------------------------------------------------------------------ modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 6, 8, .68); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: lk-fade .14s ease-out;
}
.modal {
  width: 100%; max-width: 440px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5); animation: lk-rise .16s ease-out; overflow: hidden;
}
.modal-sm { max-width: 380px; } .modal-lg { max-width: 600px; } .modal-xl { max-width: 820px; }
.modal.is-danger { box-shadow: inset 0 3px 0 var(--live), 0 24px 64px rgba(0, 0, 0, .5); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 600; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 16px 18px; overflow-y: auto; line-height: 1.5; }
.modal-body p + p { margin-top: 10px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: rgba(11, 14, 17, .35); }
.modal-foot .spacer { flex: 1 1 auto; }
@media (max-width: 767.98px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal-sm, .modal-lg, .modal-xl {
    max-width: none; border-radius: 14px 14px 0 0; max-height: 90vh; animation: lk-sheet .2s ease-out;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-foot .btn { flex: 1 1 0; }
}
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; padding: 6px 0; align-items: start; }
.checklist .ico { width: 16px; height: 16px; margin-top: 1px; }
.checklist .is-ok .ico { color: var(--up); }
.checklist .is-bad .ico { color: var(--down); }
.checklist .ck-name { font-weight: 500; }
.checklist .ck-reason { color: var(--muted); font-size: 12px; }

/* bottom sheet list (bots on phones) */
.sheet-list { display: flex; flex-direction: column; margin: -8px -18px; }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.sheet-item:last-child { border-bottom: 0; }
.sheet-item:hover { background: var(--hover); }
.sheet-item .nav-label { flex: 1 1 auto; font-weight: 500; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: 360px; max-width: calc(100vw - 24px); pointer-events: none; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: 18px 1fr 20px; gap: 10px; align-items: start;
  padding: 11px 12px; border-radius: var(--r-panel); background: var(--panel-2); border: 1px solid var(--border-2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); animation: lk-slide .18s ease-out; font-size: 12.5px; line-height: 1.4;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.toast > .ico { width: 18px; height: 18px; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-msg { color: var(--muted); overflow-wrap: anywhere; }
.toast .icon-btn { width: 20px; height: 20px; }
.toast-ok > .ico { color: var(--up); } .toast-err > .ico { color: var(--down); }
.toast-warn > .ico { color: var(--warn); } .toast-info > .ico { color: var(--paper-text); }
.toast-err { border-color: rgba(234, 57, 67, .4); }
@media (max-width: 767.98px) {
  .toasts { left: 12px; right: 12px; width: auto; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------ tooltip (title-like, from data-tip) */
.tip {
  position: fixed; z-index: 300; max-width: 280px; padding: 6px 9px; border-radius: 6px; pointer-events: none;
  background: #232a34; border: 1px solid #333c49; color: var(--text); font-size: 12px; line-height: 1.4;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
}

/* ------------------------------------------------------------------ charts (charts.js) */
.lk-chart { position: relative; display: flex; flex-direction: column; min-width: 0; width: 100%; }
.lk-chart .chart-area { position: relative; flex: 1 1 auto; min-height: 0; }
.lk-chart canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.lk-chart canvas.chart-overlay { cursor: crosshair; touch-action: pan-y; }
.lk-chart.is-pannable canvas.chart-overlay { cursor: crosshair; }
.lk-chart.is-dragging canvas.chart-overlay { cursor: grabbing; }
.chart-xs { height: 40px; } .chart-sm { height: 160px; } .chart-md { height: 280px; } .chart-lg { height: 400px; } .chart-xl { height: 520px; }
@media (max-width: 767.98px) { .chart-lg { height: 320px; } .chart-xl { height: 380px; } .chart-md { height: 240px; } }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 0 0 10px; font-size: 12px; color: var(--muted); min-height: 26px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend-swatch { width: 18px; height: 0; border-top: 2px solid var(--muted); }
.legend-swatch.is-dashed { border-top-style: dashed; }
.legend-swatch.is-dotted { border-top-style: dotted; border-top-width: 3px; }
.legend-val { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }
.chart-tip {
  position: absolute; z-index: 5; left: 0; top: 0; pointer-events: none; min-width: 150px; padding: 8px 10px;
  background: rgba(24, 29, 36, .96); border: 1px solid var(--border-2); border-radius: var(--r-ctl);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .4); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.chart-tip-head { color: var(--muted); font-size: 11px; margin-bottom: 4px; white-space: nowrap; }
.chart-tip-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.chart-tip-row .tip-name { color: var(--muted); flex: 1 1 auto; }
.chart-tip-row .tip-val { font-weight: 600; margin-left: 12px; }
.chart-tip-sw { width: 8px; height: 8px; border-radius: 2px; flex: none; background: var(--muted); }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; }
.chart-reset { position: absolute; right: 78px; top: 6px; z-index: 4; }

/* ------------------------------------------------------------------ dashboard */
.portfolio { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1099.98px) { .portfolio { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .portfolio { gap: 8px; } }
.kpi-split { display: flex; gap: 0 10px; flex-wrap: wrap; }
.kpi-split .c-paper, .kpi-split .c-live { font-weight: 600; }

.botgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
@media (max-width: 767.98px) { .botgrid { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.botcard {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 14px 16px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-panel);
  color: inherit; cursor: pointer; overflow: hidden; transition: border-color .14s, background .14s;
}
.botcard:hover { border-color: #344050; background: #141920; }
.botcard:focus-visible { box-shadow: var(--focus); }
.botcard.is-live { box-shadow: inset 0 2px 0 var(--live); }
.botcard.is-ref { box-shadow: inset 0 2px 0 rgba(240, 185, 11, .7); }
.botcard.is-archived { opacity: .55; }
.botcard.is-archived:hover { opacity: .85; }
.bc-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bc-name { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-state { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.bc-state.is-paused { color: var(--warn); }
.bc-badges { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.bc-mid { display: grid; grid-template-columns: minmax(0, 1fr) 46%; gap: 12px; align-items: end; }
.bc-equity { font-size: 22px; font-weight: 600; letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-today { font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 3px; white-space: nowrap; }
.bc-today .muted { margin-left: 2px; }
.bc-since { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-since .muted { color: var(--faint); }
.bc-spark { height: 46px; }
.bc-stats { display: grid; grid-template-columns: 1fr 1.5fr .9fr; gap: 10px; padding-top: 11px; border-top: 1px solid var(--border); }
.bc-stat { min-width: 0; }
.bc-stat .label { display: block; margin-bottom: 4px; font-size: 10.5px; }
.bc-stat-v { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; white-space: nowrap; }
.bc-stat-v small { color: var(--muted); font-weight: 500; font-size: 11px; }
.target-bar { position: relative; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--panel-2); overflow: visible; }
.target-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: var(--accent); transition: width .4s ease; }
.target-fill.is-hit { background: var(--up); }
.target-fill.is-neg { background: var(--down); }
.target-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text); opacity: .7; }
.bc-foot { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; }
.bc-foot .ico { color: var(--faint); }
.bc-foot-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.bc-foot time { flex: none; color: var(--faint); }
.botcard .strip { margin: 0 -4px; }
.botcard.is-skel { cursor: default; min-height: 210px; }

.feed { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.feed-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 16px; border-bottom: 1px solid rgba(35, 42, 51, .7); }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: rgba(30, 36, 44, .5); }
.feed-ico { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--muted); }
.feed-ico .ico { width: 14px; height: 14px; }
.feed-ico.tone-up { background: var(--up-bg); color: var(--up); }
.feed-ico.tone-down { background: var(--down-bg); color: var(--down); }
.feed-ico.tone-live { background: var(--live-bg); color: var(--live); }
.feed-ico.tone-paper { background: var(--paper-bg); color: var(--paper-text); }
.feed-ico.tone-warn { background: var(--warn-bg); color: var(--warn); }
.feed-ico.tone-accent { background: var(--accent-bg); color: var(--accent); }
.feed-main { min-width: 0; }
.feed-title { font-weight: 500; display: flex; align-items: center; gap: 6px; min-width: 0; }
.feed-title .feed-bot { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-detail { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.feed-time { color: var(--faint); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 1px; }
.dash-feed { max-height: 560px; }
@media (max-width: 1099.98px) { .dash-feed { max-height: 420px; } }
@media (max-width: 767.98px) { .dash-feed { max-height: none; } }

/* ------------------------------------------------------------------ login */
.login-body {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
  background:
    radial-gradient(900px 480px at 50% -8%, rgba(240, 185, 11, .085), transparent 62%),
    radial-gradient(700px 420px at 100% 110%, rgba(59, 130, 246, .05), transparent 60%),
    var(--bg);
  position: relative; overflow-x: hidden;
}
.login-body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.login-card {
  position: relative; width: 100%; max-width: 380px; padding: 30px 28px 24px;
  background: rgba(18, 22, 28, .92); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45); animation: lk-rise .25s ease-out;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 22px; }
.login-logo img { width: 40px; height: 40px; display: block; }
.login-word { font-size: 24px; font-weight: 650; letter-spacing: .01em; }
.login-title { text-align: center; font-size: 15px; font-weight: 600; }
.login-sub { text-align: center; color: var(--muted); margin: 4px 0 22px; font-size: 12.5px; }
.login-card .btn-block { margin-top: 20px; height: 40px; font-size: 14px; }
.caps { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warn); margin-top: 2px; }
.login-foot { position: relative; margin-top: 18px; display: flex; align-items: center; gap: 14px; color: var(--faint); font-size: 12px; flex-wrap: wrap; justify-content: center; }
.login-foot .row { gap: 6px; }
@media (max-width: 479.98px) { .login-card { padding: 26px 20px 20px; } }

/* ------------------------------------------------------------------ responsive helpers */
@media (max-width: 1279.98px) { .hide-md { display: none !important; } }
@media (max-width: 767.98px) { .hide-sm { display: none !important; } }
@media (min-width: 768px) { .show-sm { display: none !important; } }

/* ------------------------------------------------------------------ motion */
@keyframes lk-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lk-rise { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes lk-sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes lk-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes lk-slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes lk-flash-up { 0% { background-color: rgba(22, 199, 132, .22); } 100% { background-color: transparent; } }
@keyframes lk-flash-down { 0% { background-color: rgba(234, 57, 67, .22); } 100% { background-color: transparent; } }
@keyframes lk-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.shake { animation: lk-shake .38s ease-out; }
body.has-modal { overflow: hidden; }
.flash-up { animation: lk-flash-up 1.2s ease-out; border-radius: 3px; }
.flash-down { animation: lk-flash-down 1.2s ease-out; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
