/* ═══════════════════════════════════════════════════════════════
   COMMAND CENTER — Futuristic AI Agent Portal
   "Obsidian HUD" — Dark, holographic, data-forward
   Display : Syne   (geometric, sharp)
   Body    : DM Sans (clean, legible)
   Data    : DM Mono (precise, terminal)
   ─────────────────────────────────────────────────────────────── */
:root {
  /* Core backgrounds */
  --bg:      #07080c;
  --bg2:     #0d0f16;
  --bg3:     #13161f;
  --bg4:     #1c2030;

  /* Borders */
  --border:  rgba(255,255,255,0.055);
  --border2: rgba(255,255,255,0.11);
  --border3: rgba(255,255,255,0.20);

  /* Text */
  --text:    #e8eaf2;
  --muted:   #6b7280;
  --hint:    #374151;

  /* Accent palette */
  --green:   #00e5a0;
  --green2:  rgba(0,229,160,0.10);
  --amber:   #f5b731;
  --amber2:  rgba(245,183,49,0.10);
  --blue:    #4fa3f7;
  --blue2:   rgba(79,163,247,0.10);
  --red:     #f05a5a;
  --red2:    rgba(240,90,90,0.10);
  --purple:  #a78bfa;
  --purple2: rgba(167,139,250,0.10);
  --teal:    #2dd4bf;
  --teal2:   rgba(45,212,191,0.10);
  --cyan:    #22d3ee;
  --cyan2:   rgba(34,211,238,0.10);

  /* Typography */
  --display: 'Syne', sans-serif;
  --body:    'DM Sans', sans-serif;
  --mono:    'DM Mono', monospace;

  /* Radius */
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  26px;

  /* Transitions */
  --ease:  cubic-bezier(.4,0,.2,1);
}

/* ── RESET ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── BODY / CANVAS ───────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* Subtle dot-grid background */
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -5%, rgba(0,229,160,0.07) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 90% 90%, rgba(79,163,247,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 35% 30% at 5% 80%,  rgba(167,139,250,0.04) 0%, transparent 50%),
    radial-gradient(circle 1px at center, rgba(255,255,255,0.025) 0%, transparent 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 28px 28px;
}

/* Scanline depth overlay */
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px, transparent 2px,
    rgba(0,0,0,0.018) 2px, rgba(0,0,0,0.018) 3px
  );
}

/* ═══════════════════════════════════════════
   LOCK SCREEN
   ─────────────────────────────────────────── */
#lock-screen {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
}
.lock-wrap {
  width: 380px; padding: 0 24px;
  animation: fadeUp .55s var(--ease) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lock-logo {
  font-family: var(--display);
  font-size: 34px; font-weight: 800;
  letter-spacing: -0.048em;
  margin-bottom: 6px;
}
.lock-logo span {
  color: var(--green);
  text-shadow: 0 0 24px rgba(0,229,160,0.45), 0 0 60px rgba(0,229,160,0.15);
}
.lock-sub { font-size: 13px; color: var(--muted); margin-bottom: 40px; letter-spacing: 0.01em; }
.lock-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; margin-bottom: 8px; font-family: var(--display);
}
.lock-input {
  width: 100%; background: var(--bg3);
  border: 0.5px solid var(--border2);
  color: var(--text); border-radius: var(--r-md);
  padding: 14px 16px; font-size: 15px;
  font-family: var(--mono); outline: none;
  letter-spacing: .18em; transition: border-color .18s, box-shadow .18s;
  margin-bottom: 12px;
}
.lock-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,229,160,0.12), inset 0 0 20px rgba(0,229,160,0.02);
}
.lock-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--green), #00c488);
  color: #001f10;
  border: none; border-radius: var(--r-md); padding: 14px;
  font-size: 14px; font-weight: 700; font-family: var(--display);
  cursor: pointer; letter-spacing: .04em;
  transition: all .18s; box-shadow: 0 4px 24px rgba(0,229,160,0.25);
}
.lock-btn:hover {
  background: linear-gradient(135deg, #00f7af, #00d68f);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,229,160,0.35);
}
.lock-error { font-size: 12px; color: var(--red); margin-top: 10px; text-align: center; min-height: 18px; }
.lock-dots { display: flex; gap: 6px; margin-bottom: 32px; }
.lock-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border2); }
.lock-dot.lit { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ═══════════════════════════════════════════
   APP SHELL
   ─────────────────────────────────────────── */
#app { display: none; }
#app.unlocked { display: block; min-height: 100vh; }

.sidebar { display: none !important; }
.main {
  padding: 72px 48px 48px !important;
  max-width: 1440px; margin: 0 auto; overflow-x: hidden;
}
.page { display: none; }
.page.active { display: block; animation: pageIn .3s var(--ease); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   TOP STATUS BAR  (HUD nav rail)
   ─────────────────────────────────────────── */
.top-status-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  background: rgba(7,8,12,0.85);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px; z-index: 1000;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  /* Holographic bottom edge */
  box-shadow: 0 1px 0 0 rgba(0,229,160,0.06);
}
.tsb-left  { display: flex; align-items: center; gap: 16px; }
.tsb-right { display: flex; align-items: center; gap: 18px; }

/* Pulse dot */
.tsb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(0,229,160,0.6);
  animation: tsb-pulse 3s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes tsb-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(0,229,160,0.55); }
  50%       { box-shadow: 0 0 0 6px rgba(0,229,160,0.00); }
}

/* Nav links */
.tsb-nav { display: flex; align-items: center; gap: 2px; }
.tsb-nav-link {
  color: var(--muted); text-decoration: none; font-size: 12px;
  padding: 5px 11px; border-radius: 7px; transition: all .15s;
  font-family: var(--body); white-space: nowrap; border: 0.5px solid transparent;
}
.tsb-nav-link:hover { color: var(--text); background: var(--bg3); }
.tsb-nav-link.active {
  color: var(--text); background: var(--bg3);
  border-color: var(--border2);
}

/* Home / lock buttons */
.tsb-home-btn {
  background: var(--bg3); border: 0.5px solid var(--border2);
  color: var(--text); border-radius: var(--r-sm); padding: 5px 12px;
  font-size: 16px; cursor: pointer; line-height: 1;
  transition: all .15s; flex-shrink: 0;
}
.tsb-home-btn:hover { background: var(--bg4); border-color: var(--border3); color: var(--green); }

.tsb-lock-btn {
  background: transparent; border: 0.5px solid var(--border2);
  color: var(--muted); border-radius: var(--r-sm); padding: 5px 12px;
  font-size: 15px; cursor: pointer; line-height: 1;
  transition: all .15s; flex-shrink: 0;
}
.tsb-lock-btn:hover { background: var(--red2); border-color: var(--red); color: var(--red); }

/* ═══════════════════════════════════════════
   PAGE HEADER
   ─────────────────────────────────────────── */
.page-hd {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 0.5px solid var(--border);
  position: relative;
}
/* Accent underline (uses --accent injected per page) */
.page-hd::after {
  content: '';
  position: absolute; bottom: -1px; left: 0;
  width: 100px; height: 1px;
  background: linear-gradient(90deg, var(--page-accent, var(--green)), transparent);
}
.page-title {
  font-family: var(--display);
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.04em; line-height: 1.1;
}
.page-sub { font-size: 12px; color: var(--muted); margin-top: 4px; letter-spacing: 0.01em; }
.hd-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ═══════════════════════════════════════════
   HOME — GREETING
   ─────────────────────────────────────────── */
.home-greeting {
  margin-bottom: 44px; padding-bottom: 30px;
  border-bottom: 0.5px solid var(--border);
  position: relative;
}
.home-greeting::before {
  content: '';
  position: absolute; bottom: -1px; left: 0;
  width: 160px; height: 1px;
  background: linear-gradient(90deg, var(--green) 0%, rgba(79,163,247,0.4) 60%, transparent);
}
.home-greeting-title {
  font-family: var(--display);
  font-size: 40px; font-weight: 800;
  letter-spacing: -0.04em; line-height: 1.1;
}
.home-greeting-title span {
  color: var(--green);
  text-shadow: 0 0 28px rgba(0,229,160,0.45), 0 0 60px rgba(0,229,160,0.12);
}
.home-greeting-sub {
  font-size: 15px; color: var(--muted);
  margin-top: 8px; font-family: var(--body);
  font-weight: 400; letter-spacing: -0.01em;
}
.home-date {
  font-family: var(--mono); font-size: 11px;
  color: var(--hint); margin-top: 6px; letter-spacing: .07em;
}

/* ═══════════════════════════════════════════
   HOME — TILE GRID
   ─────────────────────────────────────────── */
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; margin-bottom: 28px;
}

/* Staggered entrance */
.tiles-grid .tile:nth-child(1) { animation-delay: .04s; }
.tiles-grid .tile:nth-child(2) { animation-delay: .09s; }
.tiles-grid .tile:nth-child(3) { animation-delay: .14s; }
.tiles-grid .tile:nth-child(4) { animation-delay: .19s; }
.tiles-grid .tile:nth-child(5) { animation-delay: .24s; }
.tiles-grid .tile:nth-child(6) { animation-delay: .29s; }
.tiles-grid .tile:nth-child(7) { animation-delay: .34s; }
.tiles-grid .tile:nth-child(8) { animation-delay: .39s; }

/* ── TILE CARD ───────────────────────────── */
.tile {
  background: linear-gradient(155deg, var(--bg2) 0%, rgba(10,11,18,0.97) 100%);
  border: 0.5px solid var(--border);
  border-radius: var(--r-xl); padding: 28px 28px 22px;
  cursor: pointer;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s, background .3s;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  animation: tileIn .45s var(--ease) both;
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Corner L-bracket detail */
.tile::before {
  content: '';
  position: absolute; top: 14px; right: 14px;
  width: 8px; height: 8px;
  border-top: 1px solid rgba(255,255,255,0.10);
  border-right: 1px solid rgba(255,255,255,0.10);
  border-radius: 0 4px 0 0;
  transition: border-color .3s, opacity .3s;
  opacity: 0.4;
}
.tile:hover::before { border-color: rgba(255,255,255,0.28); opacity: 1; }

/* Bottom-left corner */
.tile::after {
  content: '';
  position: absolute; bottom: 14px; left: 14px;
  width: 8px; height: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-left: 1px solid rgba(255,255,255,0.07);
  border-radius: 0 0 0 4px;
  transition: border-color .3s, opacity .3s;
  opacity: 0.3;
}
.tile:hover::after { border-color: rgba(255,255,255,0.20); opacity: 1; }

.tile:hover {
  border-color: var(--border2);
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 24px 64px rgba(0,0,0,.50), 0 0 0 0.5px rgba(255,255,255,0.06) inset;
}
.tile:active { transform: translateY(-2px) scale(1.005); }

/* Top accent bar */
.tile-accent-top {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

/* Glow sphere */
.tile-glow {
  position: absolute; top: -80px; right: -80px;
  width: 240px; height: 240px;
  border-radius: 50%; opacity: .06; filter: blur(60px);
  pointer-events: none; transition: opacity .4s;
}
.tile:hover .tile-glow { opacity: .20; }

/* Icon */
.tile-icon {
  font-size: 28px; margin-bottom: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px;
  background: var(--bg3); border: 0.5px solid var(--border2);
  border-radius: 14px;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.10));
  transition: transform .3s var(--ease), border-color .3s;
}
.tile:hover .tile-icon { transform: scale(1.08); border-color: var(--border3); }

/* Title */
.tile-name {
  font-family: var(--display);
  font-size: 15px; font-weight: 700;
  letter-spacing: -0.02em; margin-bottom: 7px;
}

/* Description */
.tile-desc {
  font-size: 12.5px; color: var(--muted);
  line-height: 1.65; margin-bottom: auto;
  padding-bottom: 18px;
}

/* Footer */
.tile-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 14px; border-top: 0.5px solid var(--border);
}
.tile-status {
  font-size: 10px; font-family: var(--mono);
  padding: 3px 10px; border-radius: 20px; letter-spacing: 0.03em;
}
.tile-stat {
  font-size: 11px; font-family: var(--mono); color: var(--muted);
  transition: color .2s;
}
.tile:hover .tile-stat { color: var(--text); }

.tile-arrow {
  font-size: 15px; color: var(--hint);
  transition: transform .3s var(--ease), color .3s;
}
.tile:hover .tile-arrow { transform: translateX(6px); color: var(--green); }

/* Wide tile */
.tile-wide { grid-column: span 2; }

/* ── QUICK CARDS (home bottom) ───────────── */
.home-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px; margin-top: 8px;
}
.quick-card {
  background: linear-gradient(155deg, var(--bg2), rgba(10,11,18,0.96));
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
  transition: border-color .22s;
}
.quick-card:hover { border-color: var(--border2); }
.quick-card-title {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .14em; font-family: var(--display); font-weight: 700;
  margin-bottom: 16px; display: flex; align-items: center; gap: 9px;
}
.quick-card-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 12px; border-radius: 2px; background: var(--green);
  flex-shrink: 0;
}
.home-quick .quick-card:last-child .quick-card-title::before { background: var(--purple); }

/* ═══════════════════════════════════════════
   BUTTONS
   ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 17px; border-radius: var(--r-sm);
  font-size: 13px; font-family: var(--body);
  cursor: pointer; transition: all .17s var(--ease);
  border: 0.5px solid var(--border2);
  background: var(--bg3); color: var(--text);
  white-space: nowrap; letter-spacing: 0.01em;
}
.btn:hover { background: var(--bg4); border-color: var(--border3); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .38; cursor: not-allowed; pointer-events: none; }
.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 7px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg3); border-color: var(--border); }

.btn-green  { background: var(--green);  color: #001f10; border-color: transparent; font-weight: 600; box-shadow: 0 4px 16px rgba(0,229,160,0.20); }
.btn-green:hover  { background: #00f7af; box-shadow: 0 6px 24px rgba(0,229,160,0.30); }
.btn-amber  { background: var(--amber);  color: #1a0e00; border-color: transparent; font-weight: 600; }
.btn-amber:hover  { background: #f7c858; }
.btn-blue   { background: var(--blue);   color: #000d1f; border-color: transparent; font-weight: 600; }
.btn-blue:hover   { background: #7bb8ff; }
.btn-purple { background: var(--purple); color: #100b20; border-color: transparent; font-weight: 600; }
.btn-purple:hover { background: #c4b5fd; }
.btn-red    { background: transparent; border-color: var(--red); color: var(--red); }
.btn-red:hover { background: var(--red2); }

/* ═══════════════════════════════════════════
   CARDS
   ─────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg); padding: 22px 24px;
  margin-bottom: 16px;
  transition: border-color .22s;
}
.card:hover { border-color: var(--border2); }
.card-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.card-title {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .12em; font-family: var(--display); font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
/* Subtle accent pip on card titles */
.card-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 10px; border-radius: 2px;
  background: var(--page-accent, var(--green)); flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   METRIC CARDS
   ─────────────────────────────────────────── */
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.mc {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: border-color .22s, transform .22s, box-shadow .22s;
}
.mc:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.30);
}
.mc-accent {
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px; border-radius: var(--r-md) var(--r-md) 0 0;
}
.mc-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .09em; margin-bottom: 10px;
  font-family: var(--display); font-weight: 600;
}
.mc-val {
  font-size: 28px; font-weight: 400; font-family: var(--mono);
  letter-spacing: -0.04em; line-height: 1;
}
.mc-unit { font-size: 14px; color: var(--muted); }
.mc-sub  { font-size: 11px; color: var(--muted); margin-top: 9px; }
.mc-sub.g { color: var(--green); }
.mc-sub.a { color: var(--amber); }
.mc-sub.r { color: var(--red); }

/* Hero metric */
.mc-hero {
  background: var(--bg2); border: 0.5px solid var(--border2);
  border-radius: 20px; padding: 26px 28px;
  position: relative; overflow: hidden;
  transition: border-color .25s, transform .25s, box-shadow .25s;
}
.mc-hero:hover { border-color: var(--border3); transform: translateY(-3px); box-shadow: 0 16px 48px rgba(0,0,0,.35); }
.mc-hero .mc-accent { height: 3px; border-radius: 20px 20px 0 0; }
.mc-hero .mc-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing:.1em; margin-bottom: 12px; font-family: var(--display); font-weight: 600; }
.mc-hero .mc-val   { font-size: 48px; font-weight: 400; font-family: var(--mono); letter-spacing: -0.05em; line-height: 1; }
.mc-hero .mc-unit  { font-size: 18px; color: var(--muted); }
.mc-hero .mc-sub   { font-size: 12px; color: var(--muted); margin-top: 10px; }
.mc-hero .mc-emoji { font-size: 32px; margin-bottom: 10px; display: block; }
.mc-hero .mc-breakdown { display: flex; gap: 20px; margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--border); }
.mc-hero .mc-breakdown-item { font-size: 12px; color: var(--muted); }
.mc-hero .mc-breakdown-item strong { display: block; font-size: 16px; font-family: var(--mono); font-weight: 400; color: var(--text); margin-bottom: 2px; }
.joint-hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }

/* ═══════════════════════════════════════════
   PROGRESS
   ─────────────────────────────────────────── */
.prog { height: 3px; background: var(--bg4); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.prog-fill { height: 100%; border-radius: 3px; transition: width .9s cubic-bezier(.4,0,.2,1); }
.prog-labels { display: flex; justify-content: space-between; font-size: 9px; color: var(--hint); margin-top: 4px; font-family: var(--mono); }

/* ═══════════════════════════════════════════
   GRID LAYOUTS
   ─────────────────────────────────────────── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.col-60-40 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ═══════════════════════════════════════════
   TABLE
   ─────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  font-size: 9px; color: var(--hint); text-transform: uppercase;
  letter-spacing: .12em; padding: 0 10px 12px 0;
  font-weight: 500; text-align: left; font-family: var(--display);
}
.tbl td { padding: 10px 10px 10px 0; border-top: 0.5px solid var(--border); vertical-align: middle; }
.tbl tr:hover td { background: rgba(255,255,255,0.015); }

/* ═══════════════════════════════════════════
   BADGES
   ─────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 600; font-family: var(--display);
  letter-spacing: 0.03em;
}
.bg { background: rgba(0,229,160,.13); color: var(--green); }
.ba { background: rgba(245,183,49,.13); color: var(--amber); }
.br { background: rgba(240,90,90,.14);  color: var(--red); }
.bb { background: rgba(79,163,247,.13); color: var(--blue); }
.bp { background: rgba(167,139,250,.13);color: var(--purple); }
.bt { background: rgba(45,212,191,.13); color: var(--teal); }
.bc { background: rgba(34,211,238,.13); color: var(--cyan); }
.bn { background: rgba(255,255,255,.07);color: var(--muted); }

/* ═══════════════════════════════════════════
   SPARKLINE
   ─────────────────────────────────────────── */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.spark-b { flex: 1; border-radius: 2px 2px 0 0; min-width: 5px; transition: height .5s ease, background .3s, opacity .3s; }
.spark-b:hover { opacity: 0.85; }
.spark-lbl { display: flex; justify-content: space-between; font-size: 9px; color: var(--hint); margin-top: 6px; font-family: var(--mono); }

/* ═══════════════════════════════════════════
   INSIGHT BOX
   ─────────────────────────────────────────── */
.insight {
  border-radius: 0 12px 12px 0;
  padding: 11px 15px; font-size: 12px;
  color: var(--muted); margin-bottom: 10px; line-height: 1.75;
  border-left-width: 2px; border-left-style: solid;
}
.ins-g { background: var(--green2);  border-left-color: var(--green); }
.ins-a { background: var(--amber2);  border-left-color: var(--amber); }
.ins-b { background: var(--blue2);   border-left-color: var(--blue);  }
.ins-r { background: var(--red2);    border-left-color: var(--red);   }
.ins-p { background: var(--purple2); border-left-color: var(--purple); }
.ins-t { background: var(--teal2);   border-left-color: var(--teal);  }
.insight strong { color: var(--text); font-weight: 500; }

/* ═══════════════════════════════════════════
   MODAL
   ─────────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); backdrop-filter: blur(8px);
  z-index: 200; align-items: center; justify-content: center;
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg2); border: 0.5px solid var(--border2);
  border-radius: var(--r-lg); padding: 28px 30px;
  width: 500px; max-width: 96vw; max-height: 90vh; overflow-y: auto;
  animation: popIn .22s cubic-bezier(.34,1.4,.64,1);
  box-shadow: 0 32px 80px rgba(0,0,0,.55);
}
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-title { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.modal-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 24px; line-height: 1; padding: 0; transition: color .15s; }
.modal-x:hover { color: var(--text); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .08em; font-family: var(--display); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg3); border: 0.5px solid var(--border2);
  color: var(--text); border-radius: var(--r-sm); padding: 11px 14px;
  font-size: 14px; font-family: var(--body); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(255,255,255,.26);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}
.field select option { background: var(--bg3); }
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ═══════════════════════════════════════════
   TOAST
   ─────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg3); border: 0.5px solid var(--border2);
  border-radius: 12px; padding: 12px 18px;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
  animation: slideUp .22s var(--ease);
  min-width: 200px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast.ok  { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
.toast.inf { border-left: 3px solid var(--blue); }

/* ═══════════════════════════════════════════
   HEALTH — USER TOGGLE
   ─────────────────────────────────────────── */
.user-toggle { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; padding: 14px 0 4px; border-top: 0.5px solid var(--border); }
.user-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 22px;
  font-size: 12px; cursor: pointer; transition: all .2s;
  border: 0.5px solid var(--border2); background: var(--bg3); color: var(--muted);
  font-family: var(--display); font-weight: 600;
}
.user-pill:hover { border-color: var(--border3); color: var(--text); }
.user-pill.active-a { background: var(--green2); border-color: var(--green); color: var(--green); }
.user-pill.active-k { background: var(--purple2); border-color: var(--purple); color: var(--purple); }
.user-pill .up-dot { width: 7px; height: 7px; border-radius: 50%; }

/* ═══════════════════════════════════════════
   HEALTH — COMPARE GRID
   ─────────────────────────────────────────── */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.cmp-card {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--r-lg); padding: 20px 22px;
  position: relative; overflow: hidden; transition: border-color .2s;
}
.cmp-card:hover { border-color: var(--border2); }
.cmp-user { font-family: var(--display); font-size: 13px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.cmp-metric { margin-bottom: 14px; }
.cmp-metric-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; margin-bottom: 5px; font-family: var(--display); font-weight: 600; }
.cmp-metric-val { font-size: 22px; font-family: var(--mono); letter-spacing: -.03em; line-height: 1; }
.cmp-metric-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ═══════════════════════════════════════════
   JOBS — KANBAN
   ─────────────────────────────────────────── */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kanban-col {
  background: var(--bg2); border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 14px;
}
.kanban-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin-bottom: 12px;
  font-family: var(--display); font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.kanban-count { background: var(--bg4); border-radius: 20px; padding: 1px 8px; font-size: 9px; }
.job-card {
  background: var(--bg3); border: 0.5px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.job-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.22); }
.job-card-company { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.job-card-role { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.job-card-meta { font-size: 10px; color: var(--hint); }

/* ═══════════════════════════════════════════
   TASKS
   ─────────────────────────────────────────── */
.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 0.5px solid var(--border);
  cursor: pointer; transition: opacity .15s;
}
.task-row:last-child { border-bottom: none; }
.task-row.done { opacity: .4; }
.task-check {
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--border3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; cursor: pointer;
}
.task-check.checked { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px rgba(0,229,160,0.35); }
.task-check.checked::after { content: '✓'; font-size: 11px; color: #001f10; font-weight: 700; }
.task-title { flex: 1; font-size: 13px; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-due { font-size: 11px; font-family: var(--mono); color: var(--muted); }
.task-due.overdue { color: var(--red); }
.task-project { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ═══════════════════════════════════════════
   JOURNAL
   ─────────────────────────────────────────── */
.mood-row { display: flex; gap: 8px; margin-bottom: 16px; }
.mood-btn {
  flex: 1; padding: 10px 4px; border-radius: 12px;
  border: 0.5px solid var(--border2); background: var(--bg3);
  cursor: pointer; text-align: center; font-size: 20px; transition: all .15s;
}
.mood-btn:hover { border-color: var(--border3); background: var(--bg4); transform: scale(1.04); }
.mood-btn.active { border-color: var(--amber); background: var(--amber2); }
.mood-label { font-size: 9px; color: var(--muted); display: block; margin-top: 4px; font-family: var(--display); }
.journal-entry {
  width: 100%; background: var(--bg3); border: 0.5px solid var(--border2);
  color: var(--text); border-radius: var(--r-md); padding: 14px;
  font-size: 14px; font-family: var(--body); outline: none;
  resize: vertical; min-height: 120px; line-height: 1.75;
  transition: border-color .15s, box-shadow .15s;
}
.journal-entry:focus { border-color: rgba(255,255,255,.22); box-shadow: 0 0 0 3px rgba(255,255,255,0.03); }

/* ═══════════════════════════════════════════
   GOOGLE FIT / HEALTH BANNER
   ─────────────────────────────────────────── */
.gfit-banner, .ghealth-banner {
  background: linear-gradient(135deg, rgba(0,229,160,.08), rgba(79,163,247,.05));
  border: 0.5px solid rgba(0,229,160,.20);
  border-radius: var(--r-md); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
}
.gfit-icon { font-size: 26px; flex-shrink: 0; }
.gfit-text { flex: 1; }
.gfit-title { font-size: 13px; font-weight: 600; color: var(--text); }
.gfit-sub { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* ═══════════════════════════════════════════
   WEALTH — ALLOCATIONS
   ─────────────────────────────────────────── */
.alloc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; font-size: 13px; }
.alloc-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.alloc-name { flex: 1; }
.alloc-track { flex: 2; height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.alloc-fill { height: 100%; border-radius: 2px; }
.alloc-pct { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 36px; text-align: right; }
.alloc-val { font-family: var(--mono); font-size: 11px; min-width: 82px; text-align: right; }

/* ═══════════════════════════════════════════
   ALGOY PAGE
   ─────────────────────────────────────────── */
.algoy-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.article-card {
  background: var(--bg3); border: 0.5px solid var(--border2);
  border-radius: var(--r-md); padding: 16px; margin-bottom: 10px;
  transition: border-color .15s, transform .15s;
}
.article-card:hover { border-color: var(--border3); transform: translateY(-1px); }
.article-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; line-height: 1.4; }
.article-meta { font-size: 11px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.article-preview { font-size: 12px; color: var(--muted); line-height: 1.65; }
.article-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.writing-score { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.score-bar { flex: 1; height: 6px; background: var(--bg4); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; }
.score-label { font-size: 11px; font-family: var(--mono); min-width: 32px; text-align: right; }
.prompt-preview { background: var(--bg3); border: 0.5px solid var(--border2); border-radius: 10px; padding: 14px; font-size: 12px; color: var(--muted); line-height: 1.75; font-family: var(--mono); white-space: pre-wrap; }

/* ═══════════════════════════════════════════
   EMPTY / LOADING STATES
   ─────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--hint); font-size: 13px; }
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }
.spin {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid var(--border2); border-top-color: var(--green);
  border-radius: 50%; animation: rotation .7s linear infinite; margin-bottom: 10px;
}
@keyframes rotation { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   SCROLLBAR
   ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border3); }

/* ═══════════════════════════════════════════
   TV / LARGE SCREEN (≥1200px)
   ─────────────────────────────────────────── */
@media (min-width: 1200px) {
  .main { padding: 80px 72px 60px !important; }
  .tiles-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 28px !important; }
  .tile { min-height: 280px !important; padding: 40px !important; }
  .tile-icon { width: 64px !important; height: 64px !important; font-size: 32px !important; border-radius: 18px !important; }
  .tile-name { font-size: 22px !important; font-weight: 800 !important; margin-bottom: 10px !important; }
  .tile-desc { font-size: 16px !important; line-height: 1.6 !important; }
  .tile-stat { font-size: 18px !important; color: var(--text) !important; font-weight: 600 !important; }
  .home-greeting-title { font-size: 56px !important; }
  .home-greeting-sub { font-size: 22px !important; margin-top: 12px !important; }
  .top-status-bar { height: 58px; font-size: 13px; padding: 0 48px; }
  .tsb-home-btn { font-size: 20px; padding: 6px 14px; }
  .page-title { font-size: 34px !important; }
}

/* ═══════════════════════════════════════════
   MOBILE (≤768px)
   ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .main { padding: 68px 16px 32px !important; }

  /* Top bar */
  .top-status-bar { padding: 0 14px; height: 48px; }
  #tsb-date-time, #tsb-sync-txt { display: none; }

  /* Greeting */
  .home-greeting { margin-bottom: 28px; padding-bottom: 20px; }
  .home-greeting-title { font-size: 26px; }
  .home-greeting-sub { font-size: 13px; }

  /* Tiles: single column */
  .tiles-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .tile-wide { grid-column: span 1 !important; }
  .tile { padding: 20px 20px 18px; min-height: unset !important; }
  .tile-icon { width: 44px; height: 44px; font-size: 22px; }

  /* Quick cards */
  .home-quick { grid-template-columns: 1fr; gap: 10px; }

  /* Metric grid: 2-col */
  .metric-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mc-val { font-size: 22px; }

  /* Multi-col → single */
  .two-col, .three-col, .col-60-40, .compare-grid, .joint-hero-row,
  .algoy-grid { grid-template-columns: 1fr !important; }

  /* Kanban: horizontal scroll */
  .kanban { grid-template-columns: repeat(5, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 8px; }

  /* Page header */
  .page-hd { flex-direction: column; gap: 12px; align-items: flex-start; margin-bottom: 24px; padding-bottom: 20px; }
  .hd-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .page-title { font-size: 22px !important; }

  /* Cards */
  .card { padding: 16px 18px; }
  .card-hd { flex-wrap: wrap; gap: 8px; }

  /* Table */
  .tbl { font-size: 12px; }
  div:has(> .tbl) { overflow-x: auto; }

  /* Nav */
  .tsb-nav { display: none; }

  /* Hero metric */
  .mc-hero .mc-val { font-size: 36px !important; }

  /* Fields */
  .field-row { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════
   TV VIEW-ONLY MODE
   ─────────────────────────────────────────── */
body.tv-view-only .hd-actions,
body.tv-view-only .lock-out-btn,
body.tv-view-only .btn-red,
body.tv-view-only button.btn:not(.btn-ghost) { display: none !important; }

/* ═══════════════════════════════════════════
   TILE ACCENT BAR PULSE
   ─────────────────────────────────────────── */
@keyframes accentPulse {
  0%, 100% { opacity: 0.75; }
  50%       { opacity: 1; filter: brightness(1.2); }
}
.tile-accent-top {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  animation: accentPulse 5s ease-in-out infinite;
}

/* Arrow → on hover uses the tile accent colour */
.tile:hover .tile-arrow { color: var(--tile-color, var(--green)); }

/* Icon glow uses tile colour */
.tile:hover .tile-icon {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 4px 16px rgba(0,0,0,.3);
}

/* ═══════════════════════════════════════════
   UTILITY
   ─────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red   { color: var(--red);   }
.text-blue  { color: var(--blue);  }
.text-purple { color: var(--purple); }
