/* ==========================================================================
   Footprint Trading Command Center — terminal-grade dark glass (v2 design pass)
   Palette: near-black blue base, neon green/red P&L, Bloomberg amber accents.
   Type: JetBrains Mono (data) + Archivo (display/UI).
   v2 changes (design upgrade 2026-10-08):
   - Archivo replaces Space Grotesk (workhorse grotesk, off the default-face list)
   - --muted lifted to #7e8ea3 (>=5.3:1 on every panel ground; was 3.7:1)
   - functional text floor raised to 11px everywhere (was 8.5-10.5px)
   - zero-offset glows removed; depth = offset + soft blur shadows only
   - meter fills animate transform (scaleX), never width (no layout thrash)
   - alert feed chips wrap on narrow screens; skeleton + skip-link systems added
   - reduced-motion is targeted (tape/pulse/meter), not a global 0.01ms kill
   ========================================================================== */
:root {
  --bg: #04070d;
  --bg-2: #070c14;
  --panel: rgba(15, 23, 36, .58);
  --panel-solid: #0b1120;
  --panel-hi: rgba(21, 31, 47, .72);
  --line: rgba(148, 163, 184, .13);
  --line-hi: rgba(148, 163, 184, .26);
  --text: #e9eff7;
  --text-2: #9aa8ba;
  --muted: #7e8ea3;
  --green: #17e38d;
  --green-dim: #0ea86a;
  --green-soft: rgba(23, 227, 141, .12);
  --red: #ff4d5e;
  --red-soft: rgba(255, 77, 94, .12);
  --amber: #ffb547;
  --amber-soft: rgba(255, 181, 71, .12);
  --cyan: #4cc2ff;
  --cyan-soft: rgba(76, 194, 255, .1);
  --violet: #9b8cff;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'Archivo', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --r: 14px;
  --r-sm: 9px;
  --shadow: 0 18px 44px -18px rgba(0, 0, 0, .7), 0 2px 8px -2px rgba(0, 0, 0, .5);
  --shadow-g: 0 6px 22px -8px rgba(23, 227, 141, .35);
  --shadow-r: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --ease: cubic-bezier(.22, .8, .32, 1);
}
/* targeted reduced-motion: stop ambient loops + meter/tape motion, keep instant
   state feedback (toasts, focus) rather than a global .01ms kill */
@media (prefers-reduced-motion: reduce) {
  .tape-track, .nav-dot.on, .phase-pill.open .dot { animation: none !important; }
  .meter-fill, .probar .fill, .view, .toast, .drawer, .drawer-scrim { transition: none !important; }
  .meter-fill, .probar .fill { transform: none !important; }
  .meter-fill { transform-origin: 0 50% !important; }
  .sk { animation: none !important; }
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
body::before { /* ambient glows + fine grid — the terminal room */
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 420px at 8% -6%, rgba(23, 227, 141, .055), transparent 60%),
    radial-gradient(760px 420px at 96% 4%, rgba(76, 194, 255, .05), transparent 60%),
    radial-gradient(600px 500px at 50% 110%, rgba(155, 140, 255, .035), transparent 65%),
    repeating-linear-gradient(0deg, rgba(148, 163, 184, .028) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(148, 163, 184, .028) 0 1px, transparent 1px 56px),
    var(--bg);
}
::selection { background: rgba(23, 227, 141, .25); }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

/* skip link — keyboard users land on content, not the nav */
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 300;
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-hi);
  padding: 9px 14px; border-radius: 9px; text-decoration: none; font-size: 13px; font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ================= shell ================= */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100dvh; position: relative; z-index: 1; }
.main { min-width: 0; display: flex; flex-direction: column; }

/* ---- sidebar ---- */
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(9, 14, 24, .9), rgba(6, 10, 17, .82));
  backdrop-filter: blur(16px); padding: 18px 14px; z-index: 40;
}
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 6px 8px 16px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text { font-weight: 700; font-size: 15px; line-height: 1.05; letter-spacing: -.01em; display: flex; flex-direction: column; }
.brand-sub { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; color: var(--muted); margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 500; position: relative;
  border: 1px solid transparent; transition: all .18s var(--ease); min-height: 44px;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.nav-item:hover { color: var(--text); background: rgba(148, 163, 184, .07); }
.nav-item.active {
  color: var(--text); background: linear-gradient(90deg, rgba(23, 227, 141, .13), rgba(23, 227, 141, .03) 65%);
  border-color: rgba(23, 227, 141, .22);
}
.nav-item.active svg { opacity: 1; color: var(--green); }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--green); }
.nav-item--minor { margin-top: 6px; font-size: 12.5px; }
.nav-dot { position: absolute; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); opacity: 0; transition: opacity .3s; }
.nav-dot.on { opacity: 1; animation: pulse 2s infinite; } /* impeccable-disable-line pulsing-dot: signals fresh data arrived in that view */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 8px 2px; border-top: 1px solid var(--line); }
.foot-chip { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--cyan); background: var(--cyan-soft); border: 1px solid rgba(76, 194, 255, .25); padding: 6px 8px; border-radius: 7px; }
.foot-chip b { color: #fff; }
.foot-note { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 22px 12px; border-bottom: 1px solid var(--line); background: rgba(5, 8, 14, .6); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30; }
.hamburger { display: none; }
.topbar-title h1 { font-size: 19px; font-weight: 700; }
.topbar-crumb { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.phase-pill { display: flex; gap: 7px; align-items: center; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); background: rgba(148, 163, 184, .06); }
.phase-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.phase-pill.open .dot { background: var(--green); animation: pulse 1.6s infinite; } /* impeccable-disable-line pulsing-dot: market-open state indicator */
.phase-pill.open { color: var(--green); border-color: rgba(23, 227, 141, .3); background: var(--green-soft); }
.phase-pill.premarket .dot { background: var(--amber); }
.phase-pill.premarket { color: var(--amber); border-color: rgba(255, 181, 71, .3); background: var(--amber-soft); }
.et-clock { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(148, 163, 184, .05); }

/* ---- ticker tape ---- */
.tape { overflow: hidden; border-bottom: 1px solid var(--line); background: rgba(7, 11, 18, .75); font-family: var(--mono); font-size: 12px; }
.tape-track { display: inline-flex; gap: 34px; padding: 7px 0; white-space: nowrap; animation: tape 46s linear infinite; will-change: transform; } /* impeccable-disable-line marquee: functional market ticker, pauses on hover, stops under reduced-motion */
.tape:hover .tape-track { animation-play-state: paused; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } } /* impeccable-disable-line marquee: functional market ticker — pauses on hover and is fully stopped under prefers-reduced-motion */
.tape-item { color: var(--text-2); }
.tape-item b { color: var(--text); font-weight: 600; }
.tape-item .up { color: var(--green); } .tape-item .down { color: var(--red); }
.tape-sep { color: rgba(255, 181, 71, .55); }

/* ================= view scaffolding ================= */
.view-host { padding: 22px; flex: 1; }
.view { display: none; animation: viewIn .4s var(--ease); }
.view.on { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 14px; }
.grid-kpi { grid-template-columns: repeat(6, 1fr); }
.grid-main { grid-template-columns: 2.1fr 1fr; grid-auto-flow: dense; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1240px) { .grid-kpi { grid-template-columns: repeat(3, 1fr); } .grid-main, .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 880px) { .grid-kpi { grid-template-columns: repeat(2, 1fr); } .grid-main, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .grid-kpi { grid-template-columns: 1fr; } }

/* ---- glass panel ---- */
.panel {
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); padding: 16px 18px; position: relative; overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.panel:hover { border-color: var(--line-hi); }
.panel-title { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-title::before { content: ''; width: 5px; height: 5px; border-radius: 1.5px; background: var(--amber); flex: none; }
.panel-title .right { margin-left: auto; letter-spacing: .04em; text-transform: none; color: var(--text-2); font-size: 12px; }
.panel-sub { color: var(--text-2); font-size: 12.5px; margin-top: 8px; line-height: 1.55; }

/* ---- KPI ---- */
.kpi { padding: 14px 16px; }
.kpi-label { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi-value { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 7px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.up { color: var(--green); }
.down { color: var(--red); }
.flat-c { color: var(--text-2); }

/* ---- risk meters ---- */
.meter { margin-bottom: 13px; }
.meter:last-child { margin-bottom: 2px; }
.meter-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.meter-head b { color: var(--text); font-weight: 600; }
.meter-bar { height: 7px; border-radius: 5px; background: rgba(148, 163, 184, .12); overflow: hidden; position: relative; }
.meter-fill { height: 100%; border-radius: 5px; background: var(--green); transform: scaleX(0); transform-origin: 0 50%; transition: transform .9s var(--ease); }
.meter-fill.armed { transform: scaleX(1); }
.meter-fill.warn { background: var(--amber); }
.meter-fill.crit { background: var(--red); }

/* ---- honesty note ---- */
.honesty { border: 1px solid rgba(255, 181, 71, .35); background: linear-gradient(180deg, rgba(255, 181, 71, .08), rgba(255, 181, 71, .03)); }
.honesty .panel-title::before { background: var(--amber); }
.honesty p { margin: 0; font-size: 13px; color: #f2d9ac; line-height: 1.65; }
.honesty b { color: var(--amber); }

/* ---- streak pills ---- */
.streak-row { display: flex; gap: 8px; flex-wrap: wrap; }
.streak { font-family: var(--mono); font-size: 12px; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line); color: var(--text-2); background: rgba(148, 163, 184, .06); }
.streak b { font-size: 15px; }
.streak.hot { color: var(--green); border-color: rgba(23, 227, 141, .35); background: var(--green-soft); }

/* ---- buttons / chips ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line); background: rgba(148, 163, 184, .08); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s var(--ease); min-height: 44px; }
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--line-hi); background: rgba(148, 163, 184, .14); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(180deg, rgba(23, 227, 141, .22), rgba(23, 227, 141, .1)); border-color: rgba(23, 227, 141, .4); color: #d9ffec; }
.btn-primary:hover { background: rgba(23, 227, 141, .28); box-shadow: var(--shadow-g); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; min-height: 36px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; padding: 3.5px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); background: rgba(148, 163, 184, .07); }
.chip.g { color: var(--green); border-color: rgba(23, 227, 141, .35); background: var(--green-soft); }
.chip.r { color: var(--red); border-color: rgba(255, 77, 94, .35); background: var(--red-soft); }
.chip.a { color: var(--amber); border-color: rgba(255, 181, 71, .35); background: var(--amber-soft); }
.chip.c { color: var(--cyan); border-color: rgba(76, 194, 255, .35); background: var(--cyan-soft); }

/* authored icon system (replaces emoji/glyph substitutes) */
.ico { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 13px; height: 13px; }
.check-item .ico { margin-top: 1px; }

/* ---- skeletons (first paint before data arrives) ---- */
.sk { position: relative; overflow: hidden; background: rgba(148, 163, 184, .08); border-radius: 7px; }
.sk::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(148, 163, 184, .12), transparent); animation: shimmer 1.4s infinite; } /* impeccable-disable-line marquee: skeleton loading affordance, replaced by real content in <1s */
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 11px; }
.sk-big { height: 30px; margin: 8px 0; }
.sk-block { min-height: 260px; height: 100%; }

/* ================= tables ================= */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: rgba(10, 16, 26, .55); backdrop-filter: blur(10px); }
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
thead th { text-align: left; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 11px 13px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; background: rgba(8, 12, 20, .95); }
thead th:hover { color: var(--text-2); }
thead th[aria-sort] { color: var(--cyan); }
thead th .arr { font-size: 12px; margin-left: 4px; }
tbody td { padding: 10px 13px; border-bottom: 1px solid rgba(148, 163, 184, .07); color: var(--text-2); white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover { background: rgba(76, 194, 255, .05); }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; }
.td-contract { color: var(--text); font-weight: 600; }
.td-sub { font-size: 12px; color: var(--muted); }

/* ---- live stream state ---- */
.sse-note { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.sse-note i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; } /* impeccable-disable-line pulsing-dot: live-stream state feedback (goes solid red when stale) */
.sse-note.sse-off i { background: var(--red); animation: none; }
.sse-note.sse-off { color: #ffb7be; }

/* ---- empty states (teach the interface) ---- */
.empty-state { display: grid; place-items: center; gap: 10px; text-align: center; padding: 44px 20px; }
.empty-state .ico { width: 30px; height: 30px; color: var(--muted); opacity: .7; }
.empty-state h3 { font-size: 16px; }
.empty-state p { margin: 0; color: var(--text-2); font-size: 13px; max-width: 46ch; line-height: 1.6; }

/* ================= drawer ================= */
.drawer-scrim { position: fixed; inset: 0; background: rgba(2, 4, 8, .6); backdrop-filter: blur(3px); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 95; background: linear-gradient(180deg, rgba(13, 20, 33, .97), rgba(8, 12, 20, .97)); border-left: 1px solid var(--line-hi); box-shadow: -30px 0 70px rgba(0, 0, 0, .55); transform: translateX(103%); transition: transform .32s var(--ease); overflow-y: auto; padding: 22px; }
.drawer.open { transform: none; }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer h2 { font-size: 21px; }
.drawer-close { position: absolute; top: 16px; right: 16px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.kv-cell { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; background: rgba(148, 163, 184, .04); min-width: 0; }
.kv-cell small { display: block; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv-cell b { font-family: var(--mono); font-size: 15.5px; font-variant-numeric: tabular-nums; }
.excursion { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
textarea.drawer-input, input.drawer-input { width: 100%; background: rgba(4, 7, 12, .8); border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 9px 11px; font-family: var(--mono); font-size: 12px; resize: vertical; }
.drawer-input:focus { border-color: var(--cyan); outline: none; }
.shots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.shots img { width: 120px; height: 78px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.shot-add { width: 120px; height: 78px; border: 1px dashed var(--line-hi); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; cursor: pointer; font-family: var(--mono); transition: all .2s; background: rgba(148, 163, 184, .04); }
.shot-add:hover { color: var(--cyan); border-color: var(--cyan); }

/* ================= modal / forms ================= */
.modal { border: none; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; }
.modal::backdrop { background: rgba(2, 4, 8, .66); backdrop-filter: blur(4px); }
.modal[open] { display: grid; place-items: center; }
.modal-card { width: min(760px, 94vw); max-height: 88dvh; overflow-y: auto; background: linear-gradient(180deg, rgba(16, 24, 38, .98), rgba(9, 14, 23, .98)); border: 1px solid var(--line-hi); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { font-size: 19px; }
.modal-sub { color: var(--muted); font-size: 12px; margin: 0 0 16px; line-height: 1.5; }
.modal-sub code { color: var(--cyan); font-family: var(--mono); font-size: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line); background: rgba(148, 163, 184, .07); color: var(--text-2); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--text); border-color: var(--line-hi); }
.icon-btn .ico { width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.form-grid label small { color: var(--muted); text-transform: none; letter-spacing: 0; font-size: 12px; }
.form-grid .span2 { grid-column: span 3; }
.form-grid input, .form-grid select, .form-grid textarea {
  background: rgba(4, 7, 12, .85); border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  padding: 9px 11px; font-family: var(--mono); font-size: 13px; min-height: 44px; width: 100%;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--green); outline: 2px solid rgba(23, 227, 141, .45); outline-offset: 1px; }
.form-preview { margin-top: 14px; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); border: 1px dashed var(--line-hi); border-radius: 9px; padding: 10px 13px; background: rgba(148, 163, 184, .04); }
.form-error { color: var(--red); font-family: var(--mono); font-size: 12px; margin-top: 10px; min-height: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.import-area { width: 100%; background: rgba(4, 7, 12, .9); border: 1px solid var(--line); border-radius: 10px; color: var(--green); padding: 13px; font-family: var(--mono); font-size: 12px; line-height: 1.55; resize: vertical; }
.import-area:focus { border-color: var(--cyan); outline: none; }
.import-tools { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.hint { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.btn-file input { display: none; }

/* ================= playbook ================= */
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .rules-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .rules-grid { grid-template-columns: 1fr; } }
.rule-card { display: flex; flex-direction: column; gap: 10px; }
.rule-card .cat { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.rule-card h3 { font-size: 15.5px; letter-spacing: -.01em; }
.rule-text { font-size: 12.5px; color: var(--text-2); line-height: 1.6; flex: 1; }
.rule-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-select { margin-left: auto; background: rgba(4, 7, 12, .8); border: 1px solid var(--line); color: var(--text); border-radius: 7px; font-family: var(--mono); font-size: 12px; padding: 6px 8px; cursor: pointer; }

/* ================= crons ================= */
.cron-grid { display: grid; gap: 14px; }
.cron-card { display: grid; grid-template-columns: 1.2fr .9fr 1.6fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .cron-card { grid-template-columns: 1fr; } }
.cron-name { font-size: 15px; font-weight: 600; }
.cron-expr { font-family: var(--mono); font-size: 12px; color: var(--cyan); margin-top: 3px; }
.logbox { font-family: var(--mono); font-size: 12px; line-height: 1.6; background: rgba(2, 5, 9, .8); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; max-height: 180px; overflow-y: auto; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.logbox b { color: var(--green); }
.logbox .err { color: var(--red); }

/* ================= monitor ================= */
.monitor-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
@media (max-width: 960px) { .monitor-grid { grid-template-columns: 1fr; } }
.big-price { font-family: var(--mono); font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.px-lines { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.px-line { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.px-line small { display: block; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.px-line b { font-family: var(--mono); font-size: 14px; }
.px-line.tgt b { color: var(--green); } .px-line.stp b { color: var(--red); } .px-line.peak b { color: var(--amber); }
.checklist { display: flex; flex-direction: column; gap: 7px; }
.check-item { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); font-family: var(--mono); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: rgba(148, 163, 184, .04); }
.check-item i { font-style: normal; display: inline-flex; }
.check-item.warn { border-color: rgba(255, 181, 71, .35); background: var(--amber-soft); color: #f2d9ac; }
.check-item.crit { border-color: rgba(255, 77, 94, .4); background: var(--red-soft); color: #ffb7be; }
.check-item.info { border-color: rgba(23, 227, 141, .3); background: var(--green-soft); }
.probbars { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.probar { display: grid; grid-template-columns: 52px 1fr 46px; gap: 9px; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.probar .bar { height: 8px; border-radius: 5px; background: rgba(148, 163, 184, .12); overflow: hidden; }
.probar .fill { height: 100%; border-radius: 5px; transform-origin: 0 50%; }
.alert-feed { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; min-width: 0; }
.alert-row { display: flex; gap: 9px; font-family: var(--mono); font-size: 12px; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--line); background: rgba(148, 163, 184, .04); color: var(--text-2); min-width: 0; }
.alert-row .t { color: var(--muted); flex: none; }
.alert-row .chip { white-space: normal; overflow-wrap: anywhere; border-radius: 8px; align-items: flex-start; text-align: left; }
.alert-row.warn { border-color: rgba(255, 181, 71, .3); }
.alert-row.crit { border-color: rgba(255, 77, 94, .35); background: var(--red-soft); }
.flat-state { text-align: center; padding: 38px 20px; }
.flat-state .big { font-family: var(--mono); font-size: 30px; letter-spacing: .1em; color: var(--cyan); }

/* ================= heatmap / analytics ================= */
.heatmap { display: grid; grid-template-columns: repeat(12, minmax(30px, 1fr)); gap: 5px; }
.hm-cell { aspect-ratio: 1; border-radius: 6px; background: rgba(148, 163, 184, .07); border: 1px solid rgba(148, 163, 184, .06); position: relative; min-width: 0; }
.hm-cell.pos { background: rgba(23, 227, 141, var(--a, .5)); border-color: rgba(23, 227, 141, .3); }
.hm-cell.neg { background: rgba(255, 77, 94, var(--a, .5)); border-color: rgba(255, 77, 94, .3); }
.hm-cell.today { outline: 1.5px solid var(--cyan); outline-offset: 1px; }
.hm-cell .tip { visibility: hidden; position: absolute; bottom: 118%; left: 50%; transform: translateX(-50%); background: #0a1018; border: 1px solid var(--line-hi); padding: 5px 9px; border-radius: 7px; font-family: var(--mono); font-size: 12px; white-space: nowrap; z-index: 5; }
.hm-cell:hover .tip { visibility: visible; }
.hm-week { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-canvas { width: 100%; height: 240px; display: block; }
.chart-canvas.tall { height: 300px; }
.chart-canvas.short { height: 170px; }
.legend { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ================= toasts ================= */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 200; }
.toast { font-family: var(--mono); font-size: 12px; padding: 11px 15px; border-radius: 10px; border: 1px solid var(--line-hi); background: rgba(10, 16, 26, .95); box-shadow: var(--shadow); color: var(--text-2); animation: toastIn .3s var(--ease); max-width: 380px; }
.toast.ok { border-color: rgba(23, 227, 141, .4); color: var(--green); }
.toast.err { border-color: rgba(255, 77, 94, .4); color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ================= audit ================= */
.audit-feed { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12px; min-width: 0; }
.audit-row { display: grid; grid-template-columns: 150px 150px 1fr; gap: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(148, 163, 184, .08); background: rgba(148, 163, 184, .03); color: var(--text-2); min-width: 0; }
.audit-row .who { color: var(--cyan); } .audit-row .act { color: var(--amber); }
@media (max-width: 760px) { .audit-row { grid-template-columns: 1fr; gap: 3px; } }
/* inside half-width panels the 3-col audit grid can't fit — stack always */
.kv-cell .audit-row { grid-template-columns: 1fr; gap: 3px; }

/* ================= responsive ================= */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; transform: translateX(-104%); transition: transform .3s var(--ease); height: 100dvh; }
  .sidebar.open { transform: none; box-shadow: 30px 0 70px rgba(0, 0, 0, .6); }
  .hamburger { display: inline-flex; }
  .topbar { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .et-clock { display: none; }
  .view-host { padding: 14px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span2 { grid-column: span 2; }
  .big-price { font-size: 34px; }
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .kv { grid-template-columns: 1fr; }
}

/* ================= scan-alarm banner ============================== */
.scan-alarm { display: flex; align-items: center; gap: 10px; margin: 10px 18px 0; padding: 12px 16px;
  border: 1px solid rgba(255, 77, 94, .55); border-radius: 10px;
  background: rgba(255, 77, 94, .14); color: #ff8f9c;
  font-family: var(--mono); font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 0 24px rgba(255, 77, 94, .18) inset; }
.scan-alarm[hidden] { display: none; }
.scan-alarm svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--red); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
