/* ═══════════════════════════════════════════════════════════════════
   HARVEST CONSOLE — LIQUID GLASS UI (2026-07-22 design lock rev. B)
   ───────────────────────────────────────────────────────────────────
   Direction: iOS 26 liquid-glass language on a dark ops scene.
   · Real translucency: backdrop blur + saturate, tinted fills
   · Specular edge lighting: inset top highlight, hairline borders
   · Spring motion with overshoot, pointer-tracked glare
   Anti-slop contract (hard rules, do not regress):
   · ONE accent family (iOS systemIndigo). Teal = live stream ONLY.
   · No gradient text, no marketing hero, no emoji-as-icon (inline SVG).
   · Glass blur ≤ 28px · font never pure #FFF · data = tabular mono.
   · Scene washes are dim light, not confetti: no acid colors.
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; }

:root {
  /* ——— scene ——— */
  --bg: #060608;
  --scene-1: rgba(94, 92, 230, .19);   /* indigo light, upper left  */
  --scene-2: rgba(10, 132, 255, .12);  /* blue light, right         */
  --scene-3: rgba(48, 209, 88, .085);  /* green light, lower left   */

  /* ——— glass tiers (fill / border / blur) ——— */
  --glass-1: linear-gradient(165deg, rgba(255,255,255,.045), rgba(255,255,255,.018));
  --glass-2: linear-gradient(165deg, rgba(255,255,255,.085), rgba(255,255,255,.028));
  --glass-3: linear-gradient(165deg, rgba(255,255,255,.13), rgba(255,255,255,.05));
  --glass-ctl: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.045));
  --glass-b1: rgba(255,255,255,.07);
  --glass-b2: rgba(255,255,255,.11);
  --glass-b3: rgba(255,255,255,.17);
  --blur-1: 0px;
  --blur-2: 0px;
  --blur-3: 8px;

  /* ——— text (iOS system label alphas, never pure white) ——— */
  --label:   rgba(242,242,247,.94);
  --label-2: rgba(235,235,245,.60);
  --label-3: rgba(235,235,245,.38);
  --label-4: rgba(235,235,245,.22);

  /* ——— iOS system colors (dark) ——— */
  --accent: #5E5CE6;            /* systemIndigo — the only accent  */
  --accent-hi: #7D7AFF;
  --accent-press: #4B48C9;
  --accent-fill: rgba(94,92,230,.22);
  --accent-fill-2: rgba(94,92,230,.12);
  --accent-line: rgba(125,122,255,.42);
  --green:  #30D158;
  --green-fill: rgba(48,209,88,.12);
  --red:    #FF453A;
  --red-fill: rgba(255,69,58,.12);
  --red-line: rgba(255,69,58,.35);
  --orange: #FF9F0A;
  --orange-fill: rgba(255,159,10,.12);
  --blue:   #0A84FF;
  --teal:   #64D2FF;            /* live/stream ONLY                */

  /* ——— shape ——— */
  --r-ctl: 12px;
  --r-card: 20px;
  --r-sheet: 26px;
  --r-pill: 999px;

  /* ——— motion ——— */
  --ease-spring: cubic-bezier(.32,1.35,.42,1);
  --ease-out: cubic-bezier(.22,1,.36,1);
  --d-fast: .16s;
  --d-med: .32s;
  --d-slow: .5s;

  /* ——— type ——— */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* ——— layout ——— */
  --topbar-h: 54px;
  --sidebar-w: 236px;
  --tabbar-h: 60px;
  --page-pad: 16px;

  color-scheme: dark;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -.003em;
  background: var(--bg);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a, [role="button"] { -webkit-tap-highlight-color: transparent; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(94,92,230,.45); color: #fff; }
img, svg { display: block; }

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ═══════════════ AMBIENT SCENE (perf-lite) ═══════════════ */
.scene { position: fixed; inset: 0; z-index: -2; overflow: hidden; contain: strict;
  background:
    radial-gradient(100% 70% at 50% 0%, rgba(94,92,230,.10), transparent 55%),
    var(--bg);
  pointer-events: none;
}
/* washes/noise/grid disabled — were main jank source on scroll/composite */
.scene-wash, .scene-noise, .scene-grid { display: none !important; }
@media (prefers-reduced-motion: reduce) { .scene-wash { animation: none; } }

/* ═══════════════ GLASS PRIMITIVES ═══════════════ */
.glass, .glass-2, .glass-3 {
  position: relative;
  border: .5px solid var(--glass-b2);
  /* perf: solid surface, no backdrop-filter / multi-layer paint */
  background: rgba(18,19,26,.96);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 24px -16px rgba(0,0,0,.45);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
}
.glass-3 {
  border-color: var(--glass-b3);
  background: rgba(22,23,32,.97);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 28px -16px rgba(0,0,0,.5);
}
/* pointer-tracked specular glare — painted as an element BACKGROUND LAYER,
   so it always sits behind content = zero text-ghosting by construction
   (21st easemize isolated-lens rationale, minus stacking-context hacks) */
.glare {
  /* perf: no pointer-tracked glare repaints */
  background: inherit;
}
.glass-3.glare { background: inherit; }
.glare:hover { --glareA: 0; }
@media (hover: none) { .glare { --glareA: 0; } }

/* ═══════════════ SHELL ═══════════════ */
.shell { min-height: 100dvh; display: flex; align-items: stretch; }

.shell-side {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  padding: 12px 0 12px 12px;
  position: sticky; top: 0; height: 100dvh;
  z-index: 30;
}
.sidebar {
  height: 100%; display: flex; flex-direction: column;
  border-radius: var(--r-card);
  border: .5px solid var(--glass-b1);
  background: rgba(14,15,20,.98);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 28px -20px rgba(0,0,0,.45);
  overflow: hidden;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 16px 16px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(160deg, var(--accent-hi), var(--accent) 55%, var(--accent-press));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 12px -4px rgba(94,92,230,.55);
  display: grid; place-items: center; color: #fff;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.brand-text h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; color: var(--label); }
.brand-text small { font-size: 11px; color: var(--label-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 10px; -webkit-overflow-scrolling: touch; }
.nav-section { margin-bottom: 14px; }
.nav-section-title {
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--label-3); padding: 6px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 10px; margin-bottom: 2px;
  border-radius: 11px; border: .5px solid transparent;
  color: var(--label-2); font-size: 13.5px; font-weight: 500;
  transition: background var(--d-fast) ease, color var(--d-fast) ease, border-color var(--d-fast) ease, transform var(--d-fast) var(--ease-out);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--label); }
.nav-item:active { transform: scale(.975); }
.nav-item .ico { width: 19px; height: 19px; color: var(--label-3); transition: color var(--d-fast) ease; flex-shrink: 0; }
.nav-item .ico svg { width: 100%; height: 100%; }
.nav-item.active {
  background: var(--accent-fill-2);
  border-color: rgba(125,122,255,.24);
  color: var(--label);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07);
}
.nav-item.active .ico { color: var(--accent-hi); }
.nav-item .nav-badge {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.09); color: var(--label-2);
}
.sidebar-foot { padding: 10px; border-top: .5px solid rgba(255,255,255,.06); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 4px 8px; border: 0; background: transparent;
  border-radius: 12px; text-align: left;
  transition: background var(--d-fast) ease;
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--glass-ctl); border: .5px solid var(--glass-b2);
  color: var(--label-2); font-size: 12px; font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.sidebar-user .su-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 550; color: var(--label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .su-sub { display: block; font-size: 11px; font-weight: 400; color: var(--label-3); }
.sidebar-user .ico { width: 16px; height: 16px; color: var(--label-3); flex-shrink: 0; }
.sidebar-user .ico svg { width: 100%; height: 100%; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }

/* ——— topbar ——— */
.topbar {
  position: sticky; top: 10px; z-index: 25;
  margin: 10px 12px 0; height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px;
  border-radius: 17px;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
}
.menu-btn {
  display: none; width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: transparent; color: var(--label-2); align-items: center; justify-content: center;
}
.menu-btn:hover { background: rgba(255,255,255,.07); }
.menu-btn svg { width: 20px; height: 20px; }
.topbar-brand { display: none; align-items: center; gap: 9px; min-width: 0; }
.topbar-brand h1 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.page-heading { min-width: 0; }
.page-heading h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  border: .5px solid var(--glass-b1); border-radius: var(--r-pill);
  background: rgba(255,255,255,.05); color: var(--label-3); font-size: 12.5px;
  min-width: 150px; max-width: 230px; flex: 0 1 230px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.22);
  transition: background var(--d-fast) ease, border-color var(--d-fast) ease;
}
.topbar-search:hover { background: rgba(255,255,255,.08); border-color: var(--glass-b2); }
.topbar-search svg { width: 14px; height: 14px; flex-shrink: 0; }
.topbar-search kbd {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(255,255,255,.07); border: .5px solid var(--glass-b1);
  color: var(--label-2);
}
.topbar-stats {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto; min-width: 0; flex: 1 1 auto;
  overflow: hidden; justify-content: flex-end;
}
.stat-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 28px; min-height: 28px; max-height: 28px;
  padding: 0 10px; margin-left: 0;
  border-radius: var(--r-pill); border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.045);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--label-3); white-space: nowrap;
  flex: 0 0 auto; line-height: 1; box-sizing: border-box;
  /* keep text inside the pill — no baseline drift / clip */
  overflow: hidden; vertical-align: middle;
}
.stat-pill .lab {
  font-size: 9.5px; letter-spacing: .05em; line-height: 1;
  flex: 0 0 auto;
}
.stat-pill .val {
  font-family: var(--mono); font-size: 12px; font-weight: 650; letter-spacing: 0;
  color: var(--label); font-variant-numeric: tabular-nums;
  line-height: 1; display: inline-block;
  /* reserve room for IDLE so pill doesn't reflow RUN↔IDLE */
  min-width: 2.6ch; text-align: center;
  transition: color var(--d-fast) ease;
  /* kill flash-up translate/blur that looked like screen flicker */
  animation: none !important; transform: none !important; filter: none !important;
}
.stat-pill.st-run { border-color: var(--accent-line); background: var(--accent-fill-2); }
.stat-pill.st-run .lab { color: var(--accent-hi); }
.stat-pill.st-run .val { color: var(--accent-hi); }
.stat-pill.err-n .val { color: var(--red); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.stream-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px;
  border-radius: var(--r-pill); border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.045);
  font-family: var(--mono); font-size: 11px; color: var(--label-3);
}
.stream-pill .dot { width: 6px; height: 6px; }
.stream-pill.on { color: var(--teal); border-color: rgba(100,210,255,.25); }
.user-chip {
  width: 34px; height: 34px; border-radius: 50%;
  border: .5px solid var(--glass-b2); background: var(--glass-ctl);
  color: var(--label-2); display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  transition: background var(--d-fast) ease, transform var(--d-fast) var(--ease-spring);
}
.user-chip:hover { background: rgba(255,255,255,.12); }
.user-chip:active { transform: scale(.92); }
.user-chip svg { width: 16px; height: 16px; }

/* account dropdown */
.menu-pop {
  position: fixed; z-index: 90; min-width: 190px; padding: 6px;
  border-radius: 16px;
  transform-origin: top right;
}
.menu-pop .mi {
  display: flex; align-items: center; gap: 9px; width: 100%;
  min-height: 38px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--label); font-size: 13.5px; font-weight: 500;
  text-align: left;
}
.menu-pop .mi:hover { background: rgba(255,255,255,.08); }
.menu-pop .mi.danger { color: var(--red); }
.menu-pop .mi .ico { width: 16px; height: 16px; color: var(--label-3); }
.menu-pop .mi.danger .ico { color: var(--red); }
.menu-pop .mi .ico svg { width: 100%; height: 100%; }
.menu-pop .menu-head { padding: 8px 10px 7px; font-size: 11px; color: var(--label-3); border-bottom: .5px solid rgba(255,255,255,.07); margin-bottom: 5px; }

/* ═══════════════ CONTENT / CARDS ═══════════════ */
.content { padding: var(--page-pad); display: grid; gap: 14px; align-content: start;
  padding-bottom: calc(var(--page-pad) + env(safe-area-inset-bottom, 0px)); }

.card {
  border-radius: var(--r-card);
  padding: 16px;
  min-width: 0;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ═══════════════ SCROLL-DRIVEN FX ═══════════════
   Adapted from 21st.dev scroll-animation patterns:
   · content reveal on viewport entry (SmoothScrollHero / animation-timeline view())
   · layered parallax speeds (SmoothScrollHero)
   · linear scroll progress hairline (bundui/skyleen77 scroll-progress)   */
.reveal {
  opacity: 0;
  transform: translateY(18px) scale(.985);
  filter: blur(6px);
  transition: opacity .52s var(--ease-out), transform .52s var(--ease-out), filter .52s var(--ease-out);
  transition-delay: var(--stagger, 0ms);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); will-change: auto; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
}

/* parallax offset for scene washes (JS sets --spy; composes with drift keyframes) */
.scene-wash { translate: 0 var(--spy, 0px); }

/* scroll progress hairline (top, scaleX origin-left) */
#scrollProgress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 95;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transform-origin: 0 50%; transform: scaleX(0);
  opacity: .85; pointer-events: none;
}

/* topbar deepens once the page scrolls under it */
.topbar.scrolled {
  background: linear-gradient(165deg, rgba(34,35,44,.72), rgba(18,19,25,.72));
  border-color: rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 14px 34px -12px rgba(0,0,0,.6);
}
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title { font-size: 15px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.section-title .t-ico { width: 17px; height: 17px; color: var(--label-3); }
.section-title .t-ico svg { width: 100%; height: 100%; }
.section-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 7px;
  border-radius: var(--r-pill); border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.06);
  font-family: var(--mono); font-size: 11px; font-weight: 650; color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.section-badge.bump { animation: bump .45s var(--ease-spring); }
@keyframes bump { 35% { transform: scale(1.22); } }

/* status tiles */
.status-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.status-cell {
  min-width: 0; padding: 11px 12px 10px;
  border-radius: 14px; border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.status-cell .k { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--label-3); margin-bottom: 5px; }
.status-cell .v {
  display: block; font-family: var(--mono); font-size: 18px; font-weight: 650;
  letter-spacing: -.02em; line-height: 1.2; min-height: 1.2em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--d-fast) ease;
  /* kill flash-up translate/blur that looked like screen flicker */
  animation: none !important; transform: none !important; filter: none !important;
}
.status-cell .v.ok { color: var(--green); }
.status-cell .v.err { color: var(--red); }
.status-cell .v.run { color: var(--accent-hi); }
.status-cell .v.idle { color: var(--label-3); }
.status-cell .v .vsub { font-size: 10px; font-weight: 500; color: var(--label-3); letter-spacing: 0; font-family: var(--font); margin-left: 4px; }

/* host RAM preflight — same glass cell language as status tiles */
.ram-meter {
  margin: -4px 0 14px;
  padding: 10px 12px 11px;
  border-radius: 14px;
  border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.ram-meter-head {
  display: flex; align-items: baseline; gap: 8px; min-width: 0;
  margin-bottom: 8px;
}
.ram-meter-head .k {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--label-3); flex-shrink: 0;
}
.ram-meter-head .v {
  font-family: var(--mono); font-size: 15px; font-weight: 650;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  color: var(--label); flex-shrink: 0;
}
.ram-meter-head .ram-note {
  margin-left: auto; min-width: 0;
  font-size: 11.5px; font-weight: 500; color: var(--label-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right;
}
.ram-bar {
  height: 4px; border-radius: 99px; overflow: hidden;
  background: rgba(255,255,255,.06);
}
.ram-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: var(--green);
  transition: width .35s ease, background .2s ease;
}
.ram-meter[data-level="ok"] .v { color: var(--green); }
.ram-meter[data-level="ok"] .ram-fill { background: var(--green); }
.ram-meter[data-level="warn"] {
  border-color: rgba(245, 166, 35, .35);
  background: rgba(245, 166, 35, .06);
}
.ram-meter[data-level="warn"] .v,
.ram-meter[data-level="warn"] .ram-note { color: #f5a623; }
.ram-meter[data-level="warn"] .ram-fill { background: #f5a623; }
.ram-meter[data-level="stop"] {
  border-color: rgba(255, 90, 90, .4);
  background: rgba(255, 90, 90, .07);
}
.ram-meter[data-level="stop"] .v,
.ram-meter[data-level="stop"] .ram-note { color: var(--red); }
.ram-meter[data-level="stop"] .ram-fill { background: var(--red); }
/* flash-up disabled globally — was causing topbar/status flicker on poll */
.v.flash-up, .stat-pill .val.flash-up { animation: none !important; transform: none !important; filter: none !important; opacity: 1 !important; }
@keyframes flash-up { from { opacity: 1; } to { opacity: 1; } }

/* ═══════════════ CONTROLS ═══════════════ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px;
  border: .5px solid var(--glass-b2); border-radius: var(--r-ctl);
  background: var(--glass-ctl);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--label); font-size: 13.5px; font-weight: 550; letter-spacing: -.003em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.11), 0 4px 14px -6px rgba(0,0,0,.4);
  transition: transform var(--d-fast) var(--ease-spring), background var(--d-fast) ease,
              border-color var(--d-fast) ease, box-shadow var(--d-fast) ease, opacity var(--d-fast) ease;
  white-space: nowrap; user-select: none; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: linear-gradient(180deg, rgba(255,255,255,.15), rgba(255,255,255,.07)); border-color: var(--glass-b3); }
.btn:active, .btn.pressed { transform: scale(.96); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn .ico { width: 16px; height: 16px; flex-shrink: 0; }
.btn .ico svg { width: 100%; height: 100%; }
.btn-primary {
  background: linear-gradient(180deg, #716FEE, var(--accent) 60%, #5552DE);
  border-color: rgba(125,122,255,.55);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -1px 0 rgba(0,0,0,.24), 0 6px 18px -6px rgba(94,92,230,.6);
  transition: translate .32s var(--ease-spring), transform var(--d-fast) var(--ease-spring),
              background var(--d-fast) ease, border-color var(--d-fast) ease, box-shadow var(--d-fast) ease;
}
.btn-primary:hover { background: linear-gradient(180deg, #807DF2, #6966EC 60%, #5D5AE6); border-color: rgba(140,138,255,.7); }
.btn-primary:active { background: linear-gradient(180deg, #5D5AE0, var(--accent-press)); box-shadow: inset 0 2px 6px rgba(0,0,0,.3), 0 2px 8px -4px rgba(94,92,230,.5); }
.tab-orb { transition: translate .32s var(--ease-spring), transform var(--d-fast) var(--ease-spring), box-shadow var(--d-fast) ease; }
.btn-danger {
  background: var(--red-fill); border-color: var(--red-line); color: #FF6961;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-danger:hover { background: rgba(255,69,58,.2); border-color: rgba(255,69,58,.5); }
.btn-ghost {
  background: transparent; border-color: transparent; color: var(--label-3);
  min-height: 32px; padding: 0 9px; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.btn-ghost:hover { background: rgba(255,255,255,.07); color: var(--label); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn-block, .w-full { width: 100%; }
/* press shine sweep */
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); transition: left .5s var(--ease-out); pointer-events: none;
}
.btn-primary:hover::after { left: 130%; }
.btn .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }

/* iOS switch */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .sw-track {
  position: absolute; inset: 0; border-radius: var(--r-pill);
  background: rgba(120,120,128,.28);
  border: .5px solid rgba(255,255,255,.09);
  transition: background .24s ease, border-color .24s ease, box-shadow .3s ease;
  pointer-events: none;
}
.switch .sw-knob {
  position: absolute; top: 2.5px; left: 3px; width: 25px; height: 25px; border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #ebebf0);
  box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 0 .5px rgba(0,0,0,.08);
  transition: transform .3s var(--ease-spring), width .18s ease;
  pointer-events: none;
}
.switch input:checked + .sw-track {
  background: linear-gradient(180deg, #6E6BF0, var(--accent));
  border-color: transparent;
  box-shadow: 0 2px 10px -2px rgba(94,92,230,.55);
}
.switch input:checked + .sw-track .sw-knob { transform: translateX(19px); }
.switch input:active + .sw-track .sw-knob { width: 29px; }
.switch input:checked:active + .sw-track .sw-knob { transform: translateX(15px); }
.switch input:focus-visible + .sw-track { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.switch-field { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 2px 0; }
.switch-field .sw-label { flex: 1; font-size: 14px; font-weight: 500; color: var(--label); }
.switch-field .sw-hint { display: block; font-size: 11.5px; font-weight: 400; color: var(--label-3); margin-top: 1px; }

/* iOS segmented */
.seg {
  position: relative; display: flex; padding: 2.5px;
  border-radius: 11px; border: .5px solid var(--glass-b1);
  background: rgba(120,120,128,.16);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.22);
}
.seg button {
  position: relative; z-index: 1; flex: 1; min-width: 0;
  min-height: 32px; padding: 0 8px; border: 0; border-radius: 8.5px;
  background: transparent; color: var(--label-2);
  font-size: 13px; font-weight: 550; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: color .2s ease;
}
.seg button.on { color: var(--label); }
.seg button:active { transform: scale(.97); }
.seg-thumb {
  position: absolute; z-index: 0; top: 2.5px; left: 0; height: calc(100% - 5px); width: 0;
  border-radius: 8.5px;
  background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,.12));
  border: .5px solid rgba(255,255,255,.16);
  box-shadow: 0 2px 8px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .3s var(--ease-spring), width .3s var(--ease-spring), opacity .2s ease;
  opacity: 0;
}
.seg-thumb.show { opacity: 1; }

/* provider chips (scroll row, iOS filter chips) + sliding liquid thumb */
.chips { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip-thumb {
  position: absolute; top: 2px; left: 0; height: 36px; width: 0;
  border-radius: var(--r-pill);
  background: var(--accent-fill); border: .5px solid var(--accent-line);
  box-shadow: 0 3px 12px -4px rgba(94,92,230,.45), inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .3s var(--ease-spring), width .3s var(--ease-spring), opacity .2s ease;
  opacity: 0; pointer-events: none; z-index: 0;
}
.chip-thumb.show { opacity: 1; }
.chip {
  position: relative; z-index: 1;
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.05); color: var(--label-2);
  font-size: 13px; font-weight: 550;
  transition: color var(--d-fast) ease, border-color var(--d-fast) ease, background var(--d-fast) ease;
}
.chip .cdot { width: 6px; height: 6px; border-radius: 50%; background: var(--label-4); transition: background var(--d-fast) ease; }
.chip:hover { color: var(--label); }
.chip:active { transform: scale(.95); }
.chip.on {
  background: transparent; border-color: transparent; color: #C7C6FF;
}
.chip.on .cdot { background: var(--accent-hi); }

/* per-provider opts under chips — same tokens as field/seg */
.provider-opts {
  margin: 8px 0 2px;
  padding: 10px 12px;
  border-radius: var(--r-ctl, 12px);
  border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.03);
}
.provider-opts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.provider-opts-grid .field { margin-bottom: 0; }
.provider-opts .seg {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(10,10,14,.42);
  border: .5px solid var(--glass-b2);
}
.provider-opts .seg-btn {
  flex: 1 1 auto;
  min-height: 30px; padding: 0 10px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--label-3);
  font-size: 12px; font-weight: 550; cursor: pointer;
}
.provider-opts .seg-btn.on {
  background: var(--accent-fill, rgba(94,92,230,.28));
  color: #C7C6FF;
  box-shadow: inset 0 0 0 .5px var(--accent-line, rgba(94,92,230,.45));
}
@media (max-width: 420px) {
  .provider-opts-grid { grid-template-columns: 1fr; }
}

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label, .field-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--label-3); }
.field-hint { font-size: 12px; color: var(--label-3); margin: 2px 0 0; line-height: 1.45; }
.input, input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="url"], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: .5px solid var(--glass-b2); border-radius: var(--r-ctl);
  background: rgba(10,10,14,.42);
  box-shadow: inset 0 1.5px 4px rgba(0,0,0,.28), inset 0 -0.5px 0 rgba(255,255,255,.05);
  color: var(--label); font-size: 15px;
  transition: border-color var(--d-fast) ease, box-shadow var(--d-fast) ease, background var(--d-fast) ease;
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--label-4); }
.input:hover, input:hover, select:hover, textarea:hover { border-color: var(--glass-b3); }
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent-hi);
  box-shadow: inset 0 1.5px 4px rgba(0,0,0,.28), 0 0 0 3.5px rgba(94,92,230,.25);
  background: rgba(12,12,18,.55);
}
textarea { min-height: 76px; resize: vertical; line-height: 1.5; font-family: var(--mono); font-size: 12.5px; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8e99' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 30px;
}
select option { background: #17181d; color: var(--label); }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* stepper (iOS) */
.stepper {
  display: inline-flex; align-items: stretch;
  border: .5px solid var(--glass-b2); border-radius: 11px; overflow: hidden;
  background: rgba(10,10,14,.42); box-shadow: inset 0 1.5px 4px rgba(0,0,0,.28);
}
.stepper button {
  width: 40px; min-height: 40px; border: 0; background: transparent;
  color: var(--label); font-size: 18px; font-weight: 500;
  display: grid; place-items: center;
  transition: background var(--d-fast) ease, transform var(--d-fast) var(--ease-spring);
}
.stepper button:hover { background: rgba(255,255,255,.07); }
.stepper button:active { transform: scale(.9); background: rgba(255,255,255,.12); }
.stepper input {
  width: 46px; min-height: 40px; border: 0; border-left: .5px solid var(--glass-b1); border-right: .5px solid var(--glass-b1);
  background: transparent; text-align: center; border-radius: 0;
  font-family: var(--mono); font-size: 15px; font-weight: 600; padding: 0 2px;
  box-shadow: none;
}
.stepper input:focus { box-shadow: none; background: rgba(255,255,255,.05); }

/* ═══════════════ LISTS / ROWS ═══════════════ */
.row-list { display: flex; flex-direction: column; }
.row {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 7px 2px;
  border-bottom: .5px solid rgba(255,255,255,.055);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* swipe-to-delete */
.swipe-row { position: relative; overflow: hidden; border-radius: 13px; margin: 2px 0; }
.swipe-under {
  position: absolute; inset: 0; display: flex; justify-content: flex-end; align-items: stretch;
  border-radius: 13px; overflow: hidden;
  background: linear-gradient(180deg, #E4392F, #C52E26);
}
.swipe-under button {
  width: 78px; border: 0; background: transparent; color: #fff;
  font-size: 12.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.swipe-under button svg { width: 18px; height: 18px; }
.swipe-main {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 7px 10px;
  border-radius: 13px; border: .5px solid transparent;
  background: rgba(255,255,255,.035);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: transform .26s var(--ease-out), background .2s ease;
  will-change: transform;
  cursor: default;
}
.swipe-row.dragging .swipe-main { transition: background .2s ease; }
.swipe-row:hover .swipe-main { background: rgba(255,255,255,.055); }
.swipe-row + .swipe-row { margin-top: 4px; }
.row-x {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.06); color: var(--label-3);
  display: grid; place-items: center; flex-shrink: 0;
  opacity: 0; transition: opacity .18s ease, background .18s ease, color .18s ease, transform .18s var(--ease-spring);
}
.swipe-row:hover .row-x, .row-x:focus-visible { opacity: 1; }
.row-x:hover { background: var(--red-fill); color: var(--red); }
.row-x:active { transform: scale(.85); }
.row-x svg { width: 12px; height: 12px; }
@media (hover: none) { .row-x { opacity: 1; background: transparent; } }

/* tags */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px; flex-shrink: 0;
  border-radius: var(--r-pill); border: .5px solid var(--glass-b1);
  background: rgba(255,255,255,.055);
  font-size: 10.5px; font-weight: 600; font-family: var(--mono); color: var(--label-2);
  white-space: nowrap;
}
.tag-ok { color: #6CE08D; border-color: rgba(48,209,88,.3); background: var(--green-fill); }
.tag-err { color: #FF8A82; border-color: rgba(255,69,58,.3); background: var(--red-fill); }
.tag-warn { color: #FFB84D; border-color: rgba(255,159,10,.3); background: var(--orange-fill); }
.tag-accent { color: #B9B8FF; border-color: var(--accent-line); background: var(--accent-fill-2); }
.tag.acc-use { color: var(--label-2); opacity: .9; font-size: 10px; letter-spacing: .02em; }

/* dots */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--label-4); flex-shrink: 0; }
.dot-live { background: var(--teal); animation: pulse-live 2.2s ease-out infinite; }
.dot-off { background: var(--red); }
.dot-ok { background: var(--green); }
.dot-run { background: var(--accent-hi); animation: pulse-run 1.4s ease-out infinite; }
@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(100,210,255,.45); }
  70% { box-shadow: 0 0 0 6px rgba(100,210,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(100,210,255,0); }
}
@keyframes pulse-run {
  0% { box-shadow: 0 0 0 0 rgba(125,122,255,.5); }
  70% { box-shadow: 0 0 0 6px rgba(125,122,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(125,122,255,0); }
}

/* health rows */
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; font-size: 12.5px; }
.kv .k { color: var(--label-3); }
.kv .vv { font-family: var(--mono); font-size: 12px; color: var(--label-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* progress (indeterminate run bar) */
.progress { position: relative; height: 4px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.08); }
.progress .bar {
  position: absolute; top: 0; left: 0; bottom: 0; width: 38%;
  border-radius: 4px;
  background: linear-gradient(90deg, transparent, var(--accent-hi) 30%, var(--accent) 70%, transparent);
  animation: slide-ind 1.5s ease-in-out infinite;
}
@keyframes slide-ind {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}

/* ═══════════════ LIQUID TERMINAL LAYER ═══════════════
   Warp-flavored terminal chrome fused into the glass shell.
   Scope: consoles, section titles, topbar path. Accent stays
   indigo; phosphor tones live only inside console surfaces.   */

/* prompt glyph on section titles: ❯ accounts */
.section-title[data-prompt]::before {
  content: attr(data-prompt);
  font-family: var(--mono); font-weight: 500; font-size: 13px;
  color: var(--teal); margin-right: 1px;
}

/* path breadcrumb title (topbar): ~/farm */
.page-heading h2.path-title, .topbar-brand h1.path-title {
  font-family: var(--mono); font-size: 12.5px; font-weight: 550;
  letter-spacing: 0; color: var(--label-2);
}

/* mobile shell chrome (Termux / Blink / a-Shell) — no desktop window metaphor:
   console header carries the ❯ prompt glyph; the console body ends in an idle
   "~ $" prompt row with a block caret. While a job runs the prompt disappears
   and the caret trails the last output line, like a real terminal. */
.console .log-line.boot { color: var(--label-3); }
.console .log-line.boot .p { color: var(--label-4); }
.console .prompt-row { margin-top: 3px; }
.console .prompt-row .p { color: var(--label-3); letter-spacing: 1px; margin-right: 4px; }
.console .prompt-row .caret-block { margin: 1px 0 0 2px; opacity: .8; }

/* console — darker phosphor-tinted inset + CRT scanlines */
.console {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px),
    rgba(3, 6, 4, .68);
  border-color: rgba(46, 160, 110, .12);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.5), inset 0 0 60px rgba(32, 220, 128, .03);
}
/* prompt chevron per log line (JS renders .p) */
.console .log-line .p { margin-right: 6px; user-select: none; }
.console .log-line .p.ok { color: var(--green); }
.console .log-line .p.err { color: var(--red); }
.console .log-line .p.start { color: var(--teal); }
.console .log-line .p.dim { color: var(--label-4); }

/* blinking block caret while a job runs */
.caret-block {
  display: inline-block; width: 7px; height: 13px;
  margin: 4px 0 0 6px; vertical-align: -2px;
  background: var(--teal); border-radius: 1.5px;
  box-shadow: 0 0 10px rgba(100,210,255,.35);
  animation: caret-blink 1.1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret-block { animation: none; opacity: .85; } }
.console {
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  background: rgba(4,4,7,.62);
  border: .5px solid rgba(255,255,255,.07);
  border-radius: 14px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.4);
  padding: 10px 12px;
  min-height: 110px; max-height: min(38vh, 320px);
  overflow: auto; overscroll-behavior: contain; overflow-anchor: none;
  color: rgba(222,222,230,.85);
}
.console .log-line { padding: 1.5px 0; word-break: break-word; animation: log-in .28s var(--ease-out); }
@keyframes log-in { from { opacity: 0; transform: translateY(3px); } }
.console .log-line .t { color: var(--label-4); margin-right: 8px; font-size: 10.5px; }
.console .log-line.ok { color: #6CE08D; }
.console .log-line.err, .console .log-line.error { color: #FF8A82; }
.console .log-line.warn { color: #FFB84D; }
.console .log-line.debug { color: var(--label-3); }
.console .log-line.start { color: var(--teal); }
.console-toolbar { display: flex; align-items: center; gap: 8px; }
.jump-pill {
  display: none; position: absolute; right: 10px; bottom: 10px; z-index: 2;
  height: 28px; padding: 0 11px; border-radius: var(--r-pill);
  border: .5px solid var(--glass-b2); background: rgba(30,30,38,.85);
  color: var(--label-2); font-size: 11.5px; font-weight: 600;
  align-items: center; gap: 5px;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.jump-pill.show { display: inline-flex; animation: log-in .2s var(--ease-out); }
.jump-pill svg { width: 11px; height: 11px; }
.console-anchored { position: relative; }

/* ═══════════════ EMPTY / ERRORS ═══════════════ */
.empty {
  padding: 18px 10px; text-align: center;
  color: var(--label-3); font-size: 12.5px; line-height: 1.5;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty .e-ico { width: 22px; height: 22px; color: var(--label-4); }
.empty .e-ico svg { width: 100%; height: 100%; }
.error-line {
  font-family: var(--mono); font-size: 12px; color: #FF9A93;
  padding: 7px 10px; margin: 4px 0; border-radius: 10px;
  background: rgba(255,69,58,.07); border: .5px solid rgba(255,69,58,.16);
  word-break: break-all; line-height: 1.5;
}

/* accordion (grok config) */
.acc { border-radius: var(--r-card); margin-bottom: 10px; overflow: hidden; }
.acc > summary {
  list-style: none; cursor: pointer; user-select: none;
  min-height: 50px; padding: 0 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: -.005em; color: var(--label);
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary .chev { width: 15px; height: 15px; color: var(--label-3); margin-left: auto; transition: transform .25s var(--ease-out); flex-shrink: 0; }
.acc > summary .chev svg { width: 100%; height: 100%; }
.acc[open] > summary .chev { transform: rotate(90deg); }
.acc > summary:hover { background: rgba(255,255,255,.04); }
.acc .acc-body { padding: 2px 16px 16px; animation: acc-in .3s var(--ease-out); }
@keyframes acc-in { from { opacity: 0; transform: translateY(-4px); } }
.acc > summary .a-ico { width: 17px; height: 17px; color: var(--label-3); flex-shrink: 0; }
.acc > summary .a-ico svg { width: 100%; height: 100%; }

/* hint line */
.hint-line { margin: 8px 0 0; font-size: 12px; color: var(--label-3); line-height: 1.5; }
.hint-line code { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 5px; background: rgba(255,255,255,.07); border: .5px solid var(--glass-b1); }

/* ═══════════════ COMMAND PALETTE ═══════════════ */
.cmd-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: flex-start; justify-content: center;
  padding: 14vh 16px 16px;
  background: rgba(4,4,8,.45);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.cmd-backdrop.open { display: flex; animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; } }
.cmd {
  width: min(540px, 100%);
  border-radius: 22px;
  overflow: hidden;
}
.cmd-input-wrap { display: flex; align-items: center; gap: 10px; padding: 4px 16px; border-bottom: .5px solid rgba(255,255,255,.08); }
.cmd-input-wrap svg { width: 16px; height: 16px; color: var(--label-3); flex-shrink: 0; }
.cmd-input {
  flex: 1; border: 0; background: transparent; box-shadow: none;
  min-height: 46px; padding: 0; font-size: 16px; color: var(--label); border-radius: 0;
}
.cmd-input:focus { box-shadow: none; background: transparent; }
.cmd-list { max-height: 320px; overflow: auto; padding: 6px; }
.cmd-sec { padding: 7px 10px 4px; font-size: 10.5px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--label-3); }
.cmd-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  min-height: 42px; padding: 0 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--label); font-size: 13.5px; font-weight: 500;
  text-align: left;
}
.cmd-item .ico { width: 17px; height: 17px; color: var(--label-3); flex-shrink: 0; }
.cmd-item .ico svg { width: 100%; height: 100%; }
.cmd-item .sub { margin-left: auto; font-size: 11px; color: var(--label-3); font-family: var(--mono); }
.cmd-item.active { background: rgba(255,255,255,.09); }
.cmd-item.active .ico { color: var(--accent-hi); }
.cmd-item .k-enter { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--label-3); border: .5px solid var(--glass-b1); border-radius: 5px; padding: 2px 5px; background: rgba(255,255,255,.05); }
.cmd-empty { padding: 22px; text-align: center; color: var(--label-3); font-size: 13px; }
.cmd-foot {
  display: flex; gap: 14px; padding: 8px 16px;
  border-top: .5px solid rgba(255,255,255,.08);
  font-size: 10.5px; color: var(--label-3);
}
.cmd-foot kbd { font-family: var(--mono); font-size: 9.5px; padding: 1px 5px; border-radius: 5px; background: rgba(255,255,255,.06); border: .5px solid var(--glass-b1); margin-right: 4px; }

/* ═══════════════ ACTION SHEET / DIALOG ═══════════════ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 110;
  display: none; align-items: flex-end; justify-content: center;
  background: rgba(4,4,8,.5);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  padding: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.sheet-backdrop.open { display: flex; animation: fade-in .2s ease; }
.sheet {
  width: min(400px, 100%); border-radius: var(--r-sheet);
  overflow: hidden;
}
.sheet-head { padding: 20px 20px 14px; text-align: center; }
.sheet-head h3 { margin: 0 0 6px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sheet-head p { margin: 0; font-size: 13px; color: var(--label-2); line-height: 1.45; word-break: break-word; }
.sheet-btns { display: flex; flex-direction: column; padding: 0 10px 10px; gap: 8px; }
.sheet-btns .btn { min-height: 48px; border-radius: 15px; font-size: 15px; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { width: min(340px, 100%); }
}

/* ═══════════════ TOASTS ═══════════════ */
.toast-container {
  position: fixed; z-index: 130; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: min(430px, 94vw);
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 9px;
  max-width: 100%; padding: 11px 16px;
  border-radius: var(--r-pill);
  border: .5px solid var(--glass-b3);
  background: linear-gradient(165deg, rgba(42,43,52,.88), rgba(26,26,33,.88));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 34px -8px rgba(0,0,0,.6);
  color: var(--label); font-size: 13.5px; font-weight: 500;
}
.toast .t-ico { width: 16px; height: 16px; flex-shrink: 0; }
.toast .t-ico svg { width: 100%; height: 100%; }
.toast.ok .t-ico { color: var(--green); }
.toast.err .t-ico { color: var(--red); }
.toast.info .t-ico { color: var(--accent-hi); }

/* ═══════════════ MOBILE TAB BAR ═══════════════ */
.tabbar {
  position: fixed; z-index: 60;
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  height: var(--tabbar-h);
  display: none; align-items: stretch; gap: 4px;
  padding: 5px; border-radius: 22px;
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.5px;
  border: .5px solid transparent; border-radius: 17px; background: transparent;
  color: var(--label-3); font-size: 10px; font-weight: 600; letter-spacing: .01em;
  transition: color var(--d-fast) ease, background var(--d-fast) ease, transform var(--d-fast) var(--ease-spring);
}
.tabbar .tab:active { transform: scale(.93); }
.tabbar .tab .ico { width: 21px; height: 21px; }
.tabbar .tab .ico svg { width: 100%; height: 100%; }
.tabbar .tab.on {
  color: var(--label);
  background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.tabbar .tab.on .ico { color: var(--accent-hi); }
.tabbar .tab-orb {
  flex: 0 0 52px; margin: -14px 2px 0; height: 52px; align-self: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #716FEE, var(--accent) 60%, #5552DE);
  border: .5px solid rgba(125,122,255,.55); color: #fff;
  display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 20px -6px rgba(94,92,230,.65);
  transition: transform var(--d-fast) var(--ease-spring);
}
.tabbar .tab-orb:active { transform: scale(.9); }
.tabbar .tab-orb svg { width: 21px; height: 21px; }

/* ═══════════════ LOGIN ═══════════════ */
.login-page {
  min-height: 100dvh; display: grid; place-items: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.login-card {
  width: min(392px, 100%); border-radius: 26px; padding: 28px 24px 22px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.login-brand .brand-mark svg { width: 22px; height: 22px; }
.login-brand h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.login-sub { font-size: 13.5px; color: var(--label-3); margin-bottom: 22px; }
.login-error {
  display: none; align-items: center; gap: 8px;
  color: #FF8A82; font-size: 12.5px; font-weight: 500;
  padding: 10px 12px; margin-bottom: 14px; border-radius: 12px;
  background: var(--red-fill); border: .5px solid var(--red-line);
}
.login-error .ico { width: 15px; height: 15px; flex-shrink: 0; }
.login-error .ico svg { width: 100%; height: 100%; }
.login-card.shake { animation: shake .5s var(--ease-out); }
@keyframes shake {
  15% { transform: translateX(-9px); } 32% { transform: translateX(7px); }
  50% { transform: translateX(-5px); } 68% { transform: translateX(3px); }
  84% { transform: translateX(-2px); }
}
.login-footer { text-align: center; font-size: 11px; color: var(--label-4); margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.login-footer svg { width: 11px; height: 11px; }
.login-card .input { min-height: 48px; border-radius: 14px; font-size: 16px; }
.login-card .btn { min-height: 50px; border-radius: 15px; font-size: 15.5px; font-weight: 600; margin-top: 8px; }

/* ═══════════════ UTILS ═══════════════ */
.text-ok { color: #6CE08D; }
.text-err { color: #FF8A82; }
.text-run { color: var(--accent-hi); }
.text-live { color: var(--teal); }
.text-warn { color: #FFB84D; }
.text-faint, .text-muted { color: var(--label-3); }
.text-xs { font-size: 11px; }
.text-right { text-align: right; }
.mt-3 { margin-top: 12px; }
.pt-3 { padding-top: 12px; }
.border-top { border-top: .5px solid rgba(255,255,255,.07); }
.row-flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); border-top-color: var(--accent-hi);
  animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 960px) {
  :root { --page-pad: 12px; }
  .shell { display: block; }
  .shell-side {
    position: fixed; inset: 0 auto 0 0; z-index: 70;
    width: min(292px, 88vw); height: 100dvh;
    padding: 10px 0 10px 10px;
    transform: translateX(-108%);
    /* linear short slide — spring overshoot felt stiff on mobile tab nav */
    transition: transform .2s ease-out;
    will-change: transform;
  }
  .shell.sidebar-open .shell-side { transform: translateX(0); }
  /* first paint: no transition so drawer never animates open on page load */
  html.boot-pending .shell-side { transition: none !important; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 65;
    background: rgba(3,3,6,.4);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 0; padding: 0; cursor: default;
  }
  .shell.sidebar-open .sidebar-backdrop { display: block; opacity: 1; }
  html.boot-pending .shell.sidebar-open .sidebar-backdrop { animation: none; }
  .menu-btn { display: inline-flex; }
  .topbar-brand { display: flex; }
  .page-heading { display: none; }
  .topbar-search { display: none; }
  .stream-pill .sp-label { display: none; }
  .stream-pill { padding: 0 9px; }
  #clockPill { display: none; }
  /* iOS Safari zooms the viewport when a focused input is <16px — guard it */
  .input, input[type="text"], input[type="password"], input[type="number"],
  input[type="email"], input[type="url"], select, textarea { font-size: 16px; }
  .tabbar { display: flex; }
  .content { padding-bottom: calc(var(--tabbar-h) + 26px + env(safe-area-inset-bottom, 0px)); }
  .toast-container { bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom, 0px)); }
  .btn, .btn-primary, .btn-danger { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .status-summary { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .status-cell { min-height: 64px; padding: 10px 10px 9px; }
  .status-cell .v {
    font-size: 18px; line-height: 1.2; min-height: 1.2em;
    overflow: hidden; text-overflow: ellipsis;
  }
  .topbar { top: 8px; margin: 8px 10px 0; }
  .content { padding-top: 14px; }
}
@media (max-width: 430px) {
  .topbar { height: 48px; flex: 0 0 48px; padding: 0 6px 0 8px; gap: 6px; }
  .topbar-brand h1 { font-size: 14px; }
  .topbar-brand .brand-mark { width: 22px; height: 22px; }
  .topbar-stats { gap: 3px; }
  .stat-pill {
    height: 26px; min-height: 26px; max-height: 26px;
    padding: 0 7px; gap: 0;
  }
  .stat-pill .lab { display: none; }
  .stat-pill .val {
    font-size: 11.5px;
    min-width: 2.8ch; /* IDLE fits */
    padding: 0 1px;
  }
  /* 375px: brand+menu+stream+user tight → keep 3 pills (state/acct/ok) */
  .topbar-stats .stat-pill:nth-child(n+4) { display: none; }
  .stream-pill { height: 26px; padding: 0 7px; }
  .user-chip { width: 30px; height: 30px; }
}


/* === PERF OVERRIDES 2026-07-23 === */
html.perf-lite .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
html.perf-lite .reveal.in { opacity: 1 !important; transform: none !important; }
html.perf-lite #scrollProgress { display: none !important; }
html.perf-lite .topbar,
html.perf-lite .tabbar,
html.perf-lite .cmd-panel,
html.perf-lite .sheet,
html.perf-lite .menu-pop {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* kill remaining backdrop-filter globally under perf-lite */
html.perf-lite * {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* soften transitions that reflow paint */
html.perf-lite .btn,
html.perf-lite .nav-item,
html.perf-lite .card,
html.perf-lite .stat-pill {
  transition: background-color .12s ease, border-color .12s ease, color .12s ease !important;
}
/* kill console log-in + caret blink (looks like screen flicker on Android WebView) */
html.perf-lite .console .log-line { animation: none !important; transform: none !important; }
html.perf-lite .caret-block { animation: none !important; opacity: .85; }
html.perf-lite .jump-pill.show { animation: none !important; }
html.perf-lite .run-strip { transition: none !important; }
/* status-cell values: no flash-up */
html.perf-lite .status-cell .v { animation: none !important; transform: none !important; filter: none !important; }
