/* MS CPA Engagement Review POC — shared styles.
   Color roles follow the dataviz reference palette (light mode). */

:root {
  color-scheme: light;
  --page:          #f9f9f7;
  --surface:       #fcfcfb;
  --ink:           #0b0b0b;
  --ink-2:         #52514e;
  --muted:         #898781;
  --grid:          #e1e0d9;
  --baseline:      #c3c2b7;
  --border:        rgba(11, 11, 11, 0.10);

  --series-1:      #2a78d6;   /* blue  — current year / primary accent */
  --series-1-lt:   #86b6ef;   /* blue 250 — prior year (ordinal pair) */
  --violet:        #4a3aa7;

  --st-good:       #0ca30c;
  --st-good-text:  #006300;
  --st-warn:       #fab219;
  --st-warn-text:  #8a5b00;
  --st-serious:    #ec835a;
  --st-serious-text:#a34310;
  --st-crit:       #d03b3b;
  --st-crit-text:  #a02020;

  --wash-good:     rgba(12, 163, 12, 0.10);
  --wash-warn:     rgba(250, 178, 25, 0.14);
  --wash-serious:  rgba(236, 131, 90, 0.14);
  --wash-crit:     rgba(208, 59, 59, 0.10);
  --wash-blue:     rgba(42, 120, 214, 0.10);

  --radius: 10px;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 4px 14px rgba(11,11,11,.06);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0; font-weight: 650; }
a { color: var(--series-1); }
button { font-family: inherit; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--grid);
}
.brand { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand .poc {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--wash-blue); color: var(--series-1);
  font-size: 11px; font-weight: 650; letter-spacing: .4px;
}
.topbar .spacer { flex: 1; }
.engagement-tag { color: var(--ink-2); font-size: 13px; }
.logout { color: var(--muted); font-size: 13px; text-decoration: none; }
.logout:hover { color: var(--ink-2); }
/* "you are here": current page shows in the nav but isn't clickable */
.nav-here {
  color: var(--ink); font-weight: 700; cursor: default;
  border-bottom: 2px solid var(--series-1); padding-bottom: 2px;
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 15% -10%, rgba(42,120,214,.08), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(27,175,122,.07), transparent 60%),
    var(--page);
}
.login-card { width: 400px; padding: 36px 34px 30px; }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 22px; }
.login-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.login-card input[type="password"] {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--baseline); border-radius: 8px; background: #fff;
}
.login-card input[type="password"]:focus { outline: 2px solid var(--series-1); border-color: transparent; }
.btn-primary {
  width: 100%; margin-top: 16px; padding: 11px 16px;
  background: var(--series-1); color: #fff; border: 0; border-radius: 8px;
  font-size: 14.5px; font-weight: 650; cursor: pointer;
}
.btn-primary:hover { background: #256abf; }
.btn-primary:disabled { background: var(--baseline); cursor: not-allowed; }
.login-error {
  margin-top: 14px; padding: 9px 12px; border-radius: 8px;
  background: var(--wash-crit); color: var(--st-crit-text); font-size: 13px;
}
.login-foot { margin-top: 20px; color: var(--muted); font-size: 11.5px; }

/* ---------- workbench ---------- */
.wb-main { max-width: 1100px; margin: 26px auto 60px; padding: 0 22px; display: grid; gap: 18px; }

/* ---------- 4-step pipeline ----------
   Each configurable step carries a theme color (--th) with a pastel fill.
   Its bubble, and the matching change-panel below, share the color so the
   mapping is obvious. */
.theme-docs   { --th: #2a78d6; --th-text: #1d5eae; --th-wash: rgba(42,120,214,.10); --th-pastel: #e9f2fd; --th-border: #bcd7f5; }
.theme-prompt { --th: #e09f00; --th-text: #8a5b00; --th-wash: rgba(250,178,25,.16); --th-pastel: #fdf4dd; --th-border: #efd79e; }
.theme-model  { --th: #0ca30c; --th-text: #006300; --th-wash: rgba(12,163,12,.10);  --th-pastel: #e8f7e8; --th-border: #b6e3b6; }
.theme-run    { --th: #4a3aa7; --th-text: #4a3aa7; --th-wash: rgba(74,58,167,.10);  --th-pastel: #edeafb; --th-border: #cec6f1; }

.steps-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: stretch; }
@media (max-width: 980px) { .steps-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps-row { grid-template-columns: 1fr; } }

/* double-height segments: badge | label + value + preview | chevron,
   with a big watermark count in the corner where applicable */
.step-bubble {
  display: flex; align-items: flex-start; gap: 11px; text-align: left;
  min-height: 152px; position: relative;  /* no overflow:hidden — the open-tab notch hangs below */
  padding: 13px 14px; border-radius: 12px;
  background: var(--th-pastel); border: 1px solid var(--th-border);
  font-family: inherit; font-size: inherit; color: var(--ink);
  transition: box-shadow .15s ease, background .2s ease, border-color .2s ease;
}
button.step-bubble { cursor: pointer; }
button.step-bubble:hover { box-shadow: 0 2px 10px var(--th-wash), var(--shadow); }
.step-bubble:not(.ready) {
  background: color-mix(in srgb, var(--th-pastel) 40%, #f5f5f2);
  border-color: var(--grid);
}

/* open = active tab: solid theme fill + notch pointing into its panel */
.step-bubble.open { position: relative; background: var(--th); border-color: var(--th); }
.step-bubble.open::after {
  content: ""; position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--th);
}
.step-bubble.open .step-name,
.step-bubble.open:not(.ready) .step-name { color: rgba(255,255,255,.8); }
.step-bubble.open .step-value,
.step-bubble.open:not(.ready) .step-value,
.step-bubble.open .step-value .sub { color: #fff; }
.step-bubble.open > .chev { color: #fff; }
.step-bubble.open .step-badge,
.step-bubble.ready.open .step-badge { background: #fff; border-color: #fff; color: var(--th-text); }
.step-bubble.open .gauge i { background: rgba(255,255,255,.35); }
.step-bubble.open .gauge i.on { background: #fff; }

.step-badge {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--muted);
  border: 1.5px solid var(--baseline);
  transition: background .2s ease, color .2s ease;
}
.step-badge svg { width: 15px; height: 15px; display: block; }
.step-bubble.ready .step-badge { background: var(--th); border-color: var(--th); color: #fff; }
/* small corner check once the step is configured */
.step-bubble.ready .step-badge::after {
  content: ""; position: absolute; right: -4px; bottom: -4px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid #fff;
  background: var(--th-text) center / 7px 7px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 6L9 17l-5-5' fill='none' stroke='white' stroke-width='4.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.step-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; position: relative; z-index: 1; }
.theme-run .step-body { justify-content: center; align-self: stretch; }

/* docs card: first few filenames */
.step-files { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; min-width: 0; }
.step-files .f {
  font-size: 10.5px; color: var(--ink-2); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-left: 13px; position: relative;
}
.step-files .f::before { content: "▸"; position: absolute; left: 2px; font-size: 8px; top: 2px; color: var(--th-text); opacity: .6; }
.step-files .f.empty { color: var(--muted); font-style: italic; padding-left: 0; }
.step-files .f.empty::before { content: none; }
.step-files .more { font-size: 13px; font-weight: 700; color: var(--th-text); line-height: .7; padding-left: 13px; }

/* prompt/engine cards: a few lines of preview text */
.step-excerpt {
  font-size: 11px; color: var(--ink-2); line-height: 1.5; margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* big watermark count (docs card): large numeral + small "file(s)" unit */
.step-count {
  position: absolute; right: 12px; bottom: 6px; z-index: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-end;
  color: rgba(11, 11, 11, .10);
}
.step-count i {
  font-family: Impact, "Arial Black", "Helvetica Neue", sans-serif; font-weight: 900;
  font-style: normal; font-size: 56px; line-height: .9; letter-spacing: -2px;
}
.step-count em {
  font-style: normal; font-size: 11px; font-weight: 800;
  letter-spacing: 2.5px; text-transform: uppercase;
}

/* open (solid fill) recolors for the preview content */
.step-bubble.open .step-files .f,
.step-bubble.open .step-excerpt { color: rgba(255,255,255,.88); }
.step-bubble.open .step-files .f::before,
.step-bubble.open .step-files .more { color: rgba(255,255,255,.75); }
.step-bubble.open .step-count { color: rgba(255,255,255,.22); }
.step-name { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--th-text); }
.step-bubble:not(.ready) .step-name { color: var(--muted); }
.step-value {
  font-size: 13px; font-weight: 650; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.step-value .nm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-value .sub { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.step-bubble:not(.ready) .step-value { color: var(--muted); font-weight: 500; }

.step-bubble > .chev {
  margin-left: auto; flex: none; font-size: 13px; color: var(--th-text);
  transition: transform .2s ease;
}
.step-bubble.open > .chev { transform: rotate(180deg); }

/* engine-strength gauge: 4 segments, deeper green = stronger engine */
.gauge { display: flex; gap: 3px; width: 100%; max-width: 140px; }
.gauge i { flex: 1; height: 6px; border-radius: 3px; background: rgba(11,11,11,.10); }
.step-body .gauge { max-width: 84px; margin-top: 3px; }
.gauge i.on:nth-child(1) { background: #9ed69e; }
.gauge i.on:nth-child(2) { background: #5cbb5c; }
.gauge i.on:nth-child(3) { background: #22a022; }
.gauge i.on:nth-child(4) { background: #0b7d0b; }
.m-gauge { max-width: 84px; flex: none; width: 84px; }

/* change-panels: one visible at a time, framed in the step's theme color */
.step-panel {
  border: 1.5px solid var(--th); border-top-width: 3px;
  background: linear-gradient(var(--th-wash), transparent 120px), var(--surface);
  box-shadow: var(--shadow); animation: fadeIn .2s ease;
}
.step-panel h2 { color: var(--th-text); }
.panel-hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 8px; }
.step-panel .bundle.selected,
.step-panel .prompt-item.selected,
.step-panel .model-item.selected { border-color: var(--th); box-shadow: 0 0 0 2px var(--th-wash); }
.step-panel .btn-small { background: var(--th); }
.step-panel .btn-small:hover { filter: brightness(.94); }

.panel { padding: 20px 22px; }
.panel h2 { font-size: 14px; letter-spacing: .3px; text-transform: uppercase; color: var(--ink-2); margin-bottom: 14px; }

.dropzone {
  border: 2px dashed var(--baseline); border-radius: var(--radius);
  padding: 26px 18px; text-align: center; color: var(--ink-2);
  transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone.dragover { border-color: var(--series-1); background: var(--wash-blue); }
.dropzone .dz-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.dz-actions { margin-top: 14px; display: flex; gap: 10px; justify-content: center; }
.btn-ghost {
  padding: 8px 14px; border: 1px solid var(--baseline); background: var(--surface);
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.btn-ghost:hover { border-color: var(--series-1); color: var(--series-1); }

/* documents render as squarish cards in a 2-column grid, indented inside
   the set card so the hierarchy (set -> documents) reads at a glance.
   The dropzone is just the last card in the grid (display:contents lets
   the JS-refreshed doclist share the grid with it). */
.docgrid { margin: 14px 0 0 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 760px) { .docgrid { grid-template-columns: 1fr; margin-left: 14px; } }
.doclist { display: contents; }
.doc {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--grid); border-radius: 8px;
  background: #fff; opacity: 0; transform: translateY(4px);
  animation: docIn .3s ease forwards;
}
@keyframes docIn { to { opacity: 1; transform: none; } }
.doc .ico { font-size: 17px; text-align: center; }
.doc .meta { min-width: 0; }
.doc .meta .name {
  font-size: 13px; font-weight: 600; color: var(--series-1);
  cursor: pointer; overflow-wrap: anywhere;
}
.doc .meta .name:hover { text-decoration: underline; }
.doc .meta .sub { font-size: 11px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.doc .meta .sub .doctype { color: var(--series-1); font-weight: 600; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.queued   { background: #f0efec; color: var(--muted); }
.pill.transfer { background: var(--wash-blue); color: var(--series-1); }
.pill.encrypt  { background: rgba(74,58,167,.10); color: var(--violet); }
.pill.classify { background: var(--wash-warn); color: var(--st-warn-text); }
.pill.done     { background: var(--wash-good); color: var(--st-good-text); }
.pill .spin {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.docbar { height: 3px; border-radius: 2px; background: var(--grid); margin-top: 6px; overflow: hidden; }
.docbar > i { display: block; height: 100%; width: 0%; background: var(--series-1); border-radius: 2px; transition: width .25s ease; }

/* run panel */
.runchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--grid); background: #fff;
  padding: 4px 10px; border-radius: 999px;
}
.chip b { color: var(--ink); font-weight: 650; }
.btn-engage {
  width: 100%; padding: 14px 16px; font-size: 15px; font-weight: 700;
  border: 0; border-radius: 10px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #2a78d6, #4a3aa7);
  box-shadow: 0 6px 18px rgba(42,120,214,.30);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn-engage:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.btn-engage:disabled { background: var(--baseline); box-shadow: none; cursor: not-allowed; }
.run-hint { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: center; }
.step-bubble .btn-engage { padding: 9px 10px; font-size: 13.5px; border-radius: 9px; }
.step-bubble .run-hint { margin-top: 4px; font-size: 10.5px; text-align: left; line-height: 1.3; }

/* progress stage */
.progress-panel { padding: 22px; display: none; }
.progress-panel.active { display: block; }
.meter { height: 14px; border-radius: 999px; background: #e9f1fb; overflow: hidden; margin: 14px 0 6px; }
.meter > i {
  display: block; height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2a78d6, #4a3aa7, #2a78d6);
  background-size: 200% 100%;
  animation: shimmer 2.2s linear infinite;
  transition: width .4s ease;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.meter-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }
.meter-row .pct { font-weight: 700; color: var(--ink); font-size: 14px; }
.stages { margin-top: 14px; display: grid; gap: 6px; }
.stage { display: flex; gap: 9px; align-items: baseline; font-size: 13px; color: var(--muted); }
.stage .s-ico { width: 16px; text-align: center; }
.stage.active { color: var(--ink); font-weight: 600; }
.stage.done { color: var(--st-good-text); }
.tokenticker { margin-top: 14px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.skip-link { font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; }

.done-banner {
  display: none; margin-top: 16px; padding: 14px 16px; border-radius: 10px;
  background: var(--wash-good); border: 1px solid rgba(12,163,12,.25);
}
.done-banner.active { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.done-banner .msg { font-size: 13.5px; color: var(--st-good-text); font-weight: 600; }
.btn-report {
  padding: 10px 18px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--st-good); color: #fff; font-weight: 700; font-size: 14px;
}

/* ---------- report ---------- */
/* sits below the sticky topbar (top offset = topbar height) */
.rp-head { padding: 16px 22px 0; background: var(--surface); border-bottom: 1px solid var(--grid); position: sticky; top: 43px; z-index: 30; }
.rp-title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 1160px; margin: 0 auto; }
.rp-title-row h1 { font-size: 17px; }
.rp-sub { color: var(--ink-2); font-size: 12.5px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge.crit { background: var(--wash-crit); color: var(--st-crit-text); border: 1px solid rgba(208,59,59,.30); }

.tabs { display: flex; gap: 2px; max-width: 1160px; margin: 12px auto 0; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--series-1); border-bottom-color: var(--series-1); }
.tab .n {
  margin-left: 6px; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: #f0efec; color: var(--ink-2);
}
.tab .n.crit { background: var(--wash-crit); color: var(--st-crit-text); }
.tab .n.warn { background: var(--wash-warn); color: var(--st-warn-text); }
.tab .n.serious { background: var(--wash-serious); color: var(--st-serious-text); }

.rp-main { max-width: 1160px; margin: 22px auto 80px; padding: 0 22px; }
.tabpane { display: none; }
.tabpane.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none;} }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { padding: 16px 18px; border-top: 3px solid var(--grid); }
.tile.crit    { border-top-color: var(--st-crit); }
.tile.warn    { border-top-color: var(--st-warn); }
.tile.serious { border-top-color: var(--st-serious); }
.tile.good    { border-top-color: var(--st-good); }
.tile .t-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.tile .t-value { font-size: 34px; font-weight: 650; margin: 2px 0; }
.tile .t-sub { font-size: 11.5px; color: var(--muted); }

/* severity chips */
.sev {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  letter-spacing: .2px; white-space: nowrap;
}
.sev.crit    { background: var(--wash-crit);    color: var(--st-crit-text); }
.sev.warn    { background: var(--wash-warn);    color: var(--st-warn-text); }
.sev.serious { background: var(--wash-serious); color: var(--st-serious-text); }
.sev.good    { background: var(--wash-good);    color: var(--st-good-text); }
.sev.info    { background: var(--wash-blue);    color: var(--series-1); }

/* finding cards */
.findings { display: grid; gap: 12px; }
.finding { padding: 16px 18px; border-left: 4px solid var(--grid); }
.finding.crit    { border-left-color: var(--st-crit); }
.finding.warn    { border-left-color: var(--st-warn); }
.finding.serious { border-left-color: var(--st-serious); }
.f-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.f-id { font-size: 12px; font-weight: 700; color: var(--muted); }
.f-area { font-size: 11px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--grid); padding: 2px 8px; border-radius: 999px; }
.f-title { font-size: 14.5px; font-weight: 650; margin-bottom: 6px; }
.f-body { font-size: 13.5px; color: var(--ink-2); }
.f-evidence {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: var(--page); border: 1px solid var(--grid);
  font-size: 12.5px; color: var(--ink-2);
}
.f-evidence b { color: var(--ink); }
.f-action { margin-top: 10px; font-size: 13px; }
.f-action b { color: var(--series-1); }
.f-impact { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* charts */
.chartgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 980px) { .chartgrid { grid-template-columns: 1fr; } }
.chartcard { padding: 18px 20px; }
.chartcard h3 { font-size: 13.5px; margin-bottom: 2px; }
.chartcard .c-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.legend .l-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.legend .l-swatch { width: 10px; height: 10px; border-radius: 3px; }
svg text { font-family: var(--font); }

#tooltip {
  position: fixed; z-index: 90; pointer-events: none; display: none;
  background: var(--ink); color: #fff; font-size: 12px; line-height: 1.4;
  padding: 8px 10px; border-radius: 7px; max-width: 260px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
#tooltip .tt-title { font-weight: 700; }
#tooltip .tt-sub { color: #c3c2b7; }

/* coverage checklist */
.coverage { display: grid; gap: 0; }
.cov-row {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 6px; border-bottom: 1px solid var(--grid); font-size: 13.5px;
}
.cov-row:last-child { border-bottom: 0; }
.cov-row .c-ico { text-align: center; font-size: 14px; }
.cov-row .c-note { color: var(--muted); font-size: 12px; text-align: right; }

/* tables */
table.rec { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rec th {
  text-align: left; font-size: 11.5px; letter-spacing: .3px; text-transform: uppercase;
  color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--baseline);
}
table.rec td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.rec tr:last-child td { border-bottom: 0; }
table.rec td.num, table.rec th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.rec .delta-up { color: var(--st-good-text); font-weight: 600; }
table.rec .delta-down { color: var(--st-crit-text); font-weight: 600; }
tr.rec-flag td { background: rgba(250,178,25,.06); }

.section-note {
  margin: 18px 0; padding: 12px 16px; border-radius: 10px; font-size: 13px;
  background: var(--wash-blue); color: var(--ink-2); border: 1px solid rgba(42,120,214,.18);
}

/* conclusion */
.verdict { padding: 22px 24px; margin-bottom: 16px; }
.verdict .v-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.verdict h2 { font-size: 17px; }
.verdict p { color: var(--ink-2); font-size: 14px; }
.next-steps { display: grid; gap: 8px; margin-top: 8px; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--grid); border-radius: 8px; background: #fff; }
.step .s-n { width: 22px; height: 22px; border-radius: 50%; background: var(--wash-blue); color: var(--series-1); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.rp-footer { max-width: 1160px; margin: 30px auto 0; padding: 14px 22px 0; border-top: 1px solid var(--grid); color: var(--muted); font-size: 11.5px; }

h2.pane-title { font-size: 16px; margin-bottom: 4px; }
p.pane-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 16px; }

/* ---------- phase-1 additions: bundles, prompts, generic output ---------- */
/* set cards tint to the docs theme so they stand out from the panel */
.bundle {
  border: 1px solid var(--th-border, var(--grid)); border-radius: 10px;
  background: var(--th-pastel, #fff); margin-bottom: 12px;
}
.bundle.selected { border-color: var(--series-1); box-shadow: 0 0 0 2px var(--wash-blue); }
.bundle-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.bundle-head .b-name { font-weight: 650; font-size: 14px; }
.bundle-head .b-count { font-size: 12px; color: var(--muted); }
.bundle-body { padding: 0 14px 12px; }
/* dropzone = one more card in the doc grid */
.bundle .dropzone {
  margin: 0; padding: 14px 12px; font-size: 12.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 92px; background: rgba(255,255,255,.6);
}
.bundle .dropzone b { color: var(--th-text, var(--ink-2)); }
.bundle .dropzone span { font-size: 11px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.inline-form input[type="text"] {
  flex: 1; padding: 9px 12px; font-size: 13.5px;
  border: 1px solid var(--baseline); border-radius: 8px; background: #fff;
}
.inline-form input[type="text"]:focus { outline: 2px solid var(--series-1); border-color: transparent; }
.btn-small {
  padding: 8px 14px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--series-1); color: #fff; font-size: 13px; font-weight: 650;
}
.btn-small:hover { background: #256abf; }
.btn-danger-link { background: none; border: none; color: var(--muted); font-size: 11.5px; cursor: pointer; text-decoration: underline; padding: 0; }
.btn-danger-link:hover { color: var(--st-crit-text); }

/* prompt library: 2-column tallish cards with a body preview */
.promptgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 760px) { .promptgrid { grid-template-columns: 1fr; } }
.prompt-item {
  display: flex; flex-direction: column; gap: 8px; min-height: 168px;
  padding: 12px 14px; border: 1px solid var(--th-border, var(--grid));
  border-radius: 10px; background: var(--th-pastel, #fff); cursor: pointer;
}
.prompt-item.selected { border-color: var(--series-1); box-shadow: 0 0 0 2px var(--wash-blue); }
.prompt-item .p-head { display: flex; gap: 10px; align-items: flex-start; }
.prompt-item .p-title { font-size: 13.5px; font-weight: 650; }
.prompt-item .p-sub { font-size: 11.5px; color: var(--muted); }
.prompt-item .p-preview {
  font-size: 11.5px; color: var(--ink-2); line-height: 1.55; flex: 1;
  padding: 8px 10px; background: rgba(255,255,255,.65); border-radius: 8px;
}
/* clamp on an inner span: clamping the padded box lets the cut line peek
   through the bottom padding */
.prompt-item .p-preview .txt {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.prompt-item .p-foot { display: flex; align-items: center; gap: 10px; }
.p-view {
  background: none; border: none; padding: 0; cursor: pointer;
  font-size: 12px; font-weight: 650; color: var(--th-text, var(--series-1));
}
.p-view:hover { text-decoration: underline; }
.sample-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--grid); border-radius: 999px; padding: 2px 8px;
}

/* full-prompt modal (amber-themed) */
.pm-box { inset: 8vh 14vw; }
@media (max-width: 900px) { .pm-box { inset: 5vh 5vw; } }
.pm-head { background: var(--th-pastel); border-bottom: 2px solid var(--th); }
.pm-head .dm-title { color: var(--th-text); }
.pm-body {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word;
  background: linear-gradient(var(--th-wash), transparent 140px), var(--surface);
}
.prompt-add textarea {
  width: 100%; min-height: 84px; padding: 9px 12px; font-size: 13px; resize: vertical;
  border: 1px solid var(--baseline); border-radius: 8px; background: #fff; font-family: inherit;
}
.prompt-add input[type="text"] { width: 100%; margin-bottom: 8px; }

.model-item { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--grid); border-radius: 8px; background: #fff; margin-bottom: 8px; cursor: pointer; }
.model-item.selected { border-color: var(--series-1); box-shadow: 0 0 0 2px var(--wash-blue); }
.model-item .m-label { font-size: 13.5px; font-weight: 650; }
.model-item .m-detail { font-size: 11.5px; color: var(--muted); }

.runrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--grid); font-size: 13px; }
.runrow:last-child { border-bottom: 0; }
.runrow .r-sub { font-size: 11.5px; color: var(--muted); }

.gen-main { max-width: 860px; margin: 26px auto 80px; padding: 0 22px; display: grid; gap: 16px; }
.gen-output { padding: 20px 24px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }

/* rendered-markdown view (mdlite): deterministic hierarchy + light color,
   styled with the app's own palette — no LLM formatting pass involved */
.gen-output.md { white-space: normal; padding: 26px 30px; }
.gen-output.md > :first-child { margin-top: 0; }
.gen-output.md h1 {
  font-size: 20px; font-weight: 700; margin: 26px 0 10px;
  padding-bottom: 10px; border-bottom: 2px solid var(--grid);
}
.gen-output.md h2 {
  font-size: 16px; font-weight: 700; color: var(--series-1); margin: 24px 0 8px;
}
.gen-output.md h3 {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--ink-2); margin: 18px 0 6px;
}
.gen-output.md h4 { font-size: 13.5px; font-weight: 700; margin: 14px 0 4px; }
.gen-output.md p { margin: 8px 0; color: var(--ink); }
.gen-output.md strong { font-weight: 700; color: var(--ink); background: var(--wash-blue); padding: 0 3px; border-radius: 4px; }
.gen-output.md ul, .gen-output.md ol { margin: 8px 0 12px; padding-left: 24px; }
.gen-output.md li { margin: 4px 0; }
.gen-output.md ul li::marker { color: var(--series-1); }
.gen-output.md ol li::marker { color: var(--series-1); font-weight: 700; }
.gen-output.md hr { border: 0; border-top: 1px solid var(--grid); margin: 20px 0; }
.gen-output.md blockquote {
  margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--series-1);
  background: var(--wash-blue); border-radius: 0 8px 8px 0; color: var(--ink-2);
}
.gen-output.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: var(--page); border: 1px solid var(--grid); border-radius: 5px; padding: 1px 5px;
}
.gen-output.md pre {
  background: var(--page); border: 1px solid var(--grid); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; margin: 10px 0;
}
.gen-output.md pre code { border: 0; padding: 0; background: none; font-size: 12.5px; }
.gen-output.md table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 12px 0; }
.gen-output.md th {
  text-align: left; font-size: 11.5px; letter-spacing: .3px; text-transform: uppercase;
  color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--baseline);
}
.gen-output.md td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.gen-output.md tr:last-child td { border-bottom: 0; }
.conf-pill { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.conf-pill.high { background: var(--wash-good); color: var(--st-good-text); }
.conf-pill.medium { background: var(--wash-warn); color: var(--st-warn-text); }
.conf-pill.low { background: var(--wash-crit); color: var(--st-crit-text); }

/* ---------- action feedback toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.28);
  opacity: 0; pointer-events: none; z-index: 120;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- in-app document viewer modal ---------- */
.doc-modal { position: fixed; inset: 0; z-index: 100; }
.dm-backdrop { position: absolute; inset: 0; background: rgba(11,11,11,.55); }
.dm-box {
  position: absolute; inset: 4vh 5vw; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 12px; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
}
.dm-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--grid); background: var(--surface);
}
.dm-title { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-close {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--grid);
  background: var(--surface); color: var(--ink-2); font-size: 18px; line-height: 1;
  cursor: pointer;
}
.dm-close:hover { background: var(--wash-crit); color: var(--st-crit-text); border-color: transparent; }
.dm-frame { flex: 1; width: 100%; border: 0; background: #525659; }

/* ---- Auth phase: login tabs, account settings, admin bar, user management ---- */

.adminbar {
  display: flex; align-items: center; gap: 18px;
  background: var(--wash-blue); border-bottom: 1px solid var(--grid);
  padding: 7px 22px; font-size: 12.5px;
}
.adminbar-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: #fff; background: var(--series-1); padding: 2px 8px; border-radius: 999px;
}
.adminlink { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.adminlink:hover { color: var(--series-1); }
.adminbar .nav-here { color: var(--ink); font-weight: 700; }
.nav-account { font-weight: 700; }

.login-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px; margin-bottom: 18px; background: var(--page);
  border: 1px solid var(--grid); border-radius: 8px; padding: 3px;
}
.login-tab {
  border: 0; background: none; padding: 7px 4px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); border-radius: 6px; cursor: pointer;
}
.login-tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.login-card input[type="text"] {
  width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid var(--baseline);
  border-radius: 8px; margin-bottom: 16px; background: #fff; font-family: inherit;
}
.login-card input[type="text"]:focus { outline: 2px solid var(--series-1); border-color: transparent; }

.flashbar { padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.flashbar.good { background: var(--wash-good); color: var(--st-good-text); }
.flashbar.bad { background: var(--wash-crit); color: var(--st-crit-text); }

.acct-grid {
  display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px;
  font-size: 13.5px; align-items: center;
}
.acct-k { color: var(--muted); font-size: 12.5px; }
.acct-form { max-width: 380px; }
.acct-form label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  margin: 12px 0 6px;
}
.acct-form input {
  width: 100%; padding: 9px 12px; font-size: 14px; border: 1px solid var(--baseline);
  border-radius: 8px; background: #fff; font-family: inherit;
}
.acct-form input:focus { outline: 2px solid var(--series-1); border-color: transparent; }
.acct-form .btn-primary, .acct-form .btn-secondary { margin-top: 14px; }
.acct-note { font-size: 12.5px; color: var(--ink-2); margin: 0 0 12px; max-width: 560px; }

.btn-secondary {
  padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--baseline); border-radius: 8px; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--series-1); color: var(--series-1); }
.btn-danger {
  padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--st-crit-text);
  background: #fff; border: 1px solid var(--grid); border-radius: 8px; cursor: pointer;
}
.btn-danger:hover { background: var(--wash-crit); border-color: transparent; }

.totp-setup { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.totp-qr { width: 168px; height: 168px; border: 1px solid var(--grid); border-radius: 8px; background: #fff; }
.totp-secret {
  display: inline-block; font-size: 13px; background: var(--page);
  border: 1px solid var(--grid); border-radius: 6px; padding: 6px 10px;
  margin-bottom: 4px; word-break: break-all; user-select: all;
}

.linkbox { border: 1px solid var(--series-1); }
.linkrow { display: flex; gap: 10px; align-items: center; }
.linkrow code {
  flex: 1; font-size: 12.5px; background: var(--page); border: 1px solid var(--grid);
  border-radius: 6px; padding: 9px 12px; word-break: break-all; user-select: all;
}

.userform { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.userform label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.userform input, .userform select {
  padding: 9px 12px; font-size: 13.5px; border: 1px solid var(--baseline);
  border-radius: 8px; background: #fff; font-family: inherit; min-width: 170px;
}
.userform input:focus, .userform select:focus { outline: 2px solid var(--series-1); border-color: transparent; }

.usertable { width: 100%; border-collapse: collapse; font-size: 13px; }
.usertable th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted); padding: 6px 10px;
  border-bottom: 1px solid var(--grid);
}
.usertable td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.usertable tr:last-child td { border-bottom: 0; }
.usertable .methods .chip { margin-right: 4px; }
.chip-admin { background: var(--wash-blue); border-color: var(--series-1); color: var(--series-1); }
.chip-pending { background: var(--wash-warn); border-color: var(--st-warn); color: var(--st-warn-text); }
.row-disabled td { opacity: .45; }
.usertable .actions { white-space: nowrap; }
.usertable .actions form { display: inline-block; margin-left: 4px; }
.btn-mini {
  padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--baseline); border-radius: 999px; cursor: pointer;
}
.btn-mini:hover { border-color: var(--series-1); color: var(--series-1); }
.btn-mini-danger:hover { border-color: var(--st-crit); color: var(--st-crit-text); }
.acct-grid .chip { justify-self: start; }
