@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');

/* ================================================================
   PURIFY — DESIGN SYSTEM v2
   Cosmic dark theme · Glassmorphism · Aurora accents
   ================================================================ */

/* ── CSS CUSTOM PROPERTIES ──────────────────────────────────────── */
:root {
  /* Void backgrounds — purple-dark theme */
  --bg-void:      #0D0D1C;
  --bg-deep:      #12122A;
  --bg-surface:   #191935;
  --bg-raised:    #21213F;
  --bg-hover:     #2A2A50;
  --bg-glass:     #1C1C38;
  --bg-glass-lg:  rgba(14, 14, 28, 0.94);
  --bg-input:     rgba(10, 10, 22, 0.80);

  /* Sidebar */
  --bg-sidebar:   #0A0A18;
  --sidebar-w:    220px;
  --sidebar-collapsed: 58px;

  /* Accent — Purify Violet */
  --accent:         #8B5CF6;
  --accent-hover:   #7C3AED;
  --accent-light:   #A78BFA;
  --accent-dim:     rgba(139, 92, 246, 0.10);
  --accent-glow:    rgba(139, 92, 246, 0.40);
  --accent-glow-sm: rgba(139, 92, 246, 0.20);

  /* Secondary — Electric Blue */
  --blue:       #3B82F6;
  --blue-dim:   rgba(59, 130, 246, 0.12);
  --blue-glow:  rgba(59, 130, 246, 0.30);

  /* Status */
  --green:       #22C55E;
  --green-dim:   rgba(34, 197, 94, 0.15);
  --green-glow:  rgba(34, 197, 94, 0.30);
  --yellow:      #F59E0B;
  --yellow-dim:  rgba(245, 158, 11, 0.15);
  --red:         #EF4444;
  --red-dim:     rgba(239, 68, 68, 0.15);
  --red-glow:    rgba(239, 68, 68, 0.30);

  /* Text */
  --text-primary:  #DDE4F0;
  --text-secondary:#8FA3BE;
  --text-muted:    #566880;
  --text-faint:    #222238;
  --text-white:    #FFFFFF;

  /* Borders */
  --border:        rgba(139, 92, 246, 0.12);
  --border-mid:    rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-card:   rgba(139, 92, 246, 0.18);
  --border-accent:rgba(139, 92, 246, 0.35);
  --accent-semi: rgba(139, 92, 246, 0.12);

  /* Radii */
  --r-xs:  3px;
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  18px;
  --r-2xl: 24px;
  --r-full:9999px;

  /* Transitions */
  --t-fast: 80ms cubic-bezier(0.4, 0, 0.2, 1);
  --t:      160ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.6), 0 8px 16px rgba(0,0,0,0.5);
  --shadow-accent: 0 0 20px rgba(139,92,246,0.25), 0 4px 12px rgba(0,0,0,0.4);
  --shadow-green:  0 0 16px rgba(34,197,94,0.25);
  --shadow-red:    0 0 16px rgba(239,68,68,0.25);
}

/* ── RESET ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-void);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ── AURORA BACKGROUND ──────────────────────────────────────────── */
.aurora-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.aurora-bg::before,
.aurora-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: aurora-drift 18s ease-in-out infinite alternate;
}

.aurora-bg::before {
  width: 800px; height: 800px;
  top: -250px; right: -150px;
  background: radial-gradient(ellipse, rgba(139,92,246,0.38) 0%, rgba(99,60,200,0.12) 40%, transparent 70%);
  animation-delay: 0s;
}

.aurora-bg::after {
  width: 700px; height: 700px;
  bottom: -200px; left: -100px;
  background: radial-gradient(ellipse, rgba(59,130,246,0.22) 0%, rgba(30,80,200,0.08) 40%, transparent 70%);
  animation-delay: -9s;
}

/* Third aurora orb — center glow */
.aurora-bg .aurora-mid {
  position: absolute;
  width: 500px; height: 300px;
  top: 40%; left: 30%;
  border-radius: 50%;
  filter: blur(100px);
  background: radial-gradient(ellipse, rgba(124,58,237,0.14) 0%, transparent 70%);
  animation: aurora-drift 24s ease-in-out infinite alternate;
  animation-delay: -4s;
  pointer-events: none;
}

@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(40px, -30px) scale(1.05); }
  66%  { transform: translate(-20px, 20px) scale(0.97); }
  100% { transform: translate(30px, 10px) scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora-bg::before,
  .aurora-bg::after,
  .aurora-bg .aurora-mid { animation: none; }
  .status-dot.pulse { animation: none; }
  .page.active { animation: none; }
}

/* ── VOICE PULSE RING ───────────────────────────────────────────── */
/* Fixed overlay covering the entire app window.
   JS updates box-shadow in real-time from audio level + voice state.
   pointer-events: none — never intercepts mouse input.
   border-radius matches the window chrome (8px). */
.voice-pulse-ring {
  position: fixed;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  /* transition only on opacity (show/hide), NOT on box-shadow — JS drives that at 60fps */
  transition: opacity 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
  .voice-pulse-ring { display: none; }
}

/* ── GRAIN TEXTURE ──────────────────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── APP SHELL ──────────────────────────────────────────────────── */
#app {
  display: flex;
  flex: 1;
  width: 100vw;
  overflow: hidden;
  position: relative;
  z-index: 2;
  -webkit-app-region: no-drag;
}

/* ── SIDEBAR ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: linear-gradient(180deg, #0E0E1E 0%, #0A0A16 100%);
  border-right: 1px solid rgba(139,92,246,0.15);
  display: flex;
  flex-direction: column;
  transition: width var(--t-slow), min-width var(--t-slow);
  overflow: hidden;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  box-shadow: 2px 0 20px rgba(0,0,0,0.4);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(139,92,246,0.15);
  height: 52px;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(139,92,246,0.08), transparent);
}

.logo-orb {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #6366F1);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow-sm);
  letter-spacing: -0.5px;
}

.logo-text-group { overflow: hidden; }
.logo-name { font-size: 15px; font-weight: 700; color: var(--text-white); white-space: nowrap; }
.logo-tagline { font-size: 10px; color: var(--text-muted); white-space: nowrap; letter-spacing: 0.02em; }

/* Sidebar collapse button */
.sidebar-collapse-btn {
  position: absolute;
  top: 16px; right: 10px;
  width: 22px; height: 22px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  transition: all var(--t);
  opacity: 0;
}
.sidebar:hover .sidebar-collapse-btn { opacity: 1; }
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar.collapsed .sidebar-collapse-btn { opacity: 1; right: 8px; }

/* Nav section */
.sidebar-nav {
  flex: 1;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--t);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.nav-item:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(139,92,246,0.18) 0%, rgba(139,92,246,0.06) 100%);
  color: var(--accent-light);
  box-shadow: inset 0 1px 0 rgba(139,92,246,0.12), inset 0 -1px 0 rgba(139,92,246,0.06);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  border-radius: 0 3px 3px 0;
  box-shadow: 2px 0 8px var(--accent-glow-sm);
}

.nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.nav-label {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  transition: opacity var(--t);
}
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.nav-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: var(--r-full);
  transition: opacity var(--t);
}
.sidebar.collapsed .nav-badge { opacity: 0; }

/* Sidebar status footer */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid rgba(139,92,246,0.12);
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(0deg, rgba(139,92,246,0.05), transparent);
}

.sidebar-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  white-space: nowrap;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.status-dot.offline { background: var(--red); }
.status-dot.pulse   { animation: status-pulse 2s ease-in-out infinite; }

@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--green-glow); }
  50% { box-shadow: 0 0 12px var(--green-glow), 0 0 20px rgba(34,197,94,0.15); }
}

.sidebar-status-text { font-size: 12px; color: var(--text-secondary); flex: 1; }
.sidebar.collapsed .sidebar-status-text { opacity: 0; width: 0; }

/* ── MAIN CONTENT ────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: linear-gradient(160deg, #15152E 0%, #111128 50%, #0E0E20 100%);
  position: relative;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(139,92,246,0.12);
  background: rgba(18, 18, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(139,92,246,0.08);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cmd-K button */
.topbar-cmd {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--t);
  cursor: pointer;
}
.topbar-cmd:hover { border-color: var(--border-accent); color: var(--text-primary); }
.topbar-cmd kbd {
  font-size: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  padding: 0 4px;
  color: var(--text-muted);
  font-family: inherit;
}

/* License badge */
.license-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.25);
  cursor: pointer;
  transition: all var(--t);
}
.license-pill:hover { background: rgba(245,158,11,0.25); }
.license-pill.paid { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,0.25); }

/* ── PAGE CONTAINER ─────────────────────────────────────────────── */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  scroll-behavior: smooth;
}

.page { display: none; }
.page.active { display: block; animation: page-in 200ms ease; }
/* Chat page fills remaining height as flex column */
.page-chat { flex: 1; min-height: 0; }
.page-chat.active { display: flex; flex-direction: column; height: calc(100% - 52px); animation: none; }

/* Dashboard fills full height without scroll */
#page-dashboard.active {
  display: flex;
  flex-direction: column;
  height: calc(100% - 52px);
  padding: 16px 20px;
  overflow: hidden;
  animation: page-in 200ms ease;
}
#page-dashboard .bento-grid {
  flex: 1;
  min-height: 0;
  grid-auto-rows: 1fr;
}

/* Logs page fills full height */
#page-logs.active {
  display: flex;
  flex-direction: column;
  height: calc(100% - 52px);
  animation: page-in 200ms ease;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.page-head-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
}
.page-head-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── GLASS CARD ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border-card);
  border-radius: var(--r-xl);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset,
              0 8px 24px rgba(0,0,0,0.45),
              0 2px 8px rgba(0,0,0,0.3);
}
.card:hover {
  border-color: rgba(139,92,246,0.30);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset,
              0 8px 32px rgba(0,0,0,0.5),
              0 0 0 1px rgba(139,92,246,0.08);
}
.card.glow:hover {
  box-shadow: 0 0 24px rgba(139,92,246,0.20),
              0 8px 32px rgba(0,0,0,0.5),
              0 1px 0 rgba(255,255,255,0.08) inset;
  border-color: var(--border-accent);
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

/* Gradient top-edge shimmer on cards */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,0.5), rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}

/* ── BENTO GRID (Dashboard) ─────────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.bento-1  { grid-column: span 3; }
.bento-2  { grid-column: span 4; }
.bento-3  { grid-column: span 5; }
.bento-4  { grid-column: span 6; }
.bento-5  { grid-column: span 7; }
.bento-8  { grid-column: span 8; }
.bento-12 { grid-column: span 12; }

/* Stat card */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

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

.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.stat-icon.purple { background: var(--accent-dim); }
.stat-icon.blue   { background: var(--blue-dim); }
.stat-icon.green  { background: var(--green-dim); }
.stat-icon.yellow { background: var(--yellow-dim); }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.stat-label { font-size: 11px; color: var(--text-muted); }

/* ── PROGRESS BAR ───────────────────────────────────────────────── */
.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 800ms cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.green  { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red    { background: var(--red); }
.progress-fill.blue   { background: var(--blue); }

/* Sparkline mini chart */
.sparkline {
  width: 100%;
  height: 40px;
  opacity: 0.85;
}

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow-sm);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-mid);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-raised); color: var(--text-primary); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); box-shadow: var(--shadow-red); }

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(34,197,94,0.25);
}
.btn-success:hover { background: rgba(34,197,94,0.25); box-shadow: var(--shadow-green); }

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 10px 20px; font-size: 14px; border-radius: var(--r-lg); }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-icon.sm { width: 26px; height: 26px; padding: 4px; }

/* Gradient primary button */
.btn-gradient {
  background: linear-gradient(135deg, var(--accent), #6366F1);
  color: white;
  border: none;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-gradient:hover { box-shadow: 0 6px 24px var(--accent-glow); transform: translateY(-1px); }

/* ── INPUTS ─────────────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 0 0 1px var(--accent-glow-sm);
}
.input:hover:not(:focus) { border-color: var(--border-strong); }

textarea.input {
  resize: none;
  min-height: 80px;
  line-height: 1.5;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}
.input-wrap .input { padding-left: 32px; }

.input-eye {
  position: absolute;
  right: 10px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  border-radius: var(--r-sm);
  transition: color var(--t);
  background: none; border: none; cursor: pointer;
}
.input-eye:hover { color: var(--text-primary); }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 11px; color: var(--red); margin-top: 5px; }

.input-group {
  display: flex;
  gap: 8px;
}
.input-group .input { flex: 1; }

/* Select */
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394A3B8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Search input */
.search-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 7px 12px;
  transition: border-color var(--t);
}
.search-input:focus-within { border-color: var(--accent); }
.search-input svg { color: var(--text-muted); flex-shrink: 0; }
.search-input input { background: none; border: none; outline: none; color: var(--text-primary); flex: 1; font-size: 13px; }

/* ── TOGGLE SWITCH ──────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--t), border-color var(--t);
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform var(--t-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
}

.toggle-label { font-size: 13px; color: var(--text-primary); cursor: pointer; }

.toggle.toggle-xs { width: 28px; height: 16px; }
.toggle.toggle-xs .toggle-track::after { width: 10px; height: 10px; top: 2px; left: 2px; }
.toggle.toggle-xs input:checked + .toggle-track::after { transform: translateX(12px); }
.toggle-sub   { font-size: 11px; color: var(--text-muted); }

/* ── BADGES ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-violet  { background: var(--accent-dim); color: var(--accent-light); border: 1px solid rgba(139,92,246,0.2); }
.badge-green   { background: var(--green-dim);  color: var(--green);         border: 1px solid rgba(34,197,94,0.2); }
.badge-yellow  { background: var(--yellow-dim); color: var(--yellow);         border: 1px solid rgba(245,158,11,0.2); }
.badge-red     { background: var(--red-dim);    color: var(--red);            border: 1px solid rgba(239,68,68,0.2); }
.badge-blue    { background: var(--blue-dim);   color: var(--blue);           border: 1px solid rgba(59,130,246,0.2); }
.badge-gray    { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-mid); }

/* Tool call chip */
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--blue);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── TABLE ──────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
}
.table-wrap thead { position: sticky; top: 0; z-index: 5; background: var(--bg-surface); }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.02);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-secondary); }

/* ── CHAT PAGE ──────────────────────────────────────────────────── */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-topbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(9,12,18,0.5);
  backdrop-filter: blur(12px);
}

.chat-title { font-size: 14px; font-weight: 600; color: var(--text-white); }
.chat-sub   { font-size: 11px; color: var(--text-muted); }

/* AI settings inline panel */
.chat-ai-panel {
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  flex-shrink: 0;
  overflow: hidden;
}
.chat-ai-panel-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
}
.chat-ai-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-ai-field-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.input-sm { height: 30px; font-size: 12px; padding: 0 10px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

/* Date separator */
.msg-date-sep {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.msg-date-sep::before, .msg-date-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Message group */
.message-group {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  align-items: flex-start;
  max-width: 780px;
}
.message-group.user { flex-direction: row-reverse; align-self: flex-end; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg-avatar.user { background: linear-gradient(135deg, var(--accent), #6366F1); color: white; }
.msg-avatar.bot  { background: linear-gradient(135deg, #1a2235, #0f1520); border: 1px solid var(--border-mid); color: var(--accent-light); }

.msg-body { display: flex; flex-direction: column; gap: 3px; max-width: 520px; }
.message-group.user .msg-body { align-items: flex-end; }

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.msg-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.msg-name.puri { color: var(--accent-light); }
.msg-time { font-size: 11px; color: var(--text-muted); }

.msg-bubble {
  padding: 9px 13px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  word-wrap: break-word;
}
.message-group.bot .msg-bubble  {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-top-left-radius: var(--r-xs);
}
.message-group.user .msg-bubble {
  background: var(--accent);
  color: white;
  border-top-right-radius: var(--r-xs);
}

/* Typing dots */
.msg-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
}
.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Tool call in chat */
.msg-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--blue);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.msg-image {
  max-width: 300px;
  max-height: 200px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border-mid);
}
.msg-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.msg-file {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Scroll to bottom button */
.scroll-to-bottom {
  position: absolute;
  bottom: 16px;
  right: 20px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--t);
  animation: fade-in 150ms ease;
  font-size: 14px;
  box-shadow: var(--shadow-md);
}
.scroll-to-bottom:hover { background: var(--bg-hover); color: var(--text-white); }

/* Chat drag overlay */
.drag-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(139,92,246,0.06);
  border: 2px dashed var(--accent);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-light);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t);
}
.chat-messages.drag-over .drag-over-overlay { opacity: 1; }

/* Chat input area */
.chat-input-area {
  border-top: 1px solid rgba(139,92,246,0.12);
  padding: 12px 16px;
  flex-shrink: 0;
  background: rgba(13, 13, 30, 0.80);
  backdrop-filter: blur(16px);
}

.chat-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-md);
  font-size: 12px;
  color: var(--accent-light);
}
.chat-attach-preview .remove-attach {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 0 2px;
  border-radius: 3px;
  transition: color var(--t);
}
.chat-attach-preview .remove-attach:hover { color: var(--red); }

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  padding: 9px 14px;
  color: var(--text-primary);
  font-size: 13px;
  resize: none;
  outline: none;
  max-height: 160px;
  min-height: 40px;
  line-height: 1.5;
  transition: border-color var(--t);
  font-family: inherit;
}
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-textarea:focus { border-color: var(--accent); }
.chat-textarea:focus-visible,
.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chat-input-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-tool-badge {
  padding: 4px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.2);
  cursor: pointer;
  transition: all var(--t);
}
.chat-tool-badge:hover { background: rgba(59,130,246,0.2); }
.chat-tool-badge.off { background: rgba(255,255,255,0.04); color: var(--text-muted); border-color: var(--border); }

/* ── MEDIA CARD ─────────────────────────────────────────────────── */
.media-art {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #1a1f2e, #0d1117);
  border: 1px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.media-info { flex: 1; min-width: 0; }
.media-track { font-size: 14px; font-weight: 600; color: var(--text-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.media-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.media-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--t-fast);
}
.media-btn:hover { background: var(--bg-hover); color: var(--text-white); }
.media-btn.play-pause {
  width: 36px; height: 36px;
  background: var(--accent);
  color: white;
  font-size: 15px;
}
.media-btn.play-pause:hover { background: var(--accent-hover); box-shadow: 0 0 12px var(--accent-glow-sm); }

.media-times { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-top: 6px; }

/* ── RECENT COMMANDS LIST ───────────────────────────────────────── */
.cmd-list { display: flex; flex-direction: column; gap: 1px; }

.cmd-item {
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.cmd-item:hover { background: var(--bg-raised); }

.cmd-icon { font-size: 14px; text-align: center; }
.cmd-text { font-size: 12px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-source { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.cmd-time   { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.cmd-ok     { font-size: 12px; }
.cmd-ok.ok  { color: var(--green); }
.cmd-ok.err { color: var(--red); }

/* ── BOT STATUS CARD ─────────────────────────────────────────────── */
.bot-status-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.bot-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bot-avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--accent), #6366F1);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.bot-name-row { font-size: 14px; font-weight: 600; color: var(--text-white); }
.bot-handle   { font-size: 12px; color: var(--text-muted); }

/* ── VOICE PAGE ──────────────────────────────────────────────────── */
.voice-mic-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 0;
}

.mic-button {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 2px solid var(--border-mid);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 34px;
  transition: all var(--t);
  position: relative;
}

.mic-button:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  box-shadow: 0 0 24px var(--accent-glow-sm);
}

.mic-button.recording {
  border-color: var(--red);
  color: var(--red);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--red-glow); }
  50%       { box-shadow: 0 0 0 16px rgba(239,68,68,0); }
}

.mic-rings {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid var(--red);
  opacity: 0;
  animation: mic-ring 1.4s ease-out infinite;
}
.mic-rings:nth-child(2) { animation-delay: 0.4s; inset: -16px; }
.mic-rings:nth-child(3) { animation-delay: 0.8s; inset: -24px; }

@keyframes mic-ring {
  0%   { opacity: 0.4; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.1); }
}

.hotkey-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-secondary);
}

.hotkey-key {
  padding: 2px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}

/* Wake word orb */
.wake-orb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--t), box-shadow var(--t);
  flex-shrink: 0;
}
.wake-orb.active {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  animation: status-pulse 2s ease infinite;
}
.wake-orb.inactive { background: var(--red); }

/* Sample dots */
.sample-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.sample-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border-mid);
  transition: all var(--t);
}
.sample-dot.recorded {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow-sm);
}

/* ── LOGS PAGE ───────────────────────────────────────────────────── */
.log-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.log-filter-btn {
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.log-filter-btn:hover { border-color: var(--border-mid); color: var(--text-primary); }
.log-filter-btn.active-debug   { background: var(--bg-raised);  color: var(--text-secondary); border-color: var(--border-mid); }
.log-filter-btn.active-info    { background: var(--blue-dim);   color: var(--blue);   border-color: rgba(59,130,246,0.25); }
.log-filter-btn.active-success { background: var(--green-dim);  color: var(--green);  border-color: rgba(34,197,94,0.25); }
.log-filter-btn.active-warn    { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(245,158,11,0.25); }
.log-filter-btn.active-error   { background: var(--red-dim);    color: var(--red);    border-color: rgba(239,68,68,0.25); }

.log-viewer {
  background: var(--bg-void);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
}

.log-line {
  display: grid;
  grid-template-columns: 70px 65px 72px 1fr;
  gap: 6px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  line-height: 1.5;
  transition: background var(--t-fast);
}
.log-line:hover { background: rgba(255,255,255,0.03); }

.log-time  { color: var(--text-muted); white-space: nowrap; }
.log-mod   { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-msg   { color: var(--text-secondary); word-break: break-all; }

.log-level {
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 10px;
  display: flex; align-items: center;
}
.lvl-debug   .log-level { color: var(--text-muted); }
.lvl-info    .log-level { color: var(--blue); }
.lvl-success .log-level { color: var(--green); }
.lvl-warn    .log-level { color: var(--yellow); }
.lvl-error   .log-level { color: var(--red); }

.lvl-error   .log-msg { color: rgba(239,68,68,0.8); }
.lvl-success .log-msg { color: rgba(34,197,94,0.8); }
.lvl-warn    .log-msg { color: rgba(245,158,11,0.8); }

/* ── MODAL ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 150ms ease;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: #1A1A30;
  border: 1px solid rgba(139,92,246,0.22);
  border-radius: var(--r-2xl);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 0 50px rgba(139,92,246,0.12),
              0 24px 48px rgba(0,0,0,0.6),
              0 1px 0 rgba(255,255,255,0.06) inset;
  animation: modal-in 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.modal.wide { max-width: 560px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.93) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-white); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--t);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Hotkey capture */
.hotkey-capture-box {
  border: 2px dashed var(--border-mid);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t);
  outline: none;
  color: var(--text-muted);
  font-size: 14px;
}
.hotkey-capture-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
  color: var(--text-primary);
}

/* ── TOAST ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toast-in 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
}
.toast::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.toast.success::before { background: var(--green); }
.toast.error::before   { background: var(--red); }
.toast.warning::before { background: var(--yellow); }
.toast.info::before    { background: var(--blue); }

.toast-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  margin-left: auto;
  opacity: 0.6;
  transition: opacity var(--t);
}
.toast-dismiss:hover { opacity: 1; }

.toast.hiding {
  animation: toast-out 200ms ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

/* ── COMMAND PALETTE ────────────────────────────────────────────── */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 150;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  animation: fade-in 120ms ease;
}
.cmd-palette-overlay.hidden { display: none; }

.cmd-palette {
  width: 540px;
  max-width: calc(100vw - 40px);
  background: #1A1A30;
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(139,92,246,0.15),
              0 32px 64px rgba(0,0,0,0.6),
              0 1px 0 rgba(255,255,255,0.06) inset;
  animation: modal-in 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cmd-palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cmd-palette-input-row svg { color: var(--text-muted); flex-shrink: 0; }

.cmd-palette-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-white);
  font-family: inherit;
}
.cmd-palette-input::placeholder { color: var(--text-muted); }

.cmd-palette-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-palette-section { margin-bottom: 4px; }
.cmd-palette-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 6px 10px 4px;
}

.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast);
}
.cmd-palette-item:hover, .cmd-palette-item.selected {
  background: var(--accent-dim);
}
.cmd-palette-item-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.cmd-palette-item-name  { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.cmd-palette-item-sub   { font-size: 11px; color: var(--text-muted); }
.cmd-palette-item-kbd   { margin-left: auto; font-size: 11px; color: var(--text-muted); }

.cmd-palette-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 14px;
  align-items: center;
}
.cmd-palette-footer span { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.cmd-palette-footer kbd {
  font-size: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: inherit;
  color: var(--text-secondary);
}

/* ── ONBOARDING ──────────────────────────────────────────────────── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #0D0D1E 0%, #0A0A1A 100%);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.onboarding-overlay.hidden { display: none; }

.ob-card {
  width: 100%;
  max-width: 460px;
  background: #1A1A32;
  border: 1px solid rgba(139,92,246,0.22);
  border-radius: var(--r-2xl);
  padding: 36px;
  box-shadow: 0 0 80px rgba(139,92,246,0.15),
              0 32px 64px rgba(0,0,0,0.6),
              0 1px 0 rgba(255,255,255,0.06) inset;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.ob-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,0.6), rgba(255,255,255,0.2), transparent);
  pointer-events: none;
}

.ob-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
.ob-logo .logo-orb { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
.ob-logo .logo-name { font-size: 22px; font-weight: 800; }

/* Step track */
.step-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.step-node {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 2px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--t);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-node.active { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 0 12px var(--accent-glow-sm); }
.step-node.done   { background: rgba(34,197,94,0.2); border-color: var(--green); color: var(--green); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-mid);
  max-width: 60px;
  transition: background var(--t);
}
.step-line.done { background: var(--green); }

/* Onboarding steps */
.ob-step { display: none; }
.ob-step.active { display: block; animation: page-in 200ms ease; }

.ob-step-title { font-size: 18px; font-weight: 700; color: var(--text-white); margin-bottom: 8px; }
.ob-step-desc  { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }

.ob-verify {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
}
.ob-verify.success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.ob-verify.error   { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,0.2); }
.ob-verify.hidden  { display: none; }

.ob-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
}

/* Consent options */
.consent-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  cursor: pointer;
  margin-bottom: 10px;
  transition: all var(--t);
  background: var(--bg-input);
}
.consent-opt:hover { border-color: var(--border-strong); }
.consent-opt.selected { border-color: var(--accent); background: var(--accent-dim); }
.consent-opt-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.consent-opt-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.consent-opt-desc  { font-size: 12px; color: var(--text-muted); }

/* ── SCRIPTS STEP EDITOR ────────────────────────────────────────── */
.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.step-item .step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.btn-remove-step {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.btn-remove-step:hover { background: var(--red-dim); color: var(--red); }

/* ── SETTINGS PAGE ──────────────────────────────────────────────── */
.settings-section { margin-bottom: 28px; }
.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  gap: 12px;
}
.settings-row:hover { background: var(--bg-raised); }
.settings-row-left { flex: 1; min-width: 0; }
.settings-row-title { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.settings-row-sub   { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* Favorites grid */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fav-slot {
  aspect-ratio: 1;
  border: 1px dashed var(--border-mid);
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all var(--t);
  background: var(--bg-input);
  color: var(--text-muted);
  flex-direction: column;
  gap: 4px;
}
.fav-slot:hover { border-color: var(--accent); background: var(--accent-dim); }
.fav-slot.filled { border-style: solid; border-color: var(--border-mid); color: var(--text-primary); }
.fav-slot-label { font-size: 10px; text-align: center; }

/* ── EMPTY STATE ─────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 10px;
  text-align: center;
}
.empty-icon  { font-size: 36px; opacity: 0.4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.empty-desc  { font-size: 13px; color: var(--text-muted); max-width: 280px; }

/* ── SCROLLBARS ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── UTILITY ─────────────────────────────────────────────────────── */
.hidden     { display: none !important; }
.invisible  { visibility: hidden; }
.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }
.w-full  { width: 100%; }
.mb-2    { margin-bottom: 8px; }
.mb-3    { margin-bottom: 12px; }
.mb-4    { margin-bottom: 16px; }
.mb-6    { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }
.ml-auto { margin-left: auto; }
.p-0     { padding: 0; }

.text-white    { color: var(--text-white); }
.text-primary  { color: var(--text-primary); }
.text-muted    { color: var(--text-muted); }
.text-accent   { color: var(--accent-light); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-yellow   { color: var(--yellow); }
.text-blue     { color: var(--blue); }

.text-xs   { font-size: 11px; }
.text-sm   { font-size: 12px; }
.text-base { font-size: 13px; }
.text-lg   { font-size: 15px; }
.text-xl   { font-size: 18px; }
.fw-5 { font-weight: 500; }
.fw-6 { font-weight: 600; }
.fw-7 { font-weight: 700; }
.fw-8 { font-weight: 800; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── ANIMATIONS ──────────────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-hover) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-md);
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-box { height: 60px; }

/* Bot page token form */
.token-form-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 16px;
}

.bot-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.bot-banner.online  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.bot-banner.offline { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,0.2); }

/* TTS category rows */
.tts-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.tts-cat-row:hover { background: var(--bg-raised); }
.tts-cat-icon { width: 28px; height: 28px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; background: var(--bg-raised); }
.tts-cat-name { font-size: 13px; color: var(--text-primary); flex: 1; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   900px  — compact (small window / min-size)
   1024px — laptop (1366×768, surface)
   1280px — default target (designed for this)
   1440px — medium monitor / MacBook 14"
   1920px — full HD wide
   ═══════════════════════════════════════════════════════════════════ */

/* ── 900px: compact window ──────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 190px; }

  body { font-size: 12px; }

  .bento-1, .bento-2, .bento-3 { grid-column: span 6; }
  .bento-4, .bento-5           { grid-column: span 12; }

  .topbar-title  { font-size: 13px; }
  .stat-val      { font-size: 22px; }
  .card          { padding: 14px; }
  .quick-grid    { grid-template-columns: repeat(2, 1fr); }
  .msg-bubble    { font-size: 13px; }
  .chat-input    { font-size: 13px; }
}

/* ── 1024px: laptop (1366×768, Surface) ─────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }

  body { font-size: 12.5px; }

  .bento-1 { grid-column: span 4; }
  .bento-2 { grid-column: span 6; }
  .bento-3 { grid-column: span 6; }

  .stat-val { font-size: 24px; }

  .msg-body { max-width: 420px; }
}

/* ── 1280px: default (no overrides needed, designed here) ────────── */

/* ── 1440px: medium monitor ─────────────────────────────────────── */
@media (min-width: 1440px) {
  :root { --sidebar-w: 240px; }

  body { font-size: 13.5px; }

  .stat-val      { font-size: 30px; }
  .card          { padding: 20px; }
  .msg-body      { max-width: 600px; }
  .chat-messages { max-width: 860px; }
}

/* ── 1920px: full HD ─────────────────────────────────────────────── */
@media (min-width: 1920px) {
  :root { --sidebar-w: 260px; }

  body { font-size: 14px; }

  .stat-val      { font-size: 34px; }
  .card          { padding: 24px; }
  .msg-body      { max-width: 720px; }
  .chat-messages { max-width: 1000px; }
  .bento-grid    { gap: 16px; }
  .quick-grid    { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}

/* ── 640px: hide sidebar ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .bento-1, .bento-2, .bento-3,
  .bento-4, .bento-5, .bento-8 { grid-column: span 12; }
  .sidebar { display: none; }
}

/* ── QUICK ACTIONS GRID ─────────────────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: all var(--t-fast);
  cursor: pointer;
  line-height: 1.3;
  text-align: center;
}

.quick-btn:hover {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: var(--accent-light);
  transform: translateY(-1px);
}

.quick-btn .qb-icon { font-size: 16px; }

/* ── VOLUME SLIDER ──────────────────────────────────────────────── */
.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.07);
  outline: none;
  margin-top: 8px;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
  transition: transform var(--t-fast);
}

.vol-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }

/* ── EXCLUSION LIST ─────────────────────────────────────────────── */
.exclusion-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  max-height: 80px;
  overflow-y: auto;
}

.exclusion-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-raised);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text-secondary);
}

.exclusion-item button {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
  transition: color var(--t-fast);
}
.exclusion-item button:hover { color: var(--red); }

/* ── CHAT EMPTY STATE ───────────────────────────────────────────── */
.chat-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  pointer-events: none;
  user-select: none;
  padding-bottom: 60px;
}

.chat-empty-orb {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(99,60,200,0.12));
  border: 1px solid rgba(139,92,246,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 0 40px rgba(139,92,246,0.18), 0 0 0 8px rgba(139,92,246,0.06);
  animation: orb-pulse 3s ease-in-out infinite;
}

@keyframes orb-pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(139,92,246,0.18), 0 0 0 8px rgba(139,92,246,0.06); }
  50%       { box-shadow: 0 0 60px rgba(139,92,246,0.28), 0 0 0 14px rgba(139,92,246,0.04); }
}

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

.chat-empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.6;
}

.chat-empty-hints {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.chat-hint-chip {
  padding: 8px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  cursor: default;
  transition: border-color var(--t);
  pointer-events: all;
}
.chat-hint-chip:hover {
  border-color: var(--border-accent);
  color: var(--accent-light);
  background: var(--accent-dim);
}

/* ── DASHBOARD STAT CARD improvements ──────────────────────────── */
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1;
  letter-spacing: -0.8px;
  margin-top: 8px;
}

.progress-track {
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 10px;
}

/* ── CUSTOM WINDOW TITLEBAR ─────────────────────────────────────── */
.win-titlebar {
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 14px;
  background: linear-gradient(90deg, #080814 0%, #0D0D1E 100%);
  border-bottom: 1px solid rgba(139,92,246,0.20);
  position: relative;
  z-index: 20;
  -webkit-app-region: drag;
  user-select: none;
  box-shadow: 0 1px 12px rgba(0,0,0,0.5);
}

.win-titlebar-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  -webkit-app-region: drag;
}

.win-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  -webkit-app-region: no-drag;
}

.wc-btn {
  width: 30px;
  height: 24px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  transition: all var(--t-fast);
}

.wc-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.wc-close:hover {
  background: rgba(239, 68, 68, 0.18);
  color: var(--red);
}

.wc-hide:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
}

/* ================================================================
   WIDGET DASHBOARD SYSTEM v3
   ================================================================ */

/* ── Dashboard header ─────────────────────────────────────────── */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 16px 6px;
  flex-shrink: 0;
}
.dash-actions { display: flex; gap: 6px; }

/* ── Widget Grid ──────────────────────────────────────────────── */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 10px;
  padding: 0 16px 16px;
  grid-auto-flow: row dense;
  overflow: visible;
  flex: 1;
  min-height: 0;
}
.widget-grid-edit .widget-cell { cursor: pointer; }
.widget-cell.cell-media { padding: 0; }

.ws-1 { grid-column: span 1; }
.ws-2 { grid-column: span 2; }
.ws-3 { grid-column: span 3; }
.ws-4 { grid-column: span 4; }
.hs-1 { grid-row: span 1; }
.hs-2 { grid-row: span 2; }
.hs-3 { grid-row: span 3; }
.hs-4 { grid-row: span 4; }

.widget-cell {
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s ease,
              border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.widget-cell:hover {
  box-shadow: 0 0 0 1px rgba(139,92,246,0.2), 0 8px 32px rgba(0,0,0,0.38);
}
.widget-cell.editing {
  border: 1.5px dashed rgba(139,92,246,0.42) !important;
  cursor: pointer;
  transform: none !important;
  animation: widget-edit-pulse 2.4s ease-in-out infinite;
}
@keyframes widget-edit-pulse {
  0%,100% { border-color: rgba(139,92,246,0.35); box-shadow: 0 0 0 0 transparent; }
  50%      { border-color: rgba(167,139,250,0.7); box-shadow: 0 0 18px rgba(139,92,246,0.14); }
}

/* ── Widget swap animation ────────────────────────────────────── */
@keyframes widget-swap {
  0%   { transform: scale(1) rotate(0deg); opacity: 1; }
  18%  { transform: scale(0.88) rotate(-2deg); opacity: 0.6; }
  50%  { transform: scale(1.06) rotate(0.8deg); opacity: 1; }
  72%  { transform: scale(0.97) rotate(-0.3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.widget-cell.swapping {
  animation: widget-swap 0.58s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 15;
}

/* ── Edit overlay (redesigned) ────────────────────────────────── */
.widget-edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6,5,20,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: inherit;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  gap: 5px;
  animation: overlay-appear 0.2s ease;
}
@keyframes overlay-appear {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to   { opacity: 1; backdrop-filter: blur(12px); }
}
.widget-edit-overlay:hover { background: rgba(10,8,28,0.93); }
.widget-edit-overlay.swap-target {
  background: rgba(99,102,241,0.12);
  border: 1.5px solid rgba(99,102,241,0.45);
  animation: swap-target-glow 0.75s ease-in-out infinite alternate;
}
@keyframes swap-target-glow {
  from { background: rgba(99,102,241,0.08); box-shadow: inset 0 0 24px rgba(99,102,241,0.06); }
  to   { background: rgba(99,102,241,0.2);  box-shadow: inset 0 0 32px rgba(99,102,241,0.18); }
}

.widget-del-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(239,68,68,0.14);
  border: 1px solid rgba(239,68,68,0.22);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  z-index: 2;
}
.widget-del-btn:hover {
  background: var(--red);
  border-color: transparent;
  color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(239,68,68,0.4);
}

.widget-edit-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}
.widget-edit-ico { font-size: 26px; filter: saturate(0.7); }
.widget-edit-name {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.04em;
}

.widget-edit-footer {
  position: absolute;
  bottom: 8px; left: 10px; right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.wec-size-badge {
  font-size: 10px;
  font-weight: 700;
  color: rgba(139,92,246,0.7);
  background: rgba(139,92,246,0.12);
  padding: 2px 6px;
  border-radius: 4px;
}
.wec-swap-hint {
  font-size: 10px;
  color: var(--accent-light);
  animation: swap-hint-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes swap-hint-pulse { from{opacity:0.5} to{opacity:1} }

/* Swap-selected widget: lifted with glow */
.widget-cell.swap-sel {
  border: 2px solid var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(139,92,246,0.18),
              0 16px 48px rgba(0,0,0,0.55),
              0 0 32px rgba(139,92,246,0.22) !important;
  transform: scale(1.025) translateY(-3px) !important;
  z-index: 12;
  animation: swap-sel-throb 1.2s ease-in-out infinite alternate;
}
@keyframes swap-sel-throb {
  from { box-shadow: 0 0 0 4px rgba(139,92,246,0.18), 0 16px 48px rgba(0,0,0,0.55), 0 0 24px rgba(139,92,246,0.2); }
  to   { box-shadow: 0 0 0 6px rgba(139,92,246,0.28), 0 20px 56px rgba(0,0,0,0.6), 0 0 40px rgba(139,92,246,0.35); }
}

/* ── Resize handle (inside edit overlay) ─────────────────────── */
.widget-resize-handle {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 24px; height: 24px;
  cursor: nwse-resize;
  color: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 25;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.15s;
}
.widget-resize-handle.rh-edit { opacity: 1; }
.widget-resize-handle:hover,
.widget-resize-handle.rh-active {
  color: var(--accent-light);
  background: rgba(139,92,246,0.2);
  border-color: rgba(139,92,246,0.4);
}
.widget-resize-handle svg { display: block; }

/* ── Shared stat primitives ───────────────────────────────────── */
.w-stat-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.w-stat-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
}
.w-stat-val {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-white);
  letter-spacing: -0.04em;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.w-stat-val.val-red {
  color: var(--red);
  text-shadow: 0 0 20px rgba(239,68,68,0.4);
}
.w-stat-val.val-yel {
  color: var(--yellow);
  text-shadow: 0 0 20px rgba(245,158,11,0.4);
}
.w-stat-val.green { color: var(--green); }
.w-stat-ico {
  width: 38px; height: 38px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.w-stat-ico.purple { background: rgba(139,92,246,0.13); color: var(--accent); box-shadow: 0 0 14px rgba(139,92,246,0.15); }
.w-stat-ico.blue   { background: rgba(59,130,246,0.13);  color: var(--blue);   box-shadow: 0 0 14px rgba(59,130,246,0.15); }
.w-stat-ico.yellow { background: rgba(245,158,11,0.13);  color: var(--yellow); box-shadow: 0 0 14px rgba(245,158,11,0.15); }
.w-stat-ico.green  { background: rgba(34,197,94,0.13);   color: var(--green);  box-shadow: 0 0 14px rgba(34,197,94,0.15); }
.w-stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Progress bar */
.w-bar-track {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 10px;
  position: relative;
}
.w-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: var(--r-full);
  transition: width 0.55s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.w-bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 8px;
  background: rgba(255,255,255,0.55);
  border-radius: var(--r-full);
  filter: blur(2px);
}
.w-bar-fill.blue   { background: linear-gradient(90deg, var(--blue), #60A5FA); }
.w-bar-fill.yellow { background: linear-gradient(90deg, var(--yellow), #FCD34D); }
.w-bar-fill.media-bar { background: linear-gradient(90deg, rgba(139,92,246,0.9), rgba(167,139,250,0.95)); transition: width 0.3s linear; }

/* Sparkline SVG */
.w-spark {
  width: 100%;
  margin-top: 8px;
  flex: 1;
  min-height: 24px;
  max-height: 120px;
  opacity: 0.85;
}

/* ── CLOCK ────────────────────────────────────────────────────── */
.w-stat, .w-clock, .w-volume, .w-bot, .w-weather, .w-currency,
.w-net, .w-bat, .w-usage { height: 100%; display: flex; flex-direction: column; }
.w-stat { gap: 0; }  /* sparkline flex:1 handles space distribution */

.w-clock {
  justify-content: space-between;
  align-items: flex-start;
}
.clock-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  opacity: 0.7;
}
/* Hide label at h=1 to save space — the widget IS obviously a clock */
.hs-1 .clock-label { display: none; }
.clock-time {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--text-white);
  font-variant-numeric: tabular-nums;
}
.wc-1x1 .clock-time { font-size: 38px; }
.wc-2x1 .clock-time { font-size: 52px; }
.wc-1x2 .clock-time { font-size: 52px; }
.wc-2x2 .clock-time { font-size: 64px; }
.wc-1x3 .clock-time { font-size: 68px; }
.wc-2x3 .clock-time { font-size: 80px; }
.clock-extra {
  display: flex;
  flex-direction: column;
  margin-top: 0;
  gap: 3px;
}
.clock-day {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
.clock-date {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* ── CALENDAR (inside clock widget) ──────────────────────────── */
.clock-cal {
  margin-top: auto; width: 100%;
  display: flex; flex-direction: column; gap: 4px;
}
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
}
.cal-nav-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; cursor: pointer; padding: 2px 6px;
  border-radius: var(--r-sm); transition: all var(--t-fast);
}
.cal-nav-btn:hover { color: var(--text-white); background: rgba(255,255,255,0.08); }
.cal-month {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer;
}
.cal-month:hover { color: var(--accent-light); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto repeat(6, 18px);
  gap: 1px; text-align: center;
  align-content: start;
}
.cal-hd {
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  padding: 2px 0; opacity: 0.6;
}
.cal-d {
  font-size: 10px; color: var(--text-secondary);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  height: 18px; width: 18px; margin: 0 auto;
}
.cal-d.cal-today {
  background: var(--accent); color: var(--text-white);
  font-weight: 700; border-radius: 50%;
}
.cal-d.cal-weekend { color: var(--text-muted); }

/* ── VOLUME ───────────────────────────────────────────────────── */
.w-volume { justify-content: space-between; gap: 6px; }
.w-vol-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.w-vol-ticks {
  display: flex; justify-content: space-between;
  margin-top: 4px; padding: 0 1px;
  font-size: 9px; color: var(--text-muted); opacity: 0.6;
}
.w-vol-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.08);
  outline: none;
  margin-top: 0;
  cursor: pointer;
}
.w-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--green), #4ADE80);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(34,197,94,0.6), 0 2px 4px rgba(0,0,0,0.4);
  transition: transform 0.15s ease;
}
.w-vol-slider::-webkit-slider-thumb:hover { transform: scale(1.3); }
.w-vol-slider.mini { width: 80px; }
.w-vol-row { display: flex; gap: 4px; margin-top: auto; }
.w-icon-btn {
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 11px;
  display: flex; align-items: center; gap: 4px;
  transition: all var(--t-fast);
}
.w-icon-btn:hover { background: var(--accent-dim); color: var(--accent); }

/* ── BOT ──────────────────────────────────────────────────────── */
.w-bot { justify-content: space-between; gap: 10px; }

.w-bot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.w-bot-avatar {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(139,92,246,0.15);
  border: 1.5px solid rgba(139,92,246,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  overflow: visible;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), border-color 0.2s;
}
.w-bot-avatar:hover { transform: scale(1.08); border-color: rgba(139,92,246,0.6); }

.w-bot-avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.w-bot-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.w-bot-status-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface-card);
  transition: background 0.3s, box-shadow 0.3s;
}
.w-bot-status-dot.dot-on {
  background: var(--green);
  box-shadow: 0 0 8px rgba(34,197,94,0.8);
  animation: bot-dot-pulse 2s ease-in-out infinite;
}
.w-bot-status-dot.dot-off { background: rgba(255,255,255,0.2); }

@keyframes bot-dot-pulse {
  0%,100% { box-shadow: 0 0 4px rgba(34,197,94,0.5); }
  50%      { box-shadow: 0 0 14px rgba(34,197,94,0.9), 0 0 24px rgba(34,197,94,0.3); }
}

.w-bot-info {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.w-bot-name {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-bot-username {
  font-size: 11px; font-weight: 500;
  color: var(--accent-light);
  opacity: 0.85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-bot-username:hover { opacity: 1; text-decoration: underline; }

.w-bot-state {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  transition: color 0.3s;
}
.w-bot-state.state-on  { color: var(--green); }
.w-bot-state.state-off { color: rgba(255,255,255,0.25); }

.w-bot-btn {
  width: 100%;
  padding: 7px 0;
  border-radius: 10px;
  border: none;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.w-bot-btn.bot-btn-start {
  background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(16,185,129,0.15));
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.3);
}
.w-bot-btn.bot-btn-start:hover {
  background: linear-gradient(135deg, rgba(34,197,94,0.35), rgba(16,185,129,0.25));
  border-color: rgba(34,197,94,0.55);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(34,197,94,0.25);
}
.w-bot-btn.bot-btn-stop {
  background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(220,38,38,0.1));
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.25);
}
.w-bot-btn.bot-btn-stop:hover {
  background: linear-gradient(135deg, rgba(239,68,68,0.28), rgba(220,38,38,0.2));
  border-color: rgba(239,68,68,0.45);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239,68,68,0.2);
}
.mt-auto { margin-top: auto; }

/* ── VOLUME mute button ───────────────────────────────────────── */
.w-mute-btn {
  margin-top: auto;
  width: 100%;
  padding: 5px 8px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all var(--t-fast);
}
.w-mute-btn:hover {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239,68,68,0.3);
  box-shadow: 0 0 12px rgba(239,68,68,0.1);
}
.w-mute-btn.mute-active {
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 0 14px rgba(239,68,68,0.2);
}
.w-mute-btn.mute-active:hover {
  background: rgba(239,68,68,0.25);
  box-shadow: 0 0 18px rgba(239,68,68,0.3);
}

/* ── NETWORK WIDGET ───────────────────────────────────────────── */
.w-net { gap: 4px; }
.w-net-speeds {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  flex: 1;
  justify-content: center;
}
.w-net-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.w-net-arrow {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.w-net-arrow.down { color: var(--green); }
.w-net-arrow.up   { color: var(--yellow); }
.w-net-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.w-net-val.secondary { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.w-net-sparks {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}
.w-net-sparks .w-spark { margin-top: 0; min-height: 18px; max-height: 30px; }

/* ── BATTERY WIDGET ───────────────────────────────────────────── */
.w-bat { gap: 6px; }
.w-bat .w-bat-footer { margin-top: auto; }
.w-bat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}
.w-bat-plug {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
}

/* ── USAGE STATS WIDGET ───────────────────────────────────────── */
.w-usage { gap: 6px; justify-content: space-between; }
.w-usage-big { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.w-usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex-shrink: 0;
}
.w-usage-cell {
  background: rgba(255,255,255,0.04);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 6px 4px;
  text-align: center;
}
.w-usage-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.w-usage-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
}

/* ── MEDIA PLAYER (full redesign) ─────────────────────────────── */
.w-media {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
}

/* Background layers */
.media-bg { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.media-bg-art {
  position: absolute; inset: -50px;
  background-size: cover; background-position: center;
  filter: blur(36px) saturate(1.8) brightness(0.32);
  transform: scale(1.15);
  transition: background-image 1.4s ease, opacity 0.8s ease;
}
.media-bg-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 60% 20%, rgba(139,92,246,0.28) 0%, rgba(8,5,22,0.98) 70%);
  transition: opacity 0.8s ease;
}
.media-bg-glow.active {
  background: radial-gradient(ellipse at 60% 20%, rgba(139,92,246,0.5) 0%, rgba(14,6,32,0.95) 65%);
  animation: media-pulse-bg 6s ease-in-out infinite alternate;
}
.media-bg-glow.with-art { opacity: 0.45; }
.media-bg-glow.with-art.active { opacity: 0.6; }
@keyframes media-pulse-bg { from { opacity: 0.8; } to { opacity: 1; } }
.media-bg-art.art-loaded { opacity: 1; }
.media-bg-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.0)  0%,
    rgba(0,0,0,0.05) 30%,
    rgba(0,0,0,0.5)  65%,
    rgba(0,0,0,0.88) 100%
  );
}

/* Content */
.media-content {
  position: relative; z-index: 1;
  height: 100%; display: flex; flex-direction: column;
}

/* Album art zone */
.media-art-zone {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px 20px 4px;
  min-height: 0;
}
/* Frame clips Spotify/branding from bottom of thumbnail */
.media-art-frame {
  width: 148px; height: 148px;
  max-width: 148px; max-height: 148px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 14px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.85),
    0 6px 20px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.1),
    0 0 0 3px rgba(255,255,255,0.04);
  transition: transform 0.5s ease;
}
.media-art-frame:hover { transform: scale(1.03) rotate(1deg); }
.media-art-img {
  width: 100%;
  height: 133%;          /* тянем на 33% выше чтобы обрезать низ */
  object-fit: cover;
  object-position: top center;
  display: block;
}

/* Vinyl orb (no art fallback) */
.media-art-orb {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: conic-gradient(
    rgba(139,92,246,0.5) 0deg,
    rgba(80,30,160,0.3) 90deg,
    rgba(30,10,80,0.6) 180deg,
    rgba(80,30,160,0.3) 270deg,
    rgba(139,92,246,0.5) 360deg
  );
  border: 2px solid rgba(139,92,246,0.25);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 0 40px rgba(139,92,246,0.2);
}
.media-art-orb::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.06);
}
.media-art-orb::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(20,10,50,0.9);
  border: 1.5px solid rgba(255,255,255,0.12);
  z-index: 1;
}
.media-art-orb svg { position: relative; z-index: 2; }
.media-art-orb.spinning {
  animation: vinyl-spin 10s linear infinite;
  box-shadow: 0 0 48px rgba(139,92,246,0.45), 0 0 80px rgba(139,92,246,0.15);
}
@keyframes vinyl-spin { to { transform: rotate(360deg); } }

/* Footer */
.media-footer {
  flex-shrink: 0;
  padding: 10px 18px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.media-meta { min-width: 0; }
.media-track-name {
  font-size: 14px; font-weight: 700;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: -0.01em;
}
.media-artist-name {
  font-size: 11px; color: rgba(255,255,255,0.48);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.media-prog { }
.media-times {
  display: flex; justify-content: space-between;
  font-size: 10px; color: rgba(255,255,255,0.3);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.media-controls {
  display: flex; align-items: center; gap: 6px;
}
.media-btn-ctrl {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.6);
  transition: color 0.15s ease, background 0.15s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  flex-shrink: 0;
}
.media-btn-ctrl:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
  transform: scale(1.15);
}
.play-btn {
  width: 46px; height: 46px;
  background: #fff;
  color: #0a0420;
  border-radius: 50%;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.55),
    0 0 0 2px rgba(255,255,255,0.15),
    0 0 20px rgba(255,255,255,0.1);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
  flex-shrink: 0;
}
.play-btn:hover {
  transform: scale(1.12);
  box-shadow:
    0 6px 32px rgba(0,0,0,0.65),
    0 0 0 3px rgba(255,255,255,0.25),
    0 0 28px rgba(255,255,255,0.18);
}
.play-btn:active { transform: scale(0.95); }
.media-vol-row {
  display: flex; align-items: center; gap: 5px;
  margin-left: auto;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

/* Horizontal compact layout (h=1) */
.media-2x1 .media-content,
.media-3x1 .media-content,
.media-4x1 .media-content {
  flex-direction: row; align-items: center;
}
.media-2x1 .media-art-zone,
.media-3x1 .media-art-zone,
.media-4x1 .media-art-zone {
  flex: 0 0 auto; padding: 10px 0 10px 14px;
}
.media-2x1 .media-art-frame,
.media-3x1 .media-art-frame,
.media-4x1 .media-art-frame {
  width: 52px; height: 52px;
  max-width: 52px; max-height: 52px;
  border-radius: 10px;
}
.media-2x1 .media-art-orb,
.media-3x1 .media-art-orb,
.media-4x1 .media-art-orb {
  width: 52px; height: 52px;
}
.media-2x1 .media-footer,
.media-3x1 .media-footer,
.media-4x1 .media-footer {
  flex: 1; padding: 10px 14px 10px 12px; gap: 5px; justify-content: center;
}

/* ── WEATHER ──────────────────────────────────────────────────── */
.w-weather {
  justify-content: center; gap: 10px;
  cursor: grab; user-select: none; overflow: hidden;
}
.w-weather:active { cursor: grabbing; }
.weather-top {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-shrink: 0; margin-bottom: 4px;
}
.weather-dots {
  display: flex; gap: 5px; align-items: center;
}
.weather-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.2); border: none;
  padding: 0; cursor: pointer;
  transition: all var(--t-fast);
}
.weather-dot.active {
  background: var(--accent); width: 16px; border-radius: 3px;
}
.weather-carousel {
  flex: 1; display: flex; align-items: center;
  justify-content: center; position: relative;
  min-height: 0; overflow: hidden;
}
.weather-slide {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; width: 100%;
}
.ws-anim-in {
  animation: wsSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes wsSlideIn {
  from { opacity: 0; transform: translateX(calc(var(--ws-dir, 1) * 50px)); }
  to   { opacity: 1; transform: translateX(0); }
}
.weather-slide-icon { font-size: 40px; line-height: 1; }
.hs-2 .weather-slide-icon, .hs-3 .weather-slide-icon { font-size: 52px; }
.weather-slide-temp {
  font-size: 42px; font-weight: 800;
  line-height: 1; letter-spacing: -0.05em;
  color: var(--text-white);
}
.hs-2 .weather-slide-temp, .hs-3 .weather-slide-temp { font-size: 56px; }
.weather-slide-name {
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.08em;
}
.weather-slide-desc {
  font-size: 13px; color: var(--text-muted);
}
.weather-slide-range {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}
.weather-range-bar {
  width: 28px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-blue, #60a5fa), var(--accent-orange, #fb923c));
  opacity: 0.6;
}
.weather-slide-extra {
  display: flex; gap: 10px; margin-top: 4px;
  font-size: 11px; color: var(--text-muted);
}
.weather-slide-extra span { display: flex; align-items: center; gap: 3px; }

/* ── CURRENCY ─────────────────────────────────────────────────── */
.currency-hdr {
  display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
}
.cur-gear {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 3px; border-radius: var(--r-sm);
  transition: all var(--t-fast); opacity: 0.5; display: flex;
}
.cur-gear:hover { opacity: 1; color: var(--text-white); }

/* rates */
.cur-rates {
  display: flex; flex-direction: column; gap: 1px;
  flex: 1; min-height: 0; justify-content: center;
}
.cur-rate-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0;
}
.cur-rate-code {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.cur-rate-val {
  font-size: 13px; font-weight: 700; color: var(--text-white);
  font-variant-numeric: tabular-nums;
}
.cur-empty {
  font-size: 11px; color: var(--text-muted); opacity: 0.5;
  text-align: center; padding: 8px 0;
}

/* settings */
.cur-settings {
  display: flex; flex-direction: column; gap: 5px;
  flex: 1; overflow-y: auto; min-height: 0;
}
.cur-settings-hint {
  font-size: 10px; color: var(--text-muted); opacity: 0.6;
}
.cur-settings-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  color: var(--text-muted); letter-spacing: 0.08em; opacity: 0.5;
  margin-top: 2px;
}
.cur-opts-grid { display: flex; flex-wrap: wrap; gap: 3px; }
.cur-chip {
  padding: 3px 7px; border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: none; color: var(--text-muted);
  font-size: 10px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast);
}
.cur-chip:hover:not(.disabled) { border-color: rgba(255,255,255,0.2); color: var(--text-secondary); }
.cur-chip.active {
  border-color: var(--accent); color: var(--text-white);
  background: rgba(139,92,246,0.1);
}
.cur-chip.disabled { opacity: 0.25; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE WIDGET SIZE OVERRIDES
   Applied via .hs-N / .ws-N classes on the parent .widget-cell
   ════════════════════════════════════════════════════════════════ */

/* Sparklines: no max-height cap in tall cells — let them fill freely */
.hs-2 .w-spark, .hs-3 .w-spark { max-height: none; }

/* Stat widgets at h≥2: bigger value font (only direct w-stat, not bat/net/usage) */
.hs-2 .w-stat > .w-stat-row .w-stat-val,
.hs-3 .w-stat > .w-stat-row .w-stat-val { font-size: 44px; }

/* Clock: bigger day/date labels in tall cells */
.hs-2 .clock-day, .hs-3 .clock-day { font-size: 14px; }
.hs-2 .clock-date, .hs-3 .clock-date { font-size: 13px; }

/* Volume: bigger thumb in tall cells */
.hs-2 .w-vol-slider, .hs-3 .w-vol-slider { height: 8px; }
.hs-2 .w-vol-slider::-webkit-slider-thumb,
.hs-3 .w-vol-slider::-webkit-slider-thumb { width: 20px; height: 20px; }

/* Battery: vertical fill track (h≥2) */
.w-bat-vtrack {
  flex: 1;
  position: relative;
  background: rgba(255,255,255,0.05);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.w-bat-vfill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  transition: height 0.8s cubic-bezier(0.4,0,0.2,1);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
}
.w-bat-vfill.green  { background: linear-gradient(180deg, var(--green), #4ADE80); }
.w-bat-vfill.yellow { background: linear-gradient(180deg, var(--yellow), #FCD34D); }
.w-bat-vfill.red    { background: linear-gradient(180deg, var(--red), #F87171); }
.w-bat-vtext {
  position: relative; z-index: 2;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.7);
  display: flex; align-items: center;
}

/* Battery at h≥2: big % number */
.hs-2 .w-bat .w-stat-val,
.hs-3 .w-bat .w-stat-val { font-size: 52px; }

/* Network: bigger speed values in wide cells */
.ws-2 .w-net-val { font-size: 18px; }
.hs-2 .w-net-val, .hs-3 .w-net-val { font-size: 20px; }
.hs-2 .w-net-sparks .w-spark, .hs-3 .w-net-sparks .w-spark { min-height: 30px; }

/* Bot: stats section */
.w-bot-divider {
  height: 1px; flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  margin: 2px 0;
}
.w-bot-stats {
  flex: 1; display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.w-bot-stat-row {
  display: flex; gap: 8px;
}
.w-bot-stat {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,0.06);
}
.w-bot-stat-n {
  font-size: 20px; font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.w-bot-stat-l {
  font-size: 9px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* Usage: scale big number in tall cells */
.hs-2 .w-usage .w-stat-val,
.hs-3 .w-usage .w-stat-val { font-size: 52px; }

/* ── Widget Catalog Modal ─────────────────────────────────────── */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 16px;
}
.catalog-item {
  padding: 12px 10px;
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  transition: all var(--t-fast);
}
.catalog-item:hover:not(.disabled) {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.catalog-item.disabled {
  opacity: 0.35; cursor: not-allowed;
  pointer-events: auto;
}
.catalog-ico  { font-size: 22px; }
.catalog-lbl  { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.catalog-sz   { font-size: 10px; }

/* ── Voice Page ──────────────────────────────────────────────────── */
.voice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.voice-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.voice-card-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vi-accent { background: rgba(139,92,246,0.15); color: var(--accent); }
.vi-blue   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.vi-green  { background: rgba(34,197,94,0.15);   color: #4ade80; }
.vi-yellow { background: rgba(234,179,8,0.15);   color: #facc15; }
.voice-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* Activation card */
.voice-mic-zone {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  padding: 8px 0;
}
.voice-hotkey-pill { display: flex; align-items: center; gap: 6px; }

/* Wake word card */
.wake-status-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.wake-orb {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.wake-orb.active   { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.wake-orb.inactive { background: var(--text-muted); }
.wake-status-text { font-size: 13px; color: var(--text-primary); }
.wake-status-sub  { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.wake-samples-block { display: flex; flex-direction: column; gap: 8px; }
.wake-samples-header { display: flex; justify-content: space-between; align-items: center; }
.wake-samples-badge {
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px; border-radius: 20px;
}
.wake-prog-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px; overflow: hidden;
}
.wake-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* TTS card */
.tts-main-toggles {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.tts-main-row  { display: flex; align-items: center; gap: 10px; }
.tts-main-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.tts-main-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tts-main-divider { height: 1px; background: var(--border); margin: 10px 0; }
.pill-btn {
  padding: 5px 14px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); border-radius: 16px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
}
.pill-btn:hover { border-color: var(--accent); color: var(--accent); }
.pill-btn.active {
  background: var(--accent); border-color: var(--accent);
  color: #fff;
}
.tts-cats-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 8px;
}
.tts-cats-grid { display: flex; flex-direction: column; gap: 6px; }

/* Exclusions card */
.voice-excl-desc { font-size: 12px; color: var(--text-muted); margin: -6px 0 12px; }
.voice-excl-add  { display: flex; gap: 8px; margin-top: 12px; }
.voice-excl-add .input { flex: 1; }

/* ── Settings Page ───────────────────────────────────────────────── */
#page-settings.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100% + 40px);
  margin: -20px -24px;
  overflow: visible;
}
.settings-layout {
  display: grid;
  grid-template-columns: 176px 1fr;
  flex: 1;
  min-height: 0;
}
.settings-tabs {
  padding: 12px 8px 16px;
  display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border);
}
.settings-tabs-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px 10px;
}
.settings-tab-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: none; background: transparent;
  color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  text-align: left; width: 100%;
  transition: all var(--t-fast);
}
.settings-tab-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.settings-tab-btn.active {
  background: var(--accent-dim);
  color: var(--accent-light);
}
.settings-tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.stab-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7;
}
.settings-tab-btn.active .stab-icon { opacity: 1; }
.settings-content {
  padding: 20px 24px 24px;
  overflow-y: auto;
}
.settings-panel { display: flex; flex-direction: column; gap: 20px; }
.settings-panel-head { margin-bottom: 4px; }
.settings-panel-title { font-size: 16px; font-weight: 700; color: var(--text-white); margin-bottom: 4px; }
.settings-panel-desc  { font-size: 12px; color: var(--text-muted); }
.sfield-group { display: flex; flex-direction: column; gap: 16px; }
.settings-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.sfield { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.sfield-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.sfield-body  { display: flex; flex-direction: column; gap: 4px; }
.sfield-hint  { font-size: 11px; color: var(--text-muted); }
.sfield-divider { height: 1px; background: var(--border); margin: 0 16px; }
.sfield-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.sfield-row-left { flex: 1; min-width: 0; }
.sfield-num-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.sfield-num  { width: 64px; text-align: center; }
.sfield-unit { font-size: 12px; color: var(--text-muted); }

/* Provider segment control */
.seg-ctrl {
  display: flex;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.seg-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.seg-btn:not(:last-child) { border-right: 1px solid var(--border); }
.seg-btn.active { background: var(--accent); color: #fff; }
.seg-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }

/* Sticky save bar */
.settings-save-bar {
  position: sticky; bottom: 0; z-index: 10;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
  padding: 10px 24px;
  flex-shrink: 0;
}
.settings-save-actions {
  display: flex; align-items: center; gap: 8px;
  justify-content: flex-end;
}

/* ── Voice Widget ─────────────────────────────────────────────────── */
.w-voice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
}

/* Ambient glow backdrop */
.wv-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 110%,
    rgba(139,92,246,0.22) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
}
.wv-glow.active { opacity: 1; }

/* Header row */
.wv-header {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 2;
  flex-shrink: 0;
}
.wv-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  transition: color 0.4s;
}
/* Label color handled by .wv-enabled / .wv-recording in new styles below */

/* Canvas fills parent zone exactly — shared by both old sphere-zone & new viz-zone */
.wv-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}

@keyframes wv-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wv-hotkey-label { font-size: 10px; color: var(--text-muted); }

/* ── Visualization zone (replaces sphere-zone) ──────────────────── */
.wv-viz-zone {
  flex: 1;
  position: relative;
  z-index: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wv-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
}
/* Muted overlay (centered icon + text) */
.wv-muted-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  opacity: 0.45;
  pointer-events: none;
}
.wv-muted-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* State modifiers */
.wv-enabled .wv-label  { color: var(--accent-light); }
.wv-recording .wv-label { color: #f87171; }

/* Status row */
.wv-status { text-align: center; position: relative; z-index: 1; min-height: 15px; flex-shrink: 0; }
.wv-status-on  { font-size: 11px; font-weight: 500; color: var(--accent-light); animation: wv-fade-in 0.35s ease; }
.wv-status-off { font-size: 11px; color: var(--text-muted); }
.wv-status-rec { font-size: 11px; font-weight: 600; color: #f87171; animation: wv-fade-in 0.2s ease; }
.wv-status-ptt { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; justify-content: center; gap: 4px; }

/* Wake word toggle row */
.wv-mode-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; flex-shrink: 0;
  padding: 2px 0;
  position: relative; z-index: 2;
}

/* ── Widget quick-action row ─────────────────── */
.w-action-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-shrink: 0;
}
.w-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
}
.w-action-pill:hover:not(:disabled) {
  background: rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.35);
  color: var(--accent-light);
}
.w-action-pill:disabled { opacity: 0.5; cursor: default; }
.w-action-pill.loading { animation: action-pulse 1s ease infinite; }
@keyframes action-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 0.9; }
}
.w-action-result {
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
  white-space: nowrap;
  animation: wv-fade-in 0.3s ease;
}

/* ================================================================
   EXPLORER PAGE
   ================================================================ */
.explorer-breadcrumbs {
  display: flex; align-items: center; gap: 2px;
  padding: 8px 0; flex-wrap: wrap;
}
.explorer-crumb {
  background: none; border: none; color: var(--accent-light);
  font-size: 12px; cursor: pointer; padding: 3px 6px;
  border-radius: var(--r-sm); display: flex; align-items: center; gap: 4px;
  transition: background var(--t);
}
.explorer-crumb:hover { background: var(--accent-dim); }
.explorer-crumb-sep { color: var(--text-muted); font-size: 11px; }
.explorer-loading {
  display: flex; align-items: center; gap: 8px;
  padding: 32px 0; color: var(--text-secondary); font-size: 13px;
  justify-content: center;
}
.explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.explorer-drive-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 12px; cursor: pointer; text-align: center;
  transition: border-color var(--t), box-shadow var(--t);
}
.explorer-drive-card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 16px var(--accent-glow-sm);
}
.explorer-drive-icon { margin-bottom: 8px; color: var(--accent-light); }
.explorer-drive-label { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.explorer-drive-info { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.explorer-list {
  display: flex; flex-direction: column; gap: 1px;
}
.explorer-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  transition: background var(--t); cursor: default;
}
.explorer-item:hover { background: var(--bg-hover); }
.explorer-item.is-dir { cursor: pointer; }
.explorer-item-icon { flex-shrink: 0; width: 22px; display: flex; align-items: center; justify-content: center; }
.explorer-item-name { flex: 1; font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer-item-size { font-size: 11px; color: var(--text-muted); width: 70px; text-align: right; flex-shrink: 0; }
.explorer-item-actions { flex-shrink: 0; opacity: 0; transition: opacity var(--t); }
.explorer-item:hover .explorer-item-actions { opacity: 1; }

.explorer-pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 0;
}

/* ================================================================
   TERMINAL PAGE
   ================================================================ */
.terminal-card {
  display: flex; flex-direction: column;
  height: calc(100vh - 180px);
  padding: 0 !important; overflow: hidden;
}
.terminal-output {
  flex: 1; overflow-y: auto; padding: 14px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12.5px; line-height: 1.6;
  background: var(--bg-void);
}
.terminal-line { white-space: pre-wrap; word-break: break-all; }
.terminal-cmd { color: var(--accent-light); }
.terminal-out { color: var(--text-primary); }
.terminal-err { color: var(--red); }
.terminal-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.terminal-prompt {
  color: var(--green); font-family: 'Consolas', monospace;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.terminal-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
}
.terminal-input::placeholder { color: var(--text-muted); }

/* ================================================================
   MACROS PAGE
   ================================================================ */
.macros-list {
  display: flex; flex-direction: column; gap: 2px;
}
.macros-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--r-sm);
  transition: background var(--t);
}
.macros-item:hover { background: var(--bg-hover); }
.macros-item-info { display: flex; flex-direction: column; gap: 4px; }
.macros-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.macros-item-keys { display: flex; gap: 4px; flex-wrap: wrap; }
.macro-key {
  display: inline-block; padding: 2px 7px;
  background: var(--bg-raised); border: 1px solid var(--border-mid);
  border-radius: var(--r-xs); font-size: 11px; font-family: 'Consolas', monospace;
  color: var(--text-secondary);
}
.macros-item-actions { display: flex; gap: 4px; }

/* ================================================================
   CLEANER PAGE
   ================================================================ */
.cleaner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.cleaner-action-card {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 24px 16px; gap: 8px;
}
.cleaner-icon { margin-bottom: 4px; }
.cleaner-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.cleaner-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.cleaner-result {
  margin-top: 10px; font-size: 12px; color: var(--green);
  padding: 6px 10px; background: var(--green-dim);
  border-radius: var(--r-sm); width: 100%;
}

.startup-list { display: flex; flex-direction: column; gap: 2px; }
.startup-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--r-sm);
  transition: background var(--t);
}
.startup-item:hover { background: var(--bg-hover); }
.startup-item-info { overflow: hidden; }
.startup-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.startup-item-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 400px; }

/* ================================================================
   MONITOR PAGE
   ================================================================ */
.monitor-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.monitor-toggle-card { padding: 18px 20px; }
.monitor-toggle-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.monitor-toggle-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }

.monitor-thresholds {
  margin-top: 16px; display: flex; flex-direction: column; gap: 12px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.monitor-threshold-row {
  display: flex; align-items: center; gap: 10px;
}
.monitor-threshold-row .form-label { width: 110px; flex-shrink: 0; margin: 0; }
.input-range {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--bg-raised); border-radius: 2px; outline: none;
}
.input-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}
.input-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: none;
}

.monitor-add-task {
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.scheduler-list { display: flex; flex-direction: column; gap: 2px; }
.scheduler-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  transition: background var(--t);
}
.scheduler-item:hover { background: var(--bg-hover); }
.scheduler-item-info { flex: 1; overflow: hidden; }
.scheduler-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* ── btn-active helper ─── */
.btn-active { background: var(--accent-dim); border-color: var(--accent) !important; color: var(--accent-light); }

/* ── btn-xs size ─── */
.btn-xs { padding: 3px 8px; font-size: 11px; min-height: 24px; }

/* ── text utility ─── */
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }

/* ── Reduced motion: canvas animation is JS — skipped at OS level ── */

/* ── Tools Page Tabs ──────────────────────────────────────────────── */
.tools-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--bg-deep);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.tools-tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t);
}
.tools-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.tools-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow-sm);
}

/* ── Dashboard Greeting ───────────────────────────────────────────── */
.dash-greeting {
  padding: 20px 24px 4px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.dash-greeting-hi {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.dash-greeting-date {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Quick Actions Widget ─────────────────────────────────────────── */
.w-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
  align-items: stretch;
  height: 100%;
}
.w-actions-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 4px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--t);
  font-family: inherit;
}
.w-actions-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 12px var(--accent-glow-sm);
}
.w-actions-btn:active { transform: scale(0.96); }
.w-actions-btn svg { opacity: 0.8; }
.w-actions-btn span { font-size: 10px; white-space: nowrap; }

/* ── Stat val color variants ──────────────────────────────────────── */
.w-stat-val.purple { color: var(--accent-light); }
.w-stat-val.blue   { color: var(--blue); }
.w-stat-val.green  { color: var(--green); }
.w-stat-val.red    { color: var(--red); }

/* ── Bar fill color variants ──────────────────────────────────────── */
.w-bar-fill.red    { background: var(--red) !important; }
.w-bar-fill.yellow { background: var(--yellow) !important; }
.w-bar-fill.green  { background: var(--green) !important; }

/* ── DISABLED BUTTON STATE ─────────────────────────────────────── */
.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── CONNECTION STATUS INDICATOR ───────────────────────────────── */
.api-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  transition: all var(--t);
}
.api-status.connected {
  color: var(--green);
  background: var(--green-dim);
}
.api-status.disconnected {
  color: var(--red);
  background: var(--red-dim);
  animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── SETTINGS UNSAVED CHANGES INDICATOR ────────────────────────── */
.settings-dirty-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--yellow);
  padding: 2px 8px;
  background: var(--yellow-dim);
  border-radius: var(--r-full);
  animation: fadeIn 200ms ease;
}

/* ── LOG JUMP-TO-BOTTOM BUTTON ─────────────────────────────────── */
