/* ==========================================================================
   Rumik Agency OS - Brand and Design System (Cream Edition v1.0)
   Single source of truth. Loaded by marketing site AND product console.
   See dashboard/DESIGN.md for the full specification.
   No em dashes anywhere in this codebase. Use commas and periods only.
   ========================================================================== */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Inter:wght@400;450;500;550;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ---- Canvas and surfaces ---- */
  --canvas:        #FBF7EF;
  --surface:       #FFFDF8;
  --surface-muted: #F3EBDD;
  --surface-hover: #F7F0E4;

  /* ---- Text ---- */
  --ink:           #201A17;
  --ink-muted:     #70645B;
  --ink-faint:     #A8998C;
  --ink-xfaint:    #C4B9B0;

  /* ---- Borders ---- */
  --border:        #DED2C2;
  --border-strong: #C4B5A2;
  --border-focus:  #A8743B;

  /* ---- Accent: restrained bronze ---- */
  --accent:        #A8743B;
  --accent-hover:  #93622E;
  --accent-active: #7D5124;
  --accent-soft:   #EAD9BF;
  --accent-ink:    #FFFFFF;
  --accent-glow:   rgba(168,116,59,0.18);

  /* ---- Status ---- */
  --ok:            #416B57;
  --ok-soft:       #D3E8DF;
  --ok-border:     #8FBFAD;
  --warn:          #A56B2C;
  --warn-soft:     #F3E0C8;
  --warn-border:   #D4A574;
  --danger:        #9B4D45;
  --danger-soft:   #F5DDD9;
  --danger-border: #D4958F;
  --info:          #3B6B8F;
  --info-soft:     #D4E8F5;

  /* ---- Navigation sidebar ---- */
  --nav:           #1E1810;
  --nav-surface:   #241E14;
  --nav-border:    rgba(255,255,255,0.08);
  --nav-ink:       #F0E8DE;
  --nav-ink-muted: #A89A8E;
  --nav-active:    rgba(168,116,59,0.20);
  --nav-active-border: #A8743B;

  /* ---- Shadows ---- */
  --shadow-card:   0 1px 3px rgba(32,26,23,0.08), 0 1px 2px rgba(32,26,23,0.04);
  --shadow-raise:  0 4px 16px -4px rgba(32,26,23,0.14);
  --shadow-float:  0 12px 40px -8px rgba(32,26,23,0.18);
  --shadow-inset:  inset 0 1px 3px rgba(32,26,23,0.06);

  /* ---- Typography ---- */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:         'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, Consolas, monospace;

  /* ---- Radii ---- */
  --r-xs:  6px;
  --r-sm:  8px;
  --r:     14px;
  --r-lg:  18px;
  --r-xl:  24px;
  --r-pill: 999px;

  /* ---- Motion ---- */
  --ease:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur:      220ms;
  --dur-slow: 380ms;

  /* ---- Layout ---- */
  --maxw:    1200px;
  --gutter:  clamp(16px, 4vw, 40px);
  --sidebar: 240px;

  /* ---- Chart series ---- */
  --c-bronze:  #A8743B;
  --c-forest:  #416B57;
  --c-clay:    #9B4D45;
  --c-slate:   #5B7B8F;
  --c-warm:    #70645B;

  /* ---- Legacy aliases (keep for compatibility with existing server-rendered HTML) ---- */
  --bg:        var(--canvas);
  --bg-2:      var(--surface-muted);
  --panel:     var(--surface);
  --panel-2:   var(--surface);
  --raised:    var(--surface-muted);
  --line:      var(--border);
  --line-2:    var(--border-strong);
  --line-strong: rgba(32,26,23,0.24);
  --ink-soft:  var(--ink-muted);
  --ink-dim:   var(--ink-faint);
  --accent-old: var(--accent);
  --gold:      var(--accent);
  --ok-old:    var(--ok);
  --warn-old:  var(--warn);
  --bad:       var(--danger);
  --grad-volt: linear-gradient(115deg, #D4A965 0%, #A8743B 60%, #7D5124 100%);
  --grad-volt-soft: linear-gradient(115deg, rgba(212,169,101,0.18), rgba(168,116,59,0.08));
  --glow-accent: 0 0 0 1px rgba(168,116,59,0.22), 0 8px 24px -8px rgba(126,80,36,0.28);
  --shadow-card-old: var(--shadow-card);
  --shadow-pop: var(--shadow-float);
  --font-sans: var(--font);
  --r-sm-old: var(--r-sm);
}

/* ==========================================================================
   Reset and base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 0;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.008em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
::selection { background: var(--accent-soft); color: var(--ink); }
a { color: inherit; text-decoration: none; }
img, svg, canvas, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.1; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---- Premium scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ==========================================================================
   Type scale
   ========================================================================== */
.t-display {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.5vw, 4.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.0;
}
.t-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.8vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}
.t-h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.6vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.t-h3 { font-size: clamp(1.05rem, 1.6vw, 1.35rem); font-weight: 600; letter-spacing: -0.015em; }
.t-lead { font-size: clamp(1rem, 1.4vw, 1.2rem); color: var(--ink-muted); line-height: 1.65; }
.t-mono { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0; }
.t-label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.01em; color: var(--ink-muted); }
.t-kicker { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); }
.t-kpi { font-size: clamp(1.8rem, 3vw, 2.8rem); font-weight: 640; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }

/* Gradient accent text (editorial headlines only) */
.grad-text {
  background: var(--grad-volt);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 10vw, 128px); position: relative; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; } .gap-4 { gap: 32px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  --btn-h: 38px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--btn-h);
  padding: 0 18px;
  border-radius: var(--r);
  font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
  border: 1px solid transparent; cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              opacity var(--dur);
  will-change: transform;
  position: relative; isolation: isolate;
  white-space: nowrap; text-decoration: none;
  min-width: 44px; min-height: 44px;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--canvas), 0 0 0 5px var(--accent);
}
.btn:active { transform: scale(0.985); }
.btn[disabled], .btn.disabled { opacity: 0.42; pointer-events: none; }
.btn-loading { pointer-events: none; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* Primary */
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent-hover);
  box-shadow: 0 1px 2px rgba(126,80,36,0.20), 0 1px 0 rgba(255,255,255,0.08) inset;
}
.btn-primary:hover:not([disabled]) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-raise);
}

/* Secondary */
.btn-secondary {
  background: var(--surface); color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}
.btn-secondary:hover:not([disabled]) {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

/* Ghost */
.btn-ghost {
  background: transparent; color: var(--accent);
  border-color: var(--accent-soft);
}
.btn-ghost:hover:not([disabled]) {
  background: var(--accent-soft);
}

/* Quiet */
.btn-quiet {
  background: transparent; color: var(--ink-muted); border-color: transparent;
}
.btn-quiet:hover:not([disabled]) {
  background: var(--surface-muted); color: var(--ink);
}

/* Danger */
.btn-danger {
  background: var(--danger-soft); color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover:not([disabled]) {
  background: var(--danger); color: #fff;
}

/* Sizes */
.btn-sm { --btn-h: 32px; padding: 0 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { --btn-h: 46px; padding: 0 24px; font-size: 15px; }
.btn-icon { padding: 0; width: var(--btn-h); aspect-ratio: 1; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  position: relative;
}
.card-pad { padding: clamp(16px, 2.4vw, 28px); }
.card-interactive {
  cursor: pointer;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.card-interactive:hover { box-shadow: var(--shadow-raise); transform: translateY(-2px); border-color: var(--border-strong); }
.card-interactive:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--canvas), 0 0 0 5px var(--accent); }

/* ==========================================================================
   Inputs and forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--ink-muted); letter-spacing: -0.005em; }
.field-hint { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
.field-error { font-size: 11px; color: var(--danger); margin-top: 3px; }

.input, .textarea, .select {
  width: 100%;
  background: var(--canvas);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
  -webkit-appearance: none; appearance: none;
}
.input:hover:not(:focus), .textarea:hover:not(:focus), .select:hover:not(:focus) {
  border-color: var(--border-strong);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}
.input.error, .textarea.error, .select.error { border-color: var(--danger); }
.input.error:focus, .textarea.error:focus { box-shadow: 0 0 0 3px rgba(155,77,69,0.14); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
::placeholder { color: var(--ink-faint); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2370645B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }

/* Dropdowns. Every select in the product uses the same cream control, chevron,
   hover, focus and disabled treatment as the inputs, so a bare <select> can
   never fall back to the operating system chrome. The browser popup itself
   follows color-scheme, kept light to match the canvas. */
select {
  color-scheme: light;
  -webkit-appearance: none; appearance: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background-color: var(--canvas);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2370645B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 32px 9px 12px;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur), background-color var(--dur);
}
select:hover:not(:disabled) { border-color: var(--border-strong); }
select:focus, select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background-color: var(--surface);
}
select:disabled { opacity: 0.55; cursor: not-allowed; background-color: var(--surface-muted); }
select.error { border-color: var(--danger); }
select option { background-color: var(--surface); color: var(--ink); }
select option:disabled { color: var(--ink-faint); }
/* A select that borrows .input (a compact toolbar filter) still needs its
   chevron: the .input rule sets the background shorthand, which clears it. */
select.input {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2370645B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Secret masking */
.secret-mask { font-family: var(--mono); letter-spacing: 0.05em; color: var(--ink-faint); }
.secret-toggle { background: none; border: none; cursor: pointer; color: var(--ink-muted); padding: 2px 4px; border-radius: 4px; font-size: 11px; }
.secret-toggle:hover { color: var(--ink); background: var(--surface-muted); }

/* ==========================================================================
   Status pills and badges
   ========================================================================== */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--surface-muted); border: 1px solid var(--border);
  font-size: 12px; color: var(--ink-muted); font-weight: 500;
  white-space: nowrap;
}
.pill-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}
.pill-dot.connected { background: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.pill-dot.loading { background: var(--warn); animation: pulse-dot 1.2s ease-in-out infinite; }
.pill-dot.degraded { background: var(--warn); }
.pill-dot.error, .pill-dot.blocked { background: var(--danger); }
.pill-dot.idle { background: var(--ink-faint); }

.status-connected { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.status-degraded  { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.status-error, .status-blocked { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.status-loading { background: var(--surface-muted); border-color: var(--border); color: var(--ink-muted); }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.badge-owner   { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(168,116,59,0.3); }
.badge-admin   { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-border); }
.badge-operator{ background: var(--info-soft); color: var(--info); border: 1px solid rgba(59,107,143,0.3); }
.badge-analyst { background: var(--surface-muted); color: var(--ink-muted); border: 1px solid var(--border); }
.badge-viewer  { background: var(--canvas); color: var(--ink-faint); border: 1px solid var(--border); }

/* ==========================================================================
   Tables
   ========================================================================== */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead tr { background: var(--surface); border-bottom: 1px solid var(--border); }
.tbl th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.tbl tbody tr { border-bottom: 1px solid var(--border); transition: background var(--dur); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:nth-child(even) { background: rgba(251,247,239,0.5); }
.tbl tbody tr:hover { background: var(--surface-muted); }
.tbl td { padding: 12px 16px; color: var(--ink); vertical-align: middle; }
.tbl-empty { padding: 48px 24px; text-align: center; color: var(--ink-muted); font-size: 13px; }

/* ==========================================================================
   Navigation sidebar
   ========================================================================== */
.nav-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar);
  background: var(--nav-surface);
  border-right: 1px solid var(--nav-border);
  display: flex; flex-direction: column;
  z-index: 100;
  padding: 0;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--nav-border);
}
.nav-brand svg { flex-shrink: 0; }
.nav-brand-name {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600;
  color: var(--nav-ink);
  letter-spacing: -0.02em;
}
.nav-brand-sub { font-size: 10px; color: var(--nav-ink-muted); font-weight: 400; letter-spacing: 0; }
.nav-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { padding: 12px 14px 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--nav-ink-muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 1px 8px;
  border-radius: var(--r-sm);
  color: var(--nav-ink-muted); font-size: 13px; font-weight: 450;
  cursor: pointer; border: none; background: none; width: calc(100% - 16px);
  text-align: left;
  transition: background var(--dur), color var(--dur);
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: var(--nav-ink); }
.nav-item.active {
  background: var(--nav-active);
  color: #E8C99A;
  border-left: 2px solid var(--nav-active-border);
  padding-left: 14px;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }
.nav-footer {
  padding: 12px;
  border-top: 1px solid var(--nav-border);
}
.nav-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur);
}
.nav-user:hover { background: rgba(255,255,255,0.07); }
.nav-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.nav-user-info { flex: 1; min-width: 0; }
.nav-user-name { font-size: 12px; font-weight: 500; color: var(--nav-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-role { font-size: 10px; color: var(--nav-ink-muted); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell {
  display: flex; min-height: 100vh;
}
.app-content {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar);
  background: var(--canvas);
}
.page-header {
  padding: 24px var(--gutter) 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.page-title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--ink);
}
.page-body { padding: 28px var(--gutter); }

/* ==========================================================================
   KPI cards
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--dur), transform var(--dur);
}
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 640; letter-spacing: -0.025em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.0; }
.kpi-note { font-size: 11px; color: var(--ink-faint); margin-top: 6px; }
.kpi-card.positive .kpi-value { color: var(--ok); }
.kpi-card.warning  .kpi-value { color: var(--warn); }
.kpi-card.danger   .kpi-value { color: var(--danger); }

/* ==========================================================================
   Chart containers
   ========================================================================== */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-card);
}
.chart-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 4px; }
.chart-card-title { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.chart-card-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.chart-range { font-size: 11px; color: var(--ink-faint); }
.chart-canvas { height: 200px; margin-top: 16px; }
.chart-canvas.compact { height: 160px; }
.chart-canvas.tall { height: 280px; }
.chart-empty {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  background: var(--canvas);
  text-align: center; padding: 24px;
}
.chart-tooltip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow-float);
  font-size: 12px; color: var(--ink);
  min-width: 140px;
}
.chart-tooltip strong { display: block; margin-bottom: 6px; font-size: 11px; color: var(--ink-muted); font-weight: 500; }
.chart-tooltip div { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.chart-tooltip span { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* KPI metrics (agency overview) */
.agency-analytics { display: flex; flex-direction: column; gap: 24px; }
.agency-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.agency-metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.agency-metric-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.agency-metric-value { font-size: 28px; font-weight: 640; letter-spacing: -0.025em; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.0; }
.agency-metric-note { font-size: 11px; color: var(--ink-faint); margin-top: 6px; }
.agency-metric.positive .agency-metric-value { color: var(--ok); }
.agency-metric.warning  .agency-metric-value { color: var(--warn); }

.agency-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.agency-chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px;
  box-shadow: var(--shadow-card);
}
.agency-chart-card.revenue-chart-card { grid-column: span 2; }
@media (max-width: 860px) { .agency-chart-grid { grid-template-columns: 1fr; } .agency-chart-card.revenue-chart-card { grid-column: span 1; } }
.agency-chart-card header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.agency-chart-card header h3 { font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.section-kicker { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 2px; }
.chart-range { font-size: 11px; color: var(--ink-faint); }
.chart-summary { font-size: 12px; color: var(--ink-muted); margin-bottom: 8px; }
.portfolio-body { display: flex; gap: 16px; align-items: center; }
.portfolio-canvas { flex: 1; height: 150px; }
.portfolio-legend { display: flex; flex-direction: column; gap: 8px; min-width: 120px; font-size: 12px; }
.portfolio-legend div { display: flex; align-items: center; gap: 8px; color: var(--ink-muted); }
.portfolio-legend span { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.portfolio-legend strong { margin-left: auto; color: var(--ink); font-weight: 600; }

/* ==========================================================================
   Atmosphere (subtle, warm, no neon)
   ========================================================================== */
.atmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.atmos .glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; }
.atmos .g1 { width: 600px; height: 500px; top: -200px; left: 50%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(212,169,101,0.18), transparent 65%); }
.atmos .g2 { width: 480px; height: 480px; top: 45%; left: -200px;
  background: radial-gradient(circle, rgba(235,220,185,0.22), transparent 68%); }
.atmos .g3 { width: 540px; height: 480px; bottom: -220px; right: -160px;
  background: radial-gradient(circle, rgba(168,116,59,0.12), transparent 68%); }
.grain::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Hairline grid for auth/marketing panels */
.hairline-grid {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.4;
  background-image:
    linear-gradient(rgba(32,26,23,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,26,23,0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 78%);
  mask: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 78%);
}

/* ==========================================================================
   Scroll reveal (progressively enhanced)
   ========================================================================== */
.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out); }
html.js .reveal.in { opacity: 1; transform: none; }
html.js .reveal[data-d="1"] { transition-delay: 0.07s; }
html.js .reveal[data-d="2"] { transition-delay: 0.14s; }
html.js .reveal[data-d="3"] { transition-delay: 0.21s; }
html.js .reveal[data-d="4"] { transition-delay: 0.28s; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .atmos { display: none; }
}

/* ==========================================================================
   Toasts
   ========================================================================== */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--nav); color: var(--nav-ink);
  border-radius: var(--r); padding: 12px 18px;
  font-size: 13px; box-shadow: var(--shadow-float);
  pointer-events: all; max-width: 360px;
  animation: toast-in 0.25s var(--ease);
  border-left: 3px solid var(--accent);
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-host { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-host:not(.hide) { background: rgba(32,26,23,0.45); backdrop-filter: blur(4px); }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-float);
  width: 100%; max-width: 480px; max-height: 90vh;
  overflow-y: auto; padding: 28px;
  animation: modal-in 0.25s var(--ease);
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 16px; letter-spacing: -0.02em; }
@keyframes modal-in { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Voice orb (Talk to it)
   ========================================================================== */
.voice-orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px 0; }
.voice-orb {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--surface-muted);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  transition: background var(--dur), border-color var(--dur), box-shadow var(--dur), transform var(--dur);
  position: relative; overflow: hidden;
}
.voice-orb::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.3), transparent 65%);
}
.voice-orb svg { width: 32px; height: 32px; color: var(--ink-muted); transition: color var(--dur); z-index: 1; }
.voice-orb.idle { background: var(--surface-muted); border-color: var(--border); }
.voice-orb.listening { background: var(--ok-soft); border-color: var(--ok-border); animation: orb-pulse 2s ease-in-out infinite; }
.voice-orb.listening svg { color: var(--ok); }
.voice-orb.thinking { background: var(--warn-soft); border-color: var(--warn-border); animation: orb-spin 1.5s linear infinite; }
.voice-orb.thinking svg { color: var(--warn); }
.voice-orb.speaking { background: var(--accent-soft); border-color: rgba(168,116,59,0.4); animation: orb-wave 0.8s ease-in-out infinite alternate; }
.voice-orb.speaking svg { color: var(--accent); }
.voice-orb.error { background: var(--danger-soft); border-color: var(--danger-border); }
.voice-orb.error svg { color: var(--danger); }
.orb-label { font-size: 13px; color: var(--ink-muted); font-weight: 500; }
@keyframes orb-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(65,107,87,0.3); } 50% { box-shadow: 0 0 0 12px rgba(65,107,87,0); } }
@keyframes orb-wave { from { transform: scale(0.96); } to { transform: scale(1.04); } }
@keyframes orb-spin { to { transform: rotate(360deg); } }

/* ---- Session transcript ---- */
.transcript { display: flex; flex-direction: column; gap: 12px; padding: 20px 0; min-height: 200px; }
.bubble { max-width: 80%; padding: 11px 15px; border-radius: var(--r); font-size: 14px; line-height: 1.55; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: var(--r-sm); }
.bubble.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); color: var(--ink); border-bottom-left-radius: var(--r-sm); box-shadow: var(--shadow-card); }
.bubble .who { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.7; margin-bottom: 4px; }
.caption-interim { font-size: 12px; color: var(--ink-muted); font-style: italic; padding: 6px 12px; align-self: flex-start; opacity: 0.8; }
.t-empty { color: var(--ink-faint); font-size: 13px; text-align: center; padding: 40px 24px; }

/* ---- Session diagnostic panel ---- */
.diag-panel {
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px 16px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-muted);
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
}
.diag-panel dt { color: var(--ink-faint); }
.diag-panel dd { margin: 0; color: var(--ink-muted); font-weight: 500; }
.diag-panel dd.good { color: var(--ok); }
.diag-panel dd.warn { color: var(--warn); }
.diag-panel dd.bad  { color: var(--danger); }

/* ==========================================================================
   Telephony cards
   ========================================================================== */
.telephony-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.telephony-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px;
  box-shadow: var(--shadow-card);
}
.telephony-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.telephony-card-title { font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -0.015em; }
.telephony-card-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.telephony-field { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.telephony-field:last-child { border-bottom: none; }
.telephony-field-label { font-size: 11px; font-weight: 500; color: var(--ink-muted); }
.telephony-field-value { font-size: 13px; color: var(--ink); font-weight: 450; font-family: var(--mono); }
.telephony-field-value.normal { font-family: var(--font); }
.telephony-actions { display: flex; gap: 8px; margin-top: 16px; }
.telephony-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; gap: 12px;
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  background: var(--canvas);
  color: var(--ink-muted); font-size: 13px;
}

/* ==========================================================================
   Sample player (Voice Studio)
   ========================================================================== */
.sample-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sample-row:last-child { border-bottom: none; }
.splay {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-muted); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px; color: var(--ink-muted);
  transition: background var(--dur), color var(--dur);
}
.splay:hover { background: var(--accent-soft); color: var(--accent); border-color: rgba(168,116,59,0.3); }
.slabel { font-size: 13px; font-weight: 500; color: var(--ink); }
.ssub { font-size: 11px; color: var(--ink-faint); }

/* ==========================================================================
   Boot screen
   ========================================================================== */
.app-root { position: relative; z-index: 2; }
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; gap: 16px; }
.boot-mark { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; }
.boot-text { font-size: 13px; color: var(--ink-muted); display: flex; align-items: center; gap: 8px; }
.boot-spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }

/* No-JS notice */
.nojs { position: fixed; inset: 0; background: var(--canvas); display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; z-index: 9999; font-size: 15px; color: var(--ink-muted); }

/* ==========================================================================
   Utilities
   ========================================================================== */
.muted { color: var(--ink-muted) !important; }
.faint { color: var(--ink-faint) !important; }
.ok    { color: var(--ok) !important; }
.warn  { color: var(--warn) !important; }
.danger{ color: var(--danger) !important; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kbd { font-family: var(--mono); font-size: 0.78rem; background: var(--surface-muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0.1em 0.45em; color: var(--ink-muted); }
.spin { animation: spin 0.75s linear infinite; }
.shimmer { animation: shimmer 1.5s ease-in-out infinite; background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface) 50%, var(--surface-muted) 75%); background-size: 200% 100%; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar: 0px; }
  .app-content { margin-left: 0; }
  .nav-sidebar { transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease); }
  .nav-sidebar.open { transform: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .telephony-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .diag-panel { grid-template-columns: 1fr; }
}
