/* ============================================================================
   PathDOC Design System — Tokens
   Contemporary RAG-platform aesthetic. Evolves the legacy slate-and-cyan
   identity (#383e4e + #38bdf8) into a professional, neutral-first system
   with a clean accent palette, light + dark parity, and swappable themes.
   ============================================================================ */

/* ---------- Typography imports (Google Fonts — see README for self-host) ---- */

/* ============================================================================
   1. PRIMITIVES — raw scales. Never reference these directly in components;
      always go through semantic tokens below so the theme stays swappable.
   ============================================================================ */
:root {
  /* Neutral — cool slate scale, calibrated for RAG/data-dense surfaces */
  --slate-0:   #ffffff;
  --slate-25:  #fbfbfc;
  --slate-50:  #f6f7f9;
  --slate-100: #eceef2;
  --slate-150: #dde1e8;
  --slate-200: #cdd2dc;
  --slate-300: #aab2c0;
  --slate-400: #7d8696;
  --slate-500: #5b6473;
  --slate-600: #434b59;
  --slate-700: #2f3641;
  --slate-800: #1e2430;
  --slate-850: #171c26;
  --slate-900: #11141c;
  --slate-950: #0a0c12;

  /* Brand — PathBlue. Evolved from the legacy #38bdf8 cyan into a deeper,
     more contemporary electric blue. Cyan is preserved as a sub-accent. */
  --blue-50:  #eef4ff;
  --blue-100: #dbe7ff;
  --blue-200: #b7cfff;
  --blue-300: #88adff;
  --blue-400: #5b88ff;
  --blue-500: #3b6bf7;  /* PathBlue — primary */
  --blue-600: #2a52d8;
  --blue-700: #2241aa;
  --blue-800: #1d3585;
  --blue-900: #182b69;

  --cyan-400: #38bdf8;  /* legacy PathDOC accent — kept as data-viz / "path" colour */
  --cyan-500: #0ea5e9;
  --cyan-600: #0284c7;

  /* Status palette */
  --green-500:  #16a34a;
  --green-100:  #dcfce7;
  --amber-500:  #d97706;
  --amber-100:  #fef3c7;
  --red-500:    #dc2626;
  --red-100:    #fee2e2;
  --violet-500: #7c3aed;
  --violet-100: #ede9fe;

  /* Alt accents — drive --accent via the [data-accent="…"] selectors below */
  --indigo-500:  #4f46e5;
  --emerald-500: #059669;
  --rose-500:    #e11d48;
  --amber-accent-500: #ea580c;
}

/* ============================================================================
   2. SEMANTIC TOKENS — light theme (default)
   ============================================================================ */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* Surfaces — back-to-front. bg < surface < raised < overlay */
  --bg:        var(--slate-50);
  --surface:   var(--slate-0);
  --raised:    var(--slate-0);
  --sunken:    var(--slate-100);
  --overlay:   rgba(17, 20, 28, 0.40);

  /* Foregrounds */
  --fg:        var(--slate-900);  /* primary text */
  --fg-muted:  var(--slate-500);  /* secondary text, labels */
  --fg-subtle: var(--slate-400);  /* tertiary, meta */
  --fg-onAccent: #ffffff;

  /* Borders + dividers */
  --border:        var(--slate-150);
  --border-strong: var(--slate-200);
  --border-subtle: var(--slate-100);
  --focus-ring:    rgba(59, 107, 247, 0.35);

  /* Accent (drives buttons, focus, links). Override via [data-accent] below. */
  --accent:        var(--blue-500);
  --accent-hover:  var(--blue-600);
  --accent-active: var(--blue-700);
  --accent-soft:   var(--blue-50);
  --accent-fg:     var(--blue-700);

  /* Status (foreground / background pairs for chips, banners) */
  --success:    var(--green-500);
  --success-soft: var(--green-100);
  --warning:    var(--amber-500);
  --warning-soft: var(--amber-100);
  --danger:     var(--red-500);
  --danger-soft: var(--red-100);
  --info:       var(--cyan-500);

  /* Code / chunk surfaces (RAG-specific) */
  --code-bg:     var(--slate-50);
  --chunk-bg:    var(--slate-25);
  --chunk-border: var(--slate-150);

  /* Shadows */
  --shadow-1: 0 1px 2px rgba(17, 20, 28, 0.05);
  --shadow-2: 0 2px 4px rgba(17, 20, 28, 0.06), 0 1px 2px rgba(17, 20, 28, 0.04);
  --shadow-3: 0 8px 24px -8px rgba(17, 20, 28, 0.12), 0 2px 4px rgba(17, 20, 28, 0.05);
  --shadow-4: 0 24px 48px -16px rgba(17, 20, 28, 0.18), 0 8px 16px -8px rgba(17, 20, 28, 0.08);
}

/* ============================================================================
   3. SEMANTIC TOKENS — dark theme
   ============================================================================ */
[data-theme="dark"] {
  color-scheme: dark;

  --bg:        var(--slate-950);
  --surface:   var(--slate-900);
  --raised:    var(--slate-850);
  --sunken:    var(--slate-900);
  --overlay:   rgba(0, 0, 0, 0.55);

  --fg:        #f0f2f6;
  --fg-muted:  var(--slate-300);
  --fg-subtle: var(--slate-400);
  --fg-onAccent: #ffffff;

  --border:        var(--slate-700);
  --border-strong: var(--slate-600);
  --border-subtle: var(--slate-800);
  --focus-ring:    rgba(91, 136, 255, 0.45);

  --accent:        var(--blue-400);
  --accent-hover:  var(--blue-300);
  --accent-active: var(--blue-200);
  --accent-soft:   rgba(91, 136, 255, 0.12);
  --accent-fg:     var(--blue-300);

  --success-soft: rgba(22, 163, 74, 0.16);
  --warning-soft: rgba(217, 119, 6, 0.18);
  --danger-soft:  rgba(220, 38, 38, 0.18);

  --code-bg:     var(--slate-850);
  --chunk-bg:    var(--slate-850);
  --chunk-border: var(--slate-700);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 12px 28px -8px rgba(0, 0, 0, 0.55), 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-4: 0 28px 60px -20px rgba(0, 0, 0, 0.65), 0 10px 18px -10px rgba(0, 0, 0, 0.4);
}

/* ============================================================================
   4. PALETTE SWAPS — set [data-accent="…"] on <html> or any scope.
      The user-facing settings panel exposes these as palette options.
   ============================================================================ */
[data-accent="blue"]    { --accent: var(--blue-500);    --accent-hover: var(--blue-600);    --accent-active: var(--blue-700);    --accent-soft: var(--blue-50);    --accent-fg: var(--blue-700); }
[data-accent="cyan"]    { --accent: var(--cyan-500);    --accent-hover: var(--cyan-600);    --accent-active: #036aa1;            --accent-soft: #e0f3fd;           --accent-fg: var(--cyan-600); }
[data-accent="indigo"]  { --accent: var(--indigo-500);  --accent-hover: #4338ca;            --accent-active: #3730a3;            --accent-soft: #eef2ff;           --accent-fg: #4338ca; }
[data-accent="emerald"] { --accent: var(--emerald-500); --accent-hover: #047857;            --accent-active: #065f46;            --accent-soft: #ecfdf5;           --accent-fg: #047857; }
[data-accent="amber"]   { --accent: var(--amber-accent-500); --accent-hover: #c2410c;       --accent-active: #9a3412;            --accent-soft: #fff7ed;           --accent-fg: #c2410c; }
[data-accent="rose"]    { --accent: var(--rose-500);    --accent-hover: #be123c;            --accent-active: #9f1239;            --accent-soft: #fff1f2;           --accent-fg: #be123c; }
[data-accent="slate"]   { --accent: var(--slate-700);   --accent-hover: var(--slate-800);   --accent-active: var(--slate-900);   --accent-soft: var(--slate-100);  --accent-fg: var(--slate-800); }

[data-theme="dark"][data-accent="blue"]    { --accent: var(--blue-400);    --accent-hover: var(--blue-300);   --accent-soft: rgba(91, 136, 255, 0.14);  --accent-fg: var(--blue-300); }
[data-theme="dark"][data-accent="cyan"]    { --accent: var(--cyan-400);    --accent-hover: #67d4fa;           --accent-soft: rgba(56, 189, 248, 0.14);  --accent-fg: var(--cyan-400); }
[data-theme="dark"][data-accent="indigo"]  { --accent: #818cf8;            --accent-hover: #a5b4fc;           --accent-soft: rgba(99, 102, 241, 0.16);  --accent-fg: #a5b4fc; }
[data-theme="dark"][data-accent="emerald"] { --accent: #34d399;            --accent-hover: #6ee7b7;           --accent-soft: rgba(16, 185, 129, 0.16);  --accent-fg: #34d399; }
[data-theme="dark"][data-accent="amber"]   { --accent: #fb923c;            --accent-hover: #fdba74;           --accent-soft: rgba(234, 88, 12, 0.18);   --accent-fg: #fdba74; }
[data-theme="dark"][data-accent="rose"]    { --accent: #fb7185;            --accent-hover: #fda4af;           --accent-soft: rgba(225, 29, 72, 0.18);   --accent-fg: #fda4af; }
[data-theme="dark"][data-accent="slate"]   { --accent: var(--slate-200);   --accent-hover: var(--slate-100);  --accent-soft: rgba(205, 210, 220, 0.10); --accent-fg: var(--slate-100); }

/* ============================================================================
   5. TYPOGRAPHY — base
   ============================================================================ */
:root {
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:   'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Display font kept available for marketing surfaces; not used in product UI */
  --font-display: 'Inter', sans-serif;

  /* Type scale — modular, base 16px. */
  --text-xs:   0.75rem;     /* 12 — meta, badges */
  --text-sm:   0.8125rem;   /* 13 — secondary UI */
  --text-base: 0.9375rem;   /* 15 — body / chat */
  --text-md:   1rem;        /* 16 — emphasised body */
  --text-lg:   1.125rem;    /* 18 — h3 / card titles */
  --text-xl:   1.375rem;    /* 22 — h2 / page section */
  --text-2xl:  1.75rem;     /* 28 — h1 */
  --text-3xl:  2.25rem;     /* 36 — display / hero */

  --leading-tight:  1.25;
  --leading-snug:   1.4;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  --tracking-tight: -0.015em;
  --tracking-normal: 0;
  --tracking-wide:   0.04em;  /* uppercase labels */

  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Spacing — 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radii — used sparingly. Buttons + inputs = md, cards = lg, pills = full */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 20px;
  --radius-full: 999px;

  /* Motion */
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-1: 80ms;
  --duration-2: 140ms;
  --duration-3: 220ms;
  --duration-4: 320ms;
}

/* ============================================================================
   6. SEMANTIC TYPE — apply via class or direct element. Use these in product
      code rather than ad-hoc font-size/weight pairs.
   ============================================================================ */
.t-display,
h1.t-display {
  font-family: var(--font-sans);
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-bold);
  color: var(--fg);
}

.t-h1, h1 {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  color: var(--fg);
}

.t-h2, h2 {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  color: var(--fg);
}

.t-h3, h3 {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
  color: var(--fg);
}

.t-h4, h4 {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
  font-weight: var(--weight-semibold);
  color: var(--fg);
}

.t-body, p {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--weight-regular);
  color: var(--fg);
}

.t-body-sm {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--fg);
}

.t-muted {
  color: var(--fg-muted);
}

.t-subtle {
  color: var(--fg-subtle);
}

.t-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.t-meta {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--fg-subtle);
  letter-spacing: 0.01em;
}

.t-mono,
code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-weight: var(--weight-regular);
  font-feature-settings: 'ss01', 'cv11';
}

.t-link, a {
  color: var(--accent-fg);
  text-decoration: none;
}
.t-link:hover, a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================================
   7. RESETS — minimal, opinionated. Pair with this stylesheet in product code.
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-fg);
}

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

/* ============================================================================
   PathDOC Design System — Components
   Built atop colors_and_type.css. Use these classes in product code; they
   are the canonical "kit" — no ad-hoc styling outside of layout work.
   ============================================================================ */

@import url('./colors_and_type.css');

/* ─── Button ────────────────────────────────────────────────────────── */
.pd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--duration-2) var(--ease-out),
    color var(--duration-2) var(--ease-out),
    border-color var(--duration-2) var(--ease-out);
  white-space: nowrap;
  user-select: none;
}
.pd-btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.pd-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.pd-btn--primary { background: var(--accent); color: var(--fg-onAccent); }
.pd-btn--primary:hover { background: var(--accent-hover); }
.pd-btn--primary:active { background: var(--accent-active); }

.pd-btn--secondary { background: var(--surface); color: var(--fg); border-color: var(--border-strong); }
.pd-btn--secondary:hover { background: var(--sunken); }
.pd-btn--secondary:active { background: var(--border); }

.pd-btn--ghost { background: transparent; color: var(--fg); }
.pd-btn--ghost:hover { background: var(--sunken); }
.pd-btn--ghost:active { background: var(--border); }

.pd-btn--danger { background: var(--danger); color: white; }
.pd-btn--danger:hover { background: #b91c1c; }

.pd-btn--sm { height: 28px; padding: 0 10px; font-size: var(--text-xs); }
.pd-btn--lg { height: 44px; padding: 0 20px; font-size: var(--text-base); }
.pd-btn--icon { width: 36px; padding: 0; }
.pd-btn--sm.pd-btn--icon { width: 28px; }

/* ─── Input ─────────────────────────────────────────────────────────── */
.pd-input,
.pd-textarea {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--fg);
  transition: border-color var(--duration-2) var(--ease-out), box-shadow var(--duration-2) var(--ease-out);
}
.pd-textarea { height: auto; min-height: 80px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.pd-input::placeholder, .pd-textarea::placeholder { color: var(--fg-subtle); }
.pd-input:hover, .pd-textarea:hover { border-color: var(--slate-300); }
.pd-input:focus, .pd-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.pd-input[aria-invalid="true"] { border-color: var(--danger); }

/* ─── Field group ──────────────────────────────────────────────────── */
.pd-field { display: flex; flex-direction: column; gap: 6px; }
.pd-field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--fg); }
.pd-field-hint  { font-size: var(--text-xs); color: var(--fg-muted); }

/* ─── Card ─────────────────────────────────────────────────────────── */
.pd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-1);
}
.pd-card__title { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--fg); margin: 0 0 4px; }
.pd-card__sub   { font-size: var(--text-sm); color: var(--fg-muted); margin: 0; }

/* ─── Badge / chip ─────────────────────────────────────────────────── */
.pd-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.01em;
  line-height: 1;
  border: 1px solid transparent;
}
.pd-badge--neutral { background: var(--sunken); color: var(--fg-muted); border-color: var(--border); }
.pd-badge--accent  { background: var(--accent-soft); color: var(--accent-fg); }
.pd-badge--success { background: var(--success-soft); color: var(--success); }
.pd-badge--warning { background: var(--warning-soft); color: var(--warning); }
.pd-badge--danger  { background: var(--danger-soft); color: var(--danger); }
.pd-badge--dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor;
  margin-right: 2px;
}

/* ─── Page-source chip (RAG-specific) ──────────────────────────────── */
.pd-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out);
}
.pd-source-chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-fg); }

/* ─── Toggle ───────────────────────────────────────────────────────── */
.pd-toggle {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out);
}
.pd-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  transition: left var(--duration-2) var(--ease-out);
}
.pd-toggle[aria-checked="true"] { background: var(--accent); }
.pd-toggle[aria-checked="true"]::after { left: 18px; }

/* ─── Slider ───────────────────────────────────────────────────────── */
.pd-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--border-strong);
  border-radius: 999px;
  outline: none;
}
.pd-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}
.pd-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
}

/* ─── Tabs ─────────────────────────────────────────────────────────── */
.pd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.pd-tab {
  padding: 10px 14px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--fg-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--duration-2) var(--ease-out), border-color var(--duration-2) var(--ease-out);
}
.pd-tab:hover { color: var(--fg); }
.pd-tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }

/* ─── Toast ────────────────────────────────────────────────────────── */
.pd-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  font-size: var(--text-sm);
  color: var(--fg);
  max-width: 360px;
}
.pd-toast__icon { width: 18px; height: 18px; flex-shrink: 0; }
.pd-toast--success .pd-toast__icon { color: var(--success); }
.pd-toast--danger  .pd-toast__icon { color: var(--danger); }

/* Toast host (portal-less stacked container, bottom-right) */
.pd-toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100% - 40px);
}
.pd-toast-host .pd-toast {
  pointer-events: auto;
  animation: pdToastIn var(--duration-3) var(--ease-out);
}
.pd-toast__body { flex: 1; min-width: 0; }
.pd-toast__title { font-weight: var(--weight-semibold); margin-bottom: 1px; }
.pd-toast__msg   { color: var(--fg-muted); font-size: var(--text-xs); }
.pd-toast__close {
  border: 0; background: transparent;
  width: 20px; height: 20px; padding: 0;
  color: var(--fg-subtle);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pd-toast__close:hover { background: var(--sunken); color: var(--fg); }
.pd-toast--info    .pd-toast__icon { color: var(--info); }
.pd-toast--warning .pd-toast__icon { color: var(--warning); }
@keyframes pdToastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Alert / Banner (inline, persistent) ─────────────────────────── */
.pd-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--fg);
  line-height: var(--leading-normal);
}
.pd-alert__icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.pd-alert__body { flex: 1; min-width: 0; }
.pd-alert__title { font-weight: var(--weight-semibold); margin-bottom: 2px; }
.pd-alert__close {
  border: 0; background: transparent;
  width: 20px; height: 20px; padding: 0;
  color: var(--fg-subtle);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pd-alert__close:hover { background: var(--sunken); color: var(--fg); }
.pd-alert--info    { background: color-mix(in srgb, var(--info) 8%, var(--surface)); border-color: color-mix(in srgb, var(--info) 25%, var(--border)); }
.pd-alert--info    .pd-alert__icon { color: var(--info); }
.pd-alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.pd-alert--success .pd-alert__icon { color: var(--success); }
.pd-alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, var(--border)); }
.pd-alert--warning .pd-alert__icon { color: var(--warning); }
.pd-alert--danger  { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.pd-alert--danger  .pd-alert__icon { color: var(--danger); }

/* ─── Tooltip (hover/focus popover) ───────────────────────────────── */
.pd-tooltip-wrap { position: relative; display: inline-flex; }
.pd-tooltip {
  position: absolute;
  z-index: 200;
  padding: 6px 10px;
  background: var(--slate-900);
  color: var(--slate-25);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.4;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--duration-2) var(--ease-out), transform var(--duration-2) var(--ease-out);
  max-width: 260px;
  text-align: center;
}
[data-theme="dark"] .pd-tooltip { background: var(--slate-200); color: var(--slate-900); }
.pd-tooltip--shown { opacity: 1; transform: translateY(0); }
.pd-tooltip__arrow {
  position: absolute;
  width: 6px; height: 6px;
  background: inherit;
  transform: rotate(45deg);
}
/* Placements */
.pd-tooltip--top    { bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(2px); }
.pd-tooltip--top.pd-tooltip--shown    { transform: translateX(-50%) translateY(0); }
.pd-tooltip--top    .pd-tooltip__arrow { bottom: -3px; left: 50%; margin-left: -3px; }
.pd-tooltip--right  { top: 50%; left: calc(100% + 8px); transform: translateY(-50%) translateX(-2px); }
.pd-tooltip--right.pd-tooltip--shown  { transform: translateY(-50%) translateX(0); }
.pd-tooltip--right  .pd-tooltip__arrow { top: 50%; left: -3px; margin-top: -3px; }
.pd-tooltip--bottom { top: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(-2px); }
.pd-tooltip--bottom.pd-tooltip--shown { transform: translateX(-50%) translateY(0); }
.pd-tooltip--bottom .pd-tooltip__arrow { top: -3px; left: 50%; margin-left: -3px; }
.pd-tooltip--left   { top: 50%; right: calc(100% + 8px); transform: translateY(-50%) translateX(2px); }
.pd-tooltip--left.pd-tooltip--shown   { transform: translateY(-50%) translateX(0); }
.pd-tooltip--left   .pd-tooltip__arrow { top: 50%; right: -3px; margin-top: -3px; }

/* ─── Confirm dialog (modal) ──────────────────────────────────────── */
.pd-confirm-scrim {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-2) var(--ease-out);
}
.pd-confirm-scrim.open { opacity: 1; pointer-events: auto; }
.pd-confirm {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(440px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-4);
  z-index: 100;
  padding: 22px 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-2) var(--ease-out), transform var(--duration-2) var(--ease-out);
}
.pd-confirm.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.pd-confirm__icon {
  width: 36px; height: 36px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.pd-confirm__icon--danger  { background: var(--danger-soft);  color: var(--danger); }
.pd-confirm__icon--warning { background: var(--warning-soft); color: var(--warning); }
.pd-confirm__icon--info    { background: var(--accent-soft);  color: var(--accent-fg); }
.pd-confirm__title { font-size: 16px; font-weight: var(--weight-semibold); margin: 0 0 6px; color: var(--fg); }
.pd-confirm__msg   { font-size: var(--text-sm); color: var(--fg-muted); margin: 0 0 18px; line-height: var(--leading-normal); }
.pd-confirm__actions {
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ─── Chat message ─────────────────────────────────────────────────── */
.pd-msg { display: flex; flex-direction: column; gap: 4px; }
.pd-msg--user { align-items: flex-end; }
.pd-msg__bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  max-width: 75%;
}
.pd-msg--user .pd-msg__bubble {
  background: var(--accent-soft);
  border: 1px solid transparent;
  color: var(--fg);
  border-bottom-right-radius: var(--radius-sm);
}
.pd-msg--assistant .pd-msg__bubble {
  background: transparent;
  max-width: 100%;
  padding: 0;
  color: var(--fg);
}
.pd-msg__meta { font-size: var(--text-xs); color: var(--fg-subtle); }

/* ─── Mode selector pill (RAG-specific composer affordance) ────────── */
.pd-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
}
.pd-mode:hover { background: var(--sunken); }
.pd-mode svg { width: 14px; height: 14px; color: var(--accent); }

/* UI kit — local styles. Pulls tokens from the root design system files. */


html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

#root { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── App shell ──────────────────────────────────────────────────── */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 56px minmax(280px, 340px) 1fr;
  min-height: 0;
  background: var(--bg);
}

.app.no-library { grid-template-columns: 56px 1fr; }
.app.no-library .library { display: none; }

/* ── Sidebar (rail) ─────────────────────────────────────────────── */
.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 10px;
}
.rail__logo {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg);
}
.rail__divider { width: 28px; height: 1px; background: var(--border); }
.rail__group { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rail__group--bottom { margin-top: auto; }
.rail__btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out), color var(--duration-2) var(--ease-out);
}
.rail__btn:hover { background: var(--sunken); color: var(--fg); }
.rail__btn.active { background: var(--accent-soft); color: var(--accent-fg); }
.rail__btn svg { width: 18px; height: 18px; }
.rail__led {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 25%, transparent);
}

/* ── Library panel ──────────────────────────────────────────────── */
.library {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.library__head {
  padding: 16px 18px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.library__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 14px;
}
.library__title { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--fg-muted); }
.library__addbtn {
  width: 24px; height: 24px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
}
.library__addbtn:hover { color: var(--fg); background: var(--sunken); }
.library__addbtn svg { display: block; }

.library__section { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.library__section-label {
  padding: 6px 4px 4px;
  font-size: 11px; font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase; letter-spacing: 0.05em;
}

.collection {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out);
}
.collection:hover { background: var(--sunken); }
.collection.active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.collection.active .collection__name { color: var(--accent-fg); }
.collection__icon { width: 28px; height: 28px; border-radius: 6px; background: var(--sunken); display: inline-flex; align-items: center; justify-content: center; color: var(--fg-muted); flex-shrink: 0; }
.collection.active .collection__icon { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent-fg); }
.collection__name { flex: 1; font-size: 13px; font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection__count { font-size: 11px; color: var(--fg-subtle); font-variant-numeric: tabular-nums; }

.library__files {
  padding: 0 14px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.library__hint {
  font-size: 11.5px; color: var(--fg-muted); line-height: 1.5;
  padding: 10px 12px;
  background: var(--sunken);
  border-radius: 8px;
  margin-bottom: 8px;
}
.file {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.file__icon { width: 24px; height: 24px; color: var(--fg-muted); }
.file__icon svg { width: 16px; height: 16px; }
.file__info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file__name { font-size: 12.5px; font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__meta { font-size: 11px; color: var(--fg-subtle); }
.file__view:hover { background: var(--hover, rgba(17, 20, 28, 0.06)); color: var(--fg); }
.file__view:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pd-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border-strong, var(--border));
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  animation: pd-spin 0.7s linear infinite;
}
@keyframes pd-spin { to { transform: rotate(360deg); } }
.file__check {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  cursor: pointer;
  background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.file__check:checked { background: var(--accent); border-color: var(--accent); }
.file__check:checked::after {
  content: ''; width: 8px; height: 4px;
  border: 1.5px solid white; border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* ── Chat panel ─────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.chat__head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
}
.chat__head-title { font-size: 14px; font-weight: 600; color: var(--fg); display: flex; align-items: center; gap: 10px; }
.chat__head-title svg { width: 16px; height: 16px; color: var(--fg-muted); }

.chat__scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat__timeline {
  width: 100%;
  max-width: 760px;
  align-self: center;
  margin: auto 0 0;
  padding: 32px 20px 24px;
  display: flex; flex-direction: column; gap: 28px;
}
.chat__load-more {
  display: flex;
  justify-content: center;
  margin-bottom: -4px;
}

.empty {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  padding: 40px;
  color: var(--fg-muted);
}
.empty__mark {
  width: 72px; height: 72px;
  --mark-bg: var(--surface);
  --mark-accent: var(--accent);
  color: var(--fg);
  opacity: 0.85;
}
.empty__title { font-size: 18px; font-weight: 600; color: var(--fg); }
.empty__sub { font-size: 13px; color: var(--fg-muted); max-width: 380px; text-align: center; line-height: 1.5; }

/* ── Composer area ─────────────────────────────────────────────── */
.composer-wrap {
  padding: 12px 24px 18px;
  background: var(--bg);
}
.composer {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.composer__box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow-2);
  transition: border-color var(--duration-2) var(--ease-out), box-shadow var(--duration-2) var(--ease-out);
}
.composer__box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.composer__textarea {
  width: 100%;
  resize: none;
  border: 0; outline: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--fg);
  min-height: 24px;
  max-height: 200px;
  padding: 4px 0;
}
.composer__textarea::placeholder { color: var(--fg-subtle); }
.composer__toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px;
}
.composer__right { display: flex; align-items: center; gap: 8px; }

.pd-msg__bubble--plain {
  white-space: pre-wrap;
}

.pd-msg__bubble--rich {
  white-space: normal;
}

.pd-msg__bubble--rich p {
  margin: 0 0 10px;
}

.pd-msg__bubble--rich p:last-child,
.pd-msg__bubble--rich ul:last-child,
.pd-msg__bubble--rich ol:last-child,
.pd-msg__bubble--rich pre:last-child {
  margin-bottom: 0;
}

.pd-msg__bubble--rich .pd-msg__list,
.pd-msg__bubble--rich ul,
.pd-msg__bubble--rich ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.pd-msg__bubble--rich li + li {
  margin-top: 4px;
}

.pd-msg__bubble--rich code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--sunken);
  padding: 1px 5px;
  border-radius: 4px;
}

.pd-msg__bubble--rich pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--sunken);
  overflow-x: auto;
}

.pd-msg__bubble--rich pre code {
  background: transparent;
  padding: 0;
}

.pd-msg__bubble--rich a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pd-msg__bubble--rich strong {
  font-weight: 600;
}

/* Tabelas (markdown GFM) nas respostas do assistente. */
.pd-msg__bubble--rich table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.pd-msg__bubble--rich th,
.pd-msg__bubble--rich td {
  border: 1px solid var(--border);
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}
.pd-msg__bubble--rich th {
  background: var(--sunken, var(--bg));
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.pd-msg__bubble--rich tbody tr:nth-child(even) td {
  background: var(--hover, rgba(17, 20, 28, 0.03));
}
.pd-msg__bubble--rich h2 {
  font-size: 14px; font-weight: 700; color: var(--fg);
  margin: 14px 0 8px;
}
.pd-msg__bubble--rich h3 {
  font-size: 13px; font-weight: 600; color: var(--fg);
  margin: 12px 0 6px;
}
.pd-msg__bubble--rich h2:first-child,
.pd-msg__bubble--rich h3:first-child { margin-top: 0; }
.pd-msg__bubble--rich hr {
  border: none; border-top: 1px solid var(--border);
  margin: 14px 0;
}

.send-btn {
  width: 38px; height: 38px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: background var(--duration-2) var(--ease-out),
    transform var(--duration-1) var(--ease-out),
    box-shadow var(--duration-2) var(--ease-out);
}
.send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent);
}
.send-btn:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 35%, transparent); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { background: var(--border-strong); cursor: not-allowed; }
.send-btn svg { width: 16px; height: 16px; }

.disclaimer {
  text-align: center;
  font-size: 11px;
  color: var(--fg-subtle);
  padding-top: 8px;
}

/* ── Mode popover ───────────────────────────────────────────────── */
.mode-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-3);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  z-index: 30;
}
.mode-item { padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.mode-item:hover { background: var(--sunken); }
.mode-item.active { background: var(--accent-soft); }
.mode-item .name { font-size: 13px; font-weight: 600; color: var(--fg); display: flex; align-items: center; justify-content: space-between; }
.mode-item .desc { font-size: 11px; color: var(--fg-muted); }
.mode-item.active .name { color: var(--accent-fg); }
.mode-pop .check { width: 14px; height: 14px; color: var(--accent); }
.mode-relative { position: relative; }

/* ── Login ──────────────────────────────────────────────────────── */
.login-stage {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 40px 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-3);
}
.login-card__logo { display: flex; justify-content: center; margin-bottom: 18px; color: var(--fg); --mark-bg: var(--surface); --mark-accent: var(--accent); }
.login-card__logo svg { width: 48px; height: 48px; }
.login-card__title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}
.login-card__title .doc { color: var(--accent); font-weight: 500; }
.login-card__sub { text-align: center; font-size: 13px; color: var(--fg-muted); margin: 4px 0 22px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .pd-btn { width: 100%; height: 40px; }
.login-form .divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--fg-subtle); margin: 4px 0;
}
.login-form .divider::before, .login-form .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Settings drawer ────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-3) var(--ease-out);
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(720px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-4);
  z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration-3) var(--ease-out);
}
.drawer--wide { width: min(1040px, 100%); }
.drawer.open { transform: translateX(0); }
.drawer__head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer__title { font-size: 16px; font-weight: 600; }
.drawer__tabs { padding: 0 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.drawer__tabs-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: help;
}
.drawer__tabs-hint svg { color: var(--fg-subtle); }
.drawer__body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer__foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--bg);
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.settings-card h4 { margin: 0; font-size: 14px; font-weight: 600; }
.settings-card .desc { margin: 0; font-size: 12.5px; color: var(--fg-muted); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .l { font-size: 13px; font-weight: 500; }
.settings-row .h { font-size: 12px; color: var(--fg-muted); }
.lang-toggle {
  display: inline-flex;
  width: fit-content;              /* never stretch in flex-column parents */
  align-self: flex-start;
  background: var(--sunken);
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
}
.lang-toggle button {
  border: 0; background: transparent;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
}
.lang-toggle button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }

/* ── Multi-column tab layouts (Ingestão / Recuperação / Otimização) ─ */
.tab-grid { display: grid; gap: 14px; }
.tab-grid--2 { grid-template-columns: 1fr 1fr; }
.tab-col { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 720px) {
  .tab-grid--2 { grid-template-columns: 1fr; }
}

/* ── Settings: tree-nav + master-detail (Direction C) ─────────────── */
.settings-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 0;
  background: var(--bg);
}
.settings-nav {
  background: var(--sunken);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.settings-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-subtle);
}
.settings-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg);
  outline: 0;
  min-width: 0;
}
.settings-search input::placeholder { color: var(--fg-subtle); }
.settings-search__kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--fg-muted);
}

.settings-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 14px;
  display: flex;
  flex-direction: column;
}
.settings-tree__group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0;
}
.settings-tree__divider-label {
  padding: 14px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}

/* Pipeline group: vertical stepper rail */
.settings-tree__group--pipe { position: relative; padding-left: 6px; }
.settings-tree__group--pipe::before {
  content: '';
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 18px;
  width: 1.5px;
  background: var(--border);
  border-radius: 999px;
}

.settings-tree__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 4px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out), color var(--duration-2) var(--ease-out);
}
.settings-tree__row svg { color: var(--fg-muted); flex-shrink: 0; }
.settings-tree__row:hover { background: var(--surface); }
.settings-tree__row.active { background: var(--accent-soft); color: var(--accent-fg); font-weight: 500; }
.settings-tree__row.active svg { color: var(--accent-fg); }
.settings-tree__row.dim { opacity: 0.45; }
.settings-tree__row-label { flex: 1; min-width: 0; }
.settings-tree__count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-fg);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.settings-tree__row--pipe { padding-left: 4px; gap: 8px; }
.settings-tree__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--fg-muted);
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.settings-tree__row--pipe.active .settings-tree__step {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Detail pane ────────────────────────────────────────────────── */
.settings-detail {
  overflow-y: auto;
  min-height: 0;
  padding: 32px 40px 40px;
  scroll-behavior: smooth;
}
.settings-detail__head {
  max-width: 720px;
  margin-bottom: 28px;
}
.settings-detail__crumb {
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin-bottom: 4px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.settings-detail__title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  color: var(--fg);
}
.settings-detail__desc {
  font-size: 13.5px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.55;
}
.settings-detail__sections {
  display: flex;
  flex-direction: column;
  max-width: 720px;
}

/* ── Per-section block — stacked, separated by hairline ──────────── */
.settings-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-section:first-child { padding-top: 0; }
.settings-section:last-child { border-bottom: 0; padding-bottom: 16px; }

.settings-section__head { margin-bottom: 14px; }
.settings-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 4px;
}
.settings-section__dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}
.settings-section__desc {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.5;
  max-width: 560px;
}
.settings-section__body { display: flex; flex-direction: column; gap: 4px; }

.settings-empty {
  padding: 64px 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}

@media (max-width: 760px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { border-right: 0; border-bottom: 1px solid var(--border); max-height: 220px; }
  .drawer--wide { width: 100%; }
  .settings-detail { padding: 24px 20px; }
}

/* ── Brand logo (PNG, monochrome navy) ───────────────────────────── */
.pd-logo--lockup,
.pd-logo--icon {
  transition: filter var(--duration-2) var(--ease-out);
}
/* Invert to white in dark theme so the navy mark stays readable */
[data-theme="dark"] .pd-logo--lockup,
[data-theme="dark"] .pd-logo--icon {
  filter: invert(1) brightness(1.05);
}

/* ── Login (split-screen) ──────────────────────────────────────── */
.login-split {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(440px, 1fr) 1.1fr;
  min-height: 0;
  background: var(--bg);
}

/* Left: form pane */
.login-form-pane {
  display: flex;
  flex-direction: column;
  padding: 32px 56px;
  background: var(--surface);
  min-width: 0;
  position: relative;
}
.login-form-pane__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.login-form-pane__wordmark {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.login-form-pane__wordmark strong { color: var(--accent); font-weight: 500; }

.login-form-pane__center {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}
.login-form-pane__heading {
  margin-bottom: 24px;
}
.login-form-pane__heading h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 6px;
}
.login-form-pane__heading p {
  font-size: 14px;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-form__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-form__forgot {
  font-size: 12px;
  color: var(--accent-fg);
  text-decoration: none;
  font-weight: 500;
}
.login-form__forgot:hover { text-decoration: underline; }

.login-form__pass { position: relative; }
.login-form__pass .pd-input { padding-right: 40px; }
.login-form__pass-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.login-form__pass-toggle:hover { background: var(--sunken); color: var(--fg); }

.login-form__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin: 4px 0;
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.login-form__divider::before,
.login-form__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-form__legal {
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin: 18px 0 0;
  text-align: center;
  line-height: 1.5;
}
.login-form__legal a {
  color: var(--fg-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.login-form__legal a:hover { color: var(--fg); }

.login-form-pane__foot {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--fg-subtle);
  flex-shrink: 0;
}
.login-form-pane__foot a {
  color: var(--fg-muted);
  text-decoration: none;
}
.login-form-pane__foot a:hover { color: var(--fg); }

/* Right: art pane */
.login-art {
  position: relative;
  overflow: hidden;
  background: var(--sunken);
  border-left: 1px solid var(--border);
}
.login-art::before {
  /* Soft accent wash */
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 60% at 70% 30%, color-mix(in srgb, var(--accent) 14%, transparent) 0%, transparent 70%),
    radial-gradient(50% 50% at 20% 85%, color-mix(in srgb, var(--accent) 10%, transparent) 0%, transparent 70%);
  pointer-events: none;
}
.login-art__inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 48px 48px;
}
.login-art__svg {
  width: 100%;
  max-width: 520px;
  height: auto;
  margin: 0 auto 24px;
  align-self: center;
  color: var(--fg);
}
.login-art__path { /* container for the animated routing */ }
.login-art__copy {
  max-width: 480px;
  align-self: center;
  text-align: center;
}
.login-art__copy h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  color: var(--fg);
}
.login-art__copy p {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.55;
  margin: 0 0 20px;
}
.login-art__features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.login-art__feature {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.login-art__feature-icon {
  width: 22px; height: 22px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-fg);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Responsive — hide art on small screens */
@media (max-width: 920px) {
  .login-split { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form-pane { padding: 32px 28px; }
}
.mode-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.mode-pill {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--sunken);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out), color var(--duration-2) var(--ease-out), border-color var(--duration-2) var(--ease-out);
}
.mode-pill:hover { color: var(--fg); }
.mode-pill.active {
  background: var(--accent-soft);
  color: var(--accent-fg);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ── Theme + accent pickers (inside Settings › Geral) ─────────────── */
.theme-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--duration-2) var(--ease-out), background var(--duration-2) var(--ease-out);
  width: 132px;
}
.theme-option:hover { border-color: var(--slate-300); }
.theme-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.theme-option__preview {
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.theme-option__preview--light { background: #f6f7f9; }
.theme-option__preview--dark  { background: #0a0c12; border-color: #2f3641; }
.theme-option__bar {
  height: 12px;
  background: rgba(0,0,0,0.06);
  border-bottom: 1px solid var(--border);
}
.theme-option__preview--dark .theme-option__bar { background: rgba(255,255,255,0.06); border-bottom-color: #2f3641; }
.theme-option__body { flex: 1; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.theme-option__line {
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,0.10);
}
.theme-option__line--short { width: 60%; background: rgba(0,0,0,0.07); }
.theme-option__preview--dark .theme-option__line { background: rgba(255,255,255,0.16); }
.theme-option__preview--dark .theme-option__line--short { background: rgba(255,255,255,0.10); }
.theme-option__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  justify-content: center;
}

.accent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-width: 560px;
}
.accent-swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--duration-2) var(--ease-out), background var(--duration-2) var(--ease-out);
  font-family: var(--font-sans);
  font-size: 12.5px;
  text-align: left;
}
.accent-swatch:hover { border-color: var(--slate-300); }
.accent-swatch.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.accent-swatch__dot {
  width: 18px; height: 18px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.accent-swatch__name { color: var(--fg); font-weight: 500; }
.accent-swatch.active .accent-swatch__name { color: var(--accent-fg); }

/* ── Theme picker (top-right) ───────────────────────────────────── */
.theme-pick {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  font-size: 11.5px;
  color: var(--fg-muted);
}
.theme-pick__group { display: flex; gap: 6px; align-items: center; }
.theme-pick__sw {
  width: 18px; height: 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  cursor: pointer;
  background-clip: padding-box;
}
.theme-pick__sw.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--fg); }
.theme-pick__theme {
  width: 26px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-pick__theme.active { background: var(--accent-soft); color: var(--accent-fg); border-color: var(--accent); }
.theme-pick__theme svg { width: 13px; height: 13px; }

/* ── Docs Assistant (Assistente de Documentação) ────────────────────
   Right-anchored drawer (narrower than Settings). Has a curated suggestion
   list when empty, and a chat-style Q&A flow once the user asks something.
   ───────────────────────────────────────────────────────────────── */
.docs-scrim {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-3) var(--ease-out);
}
.docs-scrim.open { opacity: 1; pointer-events: auto; }
.docs-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-4);
  z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration-3) var(--ease-out);
}
.docs-drawer.open { transform: translateX(0); }
.docs-drawer__head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.docs-drawer__title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.docs-drawer__sub { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.docs-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 18px;
}
.docs-drawer__foot {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.docs-empty p { font-size: 13px; color: var(--fg-muted); line-height: 1.55; margin: 0 0 16px; }
.docs-suggest { display: flex; flex-direction: column; gap: 6px; }
.docs-suggest__label {
  font-size: 11px; font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.docs-suggest__chip {
  display: grid;
  grid-template-columns: 16px 1fr 14px;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out), border-color var(--duration-2) var(--ease-out);
}
.docs-suggest__chip:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.docs-msg { display: flex; flex-direction: column; gap: 6px; }
.docs-msg__role {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-subtle);
  letter-spacing: 0.02em;
}
.docs-msg--user .docs-msg__role { color: var(--accent-fg); }
.docs-msg__body { font-size: 13.5px; line-height: 1.6; color: var(--fg); }
.docs-msg__body p { margin: 0 0 10px; }
.docs-msg__body p:last-child { margin-bottom: 0; }
.docs-msg__body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--sunken);
  padding: 1px 5px;
  border-radius: 4px;
}
.docs-msg__body strong { font-weight: 600; color: var(--fg); }
.docs-md-ol, .docs-md-ul { margin: 0 0 10px; padding-left: 20px; }
.docs-md-ol li, .docs-md-ul li { margin-bottom: 4px; }

.docs-msg--user .docs-msg__body {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 10px 12px;
}

.docs-typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.docs-typing span {
  width: 6px; height: 6px;
  background: var(--fg-subtle);
  border-radius: 999px;
  animation: docsBlink 1.2s infinite ease-in-out;
}
.docs-typing span:nth-child(2) { animation-delay: 0.15s; }
.docs-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes docsBlink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40%           { opacity: 1;    transform: translateY(-2px); }
}

/* ── YouTube link auto-attach (composer) ──────────────────────────── */
.yt-attach {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  padding: 10px 12px 6px;
  width: 100%;
  max-width: 760px;
  align-self: center;
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.yt-attach__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-muted);
}
.yt-attach__head-l { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-weight: 500; }
.yt-attach__hint { color: var(--fg-subtle); font-size: 11.5px; }
.yt-attach__hint strong { color: var(--fg); font-weight: 600; }
.yt-attach__cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.yt-card {
  display: grid;
  grid-template-columns: 64px 1fr 24px;
  gap: 10px;
  align-items: center;
  padding: 6px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.yt-card__thumb {
  width: 64px; height: 36px;
  border-radius: 4px;
  background: var(--slate-300) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.yt-card__thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.35);
  border-radius: 4px;
}
.yt-card__thumb svg { position: relative; z-index: 1; }
.yt-card__body { min-width: 0; }
.yt-card__title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.yt-card__meta { font-size: 11px; color: var(--fg-muted); margin-top: 2px; }
.yt-card__dismiss {
  width: 22px; height: 22px;
  border: 0; background: transparent;
  color: var(--fg-muted);
  border-radius: 4px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.yt-card__dismiss:hover { background: var(--surface); color: var(--fg); }
.yt-attach + .composer__box {
  border-radius: 0 0 12px 12px;
  border-top: 1px solid var(--border);
}

/* System message bubble */
.pd-msg-system {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--fg-muted);
}

/* ── Documentation (book icon — static knowledge base) ──────────── */
.documentation {
  position: fixed;
  top: 12px; right: 12px; bottom: 12px;
  width: min(960px, calc(100% - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-4);
  z-index: 50;
  display: flex; flex-direction: column;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  transition: opacity var(--duration-3) var(--ease-out), transform var(--duration-3) var(--ease-out);
}
.documentation.open { opacity: 1; transform: translateX(0); pointer-events: auto; }
.documentation__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.documentation__title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14.5px; font-weight: 600; color: var(--fg);
}
.documentation__crumb { color: var(--fg-muted); font-weight: 400; }
.documentation__body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
}
.documentation__nav {
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex; flex-direction: column;
  min-height: 0;
}
.documentation__toc {
  flex: 1; overflow-y: auto;
  padding: 4px 8px 14px;
  display: flex; flex-direction: column;
}
.documentation__toc-group { padding: 6px 0; }
.documentation__toc-label {
  padding: 8px 12px 4px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.documentation__toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin: 0 4px;
  border: 0; background: transparent;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: background var(--duration-2) var(--ease-out), color var(--duration-2) var(--ease-out);
}
.documentation__toc-item:hover { background: var(--sunken); }
.documentation__toc-item.active { background: var(--accent-soft); color: var(--accent-fg); font-weight: 500; }
.documentation__toc-item-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.documentation__toc-item-read,
.documentation__toc-item-group {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-subtle);
}
.documentation__article {
  overflow-y: auto;
  padding: 32px 40px;
}
.documentation__article-head { margin-bottom: 22px; max-width: 680px; }
.documentation__article-head h1 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--fg); margin: 0 0 6px;
}
.documentation__article-meta {
  display: flex; gap: 8px;
  font-size: 12px; color: var(--fg-subtle);
}
.documentation__article-body { max-width: 680px; font-size: 14.5px; line-height: 1.65; }
.documentation__article-body p { margin: 0 0 14px; }
.documentation__article-body .docs-md-ol,
.documentation__article-body .docs-md-ul { margin: 0 0 14px; }
.documentation__article-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--fg-muted);
  max-width: 680px;
}
@media (max-width: 760px) {
  .documentation__body { grid-template-columns: 1fr; }
  .documentation__nav { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--border); }
  .documentation__article { padding: 22px 20px; }
}

/* ── Knowledge Graph drawer (Option E: Concept Explorer + Path Finder) ── */
.graph-scrim {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-3) var(--ease-out);
}
.graph-scrim.open { opacity: 1; pointer-events: auto; }
.graph-drawer {
  position: fixed;
  top: 12px; right: 12px; bottom: 12px; left: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-4);
  z-index: 50;
  display: flex; flex-direction: column;
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
  transition: opacity var(--duration-3) var(--ease-out), transform var(--duration-3) var(--ease-out);
}
.graph-drawer.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.graph-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.graph-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg);
}
.graph-head__title svg { color: var(--accent); }
.graph-head__crumb { color: var(--fg-muted); font-weight: 400; font-size: 13px; }
.graph-head__stats {
  font-size: 11.5px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.graph-tabs {
  display: inline-flex;
  background: var(--sunken);
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
}
.graph-tabs button {
  border: 0; background: transparent;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px; font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.graph-tabs button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }
.graph-tabs button:hover:not(.active) { color: var(--fg); }

/* Body: 3-column layout for Explorer, single-column for Path Finder */
.graph-body { flex: 1; display: grid; min-height: 0; }
.graph-body--explorer { grid-template-columns: 280px 1fr 320px; }
.graph-body--paths    { grid-template-columns: 1fr; }

.graph-pane { min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.graph-pane + .graph-pane { border-left: 1px solid var(--border); }
.graph-pane__head {
  padding: 12px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.graph-pane__title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.graph-pane__body {
  flex: 1; min-height: 0; min-width: 0;
  overflow-y: auto;
}

/* Concept list (left pane) */
.concept-search {
  margin: 0 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.concept-search input {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--fg);
}
.concept-search input::placeholder { color: var(--fg-subtle); }
.concept-search svg { color: var(--fg-subtle); }

.concept-list {
  padding: 4px 8px 12px;
  display: flex; flex-direction: column; gap: 1px;
}
.concept-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--fg);
  text-align: left;
  transition: background var(--duration-2) var(--ease-out);
}
.concept-item:hover { background: var(--sunken); }
.concept-item.active { background: var(--accent-soft); color: var(--accent-fg); }
.concept-item__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concept-item__count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.concept-item.active .concept-item__count { color: var(--accent-fg); opacity: 0.7; }

/* Ego graph (center pane) */
.ego-graph {
  flex: 1;
  position: relative;
  background:
    radial-gradient(circle at center, var(--sunken) 0%, var(--bg) 80%);
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.ego-graph__legend {
  position: absolute;
  bottom: 12px; left: 12px;
  display: flex; gap: 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--fg-muted);
}
.ego-graph__legend span { display: inline-flex; align-items: center; gap: 5px; }
.ego-graph__legend .dot {
  width: 8px; height: 8px; border-radius: 999px;
  display: inline-block;
}
.ego-graph__zoom {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.ego-graph__zoom button {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  color: var(--fg-muted);
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.ego-graph__zoom button:hover { background: var(--sunken); color: var(--fg); }
.ego-graph__zoom button + button { border-top: 1px solid var(--border); }

/* SVG node styling */
.ego-svg { width: 100%; height: 100%; cursor: grab; }
.ego-node circle {
  cursor: pointer;
  transition: r 0.15s ease, stroke-width 0.15s ease;
}
.ego-node text {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--fg);
  pointer-events: none;
  user-select: none;
}
.ego-node--center circle { fill: var(--accent); stroke: color-mix(in srgb, var(--accent) 25%, transparent); stroke-width: 8; }
.ego-node--center text { font-weight: 600; font-size: 13px; fill: var(--accent-fg); }
.ego-node--neighbor circle { fill: var(--surface); stroke: var(--accent); stroke-width: 1.8; }
.ego-node--neighbor:hover circle { stroke-width: 3; }
.ego-edge {
  stroke: var(--border-strong);
  stroke-width: 1.5;
  fill: none;
}

/* Sources (right pane) */
.source-list {
  padding: 4px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.source-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.source-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg);
  font-weight: 500;
}
.source-card__head svg { color: var(--fg-muted); }
.source-card__pages {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.source-card__quote {
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--sunken);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.source-card__quote em {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--fg);
  font-style: normal;
  padding: 1px 3px;
  border-radius: 2px;
}

/* Concept summary header (above ego graph) */
.concept-header {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--border);
}
.concept-header__name {
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.concept-header__meta {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--fg-muted);
}
.concept-header__meta strong {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

/* Path Finder (single-pane) */
.path-finder { padding: 22px 28px; overflow-y: auto; flex: 1; }
.path-finder__controls {
  display: grid;
  grid-template-columns: 1fr 24px 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.path-finder__arrow {
  align-self: end;
  padding-bottom: 9px;
  color: var(--fg-muted);
  display: flex; justify-content: center;
}
.path-finder__results {
  display: flex; flex-direction: column; gap: 14px;
}
.path-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.path-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.path-card__head strong { color: var(--fg); font-weight: 600; }
.path-chain {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 4px;
}
.path-chain__node {
  padding: 5px 10px;
  background: var(--sunken);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg);
}
.path-chain__node--start { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-fg); }
.path-chain__node--end   { background: var(--accent); border-color: var(--accent); color: white; }
.path-chain__edge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--fg-subtle);
}
.path-chain__edge svg { color: var(--fg-subtle); }
.path-card__via {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--sunken);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.path-card__via strong { color: var(--fg); font-weight: 600; }
.path-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
}


/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE LAYOUTS — driven by <html data-layout="tablet|mobile">
   set by Layout.jsx (port of PathDOC/layout-profile.js). Falls back to
   media-query-only rules already defined per-component above.
   ════════════════════════════════════════════════════════════════════ */

/* ─── TABLET (720-1024 OR coarse pointer) ────────────────────────── */
[data-layout="tablet"] .app {
  grid-template-columns: 56px 1fr;
}
[data-layout="tablet"] .app.no-library {
  grid-template-columns: 56px 1fr;
}
[data-layout="tablet"] .library {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0;
  left: 56px;
  width: min(360px, 80vw);
  z-index: 32;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  transform: translateX(-105%);
  transition: transform var(--duration-3) var(--ease-out);
}
[data-layout="tablet"] .app:not(.no-library) .library { transform: translateX(0); }
/* Scrim behind tablet library */
[data-layout="tablet"] .app:not(.no-library)::after {
  content: '';
  position: fixed;
  top: 0; bottom: 0; right: 0;
  left: calc(56px + min(360px, 80vw));
  background: var(--overlay);
  z-index: 31;
  pointer-events: none;
}
/* Settings + docs drawers narrower on tablet */
[data-layout="tablet"] .drawer--wide { width: min(720px, 100%); }
[data-layout="tablet"] .documentation { width: min(720px, calc(100% - 24px)); }

/* Touch targets ≥ 40px */
[data-layout="tablet"] .rail__btn { width: 40px; height: 40px; }
[data-layout="tablet"] .rail__btn svg { width: 20px; height: 20px; }

/* ─── MOBILE (< 720px) ────────────────────────────────────────────── */
[data-layout="mobile"] body {
  /* avoid double-scroll inside chat */
  overflow: hidden;
}
[data-layout="mobile"] #root {
  height: 100vh;
  height: 100dvh;
}
[data-layout="mobile"] .app {
  display: flex;
  flex-direction: column;
  height: 100%;
  grid-template-columns: none;
}

/* Rail becomes top header bar */
[data-layout="mobile"] .rail {
  flex-direction: row;
  width: 100%;
  height: 52px;
  min-height: 52px;
  padding: 6px 8px;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 2px;
}
[data-layout="mobile"] .rail__logo { margin-right: 8px; }
[data-layout="mobile"] .rail__divider { display: none; }
[data-layout="mobile"] .rail__group {
  flex-direction: row;
  gap: 2px;
  align-items: center;
}
[data-layout="mobile"] .rail__group--bottom {
  margin-top: 0;
  margin-left: auto;
  padding: 0;
}
[data-layout="mobile"] .rail__btn { width: 42px; height: 42px; }
[data-layout="mobile"] .rail__btn svg { width: 20px; height: 20px; }

/* Library overlays as a left drawer with scrim */
[data-layout="mobile"] .library {
  position: fixed;
  top: 52px;
  left: 0; right: 0; bottom: 0;
  width: min(320px, 88vw);
  z-index: 32;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  transform: translateX(-105%);
  transition: transform var(--duration-3) var(--ease-out);
  display: flex;
  flex-direction: column;
}
[data-layout="mobile"] .app:not(.no-library) .library { transform: translateX(0); }
[data-layout="mobile"] .app:not(.no-library)::after {
  content: '';
  position: fixed;
  top: 52px; bottom: 0; right: 0;
  left: min(320px, 88vw);
  background: var(--overlay);
  z-index: 31;
  pointer-events: auto;
}

/* Chat fills remaining space */
[data-layout="mobile"] .chat { flex: 1; min-height: 0; }
[data-layout="mobile"] .chat__head {
  padding: 10px 14px;
  font-size: 13px;
}
[data-layout="mobile"] .chat__head-title { font-size: 13px; }
[data-layout="mobile"] .chat__timeline {
  padding: 18px 14px 16px;
  gap: 22px;
}
[data-layout="mobile"] .composer-wrap {
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
}
[data-layout="mobile"] .composer__textarea {
  font-size: 16px;  /* prevents iOS zoom-on-focus */
}
[data-layout="mobile"] .pd-mode { display: none; }  /* mode selector hidden, defaults to retrieval */
[data-layout="mobile"] .disclaimer { font-size: 10.5px; }

/* All drawers go full-screen on mobile */
[data-layout="mobile"] .drawer,
[data-layout="mobile"] .drawer--wide,
[data-layout="mobile"] .docs-drawer,
[data-layout="mobile"] .documentation,
[data-layout="mobile"] .graph-drawer {
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  border-radius: 0;
  border: 0;
  border-left: 0;
  transform: translateX(100%);
}
[data-layout="mobile"] .drawer.open,
[data-layout="mobile"] .documentation.open,
[data-layout="mobile"] .docs-drawer.open,
[data-layout="mobile"] .graph-drawer.open {
  transform: translateX(0);
}

/* Settings: navigation stacks on top, scrolls horizontally as pill row */
[data-layout="mobile"] .settings-layout { grid-template-columns: 1fr; }
[data-layout="mobile"] .settings-nav {
  max-height: none;
  border-right: 0;
  border-bottom: 1px solid var(--border);
}
[data-layout="mobile"] .settings-search { padding: 10px 12px 8px; }
[data-layout="mobile"] .settings-tree {
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 8px 8px;
  gap: 6px;
}
[data-layout="mobile"] .settings-tree__group {
  flex-direction: row;
  padding: 0;
}
[data-layout="mobile"] .settings-tree__group--pipe { padding-left: 0; }
[data-layout="mobile"] .settings-tree__group--pipe::before { display: none; }
[data-layout="mobile"] .settings-tree__divider-label { display: none; }
[data-layout="mobile"] .settings-tree__row {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  font-size: 12.5px;
}
[data-layout="mobile"] .settings-tree__row.active {
  border-color: var(--accent);
}
[data-layout="mobile"] .settings-tree__step { width: 18px; height: 18px; font-size: 9.5px; }
[data-layout="mobile"] .settings-detail { padding: 20px 16px 24px; }
[data-layout="mobile"] .settings-detail__title { font-size: 20px; }
[data-layout="mobile"] .settings-section { padding: 20px 0; }

/* Documentation: TOC stacks on top */
[data-layout="mobile"] .documentation__body { grid-template-columns: 1fr; }
[data-layout="mobile"] .documentation__nav {
  max-height: 180px;
  border-right: 0;
  border-bottom: 1px solid var(--border);
}
[data-layout="mobile"] .documentation__article { padding: 22px 18px; }
[data-layout="mobile"] .documentation__article-head h1 { font-size: 22px; }

/* Graph: single column on mobile — only ego graph shown, list + sources collapse */
[data-layout="mobile"] .graph-body--explorer {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  overflow-y: auto;
}
[data-layout="mobile"] .graph-pane + .graph-pane {
  border-left: 0;
  border-top: 1px solid var(--border);
}
[data-layout="mobile"] .graph-pane:first-child { max-height: 180px; overflow-y: auto; }
[data-layout="mobile"] .graph-pane:last-child  { max-height: 200px; overflow-y: auto; }
[data-layout="mobile"] .ego-graph { min-height: 320px; }
[data-layout="mobile"] .path-finder { padding: 16px; }
[data-layout="mobile"] .path-finder__controls {
  grid-template-columns: 1fr;
  gap: 8px;
}
[data-layout="mobile"] .path-finder__arrow { transform: rotate(90deg); padding: 0; }

/* Login: form padding tighter, art already hidden via 920px breakpoint */
[data-layout="mobile"] .login-form-pane { padding: 24px 20px; }
[data-layout="mobile"] .login-form-pane__heading h1 { font-size: 22px; }

/* YouTube card: stack thumb above text on narrow */
[data-layout="mobile"] .yt-card { grid-template-columns: 48px 1fr 20px; gap: 8px; }
[data-layout="mobile"] .yt-card__thumb { width: 48px; height: 28px; }

/* Confirm dialog: full-width on mobile */
[data-layout="mobile"] .pd-confirm {
  width: calc(100% - 24px);
  padding: 18px;
}

/* Toast container avoid notch */
[data-layout="mobile"] .pd-toast-host {
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  max-width: none;
}

/* Tooltip — wider, no nowrap so it doesn't escape */
[data-layout="mobile"] .pd-tooltip { white-space: normal; max-width: 200px; }
[data-layout="tablet"] .pd-tooltip { max-width: 240px; }

/* Theme picker (top-right) — hide on mobile, available inside settings */
[data-layout="mobile"] .theme-pick { display: none; }

/* Sidebar buttons: larger active highlight on touch */
[data-layout="mobile"] .rail__btn.active,
[data-layout="tablet"] .rail__btn.active {
  background: var(--accent-soft);
  color: var(--accent-fg);
}


/* ===== Login "versão C" (bloco de dados; portado pro kit, escopado em .lpc-root) ===== */
  .lpc-root {
    --lpc-bg:#060c1a; --lpc-panel:#0a142e; --lpc-ink:#f4f6fb; --lpc-muted:#8694b3;
    --lpc-accent:#2f63cc; --lpc-accent-h:#3f78e0; --lpc-line:#16213f;
    --lpc-sans:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    --lpc-mono:'JetBrains Mono',ui-monospace,monospace;
    position:fixed; inset:0; z-index:50; margin:0;
    display:grid; grid-template-columns:1.25fr .75fr;
    background:var(--lpc-bg); color:var(--lpc-ink); font-family:var(--lpc-sans);
    overflow:hidden; -webkit-font-smoothing:antialiased;
  }
  .lpc-root .lpc-left{position:relative;padding:clamp(36px,4vw,64px);padding-left:clamp(64px,6.5vw,112px);display:flex;flex-direction:column;overflow:hidden;border-right:1px solid var(--lpc-line);}
  .lpc-root .lpc-left::before{content:'';position:absolute;inset:0;background-image:linear-gradient(var(--lpc-line) 1px,transparent 1px),linear-gradient(90deg,var(--lpc-line) 1px,transparent 1px);background-size:64px 64px;opacity:.5;-webkit-mask-image:radial-gradient(90% 90% at 30% 50%,#000,transparent);mask-image:radial-gradient(90% 90% at 30% 50%,#000,transparent);animation:lpc-gridpan 30s linear infinite;}
  @keyframes lpc-gridpan{to{background-position:64px 64px;}}
  .lpc-root .lpc-left::after{content:'';position:absolute;left:-20%;top:30%;width:60%;height:40%;background:radial-gradient(circle,rgba(63,120,224,.18),transparent 70%);filter:blur(40px);pointer-events:none;animation:lpc-auro 12s ease-in-out infinite alternate;}
  @keyframes lpc-auro{to{transform:translate(20%,-10%);}}
  .lpc-root .lpc-fx{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1;}
  .lpc-root .lpc-top,.lpc-root .lpc-big,.lpc-root .lpc-foot-l{position:relative;z-index:2;}
  .lpc-root .lpc-top{display:flex;align-items:center;}
  .lpc-root .lpc-logo{height:67px;}
  .lpc-root .lpc-logo-m{display:none;}
  .lpc-root .lpc-big{margin:auto 0;}
  .lpc-root .lpc-tag{font-family:var(--lpc-mono);font-size:12px;color:var(--lpc-accent-h);letter-spacing:.12em;margin-bottom:20px;text-shadow:0 0 12px rgba(63,120,224,.32);}
  .lpc-root .lpc-h1{font-family:var(--lpc-sans);font-size:clamp(46px,6.5vw,104px);line-height:.9;font-weight:800;letter-spacing:-.045em;margin:0;text-transform:uppercase;color:var(--lpc-ink);}
  .lpc-root .lpc-o{color:transparent;-webkit-text-stroke:2px var(--lpc-ink);}
  .lpc-root .lpc-sub{font-family:var(--lpc-sans);font-size:14.5px;color:var(--lpc-muted);margin:26px 0 0;max-width:440px;line-height:1.7;}
  .lpc-root .lpc-sub b{color:var(--lpc-accent-h);font-weight:600;}
  .lpc-root .lpc-foot-l{margin-top:auto;font-family:var(--lpc-mono);font-size:11px;color:var(--lpc-muted);display:flex;gap:24px;}
  .lpc-root .lpc-foot-l a{color:var(--lpc-muted);text-decoration:none;transition:color .16s;}
  .lpc-root .lpc-foot-l a:hover{color:var(--lpc-ink);}

  .lpc-root .lpc-right{background:var(--lpc-panel);display:flex;align-items:center;justify-content:center;padding:0 clamp(32px,3.4vw,56px);}
  .lpc-root .lpc-panel{width:100%;max-width:330px;}
  .lpc-root .lpc-h2{font-family:var(--lpc-sans);font-size:13px;text-transform:uppercase;letter-spacing:.16em;font-weight:600;color:var(--lpc-muted);margin:0 0 26px;display:flex;align-items:center;gap:9px;}
  .lpc-root .lpc-h2::before{content:'';width:24px;height:2px;background:var(--lpc-accent);box-shadow:0 0 8px rgba(63,120,224,.5);}
  .lpc-root .lpc-form{display:flex;flex-direction:column;gap:18px;}
  .lpc-root .lpc-fld{display:flex;flex-direction:column;}
  .lpc-root .lpc-fld label{font-family:var(--lpc-sans);font-size:12px;font-weight:600;color:var(--lpc-muted);margin-bottom:9px;}
  .lpc-root .lpc-in{width:100%;height:48px;padding:0 14px;box-sizing:border-box;background:#06101f;border:1px solid var(--lpc-line);border-radius:0;color:var(--lpc-ink);font-family:var(--lpc-sans);font-size:14px;transition:border-color .16s,box-shadow .16s;}
  .lpc-root .lpc-in::placeholder{color:rgba(134,148,179,.55);}
  .lpc-root .lpc-in:focus{outline:none;border-color:var(--lpc-accent);box-shadow:0 0 0 1px var(--lpc-accent),0 0 14px -4px rgba(63,120,224,.3);}
  .lpc-root .lpc-btn{height:50px;margin-top:6px;border:0;border-radius:0;cursor:pointer;font-family:var(--lpc-sans);font-size:14px;font-weight:700;color:#fff;background:var(--lpc-accent);display:inline-flex;align-items:center;justify-content:center;gap:9px;text-transform:uppercase;letter-spacing:.04em;box-shadow:0 8px 22px -14px rgba(63,120,224,.5);transition:background .16s,box-shadow .16s,transform .08s;}
  .lpc-root .lpc-btn:hover{background:var(--lpc-accent-h);box-shadow:0 12px 32px -12px rgba(63,120,224,.6);}
  .lpc-root .lpc-btn:active{transform:translateY(1px);}
  .lpc-root .lpc-btn:disabled{opacity:.55;cursor:not-allowed;box-shadow:none;transform:none;}
  .lpc-root .lpc-divider{display:flex;align-items:center;gap:12px;font-family:var(--lpc-sans);font-size:11px;color:var(--lpc-muted);margin:4px 0;}
  .lpc-root .lpc-divider::before,.lpc-root .lpc-divider::after{content:'';flex:1;height:1px;background:var(--lpc-line);}
  .lpc-root .lpc-ghost{height:48px;border-radius:0;border:1px solid var(--lpc-line);background:transparent;color:var(--lpc-ink);font-family:var(--lpc-sans);font-size:13px;font-weight:500;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;transition:border-color .16s;}
  .lpc-root .lpc-ghost:hover{border-color:var(--lpc-ink);}
  .lpc-root .lpc-error{color:#ff8a8a;font-size:12.5px;text-align:center;margin-top:2px;}
  .lpc-root .lpc-foot{margin-top:30px;font-family:var(--lpc-sans);font-size:11.5px;color:#55617f;text-align:center;}

  @media (max-width:900px){
    .lpc-root{grid-template-columns:1fr;}
    .lpc-root .lpc-left{display:none;}
    .lpc-root .lpc-logo-m{display:block;height:46px;margin:0 auto 30px;}
  }
  @media (prefers-reduced-motion:reduce){
    .lpc-root .lpc-left::before,.lpc-root .lpc-left::after,.lpc-root .lpc-h2::before,.lpc-root .lpc-btn{animation:none;}
  }

/* Viewer de planilha (.xlsx via SheetJS) — grade estilo Excel/Sheets. */
.xlsx-view table { border-collapse: collapse; font: 400 12px/1.45 var(--font-sans); color: var(--fg); }
.xlsx-view td, .xlsx-view th { border: 1px solid var(--border); padding: 3px 9px; white-space: nowrap; text-align: left; vertical-align: top; }
.xlsx-view tr:nth-child(odd) td { background: var(--sunken, rgba(127,127,127,0.04)); }
.xlsx-view td:empty { min-width: 28px; }

/* Home dos LLMs: composer centralizado quando não há conversa; desce ao iniciar. */
.chat--home .chat__scroll { display: none; }
.chat--home .composer-wrap { margin-top: auto; margin-bottom: auto; }
.chat__home-greeting {
  text-align: center;
  font: 600 26px/1.2 var(--font-sans);
  color: var(--fg);
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

/* === Ditado por voz (STT) ================================================ */
.dict-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 6px;
}
.dict-wave {
  flex: 1;
  min-width: 0;
  height: 34px;
}
.dict-timer {
  font-size: 12px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.dict-status {
  font-size: 12.5px;
  color: var(--fg-muted);
}
.dict-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.dict-confirm:hover { filter: brightness(1.08); }
.dict-box { display: flex; flex-direction: column; }
.dict-live {
  padding: 8px 8px 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--fg-muted);
  font-style: italic;
  max-height: 96px;
  overflow-y: auto;
}
