/* CleaROffert · Dark design system
 * ---------------------------------------------------------------------------
 * Server-rendered shell only. No build step, no Tailwind, no preprocessor.
 * Works without JS for graceful degradation when HTMX fails.
 *
 * This stylesheet implements the dark dashboard concept
 * (ClearOffert_Dashboard_topfold/preview.png): deep-navy surfaces, a left
 * sidebar + top bar app shell, serif display type for headings and KPI
 * numbers, and a teal→blue→violet accent gradient. Because every page
 * shares these class names, restyling here re-skins login, audits,
 * reports and billing in one place.
 *
 * Fonts: CSP is `font-src 'self'`, so no external webfonts are loaded.
 * The serif stack falls back to Georgia (an elegant system serif) until a
 * self-hosted Cormorant Garamond woff2 is added under /static/fonts.
 */

:root {
  /* ── Surfaces (deep navy) ─────────────────────────────────────────────── */
  --bg: #0A0E18;
  --bg-grad-1: #0C1120;
  --bg-grad-2: #090C15;
  --sidebar: #070A12;
  --panel: #111726;
  --panel-2: #0E1421;
  --panel-raised: #161D2F;
  --panel-hover: #1A2236;

  /* ── Text ─────────────────────────────────────────────────────────────── */
  --fg: #E8EBF4;
  --fg-soft: #C2C9DA;
  --fg-muted: #828BA3;
  --fg-faint: #58607A;

  /* ── Lines ────────────────────────────────────────────────────────────── */
  --rule: #1E2740;
  --rule-soft: #161C2E;
  --rule-strong: #2A3556;

  /* ── Accent (brand gradient) ──────────────────────────────────────────── */
  --accent: #5B8DEF;
  --accent-strong: #3F6FD8;
  --accent-soft: rgba(91, 141, 239, 0.14);
  --teal: #2DD4BF;
  --violet: #A855F7;
  --grad: linear-gradient(90deg, #2DD4BF 0%, #5B8DEF 50%, #A855F7 100%);
  --grad-soft: linear-gradient(90deg, rgba(45,212,191,0.16) 0%, rgba(91,141,239,0.16) 50%, rgba(168,85,247,0.16) 100%);

  /* ── Display gold (serif KPI numbers) ─────────────────────────────────── */
  --gold: #E4D2A6;

  /* ── State ────────────────────────────────────────────────────────────── */
  --ok: #46C08A;
  --degraded: #E0A33A;
  --warn-bg: rgba(224, 163, 58, 0.12);
  --warn-fg: #E7BC6A;
  --error-bg: rgba(229, 72, 77, 0.14);
  --error-fg: #F2787C;

  /* Severity (findings + risk) */
  --sev-high: #E5484D;
  --sev-high-bg: rgba(229, 72, 77, 0.16);
  --sev-medium: #E0A33A;
  --sev-medium-bg: rgba(224, 163, 58, 0.16);
  --sev-low: #5B8DEF;
  --sev-low-bg: rgba(91, 141, 239, 0.14);
  --sev-info: #828BA3;
  --sev-info-bg: rgba(130, 139, 163, 0.14);

  --serif: "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 248px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(91, 141, 239, 0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(168, 85, 247, 0.07), transparent 55%),
    linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg) 40%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #84A9F4; text-decoration: underline; }

code { font-family: var(--mono); font-size: 0.9em; color: var(--fg-soft); }

h1, h2, h3 { color: var(--fg); }

::selection { background: rgba(91, 141, 239, 0.32); color: #fff; }

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

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

/* Top dev banner — slim, gold-tinted */
.dev-banner {
  background: linear-gradient(90deg, rgba(224,163,58,0.14), rgba(224,163,58,0.06));
  color: var(--warn-fg);
  padding: 7px 16px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--rule);
}

.foot {
  text-align: center;
  padding: 28px;
  font-size: 12.5px;
  color: var(--fg-faint);
}
.foot .muted { color: var(--fg-faint); }

/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL — sidebar + topbar + main (authenticated pages)
   Rendered by base.html when `user` is present. Anonymous pages (login,
   register-dev, pricing) skip the shell and use the centered `.container`.
   ═══════════════════════════════════════════════════════════════════════════ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - 33px); /* minus dev-banner */
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.app-sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--rule);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 10px 18px;
  color: var(--fg);
}
.sidebar-brand:hover { text-decoration: none; color: var(--fg); }
.sidebar-brand .brand-mark { color: var(--accent); }

.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--fg-faint);
  padding: 14px 12px 6px;
}

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

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-soft);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.sidebar-link:hover {
  background: var(--panel-hover);
  color: var(--fg);
  text-decoration: none;
}
.sidebar-link.is-active {
  background: var(--accent-soft);
  color: #BFD3FB;
  border-color: rgba(91, 141, 239, 0.30);
}
.sidebar-link .ico {
  width: 18px; height: 18px;
  flex: 0 0 18px;
  opacity: 0.85;
  stroke: currentColor;
  fill: none;
}
.sidebar-link.is-disabled {
  color: var(--fg-faint);
  cursor: default;
}
.sidebar-link.is-disabled:hover { background: transparent; color: var(--fg-faint); }
.sidebar-badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--fg-faint);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  border-radius: 999px;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
}
.sidebar-user { padding: 8px 12px; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  word-break: break-word;
}
.sidebar-user-tenant { font-size: 11.5px; color: var(--fg-muted); margin-top: 2px; }
.sidebar-logout { margin: 8px 0 0; }
.sidebar-logout .btn { width: 100%; }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.app-main { min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 30px;
  border-bottom: 1px solid var(--rule);
  background: rgba(10, 14, 24, 0.6);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--fg);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.app-content {
  padding: 30px;
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

/* ── Hero greeting (dashboard) ─────────────────────────────────────────── */
.hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--fg-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-eyebrow .live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(70, 192, 138, 0.18);
}
.hero-title {
  font-family: var(--serif);
  font-size: 44px;
  line-height: 1.05;
  font-weight: 600;
  margin: 12px 0 0;
  color: var(--fg);
}
.hero-title .accent-name { font-style: italic; color: var(--accent); }

/* Decorative gradient wave (inline SVG-free: pure CSS) */
.hero-wave {
  height: 60px;
  margin: 22px 0 30px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent, rgba(45,212,191,0.0) 5%),
    var(--grad-soft);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule-soft);
}
.hero-wave::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad);
  opacity: 0.55;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 6px);
  mask: repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 6px);
  filter: blur(0.3px);
}

/* ── KPI cards ─────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 4px 0 32px;
}
.kpi-card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
}
.kpi-value {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 6px;
}
.kpi-value .unit { font-size: 18px; color: var(--accent); margin-left: 4px; }
.kpi-sub { font-size: 12px; color: var(--fg-faint); margin-top: 4px; }

/* ── Generic section / panel grid for dashboard body ───────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── Risk donut (CSS conic-gradient) ───────────────────────────────────── */
.risk-card { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.risk-donut {
  --high: 0deg; --med: 0deg; --low: 0deg;
  width: 132px; height: 132px;
  border-radius: 50%;
  background: conic-gradient(
    var(--sev-high) 0 var(--high),
    var(--sev-medium) var(--high) var(--med),
    var(--sev-low) var(--med) var(--low),
    var(--rule) var(--low) 360deg
  );
  display: grid;
  place-items: center;
  position: relative;
}
.risk-donut::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: var(--panel);
}
.risk-donut-value {
  position: relative;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  color: var(--fg);
}
.risk-legend { display: flex; flex-direction: column; gap: 6px; width: 100%; font-size: 13px; }
.risk-legend-row { display: flex; align-items: center; gap: 8px; }
.risk-legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.risk-legend-row .count { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--fg-soft); }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH (login + register-dev) — centered card on the dark canvas
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-card {
  max-width: 420px;
  margin: 8vh auto;
  padding: 36px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 6px;
}
.auth-form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.auth-form label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
  margin-top: 8px;
}
.auth-form input {
  padding: 11px 13px;
  font-size: 15px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--fg);
  font-family: inherit;
}
.auth-form input::placeholder { color: var(--fg-faint); }
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-foot { margin-top: 22px; font-size: 14px; text-align: center; color: var(--fg-muted); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(91, 141, 239, 0.28);
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--fg-soft);
  border-color: var(--rule-strong);
}
.btn-ghost:hover { color: var(--fg); border-color: var(--accent); text-decoration: none; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin: 12px 0;
  border: 1px solid transparent;
}
.alert-error { background: var(--error-bg); color: var(--error-fg); border-color: rgba(229,72,77,0.3); }
.alert-warning { background: var(--warn-bg); color: var(--warn-fg); border-color: rgba(224,163,58,0.3); }
.alert-info { background: var(--accent-soft); color: #AFC6F7; border-color: rgba(91,141,239,0.3); }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD (legacy blocks kept for graceful fallback)
   ═══════════════════════════════════════════════════════════════════════════ */

.dashboard { margin-top: 8px; }
.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 22px;
}
.dashboard-head h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; margin: 0; }
.dashboard-logout { margin: 0; }

.dashboard-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.dashboard-first-run {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 24px;
}
.dashboard-first-run h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 8px; }
.dashboard-first-run-intro { margin: 0 0 12px; }
.dashboard-first-run-steps { margin: 0 0 16px; padding-left: 22px; }
.dashboard-first-run-steps li { padding: 4px 0; }
.dashboard-first-run-cta { margin-top: 4px; }

.dashboard-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.nav-item {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-disabled { background: var(--panel-2); color: var(--fg-faint); }
.nav-label { font-weight: 600; }
.nav-hint { font-size: 12px; }

.dashboard-status {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 24px;
}
.dashboard-status-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.dashboard-status-head h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0; }
.dashboard-disclaimer { text-align: center; font-size: 12.5px; }

a.nav-item.nav-link { color: var(--fg); }
a.nav-item.nav-link:hover {
  border-color: var(--accent);
  color: var(--fg);
  background: var(--panel-hover);
  text-decoration: none;
}

/* ── Status fragment ───────────────────────────────────────────────────── */
.status-list { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 0; padding: 0; }
.status-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.status-row:last-child { border-bottom: 0; }
.status-row dt { font-weight: 500; color: var(--fg-soft); margin: 0; }
.status-row dd { margin: 0; font-variant-numeric: tabular-nums; }
.status-ok { color: var(--ok); font-weight: 600; }
.status-degraded { color: var(--degraded); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUDITS pages (list / new / detail)
   ═══════════════════════════════════════════════════════════════════════════ */

.page { margin-top: 4px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.page-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 0; flex: 1; }
.page-head .back-link { font-size: 13px; }
.page-disclaimer { text-align: center; font-size: 12.5px; margin-top: 36px; }

.empty-state {
  text-align: center;
  padding: 56px 20px;
  background: var(--panel-2);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}
.empty-state h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 8px; }

.audit-projects { list-style: none; padding: 0; margin: 0; }
.audit-project-row {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--panel);
  transition: border-color 0.14s, background 0.14s;
}
.audit-project-row:hover { border-color: var(--rule-strong); background: var(--panel-hover); }
.audit-project-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  color: var(--fg);
}
.audit-project-link:hover { text-decoration: none; }
.audit-project-title { flex: 1; font-weight: 600; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--rule);
  background: var(--panel-2);
  color: var(--fg-muted);
}
.badge-status { background: var(--accent-soft); color: #AFC6F7; border-color: rgba(91,141,239,0.3); }
.badge-category { background: var(--panel-2); color: var(--fg-soft); }
.badge-storage { background: var(--panel-2); }
.badge-extraction { background: var(--panel-2); }
.badge-severity-high { background: var(--sev-high-bg); color: var(--sev-high); border-color: rgba(229,72,77,0.4); }
.badge-severity-medium { background: var(--sev-medium-bg); color: var(--sev-medium); border-color: rgba(224,163,58,0.4); }
.badge-severity-low { background: var(--sev-low-bg); color: var(--sev-low); border-color: rgba(91,141,239,0.35); }
.badge-severity-info { background: var(--sev-info-bg); color: var(--sev-info); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.audit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  padding: 26px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.audit-form label { font-size: 12px; font-weight: 600; color: var(--fg-muted); margin-top: 8px; }
.audit-form input,
.audit-form select,
.audit-form textarea {
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--fg);
}
.audit-form input:focus,
.audit-form select:focus,
.audit-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.audit-detail-description {
  margin: 16px 0 24px;
  color: var(--fg-soft);
  background: var(--panel);
  padding: 15px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.detail-section {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.detail-section h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; margin: 0 0 14px; }

.offer-list, .finding-list, .comparison-list { list-style: none; padding: 0; margin: 0; }
.offer-list li, .finding-list li, .comparison-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.offer-list li:last-child, .finding-list li:last-child, .comparison-list li:last-child { border-bottom: 0; }

.evidence {
  margin: 8px 0 0 12px;
  padding: 8px 14px;
  border-left: 2px solid var(--rule-strong);
  font-style: italic;
  color: var(--fg-soft);
}
.amount { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gold); }

/* ── Offer upload (Phase 2-B) ──────────────────────────────────────────── */
.upload-form { margin-top: 16px; }
.upload-form h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.upload-form input[type="file"] {
  background: var(--panel-2);
  color: var(--fg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 8px;
}
.upload-hint { font-size: 12.5px; margin: 4px 0 8px; }
.offer-sha { font-family: var(--mono); font-size: 12px; color: var(--fg-faint); }

/* ── Extraction (Phase 2-C) ────────────────────────────────────────────── */
.offer-row { padding: 14px 0; }
.offer-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.extract-form { display: flex; gap: 12px; align-items: baseline; margin: 8px 0 4px; }
.extract-button { padding: 5px 12px; font-size: 13px; }
.extract-hint { font-size: 12px; }
.extracted-pages {
  margin-top: 8px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.extracted-pages summary { cursor: pointer; font-weight: 600; color: var(--fg-soft); font-size: 13px; }
.extracted-page-list { list-style: decimal; padding-left: 24px; margin: 8px 0 0; }
.extracted-page { margin: 6px 0; }
.extracted-page-head { font-size: 12px; }
.extracted-page-text {
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  color: var(--fg-soft);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule-soft);
  margin: 4px 0 0;
  max-height: 180px;
  overflow: auto;
}
.extracted-text-page-body {
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg-soft);
}

/* ── Findings (Phase 2-D) ──────────────────────────────────────────────── */
.findings-run-form { display: flex; gap: 12px; align-items: baseline; margin: 4px 0; }
.findings-run-button { padding: 5px 12px; font-size: 13px; }
.findings-run-hint { font-size: 12px; }
.findings-disclaimer { font-size: 12px; margin: 0 0 12px; font-style: italic; color: var(--fg-muted); }
.finding-row { padding: 14px 0 16px; }
.finding-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.finding-title { font-size: 15px; font-weight: 600; }
.finding-info-badge { background: var(--sev-info-bg); color: var(--fg-muted); font-size: 11px; }
.finding-description { margin: 4px 0 8px; color: var(--fg-soft); }
.finding-evidence {
  margin: 8px 0 0 0;
  padding: 10px 14px;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: var(--fg-soft);
}
.finding-evidence-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.finding-evidence-meta { font-size: 12px; margin-top: 4px; color: var(--fg-faint); }
.finding-rule { font-size: 12px; margin-top: 4px; }
.finding-rule code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* ── Comparison / Preisspiegel (Phase 2-E) ─────────────────────────────── */
.comparison-link { margin-left: auto; padding: 5px 12px; font-size: 13px; }
.comparison-disclaimer { font-size: 13px; font-style: italic; margin: 0 0 16px; color: var(--fg-muted); }
.comparison-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
}
.comparison-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.comparison-table th, .comparison-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.comparison-table thead th {
  background: var(--panel-2);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}
.comparison-table tbody tr:last-child td { border-bottom: 0; }
.comparison-table .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.comparison-filename { font-size: 12px; font-family: var(--mono); color: var(--fg-faint); }
.comparison-items-section, .comparison-add-section { margin-top: 24px; }
.comparison-offer-block { margin-bottom: 16px; }
.comparison-offer-block h3 { font-family: var(--serif); font-size: 18px; margin: 0 0 6px; }
.comparison-item-row { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
.comparison-item-row:last-child { border-bottom: 0; }
.comparison-item-notes { margin-top: 4px; font-size: 13px; color: var(--fg-soft); }
.comparison-delete-form { display: inline; margin-left: 12px; }
.comparison-delete-button { padding: 3px 9px; font-size: 12px; }
.comparison-hint { font-size: 12px; margin: 0 0 8px; }

/* ═══════════════════════════════════════════════════════════════════════════
   EVIDENCE REPORT (Phase 3-A / 3-B)
   ═══════════════════════════════════════════════════════════════════════════ */

.report-link { margin-left: 8px; padding: 5px 12px; font-size: 13px; }
.audit-report { background: var(--panel); padding: 28px; border: 1px solid var(--rule); border-radius: var(--radius); }
.report-head { border-bottom: 1px solid var(--rule); padding-bottom: 18px; margin-bottom: 26px; }
.report-brand { display: flex; align-items: baseline; gap: 12px; margin: 8px 0; }
.report-brand-name { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.report-brand-tagline { font-size: 13px; color: var(--fg-muted); }
.report-title { font-family: var(--serif); font-size: 30px; margin: 4px 0 0; }
.report-local-dev-label { font-size: 13px; margin: 4px 0 12px; font-style: italic; color: var(--fg-muted); }
.report-meta { display: flex; flex-wrap: wrap; gap: 24px; font-size: 14px; color: var(--fg-soft); }
.report-section { margin: 26px 0; padding-top: 8px; }
.report-section h2 { font-family: var(--serif); font-size: 23px; margin: 0 0 12px; }
.report-section h3 { font-family: var(--serif); font-size: 18px; margin: 12px 0 8px; }
.report-section-disclaimer { font-size: 13px; font-style: italic; margin: 0 0 12px; color: var(--fg-muted); }
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.report-card { background: var(--panel-2); padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--rule); }
.report-card-value { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.report-card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; color: var(--fg-muted); }
.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table th, .report-table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.report-table thead th { background: var(--panel-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); }
.report-table tbody tr:last-child td { border-bottom: 0; }
.report-filename { font-size: 12px; color: var(--fg-faint); }
.report-comparison-block { margin-bottom: 16px; }
.report-item-list { list-style: none; padding: 0; margin: 0; }
.report-item-list li { padding: 7px 0; border-bottom: 1px solid var(--rule-soft); }
.report-item-list li:last-child { border-bottom: 0; }
.report-item-notes { font-size: 13px; margin-top: 4px; color: var(--fg-soft); }
.report-severity-group { margin: 16px 0; }
.report-severity-count { font-size: 13px; color: var(--fg-muted); }
.report-finding-list { list-style: none; padding: 0; margin: 0; }
.report-finding { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); }
.report-finding:last-child { border-bottom: 0; }
.report-finding-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.report-finding-bidder { font-size: 13px; color: var(--fg-muted); }
.report-finding-description { margin: 4px 0 8px; font-size: 14px; color: var(--fg-soft); }
.report-finding-evidence {
  margin: 6px 0 0;
  padding: 10px 14px;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: var(--fg-soft);
}
.report-finding-evidence-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; color: var(--fg-muted); }
.report-finding-evidence-meta { font-size: 12px; margin-top: 6px; color: var(--fg-faint); }
.report-invalid-findings { font-size: 13px; color: var(--fg-muted); }
.report-limits-list { list-style: disc; padding-left: 24px; margin: 0; font-size: 14px; color: var(--fg-soft); }
.report-limits-list li { padding: 2px 0; }
.report-footer-disclaimer { margin-top: 24px; font-size: 13px; font-style: italic; color: var(--fg-muted); }

.report-pdf-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0 4px; padding: 8px 0; }
.report-pdf-generate-form { margin: 0; }
.report-pdf-generate-button { padding: 7px 15px; font-size: 14px; }
.report-pdf-download-link { padding: 7px 15px; font-size: 14px; }
.report-pdf-export-note { font-size: 12px; font-style: italic; color: var(--fg-faint); }
.report-pdf-status { font-size: 13px; margin: 8px 0 0; }
.report-pdf-billing-link { margin-left: 8px; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   BILLING (Phase 3-C / 3-D)
   ═══════════════════════════════════════════════════════════════════════════ */

.billing-pricing { margin-top: 4px; }
.billing-pricing-subtitle { font-size: 14px; margin: 4px 0 0; flex-basis: 100%; color: var(--fg-soft); }
.billing-pricing-test-mode-label { font-size: 13px; margin: 8px 0 0; flex-basis: 100%; font-style: italic; color: var(--fg-muted); }

.billing-pricing-included {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 16px 0 8px;
}
.billing-pricing-included-title { font-family: var(--serif); font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.billing-pricing-included-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 16px;
  font-size: 14px;
  color: var(--fg-soft);
}
.billing-pricing-included-list li { padding-left: 20px; position: relative; }
.billing-pricing-included-list li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); font-weight: 700; }

.billing-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 24px 0; }
.billing-plan {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.billing-plan:hover { border-color: var(--rule-strong); }
.billing-plan-head { border-bottom: 1px solid var(--rule-soft); padding-bottom: 12px; margin-bottom: 6px; }
.billing-plan-head h2 { font-family: var(--serif); font-size: 23px; font-weight: 600; margin: 0 0 6px; }
.billing-plan-price { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.billing-plan-price-period { font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--fg-muted); }
.billing-plan-description { font-size: 13px; margin: 0 0 6px; color: var(--fg-muted); }
.billing-plan-features { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--fg-soft); }
.billing-plan-features li { padding: 5px 0; border-bottom: 1px solid var(--rule-soft); }
.billing-plan-features li:last-child { border-bottom: 0; }
.billing-plan-launch-discount { font-weight: 700; color: var(--teal); }
.billing-plan-form { margin: auto 0 0; }
.billing-plan-cta { width: 100%; margin-top: 8px; }
.billing-plan-cta:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.billing-status-list, .billing-account-section dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 6px 12px;
  margin: 16px 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px;
}
.billing-status-list dt { font-weight: 500; color: var(--fg-muted); }
.billing-status-list dd { margin: 0; font-variant-numeric: tabular-nums; }

.billing-account { margin-top: 4px; }
.billing-account-test-mode, .billing-invoices-test-mode { font-size: 13px; margin: 8px 0 0; flex-basis: 100%; font-style: italic; color: var(--fg-muted); }
.billing-account-section { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; margin: 16px 0; }
.billing-account-section h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.billing-credits { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.billing-credit-card { background: var(--panel-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 16px 18px; }
.billing-credit-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fg-muted); }
.billing-credit-value { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; margin-top: 4px; }
.billing-credit-of { font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--fg-muted); }
.billing-credit-used { font-size: 12px; margin-top: 4px; color: var(--fg-faint); }
.billing-actions .billing-action-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.billing-action-link, .billing-portal-button { padding: 9px 16px; font-size: 14px; }
.billing-portal-form { margin: 0; }
.billing-portal-button:disabled { opacity: 0.5; cursor: not-allowed; }
.billing-action-hint { font-size: 13px; margin-top: 8px; font-style: italic; color: var(--fg-muted); }

.billing-invoices { margin-top: 4px; }
.billing-invoices-empty {
  background: var(--panel-2);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  padding: 36px 16px;
  text-align: center;
  font-size: 14px;
  font-style: italic;
  color: var(--fg-muted);
}
.billing-invoices-table-wrapper { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }
.billing-invoices-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.billing-invoices-table th, .billing-invoices-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.billing-invoices-table thead th { background: var(--panel-2); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); }
.billing-invoices-table tbody tr:last-child td { border-bottom: 0; }
.billing-invoice-id { font-size: 12px; font-family: var(--mono); color: var(--fg-faint); }
.billing-invoice-created { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--fg-faint); }
.billing-invoice-links a { margin-right: 10px; font-size: 13px; }
.billing-invoice-links a:last-child { margin-right: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
  }
  .sidebar-brand { padding: 0 12px 0 4px; font-size: 20px; }
  .sidebar-section-label { display: none; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar-link { padding: 7px 10px; font-size: 13px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .sidebar-user { display: none; }
  .app-content { padding: 20px; }
  .app-topbar { padding: 0 18px; }
  .hero-title { font-size: 34px; }
}

@media (max-width: 720px) {
  .dashboard-meta { grid-template-columns: 1fr; }
  .dashboard-nav { grid-template-columns: 1fr; }
  .billing-plans { grid-template-columns: 1fr; }
  .billing-status-list { grid-template-columns: 1fr; }
  .billing-credits { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .billing-actions .billing-action-row { flex-direction: column; align-items: stretch; }
  .billing-action-link, .billing-portal-button { width: 100%; text-align: center; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT — strip chrome, white paper, keep audit-essential content
   (PROD-PRODUCT-F4-UX-POLISH Q-5). The PDF generator path
   (reports/pdf.py + report_pdf.html) has its own print template.
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  @page { margin: 1.5cm; }

  body, html {
    background: white !important;
    background-image: none !important;
    color: black !important;
  }

  /* Hide app chrome that has no place on paper. */
  body > .dev-banner,
  body > .foot,
  .app-sidebar,
  .app-topbar,
  .audit-report .back-link,
  .audit-report .report-pdf-actions,
  .audit-report .report-pdf-status,
  .audit-report .report-pdf-billing-link,
  .audit-report form[method="post"] {
    display: none !important;
  }

  .app-shell { display: block; }
  .app-content { padding: 0; max-width: none; }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body { font-size: 11pt; line-height: 1.4; }

  .audit-report { max-width: none; margin: 0; padding: 0; border: 0; background: white !important; }

  .report-finding, .report-comparison-block, .report-card { break-inside: avoid; page-break-inside: avoid; }
  .report-section h2, .report-section h3 { break-after: avoid; page-break-after: avoid; }

  .report-finding-evidence, .extracted-text-page-body {
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 2pt solid #888;
    padding-left: 0.5em;
  }

  .report-section-disclaimer,
  .page-disclaimer,
  .report-footer-disclaimer,
  .report-invalid-findings { display: block !important; }
}
