/* Product Analytics — design system.
   Light is the default; dark follows the system unless the viewer picks a
   theme (html[data-theme]). Token names are shared with feature styles. */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9ecf1;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #2f5fd0;
  --accent-hover: #264fb0;
  --accent-soft: #eef3fe;
  --accent-text: #ffffff;
  --focus: rgba(47, 95, 208, 0.35);
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warn-soft: #fff7e6;
  --warn-text: #92400e;
  --danger: #c0262d;
  --danger-soft: #fdeeee;
  --code-bg: #f5f6f8;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --header-h: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #151a22;
    --surface-2: #1b212b;
    --surface-3: #232b37;
    --border: #262e3a;
    --border-strong: #354050;
    --text: #e8ebf0;
    --text-2: #c5cbd5;
    --muted: #8b95a5;
    --faint: #677285;
    --accent: #7b9ef0;
    --accent-hover: #93b0f4;
    --accent-soft: #1a2540;
    --accent-text: #0b1220;
    --focus: rgba(123, 158, 240, 0.4);
    --success: #4ade80;
    --success-soft: #0f2a1a;
    --warn-soft: #2d2410;
    --warn-text: #f4c56a;
    --danger: #f08b8f;
    --danger-soft: #2e1517;
    --code-bg: #10151c;
    --shadow: none;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #151a22; --surface-2: #1b212b; --surface-3: #232b37;
  --border: #262e3a; --border-strong: #354050; --text: #e8ebf0; --text-2: #c5cbd5; --muted: #8b95a5; --faint: #677285;
  --accent: #7b9ef0; --accent-hover: #93b0f4; --accent-soft: #1a2540; --accent-text: #0b1220; --focus: rgba(123, 158, 240, 0.4);
  --success: #4ade80; --success-soft: #0f2a1a; --warn-soft: #2d2410; --warn-text: #f4c56a; --danger: #f08b8f; --danger-soft: #2e1517;
  --code-bg: #10151c; --shadow: none; --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* -- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { color: var(--text); letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 650; margin: 0 0 6px; }
h2 { font-size: 17px; font-weight: 620; margin: 28px 0 10px; }
h3 { font-size: 14px; font-weight: 620; margin: 0 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow: auto; max-height: 360px; margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 12.5px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.error { color: var(--danger); margin: 0; }
.danger { color: var(--danger) !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.icon { display: inline-block; vertical-align: -3px; flex: none; }
.lead { font-size: 15px; color: var(--muted); max-width: 720px; }

/* -- Buttons and inputs -------------------------------------------------- */

button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 520; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
button:hover:not(:disabled) { background: var(--surface-2); }
button.primary, .button-link {
  background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-text) !important;
}
button.primary:hover:not(:disabled), .button-link:hover { background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; text-decoration: none; }
.button-link { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); font-weight: 560; font-size: 13px; border: 1px solid; }
button.link {
  height: auto; box-shadow: none; border: 0; background: none; padding: 4px 6px; margin: 0 -2px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12.5px; font-weight: 520; display: inline-flex; align-items: center; gap: 5px;
}
button.link:hover { background: var(--surface-2); color: var(--text); }
.icon-btn {
  box-shadow: none; padding: 0;
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: none; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=email], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13.5px; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input[type=date] { color-scheme: inherit; }

/* -- App shell ----------------------------------------------------------- */

.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1280px; height: var(--header-h); margin: 0 auto; padding: 0 20px; display: flex; gap: 20px; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: 8px; white-space: nowrap; }
.brand strong { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 560; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
nav.tabs { display: flex; gap: 2px; height: 100%; align-items: stretch; margin-right: auto; }
nav.tabs button, nav.tabs a {
  box-shadow: none; position: relative; display: inline-flex; align-items: center; height: 100%; padding: 0 12px; border: 0; background: none;
  color: var(--muted); font-size: 13.5px; font-weight: 540; border-radius: 0; text-decoration: none; box-shadow: none;
}
nav.tabs button:hover { color: var(--text); }
nav.tabs button[aria-selected="true"] { color: var(--text); }
nav.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions form { margin: 0; }

.segmented { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented .seg { box-shadow: none; padding: 0; display: grid; place-items: center; width: 28px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); }
.segmented .seg:hover { color: var(--text); }
.segmented .seg[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

main.view { max-width: 1280px; margin: 0 auto; padding: 28px 20px 140px; }
.page-header { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.page-header > div:first-child { flex: 1; min-width: 260px; }
.page-title { font-size: 22px; font-weight: 650; margin: 0 0 4px; letter-spacing: -0.015em; }
.banner { background: var(--warn-soft); color: var(--warn-text); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; margin-bottom: 16px; }

/* -- Cards, tables, lists ----------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 16px; }
.table-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 560; font-size: 12px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table td.num, .data-table th.num { text-align: right; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 4px 16px; font-size: 13px; margin: 0; }
.members dt { font-weight: 560; color: var(--text); }
.members dd { margin: 0 0 8px; color: var(--muted); }
details summary { cursor: pointer; color: var(--text-2); font-weight: 540; font-size: 13px; margin: 12px 0 8px; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; }
details[open] summary::before { transform: rotate(45deg); }
details summary::-webkit-details-marker { display: none; }

/* -- Ask ----------------------------------------------------------------- */

#view-ask { max-width: 900px; }
.empty { text-align: center; padding: 72px 0 8px; }
.empty h2 { font-size: 26px; font-weight: 650; margin: 0 0 8px; letter-spacing: -0.02em; }
.empty > p { color: var(--muted); max-width: 520px; margin: 0 auto; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 28px auto 0; max-width: 720px; text-align: left; }
.suggestions button {
  height: auto; padding: 12px 14px; border-radius: var(--radius); white-space: normal;
  text-align: left; justify-content: flex-start; font-weight: 500; color: var(--text-2); line-height: 1.4;
}
.suggestions button:hover:not(:disabled) { border-color: var(--accent); color: var(--text); background: var(--surface); }
.sample-line { margin-top: 22px; font-size: 13px; color: var(--muted); }
.sample-banner { background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; }

.thread { display: grid; gap: 22px; }
.thread-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 16px; }
.msg-user { justify-self: end; max-width: 78%; background: var(--surface-3); color: var(--text); padding: 10px 14px; border-radius: 14px 14px 4px 14px; font-size: 14px; }
.msg-assistant { padding: 2px 0 0 40px; position: relative; }
.msg-assistant::before {
  content: ""; position: absolute; left: 0; top: 2px; width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19V9M10 19V5M16 19v-7M22 19H2'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.steps { list-style: none; margin: 0 0 10px; padding: 0; color: var(--muted); font-size: 12.5px; display: grid; gap: 3px; }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex: none; }
.steps li.running::before { width: 10px; height: 10px; background: none; border: 1.5px solid var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.answer { color: var(--text-2); font-size: 14px; }
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer strong { color: var(--text); font-weight: 600; }
.answer ul, .answer ol { padding-left: 20px; margin: 8px 0; }
.answer li { margin: 3px 0; }
.answer table { border-collapse: collapse; margin: 10px 0; font-size: 13px; font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.answer th, .answer td { border-bottom: 1px solid var(--border); padding: 6px 12px 6px 0; text-align: left; }
.answer th { color: var(--muted); font-weight: 560; font-size: 12px; }

.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 16px 20px 18px; background: linear-gradient(to bottom, transparent, var(--bg) 35%); }
.composer form { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 8px; box-shadow: var(--shadow-pop); }
.composer form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus), var(--shadow-pop); }
.composer-row { display: flex; gap: 6px; align-items: flex-end; }
.composer textarea { border: 0 !important; box-shadow: none !important; background: none; resize: none; min-height: 40px; max-height: 160px; padding: 9px 6px; font-size: 14.5px; }
.attach { box-shadow: none; padding: 0; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); flex: none; }
.attach:hover { background: var(--surface-2); color: var(--text); }
#send { height: 36px; border-radius: 9px; padding: 0 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 2px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 0 4px 0 8px; font-size: 12.5px; max-width: 100%; }
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-weight: 520; }
.chip .kind { color: var(--muted); }
.chip.error { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.chip button { border: 0; background: none; padding: 0 4px; height: auto; color: var(--muted); box-shadow: none; }
.msg-user .chips { padding: 0 0 6px; justify-content: flex-end; }
.msg-user .chip { background: var(--surface); }
.drop-overlay { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--accent) 10%, transparent); display: grid; place-items: center; pointer-events: none; }
.drop-overlay p { background: var(--surface); border: 1.5px dashed var(--accent); border-radius: var(--radius-lg); padding: 22px 30px; font-weight: 600; box-shadow: var(--shadow-pop); }

/* -- Charts -------------------------------------------------------------- */

.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 10px; margin: 12px 0; box-shadow: var(--shadow); min-width: 0; }
.grid > .chart-card { margin: 0; }
.chart-card h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 10px; color: var(--text); }
.chart-box { position: relative; height: 290px; }
.chart-actions { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); align-items: center; }
.number { font-size: 34px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; padding: 8px 0 4px; }
.save-form, .share-box { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.save-form input { width: 240px; }
.share-url { width: min(340px, 70vw) !important; font-family: var(--mono); font-size: 12px !important; }

/* Chart editor */
.editor { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 14px; display: grid; gap: 10px; }
.editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 10px 12px; }
.field { display: grid; gap: 5px; font-size: 12px; font-weight: 540; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.field input, .field select { color: var(--text); font-weight: 400; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); font-weight: 450; }
.filters { display: grid; gap: 6px; }
.filter-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 2fr) auto; gap: 6px; align-items: center; }
.words { display: grid; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.words .row { flex-wrap: nowrap; }
.words .row input { flex: 1; }

/* -- Dashboards ---------------------------------------------------------- */

.dash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin-top: 4px; }
.dash-card { display: grid; gap: 6px; align-content: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; color: inherit; min-height: 128px; box-shadow: var(--shadow); transition: border-color 0.12s, transform 0.12s; }
.dash-card:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }
.dash-card strong { font-size: 14.5px; font-weight: 620; color: var(--text); }
.dash-desc { font-size: 13px; color: var(--muted); }
.dash-card .note { margin-top: auto; }
.create-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.create-form input { flex: 1 1 220px; width: auto; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.back:hover { color: var(--text); text-decoration: none; }
.dash-heading { min-width: 0; }
.dash-heading p { margin: 0; }

/* -- Measures and How it works ------------------------------------------ */

.how { max-width: 1000px; margin: 0 auto; }
.how h1 { font-size: 26px; }
.how h2 { font-size: 17px; margin: 40px 0 12px; }
.measures-list { display: grid; gap: 16px; margin-top: 16px; }
.defs td { vertical-align: top; }
.defs code { font-size: 12px; color: var(--text-2); background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
#measures input[type=search] { max-width: 420px; }
.diagram-wrap { margin: 24px 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; overflow-x: auto; }
.diagram { width: 100%; min-width: 760px; height: auto; display: block; font-family: var(--font); }
.d-node rect { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.25; }
.d-node.accent rect { fill: var(--accent-soft); stroke: var(--accent); }
.d-node.strong rect { fill: var(--accent); stroke: var(--accent); }
.d-node.strong text { fill: var(--accent-text); }
.d-node.dashed rect { fill: none; stroke-dasharray: 5 4; stroke: var(--faint); }
.d-title { fill: var(--text); font-size: 15px; font-weight: 620; text-anchor: middle; }
.d-sub { fill: var(--muted); font-size: 12.5px; text-anchor: middle; }
.d-node.strong .d-sub { fill: var(--accent-text); opacity: 0.85; }
.d-lane { fill: var(--muted); font-size: 11px; letter-spacing: 0.08em; font-weight: 600; }
.d-label { fill: var(--muted); font-size: 12px; }
.d-edge { fill: none; stroke: var(--faint); stroke-width: 1.5; }
.d-edge.dashed { stroke-dasharray: 5 4; }
.d-arrowhead { fill: var(--faint); }
.steps-list { padding-left: 22px; display: grid; gap: 10px; max-width: 820px; color: var(--text-2); }
.steps-list strong { color: var(--text); }
.how-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.how-grid .card h3 { margin-bottom: 6px; font-size: 14.5px; }
.how-grid .card p { margin: 0 0 8px; color: var(--text-2); }
ul.plain { padding-left: 20px; display: grid; gap: 8px; max-width: 820px; color: var(--text-2); }

/* -- Login and share page ----------------------------------------------- */

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; max-width: 420px; width: 100%; box-shadow: var(--shadow-pop); }
.login-card h1 { font-size: 22px; margin: 14px 0 8px; }
.login-card form { display: grid; gap: 8px; margin-top: 22px; }
.login-card label { font-weight: 560; font-size: 13px; }
.login-card button { height: 38px; margin-top: 6px; }
.share-view { max-width: 1100px; padding-bottom: 48px; }

/* -- Tooltips and menus (shared) ---------------------------------------- */

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 520; padding: 4px 8px; border-radius: 5px;
  white-space: nowrap; pointer-events: none; z-index: 50;
}
.menu { position: absolute; z-index: 60; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 4px; }
.menu button { width: 100%; justify-content: flex-start; border: 0; box-shadow: none; background: none; height: 32px; padding: 0 10px; font-weight: 450; color: var(--text-2); }
.menu button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

@media (max-width: 760px) {
  .topbar-inner { gap: 10px; padding: 0 14px; }
  .brand .pill { display: none; }
  nav.tabs button { padding: 0 8px; font-size: 13px; }
  main.view { padding: 20px 14px 140px; }
  .suggestions { grid-template-columns: 1fr; }
  .msg-user { max-width: 92%; }
  .msg-assistant { padding-left: 0; }
  .msg-assistant::before { display: none; }
  .chart-box { height: 240px; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .composer { padding: 10px 10px 12px; }
}
@media (max-width: 520px) {
  .brand strong { display: none; }
}

/* Dashboard filters, layout, history, export */
.dash-toolbar { align-items: flex-start; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0 6px; }
.filter-dates { display: flex; gap: 8px; align-items: flex-end; }
.filter-dates select, .filter-dates input { width: auto; }
.filter-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.filter-summary { margin: 4px 0 12px; }
details.ms { position: relative; }
details.ms > summary { list-style: none; cursor: pointer; display: grid; gap: 2px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; min-width: 140px; background: var(--surface); margin: 0; color: var(--text); }
details.ms > summary::-webkit-details-marker { display: none; }
details.ms[open] > summary { border-color: var(--accent); }
.ms-label { font-size: 12px; color: var(--muted); }
.ms-value { font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-pop { position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: var(--shadow-pop); display: grid; gap: 8px; }
.ms-list { max-height: 240px; overflow: auto; display: grid; gap: 2px; }
.ms-option { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ms-only { font-size: 12px; padding: 0 4px; visibility: hidden; }
.ms-option:hover .ms-only, .ms-only:focus-visible { visibility: visible; }
@media (hover: none) { .ms-only { visibility: visible; } }
.dash-grid > .w-full { grid-column: 1 / -1; }
.size-small .chart-box { height: 200px; }
.size-large .chart-box { height: 460px; }
.size-small .table-scroll { max-height: 200px; }
.size-large .table-scroll { max-height: 560px; }
.note-card .answer { font-size: 15px; }
.note-card.size-small { min-height: 0; }
.layout-tile { cursor: grab; border-style: dashed; }
.layout-tile.dragging { opacity: .5; }
.layout-tile.drop-target { border-color: var(--accent); }
.layout-tile textarea { width: 100%; }
.layout-head { gap: 8px; margin-bottom: 6px; }
.drag-hint { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.layout-placeholder { display: grid; place-items: center; background: var(--surface-2); border-radius: 8px; min-height: 90px; padding: 10px; text-align: center; }
.size-large .layout-placeholder { min-height: 220px; }
.size-small .layout-placeholder { min-height: 50px; }
.layout-controls { gap: 10px; margin-top: 8px; font-size: 13px; }
.layout-controls select { width: auto; padding: 3px 6px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.layout-bar .row { gap: 10px; }
.history .list li { align-items: flex-start; }
.badge { display: inline-block; margin-left: 8px; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
pre.diff .add { color: var(--accent); }
pre.diff .del { color: var(--danger); }
.export-only { display: none; }
.dash-export.exporting { padding: 16px; }
.dash-export.exporting .export-only { display: block; }
@media (max-width: 640px) { .filter-actions { margin-left: 0; } .ms-pop { width: min(280px, 80vw); } }

/* Measures, drill-down, hover */
.def-line { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: -4px 0 6px; }
.def-chip { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; font-size: 12px; color: var(--muted); cursor: help; }
.def-chip:hover, .def-chip:focus-visible { color: var(--accent); }
.def-tip { position: fixed; z-index: 30; max-width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow-pop); font-size: 13px; pointer-events: none; }
.def-tip p { margin: 4px 0 6px; }
.def-tip code { display: block; font-size: 12px; background: var(--code-bg); border-radius: 6px; padding: 4px 6px; word-break: break-word; }
th[data-def] { cursor: help; }
.check[data-def] { cursor: help; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.drill-menu { position: fixed; z-index: 25; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; box-shadow: var(--shadow-pop); display: grid; gap: 2px; }
.drill-menu .eyebrow { margin: 2px 6px 6px; }
.drill-menu button { text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; }
.drill-menu button:hover, .drill-menu button:focus-visible { background: var(--accent-soft); color: var(--accent); }
.chart-card.drilled { border-left: 3px solid var(--accent); grid-column: 1 / -1; }
.drill-bar { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 4px; }
.propose { margin-top: 14px; display: grid; gap: 10px; }
.propose h2 { margin: 0; }
.propose textarea { resize: vertical; }
.examples { gap: 6px; }
.chip-button { border-radius: 999px; font-size: 13px; padding: 4px 10px; }
.proposal { border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 8px; }
.proposal h3 { margin: 0; }
.proposal-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.proposal-facts dt { color: var(--muted); }
.proposal-facts dd { margin: 0; }
pre.diff .add { color: var(--accent); }
pre.diff .ctx { color: var(--muted); }
.flash { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 8px 12px; }

/* Chat history and usage */
.ask-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ask-bar .thread-tools { margin-bottom: 0; }
.ask-bar button { display: inline-flex; align-items: center; gap: 6px; }
.history-panel { margin-bottom: 14px; display: grid; gap: 10px; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow: auto; }
.history-list li { display: flex; align-items: center; gap: 8px; border-radius: 8px; }
.history-list li.current { background: var(--accent-soft); }
.history-open { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 8px 10px; }
.history-open:hover { background: var(--surface-2); }
.history-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* Feature buttons that aren't standard buttons */
.history-open, .ms-only, .def-chip, .drill-menu button, .chip-button { height: auto; box-shadow: none; }
.history-open { justify-content: flex-start; white-space: normal; }
.drill-menu button { justify-content: flex-start; height: 32px; padding: 0 10px; font-weight: 450; color: var(--text-2); }
.chip-button { height: 28px; padding: 0 10px; border-radius: 999px; font-weight: 450; color: var(--text-2); }
.filter-bar { box-shadow: var(--shadow); }
details.ms > summary { border-color: var(--border-strong); border-radius: var(--radius-sm); }
details.ms > summary::before { display: none; }
.badge { font-weight: 560; }
pre.diff .add { color: var(--success); }
.chart-card.drilled { border-left: 2px solid var(--accent); }
.flash { border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }

/* Chart card header, collapsed steps */
.chart-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.chart-head h3 { flex: 1; margin: 4px 0 0; }
.chart-head .chart-actions { margin: 0; padding: 0; border: 0; gap: 2px; flex-wrap: nowrap; }
.chart-card .def-line { margin: 0 0 8px; }
.chart-card > span:empty { display: none; }
.chart-card .save-form, .chart-card .share-box { margin-top: 10px; }
details.steps-wrap { margin: 0 0 10px; }
details.steps-wrap > summary { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
details.steps-wrap .steps { margin: 4px 0 0 14px; }

.ask-bar { min-height: 32px; }
.empty { padding-top: 48px; }
.sample-line { max-width: 720px; margin-left: auto; margin-right: auto; }
button.link.inline { color: var(--accent); padding: 0; margin: 0; font-size: inherit; }
button.link.inline:hover { background: none; text-decoration: underline; text-underline-offset: 2px; }
.dash-toolbar { flex-wrap: nowrap; align-items: flex-start; }
.dash-toolbar .dash-heading { flex: 1; }
.dash-toolbar .spacer { display: none; }
@media (max-width: 760px) { .dash-toolbar { flex-wrap: wrap; } }

/* Narrow screens: brand and actions on one row, tabs scroll on the next */
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 8px; gap: 6px 10px; }
  .header-actions { margin-left: auto; }
  nav.tabs { order: 3; width: 100%; height: 40px; margin: 0 -6px; overflow-x: auto; scrollbar-width: none; }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs button { flex: none; }
  .page-header, .dash-toolbar { gap: 10px; }
}
@media (max-width: 760px) {
  .dash-toolbar .dash-heading { flex: 1 1 100%; }
  #measures .row code { overflow-wrap: anywhere; white-space: normal; }
  #measures .card { padding: 14px; }
  .proposal-facts { grid-template-columns: 1fr; }
  .filter-bar > * { flex: 1 1 140px; }
}
.measures-list > *, .grid > *, .how-grid > *, .dash-cards > * { min-width: 0; }

/* ==== Context Engine components ========================================== */

main.view.wide { max-width: 1360px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.btn-sm { height: 28px !important; padding: 0 10px !important; font-size: 12.5px !important; }
.placeholder { font-size: 13px; padding: 8px 0; }
.section-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.run-right .section-h:not(:first-child) { margin-top: 24px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 280px; width: auto; }
.toolbar select { width: auto; min-width: 150px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.chip-accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); }

/* Status, source and document badges */
.status { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap; border: 1px solid transparent; }
.status-new { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.status-investigating { background: var(--accent-soft); color: var(--accent); }
.status-guidance { background: var(--success-soft); color: var(--success); }
.status-pull_request { background: color-mix(in srgb, #8463d6 14%, var(--surface)); color: color-mix(in srgb, #8463d6 85%, var(--text)); }
.status-escalation { background: var(--warn-soft); color: var(--warn-text); }
.status-needs_info { background: var(--surface-3); color: var(--text-2); }
.status-draft { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.src { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 540; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.src-asof { color: var(--muted); font-weight: 450; }
.src-bigquery { color: #2f6fd6; }
.src-oracle_standin { color: #c2410c; }
.src-integration { color: #0f766e; }
.src-code { color: #7c3aed; }
:root[data-theme="dark"] .src-bigquery { color: #8fb3ff; } :root[data-theme="dark"] .src-oracle_standin { color: #fdba74; } :root[data-theme="dark"] .src-integration { color: #5eead4; } :root[data-theme="dark"] .src-code { color: #c4b5fd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .src-bigquery { color: #8fb3ff; } :root:not([data-theme="light"]) .src-oracle_standin { color: #fdba74; } :root:not([data-theme="light"]) .src-integration { color: #5eead4; } :root:not([data-theme="light"]) .src-code { color: #c4b5fd; } }
.doc { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 560; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.doc-case { color: var(--accent); }
.doc-jira { color: #2f6fd6; }
.doc-code_change { color: #7c3aed; }
.doc-kb { color: #0f766e; }

/* Tickets */
.ticket-list { display: grid; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ticket-row { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ticket-row:last-child { border-bottom: 0; }
.ticket-row:hover { background: var(--surface-2); }
.ticket-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ticket-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.ticket-subject { font-weight: 600; color: var(--text); font-size: 14.5px; }
.ticket-body { margin: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-side { display: flex; gap: 10px; align-items: center; flex: none; }
.empty-row { padding: 16px; margin: 0; }
.new-ticket { display: grid; gap: 12px; margin-bottom: 16px; }
.new-ticket h3 { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }

/* Investigation */
.run-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.run-title { flex: 1; min-width: 0; }
.run-title .page-title { margin: 6px 0 8px; }
.run-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.run-actions select { width: auto; max-width: 300px; }
.ticket-quote { margin: 0; padding: 10px 14px; border-left: 3px solid var(--border-strong); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); font-size: 13.5px; max-width: 860px; }
.shadow-banner { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--text-2); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 18px; }
.shadow-banner .icon { color: var(--accent); margin-top: 1px; }
.run-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.run-right { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; padding-right: 2px; }
.classified { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.classified .eyebrow { margin: 0 4px 0 0; }
.empty-run { padding: 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); display: grid; gap: 10px; justify-items: center; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 1.5px solid var(--border); display: grid; gap: 8px; }
.timeline > li { position: relative; }
.timeline > li::before { content: ""; position: absolute; left: -20px; top: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--border-strong); }
.tl-call { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.tl-call.running::before { border-color: var(--accent); background: var(--accent-soft); }
.tl-call.failed { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.tl-call.failed::before { border-color: var(--danger); }
.tl-call:not(.running):not(.failed)::before { background: var(--success); border-color: var(--success); }
.tl-line { display: flex; gap: 8px; align-items: center; }
.tl-toggle { width: 22px; height: 22px !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; color: var(--muted) !important; flex: none; }
.tl-toggle .icon { transition: transform 0.12s; }
.tl-call.open .tl-toggle .icon { transform: rotate(90deg); }
.tl-text { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-label { font-weight: 560; font-size: 13.5px; color: var(--text); }
.tl-args { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tl-meta { display: flex; gap: 6px; align-items: center; flex: none; }
.tl-ms { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.tl-summary { margin: 4px 0 0 30px; font-size: 13px; color: var(--text-2); }
.tl-summary:empty { display: none; }
.tl-detail { margin: 8px 0 2px 30px; }
.tl-detail pre { max-height: 260px; font-size: 12px; }
.tl-thinking { padding: 2px 0; }
.tl-thinking::before { top: 9px !important; width: 7px !important; height: 7px !important; left: -19px !important; }
.tl-thinking p { margin: 0; color: var(--muted); font-size: 13px; font-style: italic; }
.tl-dot { display: none; }
.tl-error p { color: var(--danger); margin: 0; }
.tl-fix { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.tl-fix .tl-line .icon { color: #7c3aed; }
.fix-steps { list-style: none; margin: 6px 0 0 24px; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.fix-steps li { display: flex; gap: 6px; align-items: baseline; }
.fix-steps li .icon { color: var(--success); align-self: center; }
.fix-steps li.fix-tests_failed .icon { color: var(--danger); }
.fix-steps strong { font-weight: 560; text-transform: capitalize; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; display: inline-block; }

.edi-wrap { margin-top: 18px; }
.edi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.edi-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.edi-step { position: relative; display: grid; gap: 4px; justify-items: start; padding-right: 10px; }
.edi-step::after { content: ""; position: absolute; top: 11px; left: 28px; right: 6px; height: 1.5px; background: var(--border-strong); }
.edi-step:last-child::after { display: none; }
.edi-node { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1.5px solid var(--border-strong); color: var(--muted); position: relative; z-index: 1; }
.edi-ok .edi-node { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.edi-ok::after { background: var(--success); }
.edi-failed .edi-node { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 15%, transparent); }
.edi-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.edi-failed .edi-label { color: var(--danger); }
.edi-skipped .edi-label, .edi-unknown .edi-label { color: var(--muted); font-weight: 500; }
.edi-detail { font-size: 12px; color: var(--muted); line-height: 1.4; }
.usage-bar { margin-top: 16px; }
.usage { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-variant-numeric: tabular-nums; }
.usage-item { display: inline-flex; gap: 6px; align-items: baseline; }
.usage-item strong { font-size: 14px; }

.evidence-list { display: grid; gap: 8px; }
.evidence-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 4px; }
.evidence-card p { margin: 0; font-size: 13px; }
.ev-title { font-weight: 560; font-size: 13.5px; color: var(--text); }
a.ev-title:hover { color: var(--accent); }
.outcome { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.outcome-guidance { border-top: 3px solid var(--success); }
.outcome-pull_request { border-top: 3px solid #8463d6; }
.outcome-escalation { border-top: 3px solid #d39a1b; }
.outcome-needs_info { border-top: 3px solid var(--border-strong); }
.outcome-summary { color: var(--text); }
.draft { display: grid; gap: 6px; }
.draft .row .eyebrow { margin: 0; }
.draft-text { white-space: pre-wrap; font-family: var(--font); font-size: 13.5px; line-height: 1.55; background: var(--surface-2); color: var(--text-2); max-height: none; margin: 0; }
.brief-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.brief-col ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); display: grid; gap: 3px; }

/* Pull request and diff */
.pr { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--bg); }
.pr-head { display: flex; gap: 10px; align-items: flex-start; }
.pr-head .icon { color: #7c3aed; margin-top: 3px; }
.pr-body { font-size: 13px; }
.diff { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.diff-file { display: flex; gap: 6px; align-items: center; padding: 7px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.diff-file:not(:first-child) { border-top: 1px solid var(--border); }
.diff-scroll { overflow-x: auto; }
.diff-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.diff-table td { padding: 0 8px; white-space: pre; }
.diff-table .ln { width: 1%; min-width: 34px; text-align: right; color: var(--faint); user-select: none; border-right: 1px solid var(--border); }
.diff-table tr.add td { background: color-mix(in srgb, var(--success) 12%, transparent); }
.diff-table tr.add td.code::before { content: "+"; color: var(--success); margin-right: 6px; }
.diff-table tr.del td { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.diff-table tr.del td.code::before { content: "-"; color: var(--danger); margin-right: 6px; }
.diff-table tr.ctx td.code::before { content: " "; margin-right: 6px; }
.diff-table tr.hunk td { background: var(--accent-soft); color: var(--muted); padding: 2px 8px; }
.tests ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; font-family: var(--mono); }
.tests li { display: flex; gap: 6px; align-items: center; }
.tests li.pass .icon { color: var(--success); }
.tests li.fail .icon { color: var(--danger); }

/* Resolution graph */
.graph-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; margin-bottom: 8px; }
.graph-canvas { position: relative; padding: 8px; }
.graph-scroll { overflow-x: auto; }
.graph-svg { width: 100%; min-width: 600px; height: auto; display: block; font-family: var(--font); }
.g-edge { stroke: var(--border-strong); stroke-width: 1.5; }
.g-edge-jira_commit { stroke: color-mix(in srgb, #7c3aed 55%, var(--border-strong)); }
.g-edge-case_jira { stroke: color-mix(in srgb, #2f6fd6 55%, var(--border-strong)); }
.g-edge-hit { stroke: transparent; stroke-width: 12; cursor: help; }
.g-node { cursor: pointer; outline: none; }
.g-shape { fill: var(--surface); stroke-width: 2; }
.g-case .g-shape { stroke: var(--accent); fill: var(--accent-soft); }
.g-jira .g-shape { stroke: #2f6fd6; fill: color-mix(in srgb, #2f6fd6 14%, var(--surface)); }
.g-code_change .g-shape { stroke: #7c3aed; fill: color-mix(in srgb, #7c3aed 14%, var(--surface)); }
.g-kb .g-shape { stroke: #0f766e; fill: color-mix(in srgb, #0f766e 14%, var(--surface)); }
.g-po .g-shape { stroke: #b45309; fill: color-mix(in srgb, #b45309 14%, var(--surface)); }
.g-supplier .g-shape { stroke: var(--muted); fill: var(--surface-2); }
.g-center .g-shape { stroke-width: 3; }
.g-node.selected .g-shape, .g-node:focus-visible .g-shape { stroke-width: 3.5; filter: drop-shadow(0 0 4px var(--focus)); }
.g-label { fill: var(--text); font-size: 12px; font-weight: 600; text-anchor: middle; }
.g-sub { fill: var(--muted); font-size: 10.5px; text-anchor: middle; }
.graph-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 6px 2px; font-size: 12px; color: var(--muted); }
.graph-legend span { display: inline-flex; gap: 5px; align-items: center; }
.graph-tip { position: absolute; z-index: 5; max-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-pop); pointer-events: none; }
.graph-tip strong { text-transform: capitalize; display: block; margin-bottom: 2px; }
.graph-side { display: grid; gap: 8px; align-content: start; }
.graph-side h3 { margin: 0; font-size: 15px; }
.graph-side p { margin: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.stats { display: grid; gap: 12px; }
.stack-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.stack-bar span { display: block; height: 100%; }
.seg-setup { background: #3b6fe0; } .seg-data { background: #1d9a78; } .seg-code { background: #8463d6; } .seg-unresolved { background: #9ca3af; }
.stats-legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.stats-legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Search lab */
.search-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.search-col { padding: 12px; }
.search-col-head h3 { margin: 0; }
.search-col-head .note { margin: 2px 0 10px; }
.hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hit { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; background: var(--surface); display: grid; gap: 4px; transition: border-color 0.1s, background 0.1s; }
.hit.hl { border-color: var(--accent); background: var(--accent-soft); }
.hit-top { display: flex; gap: 6px; align-items: center; }
.hit-rank { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--text-2); flex: none; }
.hit-score { font-size: 11.5px; color: var(--muted); }
.hit-title { font-size: 13px; font-weight: 560; color: var(--text); line-height: 1.35; }
.hit-snippet { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.move { font-size: 11px; font-weight: 560; color: var(--muted); }
.move.up { color: var(--success); } .move.down { color: var(--danger); } .move.new { color: var(--accent); }

/* Evaluation */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-bottom: 18px; }
.tile .number { font-size: 26px; padding: 2px 0; }
.tile .eyebrow { margin: 0; }
.tile .note { margin: 0; }
.eval-table { max-height: none; }

@media (max-width: 1100px) {
  .search-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-grid { grid-template-columns: 1fr; }
  .run-right { position: static; max-height: none; overflow: visible; }
  .graph-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .search-cols { grid-template-columns: 1fr; }
  .ticket-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .ticket-side { justify-content: space-between; }
  .ticket-body { white-space: normal; }
  .run-head { flex-direction: column; }
  .edi-steps { grid-template-columns: 1fr 1fr; row-gap: 14px; }
  .edi-step:nth-child(2)::after { display: none; }
  .tl-args { white-space: normal; }
  .graph-svg { min-width: 520px; }
}
.timeline { min-width: 0; }
.timeline > li { min-width: 0; }
.tl-text { overflow: hidden; }
.tl-args { flex: 1 1 0; min-width: 0; }
.run-left, .run-right { min-width: 0; }
.timeline { grid-template-columns: minmax(0, 1fr); } .evidence-list, .hits, .ticket-list { grid-template-columns: minmax(0, 1fr); }

.recall { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.recall dt { color: var(--muted); font-size: 13px; }
.recall dd { margin: 0; font-weight: 650; font-size: 15px; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr)); }
.graph-grid > *, .search-cols > *, .run-grid > * { min-width: 0; }
@media (max-width: 760px) {
  .tl-line { flex-wrap: wrap; }
  .tl-text { flex: 1 1 calc(100% - 30px); }
  .tl-meta { margin-left: 30px; }
  .tl-summary, .tl-detail { margin-left: 0; }
  .run-actions { flex-wrap: wrap; }
}
@media (max-width: 760px) { .tl-text { flex-direction: column; gap: 2px; } .tl-args { white-space: normal; overflow-wrap: anywhere; } }

/* Resolution graph: quiet labels until hover or focus */
.g-quiet .g-label, .g-quiet .g-sub { opacity: 0; transition: opacity 0.12s; }
.g-quiet:hover .g-label, .g-quiet:focus .g-label, .g-quiet:hover .g-sub, .g-quiet:focus .g-sub { opacity: 1; }
.g-node:hover, .g-node:focus { outline: none; }
.g-node:hover > :first-child, .g-node:focus > :first-child { stroke-width: 2.5; }
.g-label { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
