/* ============================================================================
 * PROJECT QUINCY – Master Stylesheet (quincy.css)
 * Ecosystem Design Family: OK MarCom · Synqra v2.0 · Oliver's Mail Cockpit
 * Palette: Obsidian (#06070A) · Brushed Titanium (#CBD5E1) · Champagne Gold (#D5AE58)
 * ============================================================================ */

:root,
[data-theme="dark"] {
  --q-bg-void: #050609;
  --q-bg-base: #06070A;
  --q-bg-panel: #0D0F14;
  --q-surface-1: rgba(15, 18, 25, 0.88);
  --q-surface-2: rgba(22, 26, 36, 0.92);
  --q-surface-3: rgba(31, 37, 50, 0.96);
  --q-surface-elevated: linear-gradient(155deg, rgba(28, 33, 45, 0.96) 0%, rgba(14, 17, 24, 0.99) 100%);
  --q-dock-bg: rgba(11, 14, 21, 0.92);
  --q-sheet-bg: #0B0E14;
  --q-bg-ambient:
    radial-gradient(ellipse 85% 40% at 50% -8%, rgba(213, 174, 88, 0.13) 0%, rgba(213, 174, 88, 0.025) 46%, transparent 75%),
    radial-gradient(circle at 88% 18%, rgba(56, 189, 248, 0.03) 0%, transparent 45%),
    linear-gradient(180deg, #090B10 0%, #06070A 100%);

  --q-gold: #D5AE58;
  --q-gold-metallic: #D4AF37;
  --q-gold-bright: #F5D67B;
  --q-gold-deep: #B98E35;
  --q-gold-gradient: linear-gradient(135deg, #F5D67B 0%, #D5AE58 52%, #C89E44 100%);
  --q-gold-soft: rgba(213, 174, 88, 0.13);
  --q-gold-glow: rgba(213, 174, 88, 0.24);

  --q-text-main: #F8FAFC;
  --q-text-warm: #F5F2EA;
  --q-text-titanium: #CBD5E1;
  --q-text-muted: #8E9BB0;
  --q-text-dim: #666E7C;
  --q-text-on-gold: #08090C;

  --q-border-subtle: rgba(255, 255, 255, 0.08);
  --q-border-titanium: rgba(148, 163, 184, 0.20);
  --q-border-gold: rgba(213, 174, 88, 0.42);
  --q-border-gold-strong: rgba(226, 190, 102, 0.68);
  --q-glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.09);

  --q-status-emerald: #10B981;
  --q-status-emerald-soft: rgba(16, 185, 129, 0.14);
  --q-status-amber: #F59E0B;
  --q-status-amber-soft: rgba(245, 158, 11, 0.15);
  --q-status-danger: #EF4444;
  --q-status-danger-soft: rgba(239, 68, 68, 0.15);

  --q-acct-icloud: #7AA2F7;
  --q-acct-gmail: #E06C75;
  --q-acct-marcom: #D5AE58;
  --q-acct-synqra: #34D399;

  --q-shadow-card: 0 10px 28px rgba(0, 0, 0, 0.44);
  --q-shadow-elevated: 0 22px 54px rgba(0, 0, 0, 0.78);
  --q-shadow-gold: 0 6px 20px rgba(213, 174, 88, 0.22);

  --q-font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Roboto", system-ui, sans-serif;
  --q-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --q-safe-top: env(safe-area-inset-top, 0px);
  --q-safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --q-bg-void: #EAEEF5;
  --q-bg-base: #F3F5F9;
  --q-bg-panel: #FFFFFF;
  --q-surface-1: rgba(255, 255, 255, 0.94);
  --q-surface-2: rgba(244, 247, 252, 0.98);
  --q-surface-3: rgba(235, 240, 248, 1);
  --q-surface-elevated: linear-gradient(155deg, #FFFFFF 0%, #F6F8FC 100%);
  --q-dock-bg: rgba(255, 255, 255, 0.92);
  --q-sheet-bg: #FFFFFF;
  --q-bg-ambient: linear-gradient(180deg, #F8FAFC 0%, #EEF2F7 100%);
  --q-gold: #B08518;
  --q-gold-bright: #8D680B;
  --q-text-main: #0F172A;
  --q-text-warm: #1E293B;
  --q-text-titanium: #334155;
  --q-text-muted: #64748B;
  --q-text-dim: #94A3B8;
  --q-border-subtle: rgba(15, 23, 42, 0.08);
  --q-border-titanium: rgba(15, 23, 42, 0.16);
  --q-shadow-card: 0 8px 24px rgba(15, 23, 42, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--q-bg-base);
  background-image: var(--q-bg-ambient);
  color: var(--q-text-main);
  font-family: var(--q-font-sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ============================================================================
 * 1. ZERO-TRUST AUTHENTICATION & FIRST-RUN SETUP GATE (Synqra Monolith Sibling)
 * ============================================================================ */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--q-safe-top)) 20px calc(24px + var(--q-safe-bottom));
  background: radial-gradient(circle at 50% 25%, rgba(213, 174, 88, 0.10), transparent 60%), var(--q-bg-void);
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.q-monolith {
  width: 124px;
  height: 164px;
  border-radius: 26px;
  background: linear-gradient(155deg, #171C28 0%, #0A0D14 58%, #06070B 100%);
  border: 1px solid var(--q-border-gold);
  box-shadow: var(--q-shadow-elevated), var(--q-glass-highlight), 0 0 42px rgba(213, 174, 88, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.q-monolith svg {
  width: 78px;
  height: 78px;
  filter: drop-shadow(0 0 14px rgba(213, 174, 88, 0.32));
  animation: qCoreBreathe 4.2s ease-in-out infinite;
}

@keyframes qCoreBreathe {
  0%, 100% { transform: scale(1); opacity: 0.94; }
  50% { transform: scale(1.04); opacity: 1; }
}

.brand-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--q-gold);
}

.auth-title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--q-text-main);
}

.auth-title span {
  color: var(--q-gold);
  font-weight: 700;
}

.auth-claim {
  margin: -6px 0 4px;
  font-size: 13px;
  color: var(--q-text-muted);
}

.auth-form-panel {
  width: 100%;
  background: var(--q-surface-1);
  border: 1px solid var(--q-border-gold);
  border-top: 2px solid var(--q-gold);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--q-shadow-card);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================================
 * 2. BUTTONS, INPUTS (16px iOS Safe!) & BADGES
 * ============================================================================ */

input,
textarea,
select {
  width: 100%;
  font-family: var(--q-font-sans);
  font-size: 16px; /* Strictly >= 16px so iOS Safari never auto-zooms! */
  line-height: 1.45;
  color: var(--q-text-main);
  background: var(--q-surface-2);
  border: 1px solid var(--q-border-titanium);
  border-radius: 12px;
  padding: 11px 14px;
  min-height: 44px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--q-gold);
  box-shadow: 0 0 0 3px var(--q-gold-soft);
}

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

label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--q-text-titanium);
  margin-bottom: 5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  font-family: var(--q-font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-gold {
  background: var(--q-gold-gradient);
  color: var(--q-text-on-gold);
  border-color: var(--q-border-gold-strong);
  box-shadow: var(--q-shadow-gold);
}

.btn-secondary {
  background: var(--q-surface-2);
  color: var(--q-text-main);
  border-color: var(--q-border-titanium);
}

.btn-secondary:hover,
.btn-secondary.active {
  border-color: var(--q-border-gold);
  color: var(--q-gold-bright);
  background: var(--q-gold-soft);
}

.btn-danger {
  background: var(--q-status-danger-soft);
  color: #FCA5A5;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn-pill {
  border-radius: 9999px;
}

.btn-full {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-gold {
  background: var(--q-gold-soft);
  color: var(--q-gold-bright);
  border: 1px solid var(--q-border-gold);
}

.badge-emerald {
  background: var(--q-status-emerald-soft);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-amber {
  background: var(--q-status-amber-soft);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.38);
}

.badge-danger {
  background: var(--q-status-danger-soft);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.38);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--q-status-emerald);
  box-shadow: 0 0 8px var(--q-status-emerald);
  display: inline-block;
}

.status-dot.mock {
  background: var(--q-gold);
  box-shadow: 0 0 8px var(--q-gold);
}

/* ============================================================================
 * 3. ADAPTIVE APP SHELL (Mobile-First iPhone -> 1440px+ Executive Cockpit)
 * ============================================================================ */

.app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Desktop Sidebar (hidden on iPhone < 1024px) */
.desktop-sidebar {
  display: none;
  width: 264px;
  flex-shrink: 0;
  background: var(--q-bg-panel);
  border-right: 1px solid var(--q-border-subtle);
  flex-direction: column;
  padding: 18px 14px;
  gap: 16px;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--q-border-subtle);
}

.q-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--q-border-gold);
  background: linear-gradient(145deg, #151A25, #080A0F);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.q-badge-icon svg {
  width: 24px;
  height: 24px;
}

.brand-text-wrap {
  min-width: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--q-text-main);
  line-height: 1.1;
}

.brand-sub {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--q-gold);
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 11px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--q-text-titanium);
  font-family: var(--q-font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.sidebar-btn .nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--q-text-main);
}

.sidebar-btn.active {
  background: var(--q-gold-soft);
  border-color: var(--q-border-gold);
  color: var(--q-gold-bright);
}

.sidebar-quota-box {
  margin-top: auto;
  padding: 12px;
  border-radius: 14px;
  background: var(--q-surface-1);
  border: 1px solid var(--q-border-subtle);
  font-size: 12px;
}

.quota-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  overflow: hidden;
  margin: 7px 0 5px;
}

.quota-bar-fill {
  height: 100%;
  background: var(--q-gold-gradient);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* Main Stage Column */
.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Top Header (iPhone 16 Pro Max Dynamic Island 59pt + Standalone PWA Hardened!) */
.top-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(16px, calc(var(--q-safe-top) + 12px)) 14px 12px;
  background: rgba(9, 11, 16, 0.92);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--q-border-subtle);
  z-index: 40;
}

@media (max-width: 767px) {
  html.ios-device .top-header {
    padding-top: max(22px, calc(env(safe-area-inset-top, 20px) + 14px));
  }
  html.ios-standalone .top-header {
    padding-top: max(68px, calc(env(safe-area-inset-top, 59px) + 14px));
  }
}

@media (max-width: 767px) and (display-mode: standalone) {
  .top-header {
    padding-top: max(68px, calc(env(safe-area-inset-top, 59px) + 14px));
  }
}

.header-brand-mobile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.icon-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--q-surface-2);
  border: 1px solid var(--q-border-titanium);
  color: var(--q-text-titanium);
  font-family: var(--q-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.icon-pill-btn.active {
  background: var(--q-gold-soft);
  border-color: var(--q-border-gold);
  color: var(--q-gold-bright);
}

.icon-pill-btn.challenger-active {
  background: var(--q-status-amber-soft);
  border-color: rgba(245, 158, 11, 0.55);
  color: #FBBF24;
}

.hide-mobile {
  display: none;
}

@media (min-width: 1024px) {
  .hide-mobile {
    display: inline;
  }
}

.btn-live-jarvis {
  background: var(--q-gold-gradient);
  color: var(--q-text-on-gold);
  border: 1px solid var(--q-border-gold-strong);
  box-shadow: 0 0 18px rgba(213, 174, 88, 0.38);
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 6px 14px;
}

/* ============================================================================
 * PURE FULLSCREEN OLED LIQUID 'Q' STAGE (Zero Clutter · Pure Buddy Presence)
 * ============================================================================ */

.live-stage-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  user-select: none;
  touch-action: manipulation;
}

.btn-exit-pure-live {
  position: absolute;
  top: max(68px, calc(var(--q-safe-top) + 16px));
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.24);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.speaking-meter-card {
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: linear-gradient(155deg, rgba(20, 25, 36, 0.95) 0%, rgba(11, 14, 21, 0.98) 100%);
  border: 1px solid var(--q-border-gold);
  box-shadow: var(--q-shadow-card), var(--q-glass-highlight);
}

.speaking-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 10px 0 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.speaking-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10B981 0%, #D5AE58 65%, #F5D67B 100%);
  transition: width 0.35s ease;
}

.speaking-bar-fill.warn {
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.speaking-bar-fill.low {
  background: linear-gradient(90deg, #EF4444 0%, #DC2626 100%);
}

.mobile-thread-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 14px 6px;
  border-bottom: 1px solid var(--q-border-subtle);
  background: rgba(10, 12, 18, 0.75);
  scrollbar-width: none;
}

.mobile-thread-bar::-webkit-scrollbar {
  display: none;
}

.thread-chip {
  flex-shrink: 0;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--q-surface-2);
  border: 1px solid var(--q-border-subtle);
  color: var(--q-text-titanium);
  cursor: pointer;
}

.thread-chip.active {
  background: var(--q-gold-soft);
  border-color: var(--q-border-gold);
  color: var(--q-gold-bright);
}

.conn-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.conn-status-row:last-child {
  border-bottom: none;
}

.cockpit-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 22px 20px;
  margin-bottom: 16px;
  background:
    radial-gradient(circle at 85% 20%, rgba(213, 174, 88, 0.16) 0%, transparent 55%),
    linear-gradient(155deg, rgba(24, 29, 41, 0.96) 0%, rgba(10, 12, 18, 0.99) 100%);
  border: 1px solid var(--q-border-gold);
  box-shadow: var(--q-shadow-elevated), var(--q-glass-highlight);
}

.cockpit-tile-clickable {
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease;
}

.cockpit-tile-clickable:active {
  transform: scale(0.98);
}

.cockpit-tile-clickable:hover {
  border-color: var(--q-border-gold);
}

.btn-exit-pure-live:hover,
.btn-exit-pure-live:active {
  color: var(--q-gold-bright);
  border-color: var(--q-border-gold);
}

.liquid-q-wrap {
  position: relative;
  width: min(90vw, 430px);
  height: min(90vw, 430px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#quincy-liquid-q {
  width: 100%;
  height: 100%;
  display: block;
}

/* Workspace Body (Center + Optional Desktop Right Inspector) */
.workspace-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.view-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.scroll-view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(104px + var(--q-safe-bottom));
}

/* ============================================================================
 * 4. QUINCY CHAT INTERFACE (iPhone First + Structured Cards + Voice)
 * ============================================================================ */

.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: qFadeUp 0.2s ease-out;
}

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

.msg-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.quincy {
  align-self: flex-start;
  align-items: flex-start;
  max-width: 94%;
}

.msg-bubble {
  padding: 13px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, rgba(213, 174, 88, 0.22), rgba(185, 142, 53, 0.14));
  border: 1px solid var(--q-border-gold);
  border-bottom-right-radius: 6px;
  color: var(--q-text-main);
}

.msg-row.quincy .msg-bubble {
  background: var(--q-surface-1);
  border: 1px solid var(--q-border-subtle);
  border-top-left-radius: 6px;
  box-shadow: var(--q-shadow-card), var(--q-glass-highlight);
}

.msg-bubble h3,
.msg-bubble h4 {
  margin: 6px 0 8px;
  color: var(--q-gold-bright);
  font-size: 16px;
}

.msg-bubble p {
  margin: 0 0 9px;
}

.msg-bubble p:last-child {
  margin-bottom: 0;
}

.msg-bubble ul,
.msg-bubble ol {
  margin: 6px 0 10px;
  padding-left: 20px;
}

.msg-bubble li {
  margin-bottom: 4px;
}

.msg-bubble code {
  font-family: var(--q-font-mono);
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--q-gold-bright);
}

.msg-bubble blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--q-gold);
  background: var(--q-gold-soft);
  border-radius: 0 10px 10px 0;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--q-text-muted);
  flex-wrap: wrap;
}

.tts-btn {
  background: transparent;
  border: 1px solid var(--q-border-subtle);
  color: var(--q-text-muted);
  border-radius: 99px;
  padding: 3px 9px;
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tts-btn:hover,
.tts-btn.speaking {
  border-color: var(--q-gold);
  color: var(--q-gold-bright);
  background: var(--q-gold-soft);
}

/* Inline Approval Request Card (Section 10) */
.approval-card {
  margin-top: 10px;
  width: 100%;
  max-width: 540px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--q-surface-elevated);
  border: 1px solid rgba(245, 158, 11, 0.55);
  box-shadow: var(--q-shadow-card);
}

.approval-card.tier-3 {
  border-color: rgba(239, 68, 68, 0.65);
}

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

/* Quick Prompts Strip & Composer Dock */
.chat-composer-zone {
  flex-shrink: 0;
  padding: 8px 12px calc(86px + var(--q-safe-bottom));
  background: linear-gradient(180deg, rgba(6, 7, 10, 0) 0%, rgba(6, 7, 10, 0.94) 24%);
}

.quick-prompts {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.quick-prompts::-webkit-scrollbar {
  display: none;
}

.prompt-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--q-surface-2);
  border: 1px solid var(--q-border-subtle);
  color: var(--q-text-titanium);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.prompt-chip:hover {
  border-color: var(--q-border-gold);
  color: var(--q-gold-bright);
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--q-surface-2);
  border: 1px solid var(--q-border-gold);
  border-radius: 20px;
  padding: 7px 8px 7px 14px;
  box-shadow: var(--q-shadow-card);
}

.composer-box textarea {
  border: none;
  background: transparent;
  padding: 6px 0;
  min-height: 34px;
  max-height: 120px;
  resize: none;
  box-shadow: none !important;
}

.composer-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--q-border-titanium);
  background: var(--q-surface-3);
  color: var(--q-text-titanium);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.composer-icon-btn.recording {
  background: var(--q-status-emerald-soft);
  border-color: var(--q-status-emerald);
  color: #34D399;
  animation: qMicPulse 1.3s infinite;
}

@keyframes qMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.composer-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--q-border-gold-strong);
  background: var(--q-gold-gradient);
  color: var(--q-text-on-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: var(--q-shadow-gold);
}

/* ============================================================================
 * 5. CARDS, GRIDS & TELEMETRY PANELS (Dashboard, Agents, Tasks, Memory, Logs)
 * ============================================================================ */

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

.section-title {
  margin: 0;
  font-size: clamp(20px, 2.5vw, 25px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.q-card {
  background: var(--q-surface-1);
  border: 1px solid var(--q-border-subtle);
  border-radius: 16px;
  padding: 15px;
  box-shadow: var(--q-shadow-card), var(--q-glass-highlight);
  min-width: 0;
}

.q-card.gold-edge {
  border-color: var(--q-border-gold);
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--q-text-main);
  margin: 4px 0 2px;
}

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

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--q-text-titanium);
  border: 1px solid var(--q-border-subtle);
}

/* iOS Toggle Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  min-height: 0;
}

.ios-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  transition: 0.22s;
  border: 1px solid var(--q-border-subtle);
}

.ios-slider::before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 2px;
  bottom: 2px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: 0.22s;
}

.ios-switch input:checked + .ios-slider {
  background: var(--q-gold);
  border-color: var(--q-gold-bright);
}

.ios-switch input:checked + .ios-slider::before {
  transform: translateX(20px);
  background-color: #08090C;
}

/* ============================================================================
 * 6. FLOATING iPHONE BOTTOM DOCK (.quincy-dock — High Contrast, 48px Targets!)
 * ============================================================================ */

.quincy-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + var(--q-safe-bottom));
  max-width: 460px;
  margin: 0 auto;
  height: 64px;
  padding: 5px 8px;
  border-radius: 24px;
  background: var(--q-dock-bg);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--q-border-gold);
  box-shadow: var(--q-shadow-elevated), var(--q-glass-highlight);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  z-index: 60;
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--q-text-muted);
  font-family: var(--q-font-sans);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.16s ease, background 0.16s ease;
}

.dock-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.dock-btn.active {
  color: var(--q-gold-bright);
  background: var(--q-gold-soft);
}

/* ============================================================================
 * 7. BOTTOM SHEETS & COMMAND PALETTE MODAL (Strg+K)
 * ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(3, 4, 7, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.q-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 88dvh;
  background: var(--q-sheet-bg);
  border-top: 2px solid var(--q-gold);
  border-left: 1px solid var(--q-border-subtle);
  border-right: 1px solid var(--q-border-subtle);
  border-radius: 26px 26px 0 0;
  padding: 14px 18px calc(22px + var(--q-safe-bottom));
  overflow-y: auto;
  box-shadow: var(--q-shadow-elevated);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  margin: 0 auto 14px;
}

.cmd-palette-modal {
  align-items: flex-start;
  padding-top: 10vh;
}

.cmd-box {
  width: 92%;
  max-width: 520px;
  background: var(--q-bg-panel);
  border: 1px solid var(--q-border-gold);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--q-shadow-elevated);
}

.cmd-item {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--q-border-subtle);
  background: transparent;
  color: var(--q-text-main);
  font-family: var(--q-font-sans);
  font-size: 14px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.cmd-item:hover {
  background: var(--q-gold-soft);
  color: var(--q-gold-bright);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: max(68px, calc(16px + var(--q-safe-top)));
  right: 16px;
  left: 16px;
  max-width: 380px;
  margin: 0 auto;
  z-index: 950;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-toast {
  padding: 11px 15px;
  border-radius: 13px;
  background: rgba(15, 18, 26, 0.96);
  border: 1px solid var(--q-border-gold);
  color: var(--q-text-main);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--q-shadow-elevated);
}

/* Desktop Right Inspector */
.desktop-inspector {
  display: none;
  width: 310px;
  flex-shrink: 0;
  border-left: 1px solid var(--q-border-subtle);
  background: rgba(11, 14, 20, 0.72);
  padding: 16px;
  overflow-y: auto;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================================
 * 8. RESPONSIVE BREAKPOINTS (Tablet & 1440px Executive Desktop)
 * ============================================================================ */

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-backdrop:not(.cmd-palette-modal) {
    align-items: center;
    padding: 20px;
  }
  .q-sheet {
    border-radius: 22px;
    border: 1px solid var(--q-border-gold);
  }
}

@media (min-width: 1024px) {
  .desktop-sidebar {
    display: flex;
  }
  .quincy-dock,
  .header-brand-mobile {
    display: none;
  }
  .chat-composer-zone {
    padding: 10px 24px 18px;
  }
  .chat-stream {
    padding: 22px 28px;
  }
  .scroll-view {
    padding: 24px 28px 40px;
  }
  .msg-row.quincy {
    max-width: 80%;
  }
}

@media (min-width: 1280px) {
  .desktop-inspector.active-in-chat {
    display: flex;
  }
}
