:root {
  --bg-primary: #050608;
  --bg-secondary: #0c0f16;
  --bg-card: #0c0f16;
  --bg-elevated: #1a1a28;
  --border-color: #1c2230;
  --text-primary: #eef1f5;
  --text-secondary: #a7adba;
  --text-muted: #5c6470;
  --accent-purple: #00ffaa;
  --accent-green: #00ffaa;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-blue: #3b82f6;

  /* ── Operator console token layer ─────────────────────────────── */
  --ink-0: #000000;
  --ink-1: #05060a;
  --ink-2: #0e111a;

  --line-1: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.14);
  --line-accent: rgba(0, 255, 170, 0.3);

  --fg-1: #eef1f5;
  --fg-2: #a7adba;
  --fg-3: #6b7280;
  --fg-accent: #00ffaa;
  --fg-accent-dim: rgba(0, 255, 170, 0.62);
  --fg-danger: #ff5f6d;

  /* spacing scale — 4px base */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* concentric radius ladder */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* elevation */
  --lift-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --lift-2: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --lift-3: 0 24px 64px -16px rgba(0, 0, 0, 0.7);

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 320ms;

  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, monospace;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body, #root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: ui-monospace, "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1c2230; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a3346; }

::selection { background: rgba(0, 255, 170, 0.3); color: #eef1f5; }

input, textarea, select { outline: none; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0,255,170,0.15), inset 0 0 20px rgba(0,255,170,0.05); }
  50% { box-shadow: 0 0 40px rgba(0,255,170,0.25), inset 0 0 30px rgba(0,255,170,0.08); }
}

.fade-in {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-out-init {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
}

.stagger-in {
  animation: staggerIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes staggerIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes slideIn {
  from { width: 0; opacity: 0; }
  to { width: 320px; opacity: 1; }
}

.card-in {
  animation: cardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════
   Login / operator console
   ══════════════════════════════════════════════════════════════════ */

/* cutout artwork (PNG/JPG) forced to pure white so it reads on AMOLED black */
.lx-cut-white { filter: brightness(0) invert(1); }

.lx-amoled { background: #000; }

.lx-under { position: relative; display: flex; align-items: center; }
.lx-under::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line-2);
  transition-property: background-color, height;
  transition-duration: var(--dur-base);
  transition-timing-function: var(--ease-out);
}
.lx-under:focus-within::after { background: var(--fg-accent); height: 2px; }

.lx-field {
  width: 100%;
  min-height: 54px;
  padding: var(--s-3) 52px var(--s-3) 0;
  border: 0;
  background: transparent;
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.2em;
  border-radius: 0;
  transition-property: color, opacity;
  transition-duration: var(--dur-base);
}
.lx-field::placeholder { color: var(--fg-3); letter-spacing: 0.2em; font-weight: 400; }
.lx-field:focus-visible { outline: none; }
.lx-field:disabled { opacity: 0.45; }

.lx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 52px;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition-property: background-color, box-shadow, transform, opacity, color;
  transition-duration: var(--dur-fast);
  transition-timing-function: var(--ease-out);
}
.lx-btn:active:not(:disabled) { transform: scale(0.98); }
.lx-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 255, 170, 0.28); }
.lx-btn:disabled { cursor: not-allowed; opacity: 0.6; }

.lx-btn-primary {
  background: var(--fg-accent);
  color: #000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;
}
.lx-btn-primary:hover:not(:disabled) {
  background: #35ffc0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 8px 26px -10px rgba(0, 255, 170, 0.6);
}
.lx-btn-primary:disabled {
  background: transparent;
  color: var(--fg-accent-dim);
  box-shadow: inset 0 0 0 1px var(--line-accent);
}

.lx-reveal {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 0;
  color: var(--fg-3);
  cursor: pointer;
  transition-property: color;
  transition-duration: var(--dur-fast);
}
.lx-reveal:hover { color: var(--fg-accent); }
.lx-reveal:focus-visible { outline: none; color: var(--fg-accent); }

.lx-label {
  display: block;
  margin-bottom: var(--s-1);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition-property: color;
  transition-duration: var(--dur-base);
}
.lx-under:focus-within ~ .lx-label { color: var(--fg-accent); }

.lx-err {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: rgba(255, 95, 109, 0.09);
  border: 1px solid rgba(255, 95, 109, 0.3);
  color: #ffb3b9;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
}
.lx-err[hidden] { display: none; }

.lx-dot {
  width: 5px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--fg-accent);
  animation: lx-pulse 2.4s var(--ease-out) infinite;
  flex: none;
}
@keyframes lx-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

.lx-num { font-variant-numeric: tabular-nums; }
.lx-balance { text-wrap: balance; }

.lx-shake { animation: lx-shake 320ms var(--ease-out); }
@keyframes lx-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-5px); }
  50%      { transform: translateX(4px); }
  75%      { transform: translateX(-2px); }
}

.lx-spin { animation: lx-spin 720ms linear infinite; }
@keyframes lx-spin { to { transform: rotate(360deg); } }

@keyframes lx-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lx-rise { animation: lx-rise 480ms var(--ease-out) both; }

.lx-link {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition-property: color;
  transition-duration: var(--dur-fast);
}
.lx-link:hover { color: var(--fg-accent); }
.lx-link:focus-visible { outline: none; color: var(--fg-accent); text-decoration: underline; text-underline-offset: 3px; }

/* outlined button: 44px hit area, visible boundary */
.lx-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--s-4);
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--line-accent);
  color: var(--fg-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition-property: background-color, color, transform, box-shadow;
  transition-duration: var(--dur-fast);
  transition-timing-function: var(--ease-out);
}
.lx-ghost:hover { background: rgba(0, 255, 170, 0.1); }
.lx-ghost:active { transform: scale(0.97); }
.lx-ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 255, 170, 0.28); }

@media (prefers-reduced-motion: reduce) {
  .lx-rise, .lx-dot, .lx-spin, .lx-shake { animation: none !important; }
  * { transition-duration: 1ms !important; }
}

/* ── Supabase-style collapsible sidebar ───────────────────────────────
   Default: 64px icon rail. Hover expands to 256px as an overlay (main
   content keeps its layout - no reflow). Pin button holds it open. */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  width: 64px;
  display: flex; flex-direction: column;
  background-color: #0c0f16;
  border-right: 1px solid #1c2230;
  transition: width .18s ease;
  overflow: hidden;
  white-space: nowrap;
}
#sidebar:hover, #sidebar.sb-pinned { width: 256px; }
#sidebar::-webkit-scrollbar { width: 0; height: 0; }

.sb-main { margin-left: 64px; height: 100%; }

.sb-brand {
  display: flex; align-items: center; justify-content: center;
  padding: 10px 0; min-height: 58px; flex: 0 0 auto;
}
.sb-brand img { height: 34px; width: auto; object-fit: contain; transition: height .18s ease; }
#sidebar:hover .sb-brand img, #sidebar.sb-pinned .sb-brand img { height: 52px; }

.sb-pin {
  position: absolute; top: 16px; right: 10px;
  display: none; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  color: #5c6470; background: transparent; border: none; cursor: pointer;
}
#sidebar:hover .sb-pin, #sidebar.sb-pinned .sb-pin { display: flex; }
.sb-pin:hover { background: rgba(255,255,255,0.06); color: #eef1f5; }
.sb-pinned .sb-pin { color: #00ffaa; }

.sb-item {
  display: flex; align-items: center; gap: 12px;
  margin: 2px 10px; padding: 9px 11px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: #a7adba; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
  border: none;
}
.sb-item:hover { color: #eef1f5; background: rgba(255,255,255,0.04); }
.sb-active { color: #ffffff; box-shadow: 0 0 15px rgba(0, 255, 170,0.2); }
.sb-ico { width: 18px; height: 18px; flex: 0 0 auto; }

.sb-label { opacity: 0; transition: opacity .08s ease; }
#sidebar:hover .sb-label, #sidebar.sb-pinned .sb-label { opacity: 1; transition-delay: .07s; }

.sb-mini {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 10px; font-size: 10px; font-weight: 600; flex: 0 0 auto;
}
#sidebar:hover .sb-mini, #sidebar.sb-pinned .sb-mini { display: none; }

.sb-stats {
  display: none; padding: 12px 14px;
  border-top: 1px solid #1c2230; flex: 0 0 auto;
}
#sidebar:hover .sb-stats, #sidebar.sb-pinned .sb-stats { display: block; }

.sb-meta {
  display: none; align-items: center; gap: 8px;
  padding: 3px 16px; font-size: 10px; color: #5c6470;
}
#sidebar:hover .sb-meta, #sidebar.sb-pinned .sb-meta { display: flex; }
.sb-dot { width: 6px; height: 6px; border-radius: 50%; background: #5c6470; flex: 0 0 auto; display: inline-block; }

.sb-foot { margin-top: auto; padding: 8px 0 10px; border-top: 1px solid #151b28; flex: 0 0 auto; }
.sb-logout { width: calc(100% - 20px); background: transparent; color: #5c6470; }
.sb-logout:hover { color: #ef4444 !important; background: rgba(239,68,68,0.1) !important; }