/* Licia — "expediente, modernizado".
   Ink-petrol primary on cool paper, wax-seal accent for the brand,
   rubber-stamp verdicts, mono for expedientes/CPV/amounts. */

:root {
  --ink: #1e2a32;
  --paper: #f1f3f3;
  --surface: #ffffff;
  --line: #dbe1e4;
  --line-soft: #e9edef;
  --muted: #5d6e78;
  --primary: #1c4557;
  --primary-strong: #143240;
  --primary-tint: #e7eef1;
  --seal: #a63d2f;
  --seal-bright: #c1553f;
  --go: #17714a;
  --go-bg: #e6f2eb;
  --nogo: #ae3327;
  --nogo-bg: #f8ecea;
  --review: #8a6400;
  --review-bg: #f9f1db;
  --sidebar-bg: #10222c;
  --sidebar-fg: #c7d3d9;
  --sidebar-dim: #7d93a0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 45, 0.06);
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::selection { background: rgba(28, 69, 87, 0.2); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: #eef1f2;
  border-radius: 4px;
  padding: 2px 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 8px;
}
.skip-link:focus { left: 8px; }

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

.shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  padding: 26px 18px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  padding: 2px 8px 22px;
}
.brand:hover { text-decoration: none; }

.brand-seal {
  width: 42px;
  height: 42px;
  flex: none;
  color: var(--seal-bright);
  transform: rotate(-8deg);
}

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: #f2f5f6;
  line-height: 1.1;
}
.brand-name em { font-style: italic; color: var(--seal-bright); }

.brand-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-dim);
  margin-top: 4px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-fg);
  font-weight: 500;
  font-size: 14px;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.8; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--seal-bright);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--sidebar-dim);
}
.sidebar-sources { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; }
.sidebar-foot p { margin: 0 0 8px; }

.content {
  padding: 30px 38px 48px;
  max-width: 1240px;
  width: 100%;
}

/* ----------------------------------------------------------- page header */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--seal);
  margin: 0 0 6px;
}

.page-header h1 { font-size: 29px; line-height: 1.15; }

.page-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  white-space: nowrap;
}
.sync-chip svg { width: 13px; height: 13px; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card--flush { padding: 0; overflow: hidden; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 18px; }
.card-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.card-link { font-size: 13px; font-weight: 500; white-space: nowrap; }

.grid-2 { display: grid; gap: 20px; margin-bottom: 0; }
.grid-2--main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid-2 > .card { margin-bottom: 20px; }
.stack > .card { margin-bottom: 20px; }

/* ------------------------------------------------------------------ KPIs */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi { margin-bottom: 0; padding: 16px 18px 14px; }

.kpi-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  margin: 6px 0 2px;
  font-size: 33px;
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.kpi--go .kpi-value { color: var(--go); }

.kpi-hint { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- funnel */

.funnel { display: flex; flex-direction: column; gap: 11px; }

.funnel-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.funnel-label { color: var(--muted); }
.funnel-track {
  height: 10px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}
.funnel-bar {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  min-width: 0;
}
.funnel-count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- stamps */

.stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  line-height: 1;
  border: 2px solid currentColor;
  border-radius: 5px;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.stamp--go { color: var(--go); background: var(--go-bg); }
.stamp--nogo { color: var(--nogo); background: var(--nogo-bg); }
.stamp--review { color: var(--review); background: var(--review-bg); }
.stamp--draft { color: var(--primary); background: var(--primary-tint); }

.stamp--sm { font-size: 10px; padding: 4px 8px; border-width: 1.5px; }
.stamp--md { font-size: 11px; padding: 5px 10px; }
.stamp--lg {
  font-size: 13px;
  padding: 7px 14px;
  box-shadow: 0 0 0 2.5px var(--surface), 0 0 0 4px currentColor;
  margin: 4px 6px 4px 0;
}
.stamp--xl {
  font-size: 16px;
  padding: 10px 18px;
  border-width: 2.5px;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px currentColor;
  margin: 6px 8px 6px 2px;
}

/* -------------------------------------------------------- badges & chips */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--open { color: var(--go); background: var(--go-bg); }
.badge--hold { color: var(--review); background: var(--review-bg); }
.badge--closed { color: var(--muted); background: var(--line-soft); }
.badge--off { color: var(--nogo); background: var(--nogo-bg); }
.badge--neutral { color: var(--muted); background: var(--line-soft); }

.chip-exp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  background: #eef1f2;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.chip-cpv {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: #eef1f2;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  margin: 0 6px 4px 0;
}

.chip-days {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--line-soft);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}
.chip-days--soon { color: var(--review); background: var(--review-bg); }
.chip-days--urgent { color: var(--nogo); background: var(--nogo-bg); }

/* ---------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; }

.table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f7f9f9; }
.table--compact td { padding: 8px 12px; font-size: 13px; }

.row-clickable { cursor: pointer; }
.row-link { color: var(--ink); font-weight: 500; }
.row-link:hover { color: var(--primary); }

.t-right { text-align: right; }
.t-mono { font-family: var(--font-mono); font-size: 0.95em; font-variant-numeric: tabular-nums; }
.t-muted { color: var(--muted); }
.t-break { word-break: break-all; }
.ok-mark { color: var(--go); font-weight: 600; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .table { min-width: 560px; }
.table-scroll .table--compact { min-width: 480px; }

.result-count { font-size: 13px; color: var(--muted); margin: 0 2px 12px; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--primary-strong); border-color: var(--primary-strong); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--ghost {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
.btn--ghost:hover { background: var(--paper); border-color: #c8d1d5; }

.btn--sm { font-size: 12.5px; padding: 6px 12px; }

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.label-hint { font-weight: 400; color: var(--muted); }

.field input,
.field select,
.field textarea {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
}
.field textarea { resize: vertical; line-height: 1.5; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 69, 87, 0.14);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  padding: 16px 18px;
}
.field--grow { flex: 1 1 260px; }
.filter-bar .field { min-width: 130px; }
.field--actions { flex-direction: row; align-items: flex-end; gap: 8px; min-width: auto; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.profile-form { display: flex; flex-direction: column; gap: 15px; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ----------------------------------------------------------------- flash */

.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-radius: var(--radius);
  border: 1px solid;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
}
.flash--success { color: var(--go); background: var(--go-bg); border-color: #bfdccb; }
.flash--error { color: var(--nogo); background: var(--nogo-bg); border-color: #e5c0ba; }
.flash--warning { color: var(--review); background: var(--review-bg); border-color: #e4d3a4; }
.flash--info { color: var(--primary); background: var(--primary-tint); border-color: #c3d4dc; }

.flash-close {
  flex: none;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* ------------------------------------------------------------- dashboard */

.verdict-list, .deadline-list, .source-list, .profile-list, .req-list, .action-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.action-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.action-list li:last-child { border-bottom: none; }
.action-list .stamp { flex: none; min-width: 74px; text-align: center; }
.action-list .chip-days { flex: none; margin-left: auto; min-width: 64px; text-align: center; }
.action-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.action-body a { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.action-hint { font-size: 11.5px; color: var(--muted); }

.card-foot-hint {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.verdict-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.verdict-item:last-child { border-bottom: none; }
.verdict-item .stamp { flex: none; min-width: 74px; text-align: center; }
.verdict-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.verdict-body a { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.verdict-meta { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }

.deadline-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.deadline-list li:last-child { border-bottom: none; }
.deadline-list .chip-days { flex: none; min-width: 64px; text-align: center; }
.deadline-body { display: flex; flex-direction: column; gap: 1px; }
.deadline-body a { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.deadline-date { font-size: 11.5px; color: var(--muted); }

.source-list li {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.source-list li:last-child { border-bottom: none; }
.source-code { font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.source-name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-sync { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------ onboarding */

.onboarding h2 { font-size: 22px; margin-bottom: 8px; }
.onboarding > p { color: var(--muted); max-width: 62ch; margin: 0 0 18px; }

.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.onboarding-steps li { display: flex; gap: 12px; align-items: flex-start; }

.step-num {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--seal);
  border: 1.5px solid var(--seal);
  border-radius: 50%;
}
.step-title { margin: 3px 0 6px; font-weight: 600; font-size: 14px; }
.step-body { margin: 0; font-size: 13px; color: var(--muted); }
.onboarding-steps code {
  display: inline-block;
  background: var(--sidebar-bg);
  color: #d8e2e7;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 12px;
  max-width: 100%;
  overflow-x: auto;
}

.pipeline-help {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
}
.pipeline-help summary { cursor: pointer; font-weight: 500; color: var(--primary); }
.pipeline-help ol { margin: 12px 0 8px; padding-left: 22px; }
.pipeline-help li { margin-bottom: 4px; }

/* --------------------------------------------------------- tender detail */

.breadcrumb { font-size: 13.5px; margin-bottom: 14px; }

.dossier-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.dossier-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.dossier-title { font-size: 25px; line-height: 1.25; margin-bottom: 4px; }
.dossier-body-org { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }

.dossier-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px 22px;
  margin: 0 0 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.dossier-meta dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.dossier-meta dd { margin: 0; font-size: 14px; }
.dossier-amount { font-size: 17px; font-weight: 600; }

.dossier-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.dossier-dups { color: var(--muted); }

.dossier-summary {
  margin: 16px 0 0;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  max-width: 90ch;
}

.actions form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.actions-profile { min-width: 260px; }
.actions-buttons { display: flex; flex-wrap: wrap; gap: 9px; }

.notice {
  background: var(--review-bg);
  color: var(--review);
  border: 1px solid #e4d3a4;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin: 0 0 14px;
}

/* requirements */

.req-item { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.req-item:last-child { border-bottom: none; }

.req-head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }

.req-chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.req-chip--technical_solvency { color: #2b5b8a; background: #e7eef6; }
.req-chip--economic_solvency { color: #5b4a8a; background: #eee9f6; }
.req-chip--classification { color: #8a5a2b; background: #f7ede2; }
.req-chip--guarantee { color: var(--muted); background: var(--line-soft); }
.req-chip--award_criterion { color: var(--go); background: var(--go-bg); }
.req-chip--exclusion { color: var(--nogo); background: var(--nogo-bg); }
.req-chip--deadline { color: var(--review); background: var(--review-bg); }
.req-chip--other { color: var(--muted); background: var(--line-soft); }

.req-confidence { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.req-desc { margin: 0; font-size: 14px; }
.req-missing-cites { font-size: 12px; margin: 6px 0 0; }

.citations { margin-top: 8px; }
.citations summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 500; }
.citation { margin: 10px 0 0; }
.citation figcaption {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.citation blockquote {
  margin: 0;
  padding: 10px 13px;
  background: #f7f8f8;
  border-left: 3px solid var(--line);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  white-space: pre-wrap;
}

/* assessment & drafts */

.assessment-head { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; }
.assessment-meta { margin: 0; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.assessment-summary { font-size: 14.5px; max-width: 90ch; margin: 0 0 14px; }

.raw-block,
.draft-content {
  background: #f7f8f8;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 480px;
  overflow: auto;
  margin: 0;
}

.draft-view { margin-top: 12px; }
.draft-view summary { cursor: pointer; font-size: 13px; color: var(--primary); font-weight: 500; margin-bottom: 8px; }

.ai-disclaimer {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin: 6px 0 20px;
}

/* --------------------------------------------------------------- profile */

.grid-profile { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }

.profile-list li a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--ink);
}
.profile-list li a:hover { background: var(--paper); text-decoration: none; }
.profile-list li.is-active a { background: var(--primary-tint); }
.profile-name { display: block; font-weight: 600; font-size: 14px; }
.profile-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.profile-new { margin-top: 10px; }

/* ------------------------------------------------------------ empty state */

.empty { text-align: center; padding: 26px 14px; }
.empty-title { margin: 0 0 5px; font-weight: 600; font-size: 14.5px; }
.empty-body { margin: 0 auto 12px; color: var(--muted); font-size: 13.5px; max-width: 46ch; }
.empty code { display: inline-block; margin-top: 2px; }

/* ----------------------------------------------------------- busy overlay */

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(16, 34, 44, 0.55);
}
.busy-overlay[hidden] { display: none; }

.busy-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 30px 40px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(10, 22, 30, 0.35);
  max-width: 340px;
}
.busy-card p { margin: 0; font-weight: 600; font-size: 15px; }
.busy-hint { margin-top: 6px !important; font-weight: 400 !important; font-size: 12.5px !important; color: var(--muted); }

.busy-spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  /* minmax(0, …) everywhere: bare 1fr floors at min-content and lets
     tables/code blocks inside the cards widen the column past the viewport. */
  .grid-2--main { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .onboarding-steps { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  /* minmax(0, …): a bare 1fr floors at min-content, letting wide tables
     blow the column past the viewport instead of scrolling inside it. */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    padding: 12px 16px;
  }
  .brand { padding: 4px 0; }
  .brand-tag { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item.is-active { box-shadow: inset 0 -3px 0 var(--seal-bright); }
  /* Keep the session (user + logout) reachable; hide only the fine print. */
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border-top: none; }
  .sidebar-foot p { display: none; }
  .sidebar-session { margin-top: 0; padding-top: 0; border-top: none; }
  .content { padding: 20px 18px 40px; }
  .grid-profile { grid-template-columns: minmax(0, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  /* Inputs below 16px trigger automatic zoom-on-focus in iOS Safari. */
  .field input, .field select, .field textarea { font-size: 16px; }
}

@media (max-width: 560px) {
  .content { padding: 16px 12px 36px; }
  .card { padding: 16px; }
  .card--flush { padding: 0; }
  .page-header h1 { font-size: 24px; }
  .dossier-title { font-size: 21px; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi-value { font-size: 28px; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .funnel-row { grid-template-columns: 110px minmax(0, 1fr) 36px; }
  .dossier-top { flex-direction: column; }
  .assessment-head { flex-wrap: wrap; gap: 12px; }
  .actions-profile { width: 100%; min-width: 0; }
  .actions-buttons { width: 100%; }
  .actions-buttons .btn { flex: 1 1 auto; justify-content: center; }
  .form-actions, .onb-actions { flex-wrap: wrap; }
  .onb-head { flex-wrap: wrap; }
  .chip-exp { max-width: 150px; }
  .table th, .table td { padding: 8px 10px; }
  .busy-card { margin: 0 16px; padding: 24px 22px; }
}

/* Comfortable touch targets on touch-first devices. */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn--sm { min-height: 38px; }
  .nav-item { min-height: 44px; }
  .flash-close { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------ session & job queue */

.sidebar-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}
.sidebar-user { font-weight: 600; font-size: 12.5px; overflow-wrap: anywhere; }

.notice--progress {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  width: 100%;
}
.notice--error { background: #f7e4e1; color: #8c2f23; border-color: #e0b7b0; }
.actions .notice { flex-basis: 100%; }

.busy-spinner--sm {
  width: 16px;
  height: 16px;
  margin: 0;
  border-width: 2px;
  flex: none;
}

/* ------------------------------------------------- onboarding wizard */

.onb-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.onb-card { width: min(720px, 100%); }

.onb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.onb-brand { display: flex; align-items: center; gap: 12px; }
.onb-brand svg { width: 44px; height: 44px; flex: none; color: var(--seal); transform: rotate(-8deg); }
.onb-brand .brand-name { color: var(--ink); }
.onb-brand .brand-name em { color: var(--seal); }
.onb-brand .brand-tag { color: var(--muted); }

.onb-progress {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.onb-progress li {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
}
.onb-progress li.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.onb-progress li.is-done {
  border-color: var(--go);
  background: var(--go-bg);
  color: var(--go);
}

.onb-card h1 { font-size: 26px; margin-bottom: 6px; }
.onb-error { margin-bottom: 16px; }
.onb-steps { margin-top: 18px; }
.onb-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.onb-card .field { margin-bottom: 14px; }

.onb-tips { margin: 14px 0 6px; padding-left: 18px; display: grid; gap: 8px; }
.onb-tips li { font-size: 13.5px; color: var(--muted); }
.onb-tips strong { color: var(--ink); }

.onb-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}
.onb-skip-form { margin-left: auto; }
.onb-skip {
  margin-left: auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: underline;
}
.onb-skip:hover { color: var(--ink); }
.onb-skip-form .onb-skip { margin-left: 0; }

/* ------------------------------------------------------- dashboard tour */

.page-header-side { display: flex; align-items: center; gap: 10px; }

/* The dark layer is the backdrop itself with a clip-path hole cut over the
   target (computed in tour.js): a huge spotlight box-shadow would be culled
   by the compositor after scrolling. */
.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(16, 34, 44, 0.55);
  transition: clip-path 0.25s ease;
}
.tour-backdrop[hidden] { display: none; }

.tour-spotlight {
  position: fixed;
  z-index: 301;
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--seal-bright);
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.tour-spotlight[hidden] { display: none; }

.tour-pop {
  position: fixed;
  z-index: 302;
  width: min(360px, calc(100vw - 24px));
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(10, 22, 30, 0.35);
  padding: 18px 20px 16px;
  transition: top 0.25s ease, left 0.25s ease;
}
.tour-pop[hidden] { display: none; }
.tour-pop:focus { outline: none; }

.tour-title { font-size: 17px; margin-bottom: 6px; padding-right: 22px; }
.tour-body { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }

.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-progress {
  margin-right: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.tour-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  padding: 4px;
}
.tour-close:hover { color: var(--ink); }
