/* DedwenAI — Candlelit Terminal
   Editorial restraint × industrial precision × nocturnal warmth. */

@font-face {
  font-family: "Geist Sans";
  src: url("/static/fonts/geist-sans-latin-400-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Geist Sans";
  src: url("/static/fonts/geist-sans-latin-500-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 500;
}

@font-face {
  font-family: "Geist Sans";
  src: url("/static/fonts/geist-sans-latin-600-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 600;
}

@font-face {
  font-family: "Geist Sans";
  src: url("/static/fonts/geist-sans-latin-700-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist-mono-latin-400-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist-mono-latin-500-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 500;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist-mono-latin-600-normal.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 600;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/static/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-display: swap;
  font-style: italic;
  font-weight: 400;
}

:root {
  --font-sans: "Geist Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "SFMono-Regular", Consolas, monospace;
  --font-serif: "Instrument Serif", Georgia, serif;

  --bg: #11100d;
  --surface: #171512;
  --elevated: #201d18;
  --overlay: rgba(12, 10, 7, 0.84);

  --text-primary: #f1e8da;
  --text-secondary: rgba(241, 232, 218, 0.78);
  --text-tertiary: rgba(241, 232, 218, 0.52);
  --text-on-amber: #1b1305;

  --border-subtle: rgba(241, 232, 218, 0.08);
  --border-default: rgba(241, 232, 218, 0.14);
  --border-strong: rgba(241, 232, 218, 0.24);

  --amber: #df9d2f;
  --amber-hover: #ebb04d;
  --amber-active: #c98819;
  --amber-translucent: rgba(223, 157, 47, 0.16);

  --gold: #c8a560;
  --gold-muted: rgba(200, 165, 96, 0.2);
  --gold-glow: rgba(200, 165, 96, 0.22);

  --wine: #6a2e3d;
  --wine-hover: #824154;
  --wine-tint: rgba(106, 46, 61, 0.18);

  --success: #5f9f7b;
  --warning: #c28a31;
  --info: #8f7c61;

  --silver-100: #f1e8da;
  --silver-200: #ddd1c1;
  --silver-300: #c4b7a5;
  --silver-400: #a69886;
  --silver-500: #867968;
  --silver-600: #665a4b;
  --silver-700: #4b4135;
  --silver-800: #322b23;
  --silver-900: #191612;

  --bg-base: var(--bg);
  --bg-surface: var(--surface);
  --bg-elevated: var(--elevated);
  --bg-card: #1a1714;
  --bg-hover: #23201b;
  --text-muted: var(--text-secondary);
  --text-dim: var(--text-tertiary);
  --text-ultra-dim: rgba(241, 232, 218, 0.24);
  --cinder: #7b6950;
  --cinder-dim: rgba(123, 105, 80, 0.12);
  --blue: #8f7c61;
  --green: var(--success);
  --red: #c1676f;
  --orange: #c28a31;
  --danger: var(--red);
  --neutral: var(--silver-400);
  --surface-1: rgba(255, 248, 236, 0.03);
  --surface-2: rgba(255, 248, 236, 0.05);
  --surface-3: rgba(255, 248, 236, 0.08);
  --border-1: var(--border-subtle);
  --border-2: var(--border-default);
  --border-accent: rgba(223, 157, 47, 0.32);
  --border-cinder: rgba(123, 105, 80, 0.2);
  --grad-amber: linear-gradient(135deg, #df9d2f, #c98819);
  --grad-cinder: linear-gradient(135deg, #3a2f27, #211c17);
  --grad-ai: linear-gradient(145deg, rgba(223, 157, 47, 0.07), rgba(106, 46, 61, 0.03));
  --grad-dark: linear-gradient(180deg, #11100d 0%, #15120f 50%, #0e0d0b 100%);
  --shadow-0: none;
  --shadow-1: 0 1px 4px rgba(0, 0, 0, 0.22);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.26);
  --shadow-3: 0 16px 40px rgba(0, 0, 0, 0.34);
  --shadow-4: 0 24px 64px rgba(0, 0, 0, 0.4);
  --glow-amber: 0 0 18px rgba(223, 157, 47, 0.12);
  --glow-cinder: 0 0 18px rgba(123, 105, 80, 0.1);
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --r-0: 0;
  --r-1: 2px;
  --r-2: 6px;
  --r-3: 10px;
  --r-4: 14px;
  --r-5: 18px;
  --r-full: 9999px;
  --type-xs: 11px;
  --type-sm: 13px;
  --type-md: 15px;
  --type-lg: 20px;
  --type-xl: 24px;
  --type-2xl: 32px;
  --type-3xl: 48px;
  --type-4xl: 48px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-io: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --nav-width: 280px;
  --nav-width-open: 280px;
  --panel-width: 336px;
  --accent-green: var(--success);
  --accent-red: var(--red);
  --accent-blue: var(--info);
  --accent-amber: var(--amber);
  --accent-gold: var(--gold);
  --accent-cinder: var(--cinder);
  --accent-orange: var(--warning);
  --status-active: var(--success);
  --status-warning: var(--warning);
  --status-error: var(--red);
  --status-neutral: var(--silver-400);
  --status-disabled: var(--silver-700);
  --status-inactive: var(--silver-500);
  --cinder-soft: var(--cinder);
  --cinder-soft-dim: var(--cinder-dim);
  --chart-gold: var(--gold);
  --chart-cinder: var(--cinder);
  --green-dim: rgba(95, 159, 123, 0.14);
  --green-bright: var(--success);
  --emerald: var(--success);
  --deep-red: var(--wine);
  --gold-bright: var(--gold);
  --gold-dark: #8b6731;
  --chart-1: var(--amber);
  --chart-2: var(--gold);
  --chart-3: #967f5f;
  --chart-4: var(--wine);
  --chart-5: var(--success);
  --chart-6: #6f5d49;
  --chart-7: #a5722a;
  --chart-8: #4c4034;
  --radius-xs: var(--r-1);
  --radius-sm: var(--r-2);
  --radius-md: var(--r-3);
  --radius-lg: var(--r-4);
  --radius-xl: var(--r-5);
  --radius-full: var(--r-full);
  --space-sm: var(--s-2);
  --space-md: var(--s-3);
  --space-lg: var(--s-5);
  --space-xl: var(--s-6);
  --space-2xl: var(--s-7);
  --transition-fast: var(--dur-fast) var(--ease-io);
  --transition-base: var(--dur-base) var(--ease-io);
  --transition-slow: var(--dur-slow) var(--ease-out);
  --surface-color: var(--surface-1);
  --surface-hover: var(--surface-2);
  --border-color: var(--border-1);
  --bg-color: var(--bg-base);
  --red-dim: rgba(193, 103, 111, 0.14);
  --bg-surface-alt: var(--bg-surface);
}

/* ══════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════ */
:root { color-scheme: dark; }

*,*::before,*::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html { height: 100%; }

body {
  height: 100%;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 15% 85%, rgba(106, 46, 61, 0.18) 0%, transparent 58%),
    radial-gradient(ellipse at 86% 12%, rgba(200, 165, 96, 0.08) 0%, transparent 52%),
    radial-gradient(ellipse at 50% 110%, rgba(223, 157, 47, 0.05) 0%, transparent 45%),
    repeating-linear-gradient(-52deg, transparent 0, transparent 46px, rgba(200, 165, 96, 0.008) 46px, rgba(200, 165, 96, 0.008) 47px),
    repeating-linear-gradient(38deg, transparent 0, transparent 70px, rgba(223, 157, 47, 0.006) 70px, rgba(223, 157, 47, 0.006) 71px),
    var(--grad-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--type-md);
  line-height: 1.6;
  overflow: hidden;
  display: flex;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: var(--r-2);
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  z-index: 1000;
  transform: translateY(-180%);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-3);
  border: 1px solid var(--border-default);
  background: var(--elevated);
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--type-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform var(--dur-fast) var(--ease-io);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ── Typography ── */
h1 { font-family:var(--font-sans); font-size:var(--type-2xl); font-weight:700; letter-spacing:-0.025em; line-height:1.15; }
h2 { font-family:var(--font-sans); font-size:var(--type-xl);  font-weight:700; letter-spacing:-0.018em; line-height:1.2;  }
h3 { font-family:var(--font-sans); font-size:var(--type-lg);  font-weight:600; letter-spacing:-0.012em; line-height:1.25; }
h4 { font-size:var(--type-md); font-weight:700; letter-spacing:-0.008em; }
p  { font-size:var(--type-sm); line-height:1.7; color:var(--text-secondary); }

code, .mono {
  font-family:var(--font-mono);
  font-size:0.875em;
}

/* ══════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════ */
.app-container {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   LEFT DOCK — Navigation Rail
   ══════════════════════════════════════════════ */
.left-dock {
  width: var(--nav-width);
  height: 100%;
  background: rgba(13,10,20,0.96);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--s-5) 0;
  z-index: 100;
  transition: width var(--dur-slow) var(--ease-out);
  overflow: hidden;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
}

.left-dock:hover {
  width: var(--nav-width-open);
  background: rgba(15,11,23,0.98);
  box-shadow: 16px 0 48px rgba(0,0,0,0.5);
}

.dock-header {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: var(--s-6);
  padding: 0 var(--s-2);
}

.dock-logo {
  width: 38px; height: 38px;
  flex-shrink: 0;
  background: rgba(230,168,23,0.08);
  border: 1px solid rgba(230,168,23,0.18);
  border-radius: var(--r-3);
  padding: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-base) var(--ease-out);
}

.left-dock:hover .dock-logo {
  transform: scale(1.05);
  filter: drop-shadow(0 0 12px rgba(230,168,23,0.35));
  border-color: rgba(230,168,23,0.32);
}

.dock-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 0 var(--s-2);
  overflow: hidden;
}

.dock-divider {
  height: 1px;
  background: var(--border-1);
  margin: var(--s-2) var(--s-2);
  flex-shrink: 0;
}

.dock-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  border-radius: var(--r-3);
  color: var(--text-dim);
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease-io);
  position: relative;
  padding: 0 var(--s-3);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--type-xs);
}

.dock-item:hover {
  background: var(--surface-1);
  color: var(--text-secondary);
}

.dock-item.active {
  background: rgba(230,168,23,0.08);
  color: var(--amber);
}

.dock-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--amber);
  border-radius: 0 2px 2px 0;
  box-shadow: 2px 0 8px rgba(230,168,23,0.5);
}

.dock-item[href="/assistant"].active {
  background: var(--cinder-dim);
  color: var(--cinder);
}
.dock-item[href="/assistant"].active::before {
  background: var(--cinder);
  box-shadow: 2px 0 8px rgba(155,126,240,0.5);
}

.dock-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-right: 20px;
  opacity: 0.65;
  transition: all var(--dur-fast) var(--ease-io);
}

.dock-item:hover .dock-icon,
.dock-item.active .dock-icon { opacity: 1; }

.dock-label {
  font-size: var(--type-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

.left-dock:hover .dock-label {
  opacity: 1;
  transform: translateX(0);
}

.dock-footer {
  width: 100%;
  padding: var(--s-3) var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid var(--border-1);
}

/* ══════════════════════════════════════════════
   MAIN VIEWPORT
   ══════════════════════════════════════════════ */
.main-viewport {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: radial-gradient(ellipse at 50% -10%, rgba(155,126,240,0.05), transparent 60%);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-7) var(--s-7);
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════════════
   GLASS CARD
   ══════════════════════════════════════════════ */
.glass-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  padding: var(--s-5);
  transition: background var(--dur-base) var(--ease-io),
              border-color var(--dur-base) var(--ease-io),
              transform var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
  position: relative;
  overflow: hidden;
  contain: layout paint;
}

.glass-card:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.glass-card.interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn-primary {
  background: var(--grad-amber);
  color: #000;
  border: none;
  padding: 10px var(--s-5);
  border-radius: var(--r-3);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--type-xs);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  box-shadow: 0 2px 8px rgba(230,168,23,0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(230,168,23,0.42);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(230,168,23,0.22);
}

.btn-primary:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-1);
  padding: 10px var(--s-5);
  border-radius: var(--r-3);
  font-family: inherit;
  font-weight: 600;
  font-size: var(--type-xs);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text-primary);
}

.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px var(--s-4);
  border-radius: var(--r-3);
  font-family: inherit;
  font-weight: 500;
  font-size: var(--type-xs);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
  display: inline-flex; align-items: center; gap: var(--s-1);
}

.btn-ghost:hover {
  background: var(--surface-1);
  color: var(--text-secondary);
}

.btn-connect { /* alias */ }
.btn-connect {
  background: var(--grad-amber);
  color: #000;
  border: none;
  padding: 10px var(--s-5);
  border-radius: var(--r-3);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--type-xs);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  box-shadow: 0 2px 8px rgba(230,168,23,0.22);
}
.btn-connect:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(230,168,23,0.42); }
.btn-connect:disabled { opacity: 0.38; cursor: not-allowed; }

/* ══════════════════════════════════════════════
   FORM INPUTS
   ══════════════════════════════════════════════ */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select, textarea {
  background: rgba(10,8,18,0.72);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  color: var(--text-primary);
  padding: 10px var(--s-4);
  font-family: inherit;
  font-size: var(--type-sm);
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(230,168,23,0.10);
}

input::placeholder, textarea::placeholder { color: var(--text-dim); }

.form-group { margin-bottom: var(--s-5); text-align: left; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}

/* ══════════════════════════════════════════════
   STATUS SYSTEM
   ══════════════════════════════════════════════ */
.status-dot {
  width: 7px; height: 7px;
  border-radius: var(--r-full);
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.status-dot.READY, .status-dot.HEALTHY, .status-dot.CONNECTED, .status-dot.ACTIVE {
  background: var(--green);
  box-shadow: 0 0 10px rgba(52,211,153,0.5);
}
.status-dot.WORKING, .status-dot.LOADING, .status-dot.STARTING {
  background: var(--blue);
  box-shadow: 0 0 10px rgba(59,130,246,0.4);
  animation: pulse-status 2s infinite ease-in-out;
}
.status-dot.ERROR, .status-dot.DISCONNECTED, .status-dot.FAILED {
  background: var(--red);
  box-shadow: 0 0 10px rgba(248,113,113,0.5);
}
.status-dot.DEGRADED, .status-dot.WARNING {
  background: var(--warning);
  box-shadow: 0 0 10px rgba(251,191,36,0.4);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

.status-pill.active   { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.25); }
.status-pill.warning  { background: rgba(251,191,36,0.12); color: var(--warning); border: 1px solid rgba(251,191,36,0.25); }
.status-pill.danger   { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }
.status-pill.info     { background: rgba(96,165,250,0.12); color: var(--info); border: 1px solid rgba(96,165,250,0.25); }
.status-pill.neutral  { background: var(--surface-1); color: var(--neutral); border: 1px solid var(--border-1); }
.status-pill.muted   { background: var(--cinder-dim); color: var(--cinder); border: 1px solid var(--border-cinder); }
.status-pill.blocked  { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }

/* ══════════════════════════════════════════════
   PAGE HEADER SYSTEM
   ══════════════════════════════════════════════ */
.page-shell { display: flex; flex-direction: column; gap: var(--s-5); }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-5);
  margin-bottom: var(--s-6);
}
.page-header-left { display: flex; flex-direction: column; gap: var(--s-1); }

.page-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  opacity: 0.85;
}

.page-title {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0;
}

.page-subtitle {
  font-size: var(--type-sm);
  font-weight: 400;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   SECTION TITLE
   ══════════════════════════════════════════════ */
.section-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-1);
}

/* ══════════════════════════════════════════════
   METRIC CARDS
   ══════════════════════════════════════════════ */
.metric-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--s-2);
}

.metric-value {
  font-family: var(--font-sans);
  font-size: var(--type-xl);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: var(--s-1);
}

/* ══════════════════════════════════════════════
   SKELETON LOADERS
   ══════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--r-2);
}
.skeleton-text  { height: 14px; border-radius: var(--r-1); }
.skeleton-title { height: 22px; border-radius: var(--r-1); }
.skeleton-card  { height: 80px; border-radius: var(--r-4); }

/* ══════════════════════════════════════════════
   ASSISTANT — PRIMARY EXPERIENCE
   ══════════════════════════════════════════════ */
.assistant-container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 var(--s-5);
  position: relative;
}

/* Empty State */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: fadeIn var(--dur-slow) var(--ease-out);
  padding: var(--s-8) 0;
}

.empty-state-icon {
  width: 80px; height: 80px;
  border-radius: var(--r-5);
  background: var(--grad-ai);
  border: 1px solid var(--border-cinder);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--s-6);
  box-shadow: 0 0 48px rgba(155,126,240,0.18), var(--glow-cinder);
  color: var(--cinder);
  animation: pulse-cinder 5s infinite ease-in-out;
}

.empty-state-greeting {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--s-3);
  opacity: 0.85;
}

.empty-state-title {
  font-family: var(--font-sans);
  font-size: 34px;
  font-weight: 800;
  margin-bottom: var(--s-3);
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state-sub {
  font-size: var(--type-sm);
  color: var(--text-muted);
  max-width: 460px;
  line-height: 1.75;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
  margin-top: var(--s-6);
  max-width: 600px;
  width: 100%;
}

.suggestion-chip {
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  padding: var(--s-3) var(--s-4);
  font-family: inherit;
  font-size: var(--type-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
  text-align: left;
  line-height: 1.5;
}

.suggestion-chip:hover {
  background: var(--cinder-dim);
  border-color: var(--border-cinder);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.suggestion-chip-icon {
  font-size: 16px;
  display: block;
  margin-bottom: var(--s-1);
}

/* Chat Messages */
.chat-messages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-5) 0 var(--s-4);
  overflow-y: auto;
}

.message {
  display: flex;
  gap: var(--s-3);
  max-width: 100%;
  animation: slideUp var(--dur-base) var(--ease-out);
}

.message-avatar {
  width: 30px; height: 30px;
  border-radius: var(--r-3);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid var(--border-1);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.message-content {
  flex: 1;
  font-size: var(--type-sm);
  line-height: 1.8;
  color: var(--text-primary);
  max-width: 72ch;
  min-width: 0;
}

.message-content p { margin-bottom: var(--s-3); }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { color: var(--text-primary); font-weight: 700; }
.message-content code {
  background: rgba(155,126,240,0.12);
  border: 1px solid rgba(155,126,240,0.2);
  padding: 1px 6px;
  border-radius: var(--r-2);
  font-size: 0.875em;
  color: var(--cinder);
}
.message-content pre {
  background: rgba(10,8,18,0.75);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  padding: var(--s-4);
  overflow-x: auto;
  margin: var(--s-3) 0;
  font-size: 12px;
  line-height: 1.65;
}

.message-bubble {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  border-top-left-radius: var(--r-1);
  padding: var(--s-4) var(--s-5);
}

.message-ai .message-bubble {
  background: var(--grad-ai);
  border-color: rgba(155,126,240,0.15);
}

.message-ai .message-avatar {
  background: linear-gradient(135deg,rgba(155,126,240,0.22),rgba(107,78,216,0.12));
  border-color: rgba(155,126,240,0.3);
  color: var(--cinder);
}

.message-user {
  align-self: flex-end;
  justify-content: flex-end;
}
.message-user .message-bubble {
  background: rgba(24,18,38,0.8);
  border-color: var(--border-2);
  border-top-left-radius: var(--r-4);
  border-top-right-radius: var(--r-1);
}
.message-user .message-avatar {
  background: var(--grad-amber);
  color: #000;
  border: none;
  font-weight: 900;
}
.message-user .message-content { order: 1; }
.message-user .message-avatar { order: 2; }

.message-timestamp {
  font-size: 10px;
  color: var(--text-ultra-dim);
  margin-top: var(--s-2);
  letter-spacing: 0.02em;
}

/* Tool Chips */
.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  margin-top: var(--s-3);
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  padding: 3px 9px;
  background: var(--cinder-dim);
  border: 1px solid var(--border-cinder);
  border-radius: var(--r-full);
  color: var(--cinder);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}

.tool-chip-live {
  background: rgba(230,168,23,0.10);
  border-color: rgba(230,168,23,0.25);
  color: var(--amber);
  animation: pulse-glow 2s infinite;
}

/* Thinking Indicator */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) 0;
}
.thinking-dot {
  width: 7px; height: 7px;
  border-radius: var(--r-full);
  background: var(--cinder);
  opacity: 0.8;
  animation: thinking-bounce 1.2s infinite ease-in-out;
}
.thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot:nth-child(3) { animation-delay: 0.3s; }
.thinking-label { font-size: 12px; color: var(--text-muted); font-style: italic; margin-left: var(--s-1); }

/* Streaming Phase Badge */
.stream-phase {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.75;
  margin-bottom: var(--s-2);
}

/* ══════════════════════════════════════════════
   CHAT INPUT COMPOSER
   ══════════════════════════════════════════════ */
.input-dock {
  position: sticky;
  bottom: 0;
  width: 100%;
  padding: var(--s-3) 0 var(--s-5);
  background: linear-gradient(to top, rgba(10,8,14,0.99) 60%, rgba(10,8,14,0.70) 84%, transparent);
  z-index: 10;
}

.composer-wrap {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: rgba(20,16,30,0.85);
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
  box-shadow: var(--shadow-3);
}

.composer-wrap:focus-within {
  border-color: rgba(230,168,23,0.40);
  box-shadow: 0 0 0 3px rgba(230,168,23,0.08), var(--shadow-3);
}

.composer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.toolbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
}
.toolbar-chip:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  color: var(--text-secondary);
}
.toolbar-chip.active {
  background: var(--cinder-dim);
  border-color: var(--border-cinder);
  color: var(--cinder);
}

.toolbar-field {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbar-field select {
  background: transparent;
  border: 1px solid rgba(155,126,240,0.2);
  border-radius: var(--r-2);
  color: var(--cinder);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  width: auto;
}

.toolbar-button, .icon-button {
  border: 1px solid rgba(230,168,23,0.18);
  background: rgba(230,168,23,0.06);
  color: var(--text-secondary);
  border-radius: var(--r-full);
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
}
.toolbar-button:hover, .icon-button:hover {
  border-color: rgba(230,168,23,0.4);
  background: rgba(230,168,23,0.12);
  color: var(--text-primary);
}
.toolbar-button.muted { border-color: rgba(155,126,240,0.22); background: rgba(155,126,240,0.07); color: var(--cinder); }
.toolbar-button.muted:hover { border-color: rgba(155,126,240,0.4); background: rgba(155,126,240,0.14); }

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
}

textarea#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--type-sm);
  padding: var(--s-3) 0;
  resize: none;
  max-height: 200px;
  outline: none;
  line-height: 1.65;
}
textarea#chat-input::placeholder { color: var(--text-dim); }

.send-button {
  width: 40px; height: 40px;
  border-radius: var(--r-3);
  background: var(--grad-amber);
  color: #000;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast) var(--ease-io);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(230,168,23,0.28);
}
.send-button:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 20px rgba(230,168,23,0.48);
}
.send-button:active:not(:disabled) { transform: translateY(0) scale(1); }
.send-button:disabled { opacity: 0.20; cursor: not-allowed; background: var(--text-dim); box-shadow: none; }

.composer-hint {
  text-align: center;
  margin-top: var(--s-2);
  font-size: 10px;
  color: var(--text-ultra-dim);
  letter-spacing: 0.04em;
}

/* Tool menu popover */
.tool-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + var(--s-2));
  left: var(--s-5);
  width: 280px;
  padding: var(--s-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: rgba(14,10,24,0.98);
  box-shadow: var(--shadow-3);
  z-index: 20;
  backdrop-filter: blur(24px);
}
.tool-menu.open { display: grid; gap: var(--s-1); }
.tool-menu button {
  padding: var(--s-2) var(--s-3);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  border-radius: var(--r-2);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.tool-menu button:hover { background: var(--surface-1); color: var(--text-primary); }

/* ══════════════════════════════════════════════
   CONVERSATION PANEL
   ══════════════════════════════════════════════ */
.conversation-toggle {
  position: absolute;
  left: 0;
  top: var(--s-3);
  z-index: 24;
  border: 1px solid rgba(230,168,23,0.22);
  background: rgba(20,14,32,0.85);
  color: var(--amber);
  border-radius: var(--r-full);
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all var(--dur-fast);
}
.conversation-toggle:hover {
  background: rgba(230,168,23,0.12);
  border-color: rgba(230,168,23,0.42);
}

.conversation-panel {
  position: absolute;
  left: 0;
  top: 48px;
  bottom: 140px;
  width: 300px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  background: rgba(12,9,20,0.96);
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-3);
  backdrop-filter: blur(24px);
  transform: translateX(0);
  opacity: 1;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out);
}

.conversation-panel.collapsed {
  transform: translateX(-110%);
  opacity: 0;
  pointer-events: none;
}

.conversation-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cinder);
  margin-bottom: 2px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  min-height: 0;
  overflow-y: auto;
  flex: 1;
}

.conversation-item {
  padding: 10px 12px;
  border-radius: var(--r-3);
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  cursor: pointer;
  transition: all var(--dur-fast);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.conversation-item:hover { background: var(--surface-2); border-color: var(--border-2); }
.conversation-item.active { background: var(--cinder-dim); border-color: var(--border-cinder); }

.conversation-preview {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.conversation-time {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.conversation-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  border-top: 1px solid var(--border-1);
  padding-top: var(--s-3);
}

.muted-card {
  padding: var(--s-3);
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  border-style: dashed;
}

.danger { color: var(--red) !important; border-color: rgba(248,113,113,0.2) !important; }

/* ══════════════════════════════════════════════
   RIGHT PANEL — Slide-over overlay (never pushes content)
   ══════════════════════════════════════════════ */
.right-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: var(--panel-width);
  background: rgba(13,10,20,0.97);
  border-left: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  transition: transform var(--dur-slow) var(--ease-out),
              opacity var(--dur-slow) var(--ease-out);
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(24px);
  box-shadow: -12px 0 56px rgba(0,0,0,0.65);
  pointer-events: auto;
}

.right-panel.collapsed {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* Backdrop behind the slide-over */
.right-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.40);
  backdrop-filter: blur(2px);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.right-panel-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.panel-section { margin-bottom: var(--s-5); }

/* ══════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════ */
.subtle-footer {
  padding: 10px var(--s-7) 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid rgba(230,168,23,0.07);
  background: linear-gradient(to top, rgba(14,10,22,0.85), rgba(14,10,22,0.30));
}

.footer-badge-muted {
  font-style: italic;
  font-weight: 600;
  font-size: 11px;
  color: rgba(225,195,120,0.85);
  padding: 7px 20px;
  border-radius: var(--r-full);
  background: rgba(14,10,20,0.70);
  border: 1px solid rgba(200,170,80,0.18);
  letter-spacing: 0.015em;
  box-shadow: 0 0 18px rgba(200,170,80,0.07);
  transition: all var(--dur-base);
}

.footer-badge-muted:hover {
  color: rgba(245,220,165,0.98);
  border-color: rgba(200,170,80,0.32);
}

/* ══════════════════════════════════════════════
   TYPING / STREAMING INDICATORS
   ══════════════════════════════════════════════ */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.typing span {
  width: 4px; height: 4px;
  background: var(--cinder);
  border-radius: 50%;
  animation: blink 1.4s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

/* ══════════════════════════════════════════════
   CATALOG / TOOLS
   ══════════════════════════════════════════════ */
.tools-shell {
  display: grid;
  grid-template-columns: 248px minmax(0,1fr);
  gap: var(--s-5);
  align-items: start;
}

.tools-rail {
  position: sticky;
  top: var(--s-7);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.catalog-search {
  width: 100%;
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  background: rgba(14,10,24,0.80);
  color: var(--text-primary);
  padding: 10px var(--s-3);
  font: inherit;
  font-size: var(--type-xs);
  outline: none;
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
}
.catalog-search:focus {
  border-color: rgba(230,168,23,0.45);
  box-shadow: 0 0 0 3px rgba(230,168,23,0.08);
}

.filter-group {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: var(--surface-1);
  padding: var(--s-2);
  overflow: hidden;
}

.filter-section-label {
  font-size: 9px;
  font-weight: 900;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: var(--s-1) var(--s-2) var(--s-2);
}

.filter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 8px var(--s-2);
  border-radius: var(--r-2);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--type-xs);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.filter-btn:hover { background: var(--surface-2); color: var(--text-secondary); }
.filter-btn.active { background: rgba(230,168,23,0.09); color: var(--amber); }

.filter-count {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-dim);
  background: var(--surface-1);
  border-radius: var(--r-full);
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}

.catalog-stack { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }

.catalog-section {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: rgba(255,255,255,0.025);
  overflow: hidden;
}

.catalog-section-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-1);
  background: rgba(0,0,0,0.15);
}

.catalog-section-title strong { color: var(--text-primary); font-size: var(--type-sm); font-family:var(--font-ui,system-ui,sans-serif); }
.catalog-section-title span   { color: var(--text-muted); font-size: 11px; }

.catalog-count {
  color: var(--amber);
  border: 1px solid rgba(230,168,23,0.22);
  background: rgba(230,168,23,0.08);
  border-radius: var(--r-full);
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.catalog-items {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(300px,1fr));
  gap: var(--s-2);
  padding: var(--s-3);
}

.catalog-item {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r-3);
  background: rgba(10,8,14,0.35);
  padding: var(--s-3);
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  gap: var(--s-3);
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.catalog-item:hover {
  border-color: rgba(230,168,23,0.20);
  background: rgba(255,255,255,0.04);
  transform: translateY(-1px);
}

.catalog-item.status-error { border-color: rgba(248,113,113,0.22); }
.catalog-item.status-setup_needed, .catalog-item.status-setup_required { border-color: rgba(230,168,23,0.22); }
.catalog-item.status-disabled, .catalog-item.status-disabled_by_config { opacity: 0.72; }

.item-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-3);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-1);
  color: var(--amber);
  background: rgba(230,168,23,0.08);
}
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.item-top { display: flex; justify-content: space-between; gap: var(--s-2); align-items: flex-start; }
.item-name { color: var(--text-primary); font-size: var(--type-xs); font-weight: 700; line-height: 1.3; }
.item-description { color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.item-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.item-note { color: var(--text-dim); font-size: 11px; line-height: 1.45; }
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }

.chip {
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  border-radius: var(--r-full);
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

.item-badge {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  border: 1px solid var(--border-1);
  font-family: 'JetBrains Mono', monospace;
}
.badge-active         { color: var(--green);   background: rgba(52,211,153,0.10); border-color: rgba(52,211,153,0.22); }
.badge-available      { color: var(--info);    background: rgba(96,165,250,0.10); border-color: rgba(96,165,250,0.22); }
.badge-degraded       { color: var(--warning); background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.22); }
.badge-setup_needed, .badge-setup_required { color: var(--warning); background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.22); }
.badge-error, .badge-failed { color: var(--red); background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.22); }
.badge-disabled, .badge-disabled_by_config { color: var(--neutral); background: var(--surface-1); border-color: var(--border-1); }
.badge-recommended    { color: var(--amber); background: rgba(230,168,23,0.10); border-color: rgba(230,168,23,0.22); }

.item-action {
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  text-transform: uppercase;
  transition: all var(--dur-fast);
}
.item-action:hover { color: var(--amber); border-color: rgba(230,168,23,0.3); background: rgba(230,168,23,0.07); }

.catalog-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: var(--s-3);
}
.catalog-metric {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: var(--surface-1);
  padding: var(--s-4);
}
.catalog-metric .label { color: var(--text-dim); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.catalog-metric .value { margin-top: var(--s-2); color: var(--gold); font-size: 24px; font-weight: 900; font-family:var(--font-ui,system-ui,sans-serif); }

.mode-panel {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: linear-gradient(145deg, rgba(131,92,255,0.09), rgba(255,255,255,0.025));
  padding: var(--s-4);
}
.mode-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-3); }
.mode-description { color: var(--text-muted); font-size: var(--type-xs); line-height: 1.6; max-width: 720px; }
.mode-chain { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mode-chain .chip { border-color: rgba(131,92,255,0.22); background: rgba(131,92,255,0.08); color: var(--text-secondary); }
.mode-select {
  min-width: 220px;
  border: 1px solid rgba(230,168,23,0.18);
  border-radius: var(--r-3);
  background: rgba(14,10,24,0.85);
  color: var(--text-primary);
  padding: 8px 12px;
  font: inherit; font-size: var(--type-xs); font-weight: 700;
  outline: none; width: auto;
}
.manual-picker { display: none; margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border-1); color: var(--text-muted); font-size: var(--type-xs); }
.manual-picker.active { display: block; }
.manual-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.manual-toggle input { accent-color: var(--amber); }

/* ══════════════════════════════════════════════
   ADMIN COMMAND CENTER
   ══════════════════════════════════════════════ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px,1fr));
  gap: var(--s-3);
}

.subsystem-card {
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: var(--surface-1);
  padding: var(--s-4) var(--s-5);
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur-base), background var(--dur-base);
}

.subsystem-card.severity-healthy { border-color: rgba(52,211,153,0.18); }
.subsystem-card.severity-warning { border-color: rgba(251,191,36,0.22); }
.subsystem-card.severity-error   { border-color: rgba(248,113,113,0.22); }

.subsystem-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--dur-base);
}
.subsystem-card.severity-healthy::before { background: linear-gradient(90deg, var(--green), transparent); }
.subsystem-card.severity-warning::before { background: linear-gradient(90deg, var(--warning), transparent); }
.subsystem-card.severity-error::before   { background: linear-gradient(90deg, var(--red), transparent); }

.subsystem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-3);
}

.subsystem-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--type-sm);
  color: var(--text-primary);
}

.subsystem-row {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
}
.subsystem-row:last-child { border-bottom: none; }
.subsystem-row-key { color: var(--text-muted); font-weight: 500; }
.subsystem-row-val {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-align: right;
  word-break: break-all;
  max-width: 60%;
}

/* Live Pulse */
.live-pulse {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
  font-family: 'JetBrains Mono', monospace;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: var(--r-full);
  animation: live-blink 1.8s infinite;
  box-shadow: 0 0 6px rgba(52,211,153,0.7);
}

/* Admin tool card */
.admin-tool-card {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  transition: all var(--dur-fast);
}
.admin-tool-card:hover { background: var(--surface-2); border-color: var(--border-2); }

/* ══════════════════════════════════════════════
   TOR BROWSER — Arc-Inspired
   ══════════════════════════════════════════════ */
.tor-browser-shell {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-1);
  border-radius: var(--r-4);
  background: var(--surface-1);
  overflow: hidden;
  height: calc(100vh - 280px);
  min-height: 480px;
}

.tor-chrome {
  background: rgba(14,10,22,0.95);
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}

.tor-tab-bar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: var(--s-2) var(--s-3) 0;
}

.tor-tab {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px var(--s-3);
  border-radius: var(--r-3) var(--r-3) 0 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-1);
  border-bottom: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all var(--dur-fast);
}
.tor-tab.active {
  background: rgba(20,15,32,0.95);
  color: var(--text-primary);
  border-color: var(--border-1);
}
.tor-tab:hover { background: var(--surface-2); }
.tor-tab-new {
  width: 28px; height: 28px;
  border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-1);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--dur-fast);
  flex-shrink: 0;
}
.tor-tab-new:hover { background: var(--surface-2); color: var(--text-secondary); }

.tor-nav-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
}

.tor-nav-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-2);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--dur-fast);
  flex-shrink: 0;
}
.tor-nav-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text-secondary); }
.tor-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.tor-security-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-2);
  background: rgba(52,211,153,0.10);
  border: 1px solid rgba(52,211,153,0.22);
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.tor-security-badge.disconnected {
  background: rgba(248,113,113,0.10);
  border-color: rgba(248,113,113,0.22);
  color: var(--red);
}

.tor-url-bar {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  color: var(--text-primary);
  padding: 5px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  outline: none;
  transition: all var(--dur-base);
  width: auto;
}
.tor-url-bar:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(230,168,23,0.40);
  box-shadow: 0 0 0 3px rgba(230,168,23,0.08);
}

.tor-load-bar {
  height: 2px;
  background: var(--border-1);
  position: relative;
  overflow: hidden;
}
.tor-load-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--cinder), var(--amber));
  border-radius: var(--r-full);
  width: 0%;
  transition: width 0.3s var(--ease-out);
}
.tor-load-progress.loading { animation: load-sweep 1.5s infinite var(--ease-io); }

.tor-content-area {
  flex: 1;
  overflow: auto;
  padding: var(--s-5) var(--s-6);
  font-size: var(--type-xs);
  color: var(--text-secondary);
  line-height: 1.75;
  white-space: pre-wrap;
  font-family: inherit;
}

.tor-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  color: var(--text-dim);
  font-size: var(--type-sm);
}

.tor-status-bar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 6px var(--s-4);
  border-top: 1px solid var(--border-1);
  background: rgba(10,8,18,0.60);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  flex-shrink: 0;
}

.tor-circuit-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* Tor Status Grid */
.tor-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
  gap: var(--s-3);
}

/* ══════════════════════════════════════════════
   ANIMATIONS & KEYFRAMES
   ══════════════════════════════════════════════ */
@keyframes blink {
  0%,100% { opacity: 0.15; }
  50%      { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
@keyframes shimmer-gold {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 20px rgba(230,168,23,0.12); }
  50%      { box-shadow: 0 0 40px rgba(230,168,23,0.38); }
}
@keyframes pulse-cinder {
  0%,100% { box-shadow: 0 0 30px rgba(155,126,240,0.12), var(--glow-cinder); }
  50%      { box-shadow: 0 0 60px rgba(155,126,240,0.35), var(--glow-cinder); }
}
@keyframes pulse-status {
  0%,100% { opacity: 0.7; }
  50%      { opacity: 1; }
}
@keyframes thinking-bounce {
  0%,100% { transform: scale(0.7); opacity: 0.4; }
  50%      { transform: scale(1.2); opacity: 1; }
}
@keyframes live-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.25; }
}
@keyframes load-sweep {
  0%   { transform: translateX(-100%); width: 60%; }
  100% { transform: translateX(200%); width: 60%; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes gradient-drift {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes typing-cursor {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes wizard-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes float {
  0%,100% { transform: translateY(0px); }
  50%      { transform: translateY(-6px); }
}

/* ══════════════════════════════════════════════
   UTILITY CLASSES
   ══════════════════════════════════════════════ */
.animate-fade-in    { animation: fadeIn    var(--dur-slow) var(--ease-out); }
.animate-slide-up   { animation: slideUp   var(--dur-base) var(--ease-out); }
.animate-slide-right { animation: slideRight var(--dur-base) var(--ease-out); }
.animate-pulse-glow  { animation: pulse-glow   4s infinite ease-in-out; }
.animate-pulse-cinder { animation: pulse-cinder 5s infinite ease-in-out; }
.animate-page-enter  { animation: page-enter 320ms var(--ease-out) both; }
.animate-float       { animation: float 4s ease-in-out infinite; }

.hover-lift { transition: transform var(--dur-fast) var(--ease-out); }
.hover-lift:hover { transform: translateY(-2px); }
.hover-glow:hover { box-shadow: var(--glow-amber); }

/* ── Cinematic shimmer for premium loading states ── */
.shimmer-gold {
  background: linear-gradient(90deg,
    rgba(201,168,76,0.04) 0%,
    rgba(230,168,23,0.14) 40%,
    rgba(201,168,76,0.04) 80%);
  background-size: 200% 100%;
  animation: shimmer-gold 2.2s infinite;
}

/* ── Typing cursor for streaming text ── */
.typing-cursor::after {
  content: '▋';
  display: inline;
  animation: typing-cursor 0.85s step-end infinite;
  color: var(--cinder);
  font-size: 0.85em;
  margin-left: 1px;
}

/* ── Onboarding / First-Run Wizard ── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 15000;
  background: rgba(4,3,9,0.88);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5);
}
.onboarding-card {
  width: min(540px,94vw);
  background: linear-gradient(160deg, rgba(20,16,30,0.99), rgba(13,10,20,0.99));
  border: 1px solid rgba(155,126,240,0.22);
  border-radius: 20px;
  padding: var(--s-8) var(--s-7);
  box-shadow: 0 40px 120px rgba(0,0,0,0.75), 0 0 0 1px rgba(155,126,240,0.08);
  animation: wizard-rise 420ms var(--ease-out) both;
  position: relative;
  overflow: hidden;
}
.onboarding-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155,126,240,0.12), transparent 70%);
  pointer-events: none;
}
.onboarding-step-indicator {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}
.onboarding-step-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--surface-2);
  transition: all var(--dur-base) var(--ease-out);
}
.onboarding-step-dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--amber);
}
.onboarding-step-dot.done { background: var(--green); }

/* ── Inline image preview in chat ── */
.chat-image-preview {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: rgba(155,126,240,0.06);
  border: 1px solid rgba(155,126,240,0.18);
  border-radius: var(--r-3);
  margin-bottom: var(--s-2);
}
.chat-image-preview img {
  width: 48px; height: 48px;
  object-fit: cover;
  border-radius: var(--r-2);
}
.chat-image-preview-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-image-preview-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: var(--r-1);
  transition: color var(--dur-fast);
}
.chat-image-preview-remove:hover { color: var(--red); }

/* ── Composer attach button ── */
.composer-attach-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-io);
  flex-shrink: 0;
}
.composer-attach-btn:hover {
  color: var(--cinder);
  background: var(--cinder-dim);
}

/* ── Message image attachment ── */
.message-image-attachment {
  margin-bottom: var(--s-3);
  border-radius: var(--r-3);
  overflow: hidden;
  border: 1px solid var(--border-1);
  max-width: 320px;
}
.message-image-attachment img {
  width: 100%;
  display: block;
  object-fit: cover;
}

/* ── Adaptive suggestion chips with gradient hover ── */
.suggestion-chip-adaptive {
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-1);
  border-radius: var(--r-3);
  padding: var(--s-3) var(--s-4);
  font-family: inherit;
  font-size: var(--type-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease-out);
  text-align: left;
  line-height: 1.5;
  position: relative;
  overflow: hidden;
}
.suggestion-chip-adaptive::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(155,126,240,0.08), rgba(230,168,23,0.04));
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-io);
}
.suggestion-chip-adaptive:hover { border-color: var(--border-cinder); color: var(--text-primary); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.suggestion-chip-adaptive:hover::before { opacity: 1; }

/* ── Runtime transparency bar ── */
.runtime-transparency-bar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  background: rgba(10,8,14,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: var(--s-3);
  letter-spacing: 0.02em;
}
.runtime-transparency-bar .rtb-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.rtb-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(52,211,153,0.5);
  flex-shrink: 0;
}

.text-gradient {
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gold   { color: var(--gold); }
.text-amber  { color: var(--amber); }
.text-cinder { color: var(--cinder); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-muted      { color: var(--text-muted); }
.text-dim        { color: var(--text-dim); }
.text-secondary  { color: var(--text-secondary); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Performance */
.glass-card,
.conversation-panel,
.catalog-section,
.tor-browser-shell {
  contain: layout paint;
}
/* right-panel is position:fixed — only safe to contain paint, not layout */
.right-panel { contain: paint; }

html, body, .app-container, .content-area, .glass-card { min-width: 0; }
canvas, svg, img, video { max-width: 100%; }
.content-area > *, .page-header, .page-header-actions { min-width: 0; }

/* ══════════════════════════════════════════════
   GLOBAL TOAST
   ══════════════════════════════════════════════ */
#dedwen-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.dedwen-toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: var(--r-3);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  border: 1px solid;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-3);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp var(--dur-base) var(--ease-out);
  min-width: 240px;
  max-width: 360px;
}
.dedwen-toast.toast-success { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.28); color: var(--green); }
.dedwen-toast.toast-error   { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.28); color: var(--red); }
.dedwen-toast.toast-info    { background: rgba(96,165,250,0.12);  border-color: rgba(96,165,250,0.28);  color: var(--info); }
.dedwen-toast.toast-warning { background: rgba(251,191,36,0.12);  border-color: rgba(251,191,36,0.28);  color: var(--warning); }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 1280px) {
  :root { --panel-width: 280px; }
  .content-area { padding: var(--s-6); }
  .catalog-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 1024px) {
  .tools-shell { grid-template-columns: 1fr; }
  .tools-rail  { position: static; }
  .catalog-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 768px) {
  :root {
    --nav-width:      56px;
    --nav-width-open: 56px;
    --panel-width:    100%;
  }
  .left-dock:hover { width: var(--nav-width); box-shadow: none; background: rgba(13,10,20,0.96); }
  .dock-label { display: none !important; }
  .right-panel {
    width: 100%;
    max-width: 340px;
  }
  .assistant-container { padding: 0 var(--s-3); }
  .message { max-width: 98%; }
  .message-content { max-width: 100%; }
  .page-header { flex-direction: column; align-items: stretch; gap: var(--s-3); }
  .page-header-actions { flex-wrap: wrap; justify-content: flex-start; gap: var(--s-2); }
  .content-area { padding: var(--s-4); overflow-x: hidden; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .tor-browser-shell { height: auto; min-height: 400px; }
  /* Portfolio cards single column */
  .portfolio-grid, [style*="grid-template-columns: repeat(4"] { grid-template-columns: 1fr 1fr !important; }
  /* Mining telemetry 2-col on tablet */
  [style*="grid-template-columns: repeat(7"] { grid-template-columns: repeat(4, minmax(0,1fr)) !important; }
  /* Touch targets */
  button, .btn-primary, .btn-secondary, .btn-ghost { min-height: 44px; }
  .dock-item { min-height: 44px; }
  /* Signal panel stack on mobile */
  #signal > div:last-child { grid-template-columns: 1fr !important; }
  #signal-conv-list { max-height: 120px; overflow-y: auto; }
}

@media (max-width: 480px) {
  .content-area { padding: var(--s-3); }
  .app-container { overflow-x: hidden; }
  .dock-nav { padding: 0 var(--s-1); }
  .dock-item { padding: 0 var(--s-2); justify-content: center; }
  .dock-icon { margin-right: 0; }
  .input-dock { padding: var(--s-3) 0 var(--s-5); }
  .empty-state-title { font-size: 26px; }
  .catalog-items { grid-template-columns: 1fr; }
  /* Mining telemetry 2-col on phone */
  [style*="grid-template-columns: repeat(7"] { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
  [style*="grid-template-columns: repeat(4"] { grid-template-columns: 1fr 1fr !important; }
  .glass-card { padding: var(--s-3) !important; }
}

@media (max-width: 375px) {
  :root { --nav-width: 48px; }
  .dock-item { padding: 0; min-height: 48px; }
  .content-area { padding: var(--s-2); }
  .empty-state-title { font-size: 20px; }
  .message { max-width: 100%; }
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

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

/* ══════════════════════════════════════════════════════════════════════
   EXPERIENTIAL FLAGSHIP — Ambient · Presence · Convergence
   DedwenAI v5 — Living Operator Experience
   ══════════════════════════════════════════════════════════════════════ */

/* ── Ambient animations ─────────────────────────────────────────────── */
@keyframes ambient-breathe {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%       { opacity: 1;    transform: scale(1.06); }
}
@keyframes ambient-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(155,126,240,0); }
  50%       { box-shadow: 0 0 0 6px rgba(155,126,240,0.10); }
}
@keyframes slide-down-fade {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slide-up-fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes message-reveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes context-pulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; }
}
@keyframes heartbeat {
  0%   { transform: scale(1);    opacity: 0.6; }
  14%  { transform: scale(1.25); opacity: 1; }
  28%  { transform: scale(1);    opacity: 0.8; }
  42%  { transform: scale(1.15); opacity: 1; }
  70%  { transform: scale(1);    opacity: 0.6; }
  100% { transform: scale(1);    opacity: 0.6; }
}
@keyframes thinking-orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes scan-line {
  0%   { transform: translateY(-100%); opacity: 0; }
  10%  { opacity: 0.4; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(100%); opacity: 0; }
}

/* ── Cognitive Continuity Bar ───────────────────────────────────────── */
.cognitive-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 16px;
  background: rgba(13,10,20,0.85);
  border-bottom: 1px solid rgba(155,126,240,0.10);
  backdrop-filter: blur(16px);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  flex-shrink: 0;
  animation: slide-down-fade 0.4s var(--ease-out);
  position: relative;
}

.cognitive-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(155,126,240,0.04) 50%,
    transparent 100%);
  pointer-events: none;
}

.cbar-section {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-right: 1px solid rgba(255,255,255,0.05);
  min-width: 0;
  flex-shrink: 0;
}

.cbar-section:first-child { padding-left: 0; }
.cbar-section:last-child  { border-right: none; margin-left: auto; padding-right: 0; }

.cbar-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--green);
  animation: ambient-breathe 3s ease-in-out infinite;
}
.cbar-dot.amber  { background: var(--amber); }
.cbar-dot.muted { background: var(--cinder); animation-delay: 0.8s; }
.cbar-dot.blue   { background: var(--blue); animation-delay: 1.6s; }
.cbar-dot.dim    { background: var(--neutral); animation: none; opacity: 0.4; }

.cbar-label {
  color: var(--text-ultra-dim);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.cbar-value {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.cbar-value.highlight { color: var(--cinder); }
.cbar-value.amber     { color: var(--amber); }

/* ── Ambient Presence Overlay (shown during inference) ──────────────── */
.ambient-thinking {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.4s var(--ease-io);
  overflow: hidden;
}

.ambient-thinking.active { opacity: 1; }

.ambient-thinking::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--cinder) 30%,
    var(--amber) 60%,
    transparent 100%);
  animation: scan-line 2s ease-in-out infinite;
}

/* ── Message enhancements ────────────────────────────────────────────── */
.message {
  animation: message-reveal 0.3s var(--ease-out) both;
}

.message-content code {
  background: rgba(155,126,240,0.12);
  border: 1px solid rgba(155,126,240,0.18);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: var(--cinder);
}

.message-content pre {
  background: rgba(10,8,18,0.85);
  border: 1px solid var(--border-1);
  border-left: 3px solid var(--cinder);
  border-radius: var(--r-3);
  padding: var(--s-4);
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  margin: var(--s-3) 0;
  color: var(--text-secondary);
  position: relative;
}

.message-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.message-content blockquote {
  border-left: 3px solid var(--amber);
  padding-left: var(--s-4);
  margin: var(--s-3) 0;
  color: var(--text-muted);
  font-style: italic;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  color: var(--text-primary);
  margin: var(--s-3) 0 var(--s-2);
  font-family: var(--font-sans);
}

.message-content ul,
.message-content ol {
  padding-left: var(--s-5);
  margin: var(--s-2) 0;
  color: var(--text-secondary);
}

.message-content li { margin-bottom: var(--s-1); }

.message-content hr {
  border: none;
  border-top: 1px solid var(--border-1);
  margin: var(--s-4) 0;
}

.message-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: var(--s-3) 0;
}

.message-content th,
.message-content td {
  padding: 6px 10px;
  border: 1px solid var(--border-1);
  text-align: left;
}

.message-content th {
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* ── Character presence badge (on AI messages) ──────────────────────── */
.character-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--cinder-dim);
  border: 1px solid var(--border-cinder);
  font-size: 10px;
  font-weight: 700;
  color: var(--cinder);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Context cross-links (convergence access) ────────────────────────── */
.convergence-strip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) 0 0;
  flex-wrap: wrap;
}

.conv-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--dur-fast) var(--ease-io);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.conv-link:hover {
  background: var(--cinder-dim);
  border-color: var(--border-cinder);
  color: var(--cinder);
  transform: translateY(-1px);
}

.conv-link.active {
  background: var(--cinder-dim);
  border-color: var(--border-cinder);
  color: var(--cinder);
}

/* ── System heartbeat (dock footer) ──────────────────────────────────── */
.dock-heartbeat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--s-2) var(--s-3);
  opacity: 0.65;
}

.dock-heartbeat-icon {
  font-size: 13px;
  animation: heartbeat 4s ease-in-out infinite;
  display: inline-block;
}

.dock-heartbeat-text {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.left-dock:hover .dock-heartbeat-text { opacity: 1; }

/* ── Ambient intelligence state on empty canvas ─────────────────────── */
.ambient-orbit {
  position: relative;
  width: 80px; height: 80px;
}

.ambient-orbit .orbit-ring {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1px solid rgba(155,126,240,0.15);
  animation: thinking-orbit 8s linear infinite;
}

.ambient-orbit .orbit-ring::after {
  content: '';
  position: absolute;
  top: -2px; left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--cinder);
  transform: translateX(-50%);
  box-shadow: 0 0 8px var(--cinder);
}

.ambient-orbit .orbit-ring.alt-spin {
  animation: orbit-rotate-alt 12s linear infinite;
  inset: -28px;
  border-color: rgba(230,168,23,0.10);
}

.ambient-orbit .orbit-ring.alt-spin::after { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

@keyframes orbit-rotate-alt {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

/* ── Thinking state during inference ─────────────────────────────────── */
.inference-progress {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: rgba(155,126,240,0.06);
  border: 1px solid rgba(155,126,240,0.12);
  border-radius: var(--r-4);
  animation: slide-up-fade 0.25s var(--ease-out);
  margin: var(--s-3) 0;
}

.inference-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(155,126,240,0.25);
  border-top-color: var(--cinder);
  border-radius: 50%;
  animation: thinking-orbit 0.7s linear infinite;
  flex-shrink: 0;
}

.inference-label {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--cinder);
  opacity: 0.85;
}

.inference-domain {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Model transparency badge (on message) ───────────────────────────── */
.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: rgba(230,168,23,0.08);
  border: 1px solid rgba(230,168,23,0.18);
  font-size: 9px;
  font-weight: 800;
  color: var(--amber);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Cross-system panel (right panel enhanced) ───────────────────────── */
.context-panel-section {
  background: rgba(155,126,240,0.04);
  border: 1px solid rgba(155,126,240,0.10);
  border-radius: var(--r-3);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-3);
}

.context-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  padding: 3px 0;
}

.context-panel-row .label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.context-panel-row .value {
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Animated page entry ─────────────────────────────────────────────── */
.main-viewport {
  animation: fadeIn 0.35s var(--ease-out);
}

/* ── Enhanced dock active state ──────────────────────────────────────── */
.dock-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(230,168,23,0.5);
}

/* ── Nav item hover glow ─────────────────────────────────────────────── */
.dock-item:hover .dock-icon svg {
  filter: drop-shadow(0 0 4px rgba(155,126,240,0.4));
  transition: filter var(--dur-base) var(--ease-io);
}

/* ── Input dock glow on focus ────────────────────────────────────────── */
.composer-wrap:focus-within {
  box-shadow: 0 0 0 1px rgba(155,126,240,0.20), 0 0 32px rgba(155,126,240,0.06);
  transition: box-shadow var(--dur-base) var(--ease-io);
}

/* ── Section: memory recall chip ─────────────────────────────────────── */
.memory-recall-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.18);
  font-size: 9px;
  font-weight: 800;
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-io);
}

.memory-recall-chip:hover {
  background: rgba(52,211,153,0.14);
  transform: translateY(-1px);
}


/* ══════════════════════════════════════════════
   DESIGN SYSTEM UTILITIES (Phase 2 — Token Migration)
   ══════════════════════════════════════════════ */

/* Form input utility — replaces repeated inline styles in
   settings.html, mining.html, trading.html form controls */
.ds-input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--type-sm);
  transition: border-color var(--transition-fast);
}
.ds-input:focus {
  border-color: var(--accent-amber);
  outline: none;
}

/* Compact select variant for toolbar controls */
.ds-select {
  background: var(--surface-1);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  color: var(--text-primary);
  font-family: inherit;
}

/* Status color utilities for JS-rendered elements */
.color-active   { color: var(--status-active); }
.color-warning  { color: var(--status-warning); }
.color-error    { color: var(--status-error); }
.color-neutral  { color: var(--status-neutral); }
.color-disabled { color: var(--status-disabled); }
.color-success  { color: var(--success); }
.color-danger   { color: var(--danger); }

/* Status dot indicator — small colored circle */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.status-dot--active   { background: var(--status-active); }
.status-dot--error    { background: var(--status-error); }
.status-dot--warning  { background: var(--status-warning); }
.status-dot--neutral  { background: var(--status-neutral); }
.status-dot--disabled { background: var(--status-disabled); }

/* Meta chip variants (provider labels in chat messages) */
.meta-chip.provider-local {
  background: rgba(74,222,128,0.07);
  border: 1px solid rgba(74,222,128,0.18);
  color: var(--status-active);
}
.meta-chip.provider-cloud {
  background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.18);
  color: var(--status-warning);
}

/* Connector toggle button variants */
.btn-connector-enable {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(74,222,128,0.15);
  color: var(--status-active);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}
.btn-connector-disable {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--red-dim);
  color: var(--status-error);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

/* Approval/rejection inline badges */
.badge-approved {
  color: var(--status-active);
  font-weight: 700;
  font-size: 11px;
}
.badge-rejected {
  color: var(--status-error);
  font-weight: 700;
  font-size: 11px;
}

/* Ultra-Ego toggle switch */
.ultra-ego-switch {
  width: 48px;
  height: 26px;
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background var(--dur-base), border-color var(--dur-base);
}
.ultra-ego-switch--on {
  background: var(--cinder-soft);
  border: 1px solid rgba(167,139,250,0.5);
}
.ultra-ego-switch--off {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
}
.ultra-ego-knob {
  position: absolute;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: left var(--dur-base);
  box-shadow: var(--shadow-1);
}
.ultra-ego-knob--on  { left: 24px; }
.ultra-ego-knob--off { left: 3px; }

/* ══════════════════════════════════════════════
   MOBILE HAMBURGER SHEET
   At ≤768px the left dock becomes a hidden sheet
   that slides in on demand. Full-width content.
   ══════════════════════════════════════════════ */
.mob-ham-btn { display: none; }
.mob-topbar  { display: none; }
.mob-nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(4,6,12,0.72);
  backdrop-filter: blur(3px);
  z-index: 1998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

@media (max-width: 768px) {
  /* Dock becomes a fixed off-screen sheet */
  .left-dock {
    position: fixed !important;
    top: 0; left: 0;
    height: 100dvh !important;
    width: min(280px, 82vw) !important;
    transform: translateX(-100%);
    z-index: 2000;
    transition: transform 0.26s var(--ease-out), box-shadow 0.26s;
    overflow-y: auto;
    padding-top: var(--s-5) !important;
  }
  /* Show labels when sheet is open */
  body.mob-nav-open .left-dock { transform: translateX(0); box-shadow: 6px 0 48px rgba(0,0,0,0.65); }
  body.mob-nav-open .left-dock .dock-label { display: flex !important; }
  body.mob-nav-open .left-dock .dock-heartbeat-text { opacity: 1; }
  /* Prevent hover expansion on mobile */
  .left-dock:hover {
    width: min(280px, 82vw) !important;
    box-shadow: none;
  }
  body.mob-nav-open .left-dock:hover {
    box-shadow: 6px 0 48px rgba(0,0,0,0.65);
  }
  /* Scrim active */
  body.mob-nav-open .mob-nav-scrim { opacity: 1; pointer-events: auto; }
  body.mob-nav-open { overflow: hidden; }

  /* Mobile top bar */
  .mob-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border-1);
    background: rgba(13,10,20,0.97);
    min-height: 52px;
    flex-shrink: 0;
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 500;
  }
  .mob-ham-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--r-2);
    padding: 0;
    flex-shrink: 0;
    transition: color var(--dur-fast), background var(--dur-fast);
  }
  .mob-ham-btn:hover  { color: var(--text-primary); background: rgba(255,255,255,0.07); }
  .mob-ham-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
  .mob-topbar-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    flex: 1;
    font-family: var(--font-ui);
  }
  /* Push main-viewport to full width — dock is now fixed, not in flex flow */
  .main-viewport { width: 100%; }
}

/* Regenerate button on AI messages */
.msg-regen-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r-2);
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
  font-family: var(--font-mono);
}
.msg-regen-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(230,168,23,0.25);
  background: rgba(230,168,23,0.05);
}
.msg-regen-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.msg-regen-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.msg-regen-btn svg { opacity: 0.7; }

/* ══════════════════════════════════════════════
   UI RESCUE OVERRIDES
   Quiet shell, restrained auth, and page-frame reset
   ══════════════════════════════════════════════ */
body {
  background: var(--bg);
  background-image: none;
}

.app-container {
  background:
    radial-gradient(circle at top left, rgba(200, 165, 96, 0.04), transparent 28%),
    linear-gradient(180deg, #11100e 0%, #13110f 100%);
}

.left-dock.app-sidebar {
  width: 272px;
  align-items: stretch;
  padding: 24px 18px 20px;
  background: rgba(19, 17, 15, 0.96);
  border-right: 1px solid var(--border-default);
  backdrop-filter: none;
  box-shadow: none;
}

.left-dock:hover {
  width: var(--sidebar-open-width);
  background: var(--sidebar-bg);
  box-shadow: none;
}

.app-brand {
  display: grid;
  gap: 10px;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.app-brand-link,
.mobile-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
}

.app-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 1px rgba(200, 165, 96, 0.28);
}

.app-brand-wordmark,
.mob-topbar-title,
.auth-brand-wordmark {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.app-brand-subtitle {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-tertiary);
}

.dock-nav.app-nav {
  display: grid;
  gap: 4px;
}

.dock-divider,
.dock-heartbeat,
.subtle-footer,
.footer-badge-muted,
.right-panel-backdrop,
.status-dot#sys-dot-nav,
#status-toggle-btn,
.right-panel {
  display: none !important;
}

.dock-item.app-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  text-decoration: none;
  background: transparent;
  transition: background var(--dur-fast) var(--ease-io), color var(--dur-fast) var(--ease-io), border-color var(--dur-fast) var(--ease-io);
}

.dock-item.app-nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.dock-item.app-nav-item.active,
.dock-item.app-nav-item[aria-current="page"] {
  background: rgba(223, 157, 47, 0.08);
  border-color: rgba(223, 157, 47, 0.16);
  color: var(--text-primary);
  position: relative;
}

.dock-item.app-nav-item.active::before,
.dock-item.app-nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
  background: var(--amber);
}

.dock-icon.app-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.dock-label {
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.app-sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.app-account {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.app-account-meta {
  display: grid;
  gap: 2px;
}

.app-account-name {
  font-size: 14px;
  font-weight: 600;
}

.app-account-plan {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.app-account-actions {
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
}

.dedwen-companion-panel {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border-default);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.14);
}

.dedwen-companion-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.dedwen-companion-head strong {
  display: block;
  font-size: 14px;
}

.dedwen-companion-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.dedwen-companion-avatar {
  width: 36px;
  height: 36px;
}

.dedwen-companion-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.dedwen-companion-metrics div {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
}

.dedwen-companion-metrics dt {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.dedwen-companion-metrics dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.dedwen-companion-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.app-account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.dedwen-mascot-frame {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(223, 157, 47, 0.18);
  background:
    radial-gradient(circle at top, rgba(223, 157, 47, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(40, 31, 27, 0.96), rgba(28, 23, 19, 0.96));
  box-shadow: 0 10px 30px rgba(10, 10, 10, 0.24);
  transition: transform var(--dur-fast) var(--ease-io), box-shadow var(--dur-fast) var(--ease-io), border-color var(--dur-fast) var(--ease-io);
}

.activate-dedwen:hover .dedwen-mascot-frame,
.activate-dedwen:focus-visible .dedwen-mascot-frame {
  transform: translateY(-1px);
  border-color: rgba(223, 157, 47, 0.4);
  box-shadow: 0 14px 32px rgba(10, 10, 10, 0.34), 0 0 0 3px rgba(223, 157, 47, 0.12);
}

.dedwen-mascot-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.main-viewport.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
}

.app-main-content.content-area {
  min-width: 0;
  padding: 24px 28px 28px;
}

.mob-topbar.mobile-topbar {
  background: rgba(17, 16, 14, 0.96);
  border-bottom: 1px solid var(--border-default);
  backdrop-filter: none;
}

.page-shell {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  padding-bottom: 4px;
}

.page-kicker,
.section-title,
.mini-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.page-subtitle {
  max-width: 680px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.glass-card,
.surface,
.surface-card {
  background: linear-gradient(180deg, rgba(32, 29, 25, 0.96), rgba(25, 23, 20, 0.96));
  border: 1px solid var(--border-default);
  box-shadow: none;
  backdrop-filter: none;
}

.glass-card:hover,
.glass-card.interactive:hover {
  border-color: rgba(223, 157, 47, 0.18);
  box-shadow: none;
  transform: none;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-connect,
.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 40px;
  border-radius: 10px;
  box-shadow: none !important;
  backdrop-filter: none;
}

.btn-primary,
.primary-btn,
.btn-login {
  background: var(--amber);
  color: var(--text-on-amber);
  border: 1px solid rgba(223, 157, 47, 0.32);
}

.btn-primary:hover:not(:disabled),
.primary-btn:hover:not(:disabled),
.btn-login:hover:not(:disabled) {
  background: var(--amber-hover);
  transform: translateY(-1px);
}

.btn-secondary,
.secondary-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.btn-ghost,
.ghost-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.btn-ghost.danger,
.danger-btn {
  color: #d48b97;
  border-color: rgba(106, 46, 61, 0.3);
  background: rgba(106, 46, 61, 0.12);
}

.empty-state {
  min-height: 100%;
  justify-content: center;
  gap: 16px;
  padding: 48px 0 56px;
  text-align: left;
}

.empty-state-greeting {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  color: var(--gold);
}

.empty-state-title {
  font-size: 40px;
  line-height: 1.05;
  max-width: 560px;
}

.empty-state-sub {
  max-width: 560px;
  font-size: 15px;
}

.suggestion-grid {
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.suggestion-chip,
.suggestion-chip-adaptive {
  justify-content: flex-start;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
  color: var(--text-secondary);
}

.suggestion-chip:hover,
.suggestion-chip-adaptive:hover {
  border-color: rgba(223, 157, 47, 0.18);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.suggestion-chip-icon {
  display: none;
}

.convergence-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.conv-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
}

.conv-link:hover {
  color: var(--text-primary);
  border-color: var(--border-default);
}

.chat-messages-container {
  flex: 1;
  padding-right: 0;
}

.conversation-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.conversation-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-dock {
  padding: 18px 0 8px;
}

.composer-wrap {
  background: rgba(32, 29, 25, 0.98);
  border: 1px solid var(--border-default);
  box-shadow: none;
}

.composer-wrap:focus-within {
  border-color: rgba(223, 157, 47, 0.3);
  box-shadow: 0 0 0 2px rgba(223, 157, 47, 0.08);
}

.composer-toolbar {
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-button.muted {
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.toolbar-button.muted:hover {
  border-color: rgba(223, 157, 47, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.send-button {
  background: var(--amber);
  color: var(--text-on-amber);
}

.send-button:disabled {
  background: rgba(255,255,255,0.12);
  color: var(--text-tertiary);
}

.message-ai .message-avatar,
.message-user .message-avatar {
  display: none;
}

.message-ai .message-bubble {
  background: transparent;
  border: none;
  padding-left: 0;
  padding-right: 0;
}

.message-user .message-bubble {
  background: var(--wine-tint);
  border: 1px solid rgba(106, 46, 61, 0.28);
}

.auth-page {
  overflow: auto;
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(200, 165, 96, 0.08), transparent 28%),
    linear-gradient(180deg, #11100e 0%, #151310 100%);
}

.auth-panel {
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 12px;
}

.auth-panel-compact {
  max-width: 420px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.auth-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.auth-title {
  font-size: 32px;
  line-height: 1;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

.auth-card {
  padding: 28px;
  border-radius: 14px;
  background: rgba(24, 22, 19, 0.98);
  border: 1px solid var(--border-default);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-divider span,
.auth-status-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

.auth-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-error {
  margin-top: 16px;
  display: none;
  padding: 10px 12px;
  font-size: 13px;
  color: #dc9aa4;
  background: rgba(106, 46, 61, 0.16);
  border: 1px solid rgba(106, 46, 61, 0.28);
  border-radius: 10px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  background: rgba(255,255,255,0.03);
}

.auth-footer {
  font-size: 13px;
  color: var(--text-tertiary);
}

.auth-footer a {
  color: var(--amber);
  text-decoration: none;
}

@media (max-width: 1024px) {
  .app-main-content.content-area {
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .left-dock.app-sidebar {
    width: min(280px, 84vw) !important;
    padding: 20px 14px 16px;
  }

  .app-main-content.content-area {
    padding: 12px;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Settings surface */
.settings-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-nav-btn {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-3);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 248, 236, 0.02);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}

.settings-nav-btn:hover,
.settings-nav-btn:focus-visible {
  background: rgba(255, 248, 236, 0.05);
  border-color: var(--border-default);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.settings-nav-btn.active {
  background: rgba(223, 157, 47, 0.1);
  border-color: rgba(223, 157, 47, 0.2);
  color: var(--text-primary);
  box-shadow: inset 3px 0 0 var(--amber);
}

.settings-nav-title {
  font-size: 14px;
  font-weight: 700;
}

.settings-nav-copy {
  font-size: 12px;
  color: var(--text-tertiary);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.settings-section.active {
  display: flex;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 24px;
}

.settings-card-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-card-head-inline {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.settings-card-copy {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 64ch;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-row,
.settings-toggle-row,
.settings-kv-item,
.runtime-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--border-subtle);
}

.settings-card .settings-row:first-of-type,
.settings-card .settings-toggle-row:first-of-type,
.settings-kv-list .settings-kv-item:first-of-type,
.runtime-list .runtime-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.settings-row-copy,
.runtime-copy {
  min-width: 0;
  flex: 1;
}

.settings-row-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-row-help,
.settings-runtime-meta,
.settings-field-help,
.settings-status-note,
.settings-empty {
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-row-help,
.settings-runtime-meta,
.settings-field-help {
  margin-top: 4px;
}

.settings-status-note {
  line-height: 1.55;
  white-space: pre-wrap;
}

.settings-status-note.is-error,
.settings-empty.is-error {
  color: #dc9aa4;
}

.settings-row-control,
.settings-toggle-control,
.runtime-actions,
.settings-inline-actions,
.settings-save-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-toggle-control {
  align-self: center;
}

.settings-kv-list,
.runtime-list {
  display: flex;
  flex-direction: column;
}

.runtime-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
}

.settings-note-list {
  margin-top: 12px;
  padding-left: 18px;
  color: var(--text-secondary);
  display: grid;
  gap: 6px;
}

.settings-switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings-switch {
  position: relative;
  width: 52px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.settings-switch-track {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: rgba(255, 248, 236, 0.06);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.settings-switch-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--silver-200);
  transition: transform var(--dur-fast), background var(--dur-fast);
}

.settings-switch-input:checked + .settings-switch .settings-switch-track {
  background: rgba(223, 157, 47, 0.18);
  border-color: rgba(223, 157, 47, 0.32);
}

.settings-switch-input:checked + .settings-switch .settings-switch-knob {
  transform: translateX(22px);
  background: var(--amber);
}

.settings-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-mini-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-3);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 248, 236, 0.03);
}

.settings-mini-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.settings-mini-body {
  display: grid;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-field-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-field-block label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-field-block-wide {
  grid-column: 1 / -1;
}

.settings-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.settings-link-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: var(--r-3);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 248, 236, 0.03);
  text-decoration: none;
  color: var(--text-primary);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}

.settings-link-card:hover,
.settings-link-card:focus-visible {
  background: rgba(255, 248, 236, 0.05);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.settings-link-title {
  font-size: 14px;
  font-weight: 700;
}

.settings-link-copy {
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-compact {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.routing-mode-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-3);
  overflow: hidden;
  background: rgba(255, 248, 236, 0.02);
}

.routing-mode-card > summary {
  list-style: none;
  cursor: pointer;
}

.routing-mode-card > summary::-webkit-details-marker {
  display: none;
}

.routing-mode-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
}

.routing-mode-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.routing-model-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}

.routing-model-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-2);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 248, 236, 0.03);
}

.routing-model-row.disabled-model {
  opacity: 0.72;
}

.routing-model-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.routing-model-check input[type="checkbox"] {
  accent-color: var(--amber);
}

.routing-model-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.routing-reorder {
  display: flex;
  gap: 6px;
}

.routing-chain-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
}

@media (max-width: 1100px) {
  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  .settings-grid-two,
  .settings-link-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-head-inline,
  .settings-row,
  .settings-toggle-row,
  .settings-kv-item,
  .runtime-item {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-row-control,
  .settings-toggle-control,
  .runtime-actions,
  .settings-inline-actions,
  .settings-save-row {
    justify-content: flex-start;
  }
}

/* Tor surface */
.tor-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tor-header-actions {
  align-items: center;
}

.tor-banner {
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
}

.tor-banner.warning {
  border-color: rgba(223, 157, 47, 0.28);
  background: rgba(223, 157, 47, 0.08);
  color: var(--amber);
}

.tor-banner.danger {
  border-color: rgba(193, 103, 111, 0.28);
  background: rgba(106, 46, 61, 0.16);
  color: #dc9aa4;
}

.tor-controls-card {
  padding: 18px 20px;
  gap: 10px;
}

.tor-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tor-control-note {
  font-size: 12px;
  color: var(--text-secondary);
}

.tor-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.tor-status-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tor-status-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.tor-status-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

.tor-browser-card {
  padding: 20px;
  gap: 16px;
}

.tor-address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.tor-address-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tor-field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.tor-field-label-inline {
  margin-right: 2px;
}

.tor-go-btn {
  min-width: 84px;
}

.tor-browser-error {
  padding: 12px 14px;
  border-radius: var(--r-3);
  border: 1px solid rgba(193, 103, 111, 0.28);
  background: rgba(106, 46, 61, 0.16);
  color: #dc9aa4;
  font-size: 12px;
  font-family: var(--font-mono);
}

.tor-browser-viewport {
  position: relative;
  min-height: 460px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-3);
  overflow: hidden;
  background: rgba(8, 7, 5, 0.66);
}

.tor-browser-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 4, 3, 0.62);
  z-index: 2;
}

.tor-empty {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  text-align: center;
}

.tor-empty-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(223, 157, 47, 0.18);
  background: rgba(223, 157, 47, 0.08);
  color: var(--amber);
}

.tor-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.tor-empty-copy {
  max-width: 56ch;
  font-size: 13px;
  color: var(--text-secondary);
}

.tor-view-mode-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 248, 236, 0.03);
}

.tor-view-mode-label-group,
.tor-view-mode-actions,
.tor-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tor-view-mode-label-group {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tor-view-mode-btn {
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--r-2);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.tor-view-mode-btn.active {
  border-color: rgba(223, 157, 47, 0.28);
  background: rgba(223, 157, 47, 0.12);
  color: var(--amber);
}

.tor-browser-iframe {
  width: 100%;
  min-height: 360px;
  border: none;
  background: var(--bg-base);
}

.tor-content-area {
  min-height: 360px;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.tor-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  overflow: auto;
}

.tor-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tor-tab-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 220px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

.tor-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.tor-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tor-tab-close {
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.tor-nav-select {
  width: auto;
  min-width: 120px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-2);
  border: 1px solid var(--border-default);
  background: rgba(255, 248, 236, 0.04);
  color: var(--text-primary);
}

.tor-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.tor-circuit-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tor-circuit-badge-waiting {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(223, 157, 47, 0.22);
  background: rgba(223, 157, 47, 0.08);
  color: var(--amber);
}

.tor-details-card {
  padding: 20px;
  gap: 16px;
}

.tor-details-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.tor-details-panel {
  display: block;
}

.tor-details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tor-detail-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.tor-detail-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.tor-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tor-detail-item,
.tor-memory-item {
  padding: 12px 14px;
  border-radius: var(--r-2);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 248, 236, 0.03);
  font-size: 12px;
  color: var(--text-secondary);
}

.tor-memory-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.tor-memory-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.tor-memory-copy,
.tor-detail-copy {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tor-sandbox-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.tor-sandbox-row:first-child {
  border-top: none;
  padding-top: 0;
}

@media (max-width: 1200px) {
  .tor-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tor-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .tor-address-row {
    grid-template-columns: 1fr;
  }

  .tor-go-btn {
    width: 100%;
  }

  .tor-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tor-details-header,
  .tor-controls,
  .tor-nav-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .tor-nav-group-wide {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .tor-status-grid {
    grid-template-columns: 1fr;
  }

  .tor-browser-card,
  .tor-details-card,
  .tor-controls-card {
    padding: 16px;
  }

  .tor-empty,
  .tor-content-area,
  .tor-browser-iframe {
    min-height: 280px;
  }
}

/* ══════════════════════════════════════════════
   ERROR PAGES & EMPTY STATES
   ══════════════════════════════════════════════ */
.empty-state-compact {
  min-height: 0;
  width: 100%;
  gap: 10px;
  padding: 24px;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  border: 1px dashed var(--border-default);
  border-radius: var(--r-4);
  background: rgba(255, 255, 255, 0.018);
}

.empty-state-compact .empty-state-title {
  font-size: 20px;
  line-height: 1.15;
  max-width: none;
}

.empty-state-compact .empty-state-sub {
  font-size: 13px;
  max-width: none;
}

.error-page {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-card {
  width: min(640px, 100%);
  padding: 32px;
  display: grid;
  gap: 14px;
  border-radius: var(--r-4);
  border: 1px solid var(--border-default);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.02));
}

.error-trace {
  font-size: 12px;
  color: var(--text-tertiary);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.not-configured-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--border-default);
  border-radius: var(--r-4);
  background: rgba(255, 255, 255, 0.018);
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text-secondary);
}

.loading-row::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(223, 157, 47, 0.38);
  animation: dedwen-loading-pulse 1.4s ease-in-out infinite;
}

button.u2a-card,
button.template-card,
button.gallery-card,
button.drop-zone,
button#training-dropzone {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

button.gallery-card {
  padding: 0;
}

@keyframes dedwen-loading-pulse {
  0%, 100% { transform: scale(1); opacity: 0.65; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* ══════════════════════════════════════════════
   FLAGSHIP UI FINISH
   ══════════════════════════════════════════════ */

body {
  background:
    radial-gradient(circle at 16% 14%, rgba(200, 165, 96, 0.08), transparent 30%),
    radial-gradient(circle at 84% 10%, rgba(106, 46, 61, 0.08), transparent 28%),
    linear-gradient(180deg, #100f0d 0%, #15120f 58%, #0f0d0b 100%);
}

.app-main {
  position: relative;
}

.page-frame,
.page-frame-wide,
.page-frame-narrow {
  width: 100%;
  margin: 0 auto;
}

.page-frame {
  max-width: 1240px;
}

.page-frame-wide {
  max-width: 1360px;
}

.page-frame-narrow {
  max-width: 1080px;
}

.page-ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top center, rgba(223, 157, 47, 0.05), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.015), transparent 30%);
}

.surface-raised,
.surface-panel,
.surface-inset,
.flag-card,
.metric-card {
  border-radius: var(--r-4);
  border: 1px solid var(--border-default);
  background: linear-gradient(180deg, rgba(33, 29, 24, 0.98), rgba(24, 21, 18, 0.98));
}

.surface-raised {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.surface-panel {
  padding: 20px;
}

.surface-inset {
  padding: 16px;
  background: linear-gradient(180deg, rgba(28, 25, 21, 0.98), rgba(21, 18, 15, 0.98));
}

.flag-card {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.flag-card-header,
.flag-card-actions,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.flag-card-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.flag-card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}

.flag-card-copy {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.flag-card-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.metric-card {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.metric-card .metric-label,
.status-row .status-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.metric-card .metric-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.media-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.media-thumb,
.relic-thumb,
.agent-thumb,
.tool-thumb,
.creative-thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  border: 1px solid rgba(223, 157, 47, 0.18);
  background:
    radial-gradient(circle at top, rgba(223, 157, 47, 0.14), transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.media-thumb::before,
.relic-thumb::before,
.agent-thumb::before,
.tool-thumb::before,
.creative-thumb-placeholder::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  border: 1px solid rgba(223, 157, 47, 0.14);
}

.media-thumb-icon,
.thumb-glyph {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  color: var(--gold);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 26px;
  height: 26px;
}

.thumb-grid span {
  border-radius: 4px;
  background: rgba(223, 157, 47, 0.16);
  border: 1px solid rgba(223, 157, 47, 0.16);
}

.thumb-orb {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(223, 157, 47, 0.22);
  background: radial-gradient(circle at 35% 35%, rgba(223, 157, 47, 0.34), rgba(223, 157, 47, 0.08));
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-mini,
.btn-icon,
.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-io), border-color var(--dur-fast) var(--ease-io), color var(--dur-fast) var(--ease-io), transform var(--dur-fast) var(--ease-io);
}

.btn-mini {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-icon {
  min-width: 44px;
  padding: 0;
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled),
.btn-danger:hover:not(:disabled),
.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-danger,
.btn-ghost.danger {
  background: rgba(106, 46, 61, 0.12);
  border: 1px solid rgba(106, 46, 61, 0.28);
  color: #e0b5bd;
}

.btn-disabled-reason {
  font-size: 12px;
  color: var(--text-tertiary);
}

.segmented,
.admin-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
}

.segmented-item,
.admin-section-chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.segmented-item[aria-selected="true"],
.admin-section-chip.active,
.admin-section-chip[aria-selected="true"] {
  background: rgba(223, 157, 47, 0.1);
  border-color: rgba(223, 157, 47, 0.18);
  color: var(--text-primary);
}

.tab-panel {
  display: grid;
  gap: 18px;
}

.collapse-panel {
  display: grid;
  gap: 0;
}

.collapse-panel[data-open="true"] .collapse-trigger {
  border-bottom-color: transparent;
}

.collapse-trigger {
  width: 100%;
}

.collapse-content {
  overflow: hidden;
  transition: opacity var(--dur-base) var(--ease-io), transform var(--dur-base) var(--ease-io);
}

.collapse-content[hidden] {
  display: none;
}

.auth-page {
  display: block;
}

.auth-shell {
  min-height: 100vh;
  padding: 32px 28px;
  display: grid;
  place-items: center;
}

.auth-stage {
  width: min(1120px, 100%);
  min-height: min(760px, calc(100vh - 64px));
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(320px, 1fr);
  gap: 56px;
  align-items: stretch;
}

.auth-panel {
  width: 100%;
  max-width: none;
  display: grid;
  gap: 16px;
  align-content: center;
}

.auth-panel-compact {
  max-width: none;
}

.auth-card {
  padding: 32px;
  border-radius: 20px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-field,
.auth-actions,
.auth-meta,
.auth-oauth {
  display: grid;
  gap: 8px;
}

.auth-context {
  display: grid;
  align-content: center;
}

.auth-context-card {
  display: grid;
  gap: 20px;
  padding: 34px;
  border-radius: 24px;
  border: 1px solid rgba(223, 157, 47, 0.14);
  background:
    radial-gradient(circle at top, rgba(223, 157, 47, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(33, 29, 24, 0.98), rgba(21, 18, 15, 0.98));
}

.auth-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-context-stat {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.auth-context-title {
  font-size: 14px;
  font-weight: 600;
}

.auth-context-copy {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.auth-form .form-group {
  display: grid;
  gap: 8px;
}

.auth-form input,
.auth-form select,
.auth-form textarea,
.auth-field input,
.auth-field select,
.auth-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-default);
  background: rgba(255,255,255,0.025);
  color: var(--text-primary);
}

.auth-footer {
  margin-top: 8px;
}

.assistant-layout {
  grid-template-columns: 288px minmax(0, 820px) minmax(0, 260px) !important;
  gap: 28px !important;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px !important;
}

.assistant-history {
  gap: 18px !important;
}

.assistant-rail-card {
  border-radius: 18px !important;
  padding: 20px !important;
  background: linear-gradient(180deg, rgba(33, 29, 24, 0.98), rgba(24, 21, 18, 0.98)) !important;
}

.conversation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.conversation-actions > * {
  flex: 1 1 0;
}

.conversation-list {
  padding: 10px;
  gap: 10px;
}

.chat-history-item {
  border-radius: 14px !important;
  background: rgba(255,255,255,0.02) !important;
  border: 1px solid rgba(255,255,255,0.05);
}

.chat-history-item:hover {
  border-color: rgba(223, 157, 47, 0.18);
  background: rgba(223, 157, 47, 0.04) !important;
}

.assistant-main .chat-messages-container {
  padding-inline: 6px;
}

.assistant-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.assistant-stats-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.assistant-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.assistant-stat-pill strong {
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
}

.assistant-toolbar-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.assistant-empty-card {
  width: min(100%, 620px);
  margin: auto;
  padding: 32px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(28, 25, 21, 0.94), rgba(22, 19, 16, 0.94));
}

.admin-shell {
  max-width: 1360px;
  gap: 26px;
}

.admin-grid-overview {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-card {
  border-radius: 18px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(32, 29, 25, 0.98), rgba(23, 20, 17, 0.98));
  border: 1px solid rgba(255,255,255,0.08);
}

.admin-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.admin-card-title {
  font-size: 18px;
  line-height: 1.2;
}

.admin-kv-row {
  display: grid;
  grid-template-columns: minmax(0, 128px) minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.admin-kv-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.admin-kv-key {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

.admin-kv-value {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.admin-grid-split {
  align-items: start;
}

.admin-collapsible-grid {
  display: grid;
  gap: 18px;
}

.admin-collapse-card .collapse-content {
  padding-top: 16px;
}

.product-surface-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.product-surface-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 18px;
}

.product-surface-top {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.product-surface-title {
  font-size: 18px;
  line-height: 1.2;
}

.product-surface-copy {
  font-size: 14px;
  line-height: 1.65;
}

.product-surface-footer {
  display: grid;
  gap: 12px;
}

.product-surface-note {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.55;
}

.tor-shell {
  gap: 18px;
}

.tor-status-card {
  padding: 18px;
  border-radius: 18px;
}

.tor-browser-card,
.tor-details-card,
.tor-controls-card {
  border-radius: 20px;
}

.tor-browser-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(30, 27, 23, 0.98), rgba(21, 18, 15, 0.98));
}

.tor-browser-viewport {
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.07);
  background: linear-gradient(180deg, rgba(16, 14, 12, 0.96), rgba(11, 10, 9, 0.96));
}

.tor-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
  padding: 32px;
}

.tor-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(223, 157, 47, 0.16);
  background: rgba(223, 157, 47, 0.05);
  color: var(--gold);
}

.tor-details-panel {
  padding-top: 18px;
}

.trading-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 22px;
}

.trading-header {
  align-items: flex-end;
}

.trading-grid {
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 22px;
}

.trading-shell .discovery-panel,
.trading-shell .chart-workspace,
.trading-shell .execution-panel,
.trading-shell .asset-card,
.trading-shell .right-column > .glass-card {
  background: linear-gradient(180deg, rgba(32, 29, 25, 0.98), rgba(23, 20, 17, 0.98));
  border-color: rgba(255,255,255,0.08);
  border-radius: 18px;
  box-shadow: none;
}

.trading-shell .market-row.selected {
  background: rgba(223, 157, 47, 0.08);
}

.trading-shell .chart-empty,
.trading-shell #prices-error,
.trading-shell #preview-box,
.trading-shell #trade-error,
.trading-shell #trade-success {
  border-radius: 14px;
}

.trading-glyph {
  display: inline-grid;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(223,157,47,0.18);
  background: radial-gradient(circle at top, rgba(223,157,47,0.16), transparent 56%), rgba(255,255,255,0.03);
  place-items: center;
  color: var(--gold);
}

.text-accent-cinder,
.text-cinder {
  color: var(--cinder);
}

.btn-compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .auth-stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    min-height: auto;
  }

  .auth-context {
    order: 2;
  }

  .assistant-layout {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }

  .assistant-spacer {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .auth-shell {
    padding: 28px 24px;
  }

  .auth-stage {
    width: min(720px, 100%);
  }
}

@media (max-width: 900px) {
  .assistant-layout {
    grid-template-columns: 1fr !important;
    padding: 18px 14px 20px !important;
  }

  .assistant-history {
    order: 2;
  }

  .assistant-main {
    order: 1;
  }
}

@media (max-width: 768px) {
  .product-surface-grid,
  .status-grid,
  .admin-grid-overview,
  .tor-status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .auth-shell {
    padding: 20px 16px;
  }

  .auth-stage {
    width: 100%;
  }

  .auth-card {
    padding: 24px;
  }

  .admin-section-nav,
  .segmented {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}

@media (max-width: 640px) {
  .auth-stage {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .auth-card {
    width: calc(100vw - 32px);
    max-width: none;
    padding: 22px 20px;
  }

  .auth-context {
    display: none;
  }

  .product-surface-grid,
  .status-grid,
  .admin-grid-overview,
  .tor-status-grid {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   Final flagship override layer
   ===================================================================== */

:root[data-theme="dark"] {
  --bg: #14110f;
  --bg-elevated: #1a1613;
  --surface: #1d1915;
  --surface-2: #25201c;
  --surface-3: #2d2621;
  --thumbnail: #221b16;
  --text: #f4ece0;
  --text-on-surface: #f4ece0;
  --text-muted: rgba(244, 236, 224, 0.72);
  --text-tertiary: rgba(244, 236, 224, 0.46);
  --border: rgba(244, 236, 224, 0.12);
  --border-strong: rgba(244, 236, 224, 0.24);
  --amber: #df9d2f;
  --amber-hover: #e9af49;
  --amber-glow: rgba(223, 157, 47, 0.18);
  --gold: #cfb178;
  --gold-soft: rgba(207, 177, 120, 0.2);
  --wine: #6a3343;
  --wine-soft: rgba(106, 51, 67, 0.18);
  --wine-deep: #41212c;
  --royal-purple: #5d4a7c;
  --royal-purple-soft: rgba(93, 74, 124, 0.18);
  --success: #68a784;
  --warning: #c7923a;
  --info: #7f8c96;
}

:root[data-theme="light"] {
  --bg: #ebe2d6;
  --bg-elevated: #f2eadf;
  --surface: #faf5ee;
  --surface-2: #efe5d7;
  --surface-3: #e3d6c6;
  --thumbnail: #d7c7b4;
  --text: #241a17;
  --text-on-surface: #241a17;
  --text-muted: rgba(36, 26, 23, 0.74);
  --text-tertiary: rgba(36, 26, 23, 0.48);
  --border: rgba(64, 46, 38, 0.14);
  --border-strong: rgba(64, 46, 38, 0.24);
  --amber: #c98718;
  --amber-hover: #d9962c;
  --amber-glow: rgba(201, 135, 24, 0.14);
  --gold: #8b6731;
  --gold-soft: rgba(139, 103, 49, 0.18);
  --wine: #6a3343;
  --wine-soft: rgba(106, 51, 67, 0.16);
  --wine-deep: #4f2431;
  --royal-purple: #73548e;
  --royal-purple-soft: rgba(115, 84, 142, 0.16);
  --success: #507c61;
  --warning: #9e6a21;
  --info: #4d6575;
}

:root {
  --thumbnail-card-shadow: 0 18px 48px rgba(8, 8, 8, 0.24);
  --sidebar-open-width: 240px;
  --sidebar-collapsed-width: 64px;
  --rightrail-width: 300px;
  --rightrail-collapsed-width: 46px;
  --page-width-wide: min(1360px, calc(100vw - 48px));
  --page-width: min(1240px, calc(100vw - 48px));
  --page-width-narrow: min(1040px, calc(100vw - 48px));
}

html, body {
  background:
    radial-gradient(circle at top, rgba(223, 157, 47, 0.08), transparent 42%),
    radial-gradient(circle at bottom right, rgba(106, 51, 67, 0.1), transparent 36%),
    var(--bg);
  color: var(--text);
}

body.app-shell-body {
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(223, 157, 47, 0.08), transparent 42%),
    radial-gradient(circle at bottom right, rgba(106, 51, 67, 0.1), transparent 36%),
    var(--bg);
}

.app-shell {
  min-height: 100vh;
  background: transparent;
}

.app-sidebar {
  width: var(--sidebar-open-width);
  transition: width var(--dur-base) var(--ease-io), transform var(--dur-base) var(--ease-io);
  overflow: hidden;
}

.app-sidebar[data-collapsed="true"] {
  width: var(--sidebar-collapsed-width);
}

.app-sidebar[data-collapsed="true"] .dock-label,
.app-sidebar[data-collapsed="true"] .app-brand-subtitle,
.app-sidebar[data-collapsed="true"] .app-account-meta {
  display: none;
}

.app-sidebar[data-collapsed="true"] .app-account-actions,
.app-sidebar[data-collapsed="true"] .dock-nav {
  align-items: center;
}

.app-sidebar[data-collapsed="true"] .app-account {
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-sidebar[data-collapsed="true"] .dedwen-companion-panel {
  display: none;
}

.app-sidebar[data-collapsed="true"] .dedwen-mascot-frame {
  width: 32px;
  height: 32px;
  border-radius: 12px;
}

.app-sidebar[data-collapsed="true"] .app-nav-item,
.app-sidebar[data-collapsed="true"] .dock-button {
  justify-content: center;
  padding-inline: 0;
}

.app-brand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
}

.brand-mark-image {
  display: block;
  width: 154px;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.22));
}

.brand-mark-image--sidebar {
  width: 158px;
}

.brand-mark-image--topbar {
  width: 112px;
}

.app-sidebar[data-collapsed="true"] .brand-mark-image--sidebar {
  width: 34px;
  overflow: hidden;
}

.sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.sidebar-collapse-btn:hover,
.sidebar-collapse-btn:focus-visible {
  color: var(--text);
  background: var(--surface-3);
}

.app-sidebar[data-collapsed="true"] .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.app-nav-item,
.dock-button {
  min-height: 44px;
}

.app-account-actions {
  display: grid;
  gap: 8px;
}

.profile-shell {
  display: grid;
  gap: 24px;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 20px;
}

.profile-identity-card,
.profile-status-card,
.profile-shortcuts-card,
.profile-session-card {
  padding: 24px;
}

.profile-identity-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.profile-avatar-frame {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.profile-name {
  margin: 0;
  font-size: 24px;
}

.profile-role {
  margin: 4px 0 0;
  color: var(--text-secondary);
}

.profile-summary,
.profile-shortcuts {
  display: grid;
  gap: 12px;
}

.profile-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.profile-summary-row span {
  color: var(--text-secondary);
}

.profile-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 960px) {
  .profile-grid,
  .profile-status-grid,
  .dedwen-companion-metrics {
    grid-template-columns: 1fr;
  }
}

.app-main {
  min-width: 0;
}

.page-shell,
.page-frame,
.page-frame-wide,
.page-frame-narrow {
  width: 100%;
  margin-inline: auto;
}

.page-frame-wide,
.page-shell.admin-shell,
.page-shell.trading-shell,
.page-shell.tor-shell {
  max-width: var(--page-width-wide);
}

.page-frame,
.page-shell {
  max-width: var(--page-width);
}

.page-frame-narrow {
  max-width: var(--page-width-narrow);
}

.surface,
.surface-card,
.flag-card,
.metric-card,
.thumbnail-card,
.admin-card,
.auth-card,
.auth-context-card,
.product-surface-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(7, 7, 7, 0.16);
}

.metric-card,
.thumbnail-card,
.product-surface-card,
.settings-card,
.admin-card,
.tor-status-card {
  border-radius: 18px;
}

.product-surface-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.product-surface-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.product-surface-top {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.product-surface-footer {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  gap: 12px;
}

.agent-thumb,
.relic-thumb,
.tool-thumb,
.media-thumb {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(223, 157, 47, 0.16), transparent 40%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.06)),
    var(--thumbnail);
  border: 1px solid var(--border);
  box-shadow: var(--thumbnail-card-shadow);
}

.thumb-glyph {
  width: 30px;
  height: 30px;
  color: var(--gold);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  gap: 6px;
}

.thumb-grid span,
.thumb-orb {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold-soft);
}

.thumb-orb {
  width: 24px;
  height: 24px;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-mini,
.btn-icon {
  min-height: 44px;
  border-radius: 12px;
}

.btn-primary,
.btn-login,
.btn-gen {
  background: var(--amber);
  color: var(--text-on-amber);
  border: 1px solid rgba(201, 135, 24, 0.28);
  box-shadow: 0 10px 24px var(--amber-glow);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--wine-soft);
  color: #efc1cd;
  border: 1px solid rgba(106, 51, 67, 0.42);
}

.btn-mini {
  min-height: 36px;
  padding: 0 12px;
}

.segmented,
.admin-section-nav,
.creative-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented-item,
.admin-section-chip,
.creative-tab {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}

.segmented-item[aria-selected="true"],
.admin-section-chip.active,
.creative-tab.active {
  background: rgba(223, 157, 47, 0.12);
  color: var(--text);
  border-color: rgba(223, 157, 47, 0.32);
}

.command-palette {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 12000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  background: rgba(8, 8, 8, 0.72);
  backdrop-filter: blur(12px);
}

.command-palette.visible {
  display: flex;
}

.command-palette-card {
  width: min(720px, 92vw);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  overflow: hidden;
}

.command-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.command-palette-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.command-palette-key,
.command-palette-item-path {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.command-palette-results {
  max-height: 52vh;
  overflow: auto;
  padding: 8px;
}

.command-palette-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.command-palette-item:hover {
  background: var(--surface-2);
}

.command-palette-empty {
  padding: 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.dedwen-toast-label {
  font-size: 11px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dedwen-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 8, 0.72);
  backdrop-filter: blur(6px);
}

.dedwen-confirm-overlay.visible {
  display: flex;
}

.dedwen-confirm-card {
  width: min(420px, 90vw);
  padding: 28px 28px 22px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
}

.dedwen-confirm-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.dedwen-confirm-body {
  margin: 0 0 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.dedwen-confirm-typed-wrap {
  display: none;
  margin-bottom: 14px;
}

.dedwen-confirm-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.dedwen-confirm-input {
  width: 100%;
  box-sizing: border-box;
}

.dedwen-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.dedwen-confirm-ok[disabled] {
  opacity: 0.45;
  cursor: default;
}

.auth-page {
  background:
    radial-gradient(circle at top left, rgba(223, 157, 47, 0.12), transparent 32%),
    linear-gradient(145deg, rgba(14, 12, 10, 0.98), rgba(20, 16, 13, 0.92)),
    var(--bg);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 24px;
}

.auth-stage {
  display: grid;
  grid-template-columns: minmax(420px, 560px) minmax(360px, 1fr);
  width: min(1120px, 100%);
  gap: 36px;
  align-items: stretch;
}

.auth-panel,
.auth-context {
  min-width: 0;
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 18px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
}

.auth-brand-wordmark {
  display: none;
}

.auth-card {
  width: min(100%, 540px);
  padding: 28px;
  border-radius: 22px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .form-group {
  display: grid;
  gap: 6px;
}

.auth-context-card {
  min-height: 100%;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-context-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10, 9, 8, 0.08), rgba(10, 9, 8, 0.3)),
    url("/branding/login.png") center/cover no-repeat;
  opacity: 0.92;
}

.auth-context-card > * {
  position: relative;
  z-index: 1;
}

.auth-context-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-context-stat {
  padding: 14px;
  border-radius: 16px;
  background: rgba(14, 12, 10, 0.62);
  border: 1px solid rgba(244, 236, 224, 0.1);
  backdrop-filter: blur(8px);
}

.assistant-layout {
  grid-template-columns: minmax(0, 760px) var(--rightrail-width) !important;
  justify-content: center;
  max-width: var(--page-width-wide);
  margin: 0 auto;
}

.assistant-main {
  min-width: 0;
}

.assistant-history {
  order: 2;
  min-width: 0;
}

.assistant-layout .app-rightrail,
.assistant-history.app-rightrail {
  width: var(--rightrail-width);
  transition: width var(--dur-base) var(--ease-io), transform var(--dur-base) var(--ease-io);
}

.assistant-history.app-rightrail[data-collapsed="true"] {
  width: var(--rightrail-collapsed-width);
}

.assistant-history.app-rightrail[data-collapsed="true"] .assistant-side-kicker,
.assistant-history.app-rightrail[data-collapsed="true"] .assistant-side-title,
.assistant-history.app-rightrail[data-collapsed="true"] .assistant-side-copy,
.assistant-history.app-rightrail[data-collapsed="true"] .conversation-actions,
.assistant-history.app-rightrail[data-collapsed="true"] #chat-history-list {
  display: none;
}

.assistant-rail-toggle {
  margin-left: auto;
}

.assistant-rail-card {
  border-radius: 18px;
}

.assistant-toolbar-meta,
.assistant-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.assistant-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
}

.assistant-stat-pill strong {
  color: var(--text);
}

.assistant-empty-card {
  min-height: 44vh;
}

.tor-shell {
  display: grid;
  gap: 20px;
}

.tor-browser-frame,
.tor-browser-card {
  min-height: max(560px, 70vh);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
}

.tor-controls-card {
  order: 3;
}

.tor-status-grid {
  order: 4;
}

.tor-details-card {
  order: 5;
}

.tor-browser-card {
  order: 2;
}

.admin-shell {
  display: grid;
  gap: 22px;
}

.admin-grid-overview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-shell {
  grid-template-columns: 280px minmax(0, 1fr) !important;
  gap: 32px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 24px;
}

.u2a-page,
.u2a-shell {
  height: 100%;
}

.u2a-hub {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.u2a-category-list,
.u2a-detail-panel,
.u2a-list-panel {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.u2a-category-list {
  padding: 18px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.u2a-detail-panel {
  min-height: 520px;
  padding: 24px;
}

.u2a-empty-state {
  min-height: 100%;
}

.empty-state--mascot,
.dedwen-mascot-empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.dedwen-mascot,
.dedwen-mascot-empty,
.dedwen-mascot-sm {
  display: block;
  width: 92px;
  height: auto;
}

.dedwen-mascot-sm {
  width: 56px;
}

.dedwen-mascot-avatar {
  width: 20px;
  height: 20px;
}

.dedwen-mascot-watermark {
  opacity: 0.12;
  filter: saturate(0.92);
}

.assistant-presence-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(223, 157, 47, 0.14);
  background: var(--royal-purple-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.assistant-presence-pill .dedwen-mascot-avatar {
  width: 18px;
  height: 18px;
}

.tor-empty-mascot {
  width: 84px;
}

.rate-limit-shell {
  max-width: 720px;
  margin: 0 auto;
}

.relics-grid-locked {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.product-surface-action {
  align-self: start;
}

@media (max-width: 1279px) {
  .product-surface-grid,
  .admin-grid-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .app-sidebar {
    transform: translateX(-110%);
    width: min(320px, calc(100vw - 40px));
  }

  body.mob-nav-open .app-sidebar {
    transform: translateX(0);
  }

  .assistant-layout {
    grid-template-columns: 1fr !important;
  }

  .assistant-history.app-rightrail {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(320px, calc(100vw - 32px));
    padding: 18px;
    background: rgba(11, 10, 8, 0.94);
    transform: translateX(110%);
    z-index: 1200;
  }

  .assistant-history.app-rightrail[data-open="true"] {
    transform: translateX(0);
  }

  .auth-stage {
    grid-template-columns: 1fr;
    width: min(720px, 100%);
  }

  .auth-context {
    order: -1;
  }

  .auth-context-card {
    min-height: 280px;
  }

  .settings-shell,
  .u2a-hub {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  .product-surface-grid,
  .admin-grid-overview,
  .relics-grid-locked,
  .auth-context-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tor-browser-frame,
  .tor-browser-card {
    min-height: 60vh;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    padding: 20px 16px;
  }

  .auth-card {
    width: calc(100vw - 32px);
    max-width: none;
    padding: 22px 20px;
  }

  .auth-context {
    display: none;
  }

  .product-surface-grid,
  .admin-grid-overview,
  .relics-grid-locked {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════
   LIGHT MODE — Sidebar / Shell Coherence
   ══════════════════════════════════════════════ */
:root[data-theme="light"] .left-dock,
:root[data-theme="light"] .app-sidebar {
  background: rgba(245, 237, 224, 0.97);
  border-right-color: rgba(64, 46, 38, 0.14);
}

:root[data-theme="light"] .left-dock:hover {
  background: rgba(250, 244, 233, 0.99);
  box-shadow: 16px 0 48px rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .dock-item {
  color: var(--text-tertiary);
}

:root[data-theme="light"] .dock-item:hover {
  background: var(--surface-2);
  color: var(--text-on-surface);
}

:root[data-theme="light"] .dock-item.active,
:root[data-theme="light"] .dock-item[aria-current="page"] {
  background: var(--amber-translucent);
  color: var(--amber);
}

:root[data-theme="light"] .dock-footer,
:root[data-theme="light"] .app-sidebar-footer {
  border-top-color: rgba(64, 46, 38, 0.12);
}

:root[data-theme="light"] .dock-divider {
  background: rgba(64, 46, 38, 0.1);
}

:root[data-theme="light"] .dock-logo {
  background: rgba(201, 135, 24, 0.1);
  border-color: rgba(201, 135, 24, 0.22);
}

/* Mobile nav drawer in light mode */
:root[data-theme="light"] body.mob-nav-open .left-dock {
  box-shadow: 6px 0 48px rgba(0, 0, 0, 0.15);
}

/* Light mode — text vars (WCAG AA) */
:root[data-theme="light"] {
  --text-primary: #241a17;
  --text-secondary: rgba(36, 26, 23, 0.82);
  --text-tertiary: rgba(36, 26, 23, 0.58);
  --text-muted: rgba(36, 26, 23, 0.72);
  --text-dim: rgba(36, 26, 23, 0.52);
  --surface-1: rgba(64, 46, 38, 0.04);
  --surface-2: rgba(64, 46, 38, 0.07);
  --surface-3: rgba(64, 46, 38, 0.11);
  --cinder-dim: rgba(139, 103, 49, 0.12);
}

/* ══════════════════════════════════════════════
   ADMIN — Skeleton / Shimmer Loading Cards
   ══════════════════════════════════════════════ */
.admin-card-skeleton {
  pointer-events: none;
}

.admin-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--r-1);
}

:root[data-theme="light"] .admin-skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.09) 50%,
    rgba(0, 0, 0, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
}

.admin-skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 10px;
  border-radius: var(--r-1);
}

.admin-skeleton-pill {
  height: 22px;
  width: 80px;
  border-radius: var(--r-full);
}

.admin-skeleton-line {
  height: 13px;
  width: 100%;
  margin-top: 8px;
  border-radius: var(--r-1);
}

.admin-skeleton-line.is-wide {
  width: 85%;
}

.admin-skeleton-line.is-short {
  width: 50%;
}

/* ══════════════════════════════════════════════
   MOBILE COMPOSER — 480px and below
   ══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .composer-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }

  .toolbar-field {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
  }

  .toolbar-field select {
    max-width: 100%;
    font-size: 11px;
  }

  .toolbar-button {
    flex: 1 1 auto;
    font-size: 11px;
    padding: 5px 8px;
    min-width: 0;
  }

  .composer-input-row {
    gap: 6px;
  }

  .send-button,
  .stop-button {
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }

  #chat-input {
    font-size: 16px; /* prevents iOS zoom */
  }

  .composer-wrap {
    overflow-x: hidden;
  }
}

/* ══════════════════════════════════════════════
   CREATIVE — Preview empty state
   ══════════════════════════════════════════════ */
#preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.preview-empty-heading {
  font-size: var(--type-md);
  font-weight: 600;
  color: var(--text-primary);
}

.preview-empty-hint {
  font-size: var(--type-sm);
  color: var(--text-secondary);
  max-width: 280px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════
   VISUAL QUALITY PASS — 2026-05-16
   Light-mode coherence · nav polish · component depth
   ══════════════════════════════════════════════ */

/* ── Light mode: form inputs ── */
:root[data-theme="light"] input[type="text"],
:root[data-theme="light"] input[type="email"],
:root[data-theme="light"] input[type="password"],
:root[data-theme="light"] input[type="number"],
:root[data-theme="light"] input[type="search"],
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  background: rgba(255, 252, 247, 0.92);
  border-color: rgba(64, 46, 38, 0.18);
  color: #241a17;
}

:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder {
  color: rgba(36, 26, 23, 0.42);
}

/* ── Light mode: glass-card / surface cards ── */
:root[data-theme="light"] .glass-card,
:root[data-theme="light"] .surface,
:root[data-theme="light"] .surface-card {
  background: rgba(252, 247, 240, 0.95);
  border-color: rgba(64, 46, 38, 0.12);
}

:root[data-theme="light"] .glass-card:hover,
:root[data-theme="light"] .glass-card.interactive:hover {
  background: rgba(255, 251, 244, 0.98);
  border-color: rgba(64, 46, 38, 0.2);
}

:root[data-theme="light"] .surface-raised,
:root[data-theme="light"] .surface-panel,
:root[data-theme="light"] .surface-inset,
:root[data-theme="light"] .flag-card,
:root[data-theme="light"] .metric-card {
  background: rgba(252, 247, 240, 0.95);
  border-color: rgba(64, 46, 38, 0.12);
  box-shadow: 0 2px 10px rgba(64, 46, 38, 0.05);
}

:root[data-theme="light"] .surface-inset {
  background: rgba(245, 238, 228, 0.92);
}

/* ── Light mode: buttons ── */
:root[data-theme="light"] .btn-secondary,
:root[data-theme="light"] .secondary-btn {
  background: rgba(64, 46, 38, 0.06);
  border-color: rgba(64, 46, 38, 0.18);
  color: #241a17;
}

:root[data-theme="light"] .btn-secondary:hover:not(:disabled),
:root[data-theme="light"] .secondary-btn:hover:not(:disabled) {
  background: rgba(64, 46, 38, 0.11);
  border-color: rgba(64, 46, 38, 0.26);
}

:root[data-theme="light"] .btn-ghost,
:root[data-theme="light"] .ghost-btn {
  color: rgba(36, 26, 23, 0.7);
}

:root[data-theme="light"] .btn-ghost:hover,
:root[data-theme="light"] .ghost-btn:hover {
  background: rgba(64, 46, 38, 0.07);
  color: #241a17;
}

/* ── Light mode: companion panel ── */
:root[data-theme="light"] .dedwen-companion-panel {
  background: rgba(252, 247, 240, 0.97);
  border-color: rgba(64, 46, 38, 0.13);
  box-shadow: 0 8px 24px rgba(64, 46, 38, 0.08);
}

:root[data-theme="light"] .dedwen-companion-metrics div {
  background: rgba(244, 238, 228, 0.9);
  border-color: rgba(64, 46, 38, 0.1);
}

/* ── Light mode: sidebar nav item hover ── */
:root[data-theme="light"] .dock-item.app-nav-item:hover {
  background: rgba(64, 46, 38, 0.06);
  color: #241a17;
}

/* ── Light mode: settings nav ── */
:root[data-theme="light"] .settings-nav-btn {
  background: rgba(64, 46, 38, 0.03);
  border-color: rgba(64, 46, 38, 0.1);
}

:root[data-theme="light"] .settings-nav-btn.active,
:root[data-theme="light"] .settings-nav-btn[aria-current="true"] {
  background: rgba(201, 135, 24, 0.08);
  border-color: rgba(201, 135, 24, 0.2);
}

/* ── Light mode: admin skeleton shimmer ── */
:root[data-theme="light"] .admin-card-skeleton {
  background: rgba(64, 46, 38, 0.04);
}

/* ── Light mode: section-title line ── */
:root[data-theme="light"] .section-title::after {
  background: rgba(64, 46, 38, 0.12);
}

/* ── Light mode: page kicker ── */
:root[data-theme="light"] .page-kicker,
:root[data-theme="light"] .mini-kicker {
  color: rgba(36, 26, 23, 0.5);
}

/* ── status-pill.subtle / .success ── */
.status-pill.subtle {
  background: var(--surface-1);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  font-family: var(--font-mono);
}

.status-pill.success { background: rgba(95,159,123,0.12); color: var(--success); border: 1px solid rgba(95,159,123,0.25); }

/* ── U2A card component ── */
button.u2a-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  margin-bottom: 4px;
  font: inherit;
  color: inherit;
}

button.u2a-card:hover {
  background: var(--surface-1);
  border-color: var(--border-default);
}

button.u2a-card.selected {
  background: rgba(223, 157, 47, 0.07);
  border-color: rgba(223, 157, 47, 0.22);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.card-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.card-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Source badge variants ── */
.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge-trace    { background: rgba(123,105,80,0.14);  color: var(--cinder);        border: 1px solid rgba(123,105,80,0.22); }
.badge-signal   { background: rgba(95,159,123,0.12);  color: var(--success);       border: 1px solid rgba(95,159,123,0.22); }
.badge-email    { background: rgba(143,124,97,0.12);  color: var(--info);          border: 1px solid rgba(143,124,97,0.2); }
.badge-approval { background: rgba(223,157,47,0.12);  color: var(--amber);         border: 1px solid rgba(223,157,47,0.22); }
.badge-assistant{ background: rgba(93,74,124,0.1);    color: var(--royal-purple);  border: 1px solid rgba(93,74,124,0.18); }

/* ── u2a-tab buttons ── */
button.u2a-tab {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}

button.u2a-tab:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

button.u2a-tab.active {
  background: rgba(223, 157, 47, 0.08);
  border-color: rgba(223, 157, 47, 0.18);
  color: var(--text-primary);
}

/* ── Mobile topbar — constrain brand image ── */
@media (max-width: 1024px) {
  .brand-mark-image--topbar {
    width: 88px;
  }
  .mob-topbar.mobile-topbar,
  .mob-topbar {
    min-height: 52px;
  }
}

/* ── Lottery: light-mode inline field colors ── */
:root[data-theme="light"] #lotteryGameSelector,
:root[data-theme="light"] #lotteryDraws {
  background: rgba(255, 252, 247, 0.92);
  border-color: rgba(64, 46, 38, 0.18);
  color: #241a17;
}

/* ── Bot: decision history empty state ── */
.activity-chart-panel {
  min-height: 140px;
}

/* ── Sidebar: collapse button cursor ── */
.sidebar-collapse-btn {
  cursor: pointer;
}

/* ── Light mode: u2a category list ── */
:root[data-theme="light"] .u2a-category-list,
:root[data-theme="light"] .u2a-detail-panel,
:root[data-theme="light"] .u2a-list-panel {
  background: rgba(252, 247, 240, 0.95);
  border-color: rgba(64, 46, 38, 0.12);
}

/* ── Light mode: tor browser frame ── */
:root[data-theme="light"] .tor-browser-card,
:root[data-theme="light"] .tor-browser-frame {
  background: rgba(252, 247, 240, 0.95);
  border-color: rgba(64, 46, 38, 0.14);
}

/* ── Relics grid spacing ── */
.relics-grid-locked {
  gap: 20px;
}

/* ── Profile: shortcut buttons ── */
.profile-shortcut-btn,
.shortcut-list .btn-secondary {
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
}

/* ── Light mode: modal / overlay cards ── */
:root[data-theme="light"] .onboarding-card,
:root[data-theme="light"] .dedwen-confirm-card {
  background: rgba(252, 247, 240, 0.98);
  border-color: rgba(64, 46, 38, 0.14);
  color: #241a17;
}

/* ── Light mode: admin card header ── */
:root[data-theme="light"] .admin-card-header {
  border-bottom-color: rgba(64, 46, 38, 0.1);
}

/* ── Light mode: page ambient overlay ── */
:root[data-theme="light"] .page-ambient::before {
  background:
    radial-gradient(circle at top center, rgba(201, 135, 24, 0.04), transparent 34%),
    linear-gradient(180deg, rgba(0,0,0,0.01), transparent 30%);
}

/* ══════════════════════════════════════════════
   LIGHT MODE — Component-specific dark overrides
   These target the hardcoded dark gradients that
   the generic .glass-card override doesn't reach.
   ══════════════════════════════════════════════ */

/* ── Assistant: central empty-state card ── */
:root[data-theme="light"] .assistant-empty-card {
  background: rgba(250, 245, 238, 0.96) !important;
  border-color: rgba(64, 46, 38, 0.12) !important;
}

/* ── Assistant: right-rail card ── */
:root[data-theme="light"] .assistant-rail-card {
  background: rgba(250, 245, 238, 0.96) !important;
  border-color: rgba(64, 46, 38, 0.12) !important;
}

/* ── Assistant: chat composer ── */
:root[data-theme="light"] .composer-wrap {
  background: rgba(252, 248, 242, 0.98);
  border-color: rgba(64, 46, 38, 0.16);
}

/* ── Admin: individual admin cards ── */
:root[data-theme="light"] .admin-card {
  background: rgba(250, 245, 238, 0.96);
  border-color: rgba(64, 46, 38, 0.1);
}

/* ── Admin: card titles ── */
:root[data-theme="light"] .admin-card-title {
  color: #241a17;
}

/* ── Tor: chrome, tab-bar, viewport, url-bar ── */
:root[data-theme="light"] .tor-chrome {
  background: rgba(240, 234, 224, 0.98);
  border-bottom-color: rgba(64, 46, 38, 0.14);
}

:root[data-theme="light"] .tor-tab {
  background: rgba(245, 239, 228, 0.9);
  border-color: rgba(64, 46, 38, 0.12);
  color: rgba(36, 26, 23, 0.7);
}

:root[data-theme="light"] .tor-tab.active {
  background: rgba(252, 248, 242, 0.98);
  color: #241a17;
}

:root[data-theme="light"] .tor-browser-viewport {
  background: rgba(240, 234, 220, 0.85);
  border-color: rgba(64, 46, 38, 0.1);
}

:root[data-theme="light"] .tor-url-bar {
  background: rgba(255, 252, 246, 0.95);
  border-color: rgba(64, 46, 38, 0.18);
  color: #241a17;
}

:root[data-theme="light"] .tor-url-bar:focus {
  background: #fff;
  border-color: var(--amber);
}

:root[data-theme="light"] .tor-address-row {
  background: rgba(248, 243, 234, 0.9);
  border-bottom-color: rgba(64, 46, 38, 0.1);
}

:root[data-theme="light"] .tor-status-bar {
  background: rgba(235, 228, 215, 0.9);
  border-top-color: rgba(64, 46, 38, 0.1);
  color: rgba(36, 26, 23, 0.65);
}

/* ── Trading: dark panel overrides ── */
:root[data-theme="light"] .trading-shell .discovery-panel,
:root[data-theme="light"] .trading-shell .chart-workspace,
:root[data-theme="light"] .trading-shell .execution-panel,
:root[data-theme="light"] .trading-shell .asset-card,
:root[data-theme="light"] .trading-shell .right-column > .glass-card {
  background: rgba(250, 245, 238, 0.96);
  border-color: rgba(64, 46, 38, 0.1);
}

:root[data-theme="light"] .trading-shell .market-row {
  border-bottom-color: rgba(64, 46, 38, 0.06);
  color: #241a17;
}

:root[data-theme="light"] .trading-shell .market-row:hover {
  background: rgba(64, 46, 38, 0.04);
}

/* ── Onboarding overlay: softer in light mode ── */
:root[data-theme="light"] .onboarding-overlay {
  background: rgba(100, 80, 55, 0.5);
  backdrop-filter: blur(12px);
}

/* ── Bot: activity chart area ── */
:root[data-theme="light"] .activity-chart-panel {
  background: rgba(250, 245, 238, 0.96);
  border-color: rgba(64, 46, 38, 0.1);
}

/* ── Creative: section group cards ── */
:root[data-theme="light"] .creative-form-section {
  background: rgba(250, 245, 238, 0.96);
  border-color: rgba(64, 46, 38, 0.1);
}

/* ── Profile: session card ── */
:root[data-theme="light"] .profile-session-card,
:root[data-theme="light"] .profile-shell .glass-card {
  background: rgba(250, 245, 238, 0.96);
  border-color: rgba(64, 46, 38, 0.1);
}

/* ── Light mode: toolbar buttons in chat ── */
:root[data-theme="light"] .toolbar-button.muted {
  background: rgba(64, 46, 38, 0.05);
  border-color: rgba(64, 46, 38, 0.15);
  color: rgba(36, 26, 23, 0.65);
}

:root[data-theme="light"] .toolbar-button.muted:hover {
  background: rgba(64, 46, 38, 0.09);
  color: #241a17;
}

/* ── Light mode: status bar (tor footer) ── */
:root[data-theme="light"] .tor-footer-bar,
:root[data-theme="light"] #tor-circuit-footer {
  background: rgba(232, 225, 212, 0.9);
  color: rgba(36, 26, 23, 0.6);
}

/* ── Light mode: code/mono text in light mode ── */
:root[data-theme="light"] code,
:root[data-theme="light"] .mono,
:root[data-theme="light"] pre {
  background: rgba(64, 46, 38, 0.06);
  color: rgba(36, 26, 23, 0.85);
}

/* ── Light mode: conversation list items ── */
:root[data-theme="light"] .chat-history-item,
:root[data-theme="light"] .conversation-item {
  background: transparent;
  border-color: rgba(64, 46, 38, 0.08);
  color: #241a17;
}

:root[data-theme="light"] .chat-history-item:hover,
:root[data-theme="light"] .conversation-item:hover {
  background: rgba(64, 46, 38, 0.05);
}

/* ── Collapsed sidebar nav indicator ── */
.app-sidebar[data-collapsed="true"] .dock-item.app-nav-item.active::before,
.app-sidebar[data-collapsed="true"] .dock-item.app-nav-item[aria-current="page"]::before {
  left: 0;
}

/* ── Light mode: mob topbar ── */
:root[data-theme="light"] .mob-topbar.mobile-topbar,
:root[data-theme="light"] .mob-topbar {
  background: rgba(240, 234, 224, 0.97);
  border-bottom-color: rgba(64, 46, 38, 0.12);
}

/* ── Light mode: Bot execution mode buttons (template inline-style override) ── */
:root[data-theme="light"] .mode-btn {
  background: rgba(64, 46, 38, 0.04);
  border-color: rgba(64, 46, 38, 0.14);
  color: #241a17;
}

:root[data-theme="light"] .mode-btn:hover {
  background: rgba(64, 46, 38, 0.08);
  border-color: rgba(64, 46, 38, 0.22);
}

:root[data-theme="light"] .mode-btn.active-auto {
  border-color: rgba(59,130,246,0.45);
  background: rgba(59,130,246,0.08);
}

:root[data-theme="light"] .mode-btn.active-manual {
  border-color: rgba(201,135,24,0.45);
  background: rgba(201,135,24,0.08);
}

:root[data-theme="light"] .mode-btn.active-ultra_ego {
  border-color: rgba(193,103,111,0.45);
  background: rgba(193,103,111,0.08);
}

/* ── Light mode: Feed / log entries ── */
:root[data-theme="light"] .feed-entry {
  border-bottom-color: rgba(64, 46, 38, 0.06);
  color: rgba(36, 26, 23, 0.75);
}

:root[data-theme="light"] .feed-tag {
  background: rgba(64, 46, 38, 0.08);
  color: rgba(36, 26, 23, 0.6);
}

/* ── Light mode: Admin tab bar ── */
:root[data-theme="light"] .admin-tab-bar,
:root[data-theme="light"] .tab-bar {
  border-bottom-color: rgba(64, 46, 38, 0.1);
}

:root[data-theme="light"] .admin-tab,
:root[data-theme="light"] .tab-btn {
  color: rgba(36, 26, 23, 0.6);
}

:root[data-theme="light"] .admin-tab.active,
:root[data-theme="light"] .tab-btn.active {
  color: #241a17;
  border-bottom-color: var(--amber);
}
