/* Alpago Procurement Intelligence - UI
   Dark glass, restrained palette, numbers first. */

:root {
  /* Drawing office at night: ink-navy ground under a faint drafting grid, frosted panels,
     copper (the MEP trade's own metal) reserved for the one primary action on each screen. */
  --bg: #090e18;
  --bg-2: #0d1524;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.075);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --stroke: rgba(196, 214, 240, 0.09);
  --stroke-strong: rgba(196, 214, 240, 0.17);
  --text: #e9eef5;
  --text-2: #b9c4d2;
  --muted: #8693a6;
  --accent: #93b4e2;          /* steel: links, info, focus */
  --accent-ink: #0b1526;
  --accent-soft: rgba(147, 180, 226, 0.13);
  --copper: #d98b5d;          /* brand / primary action */
  --copper-2: #f0a77a;
  --copper-ink: #1d1008;
  --copper-soft: rgba(217, 139, 93, 0.14);
  --ok: #7cc4a4;
  --ok-soft: rgba(124, 196, 164, 0.13);
  --warn: #e6c463;
  --warn-soft: rgba(230, 196, 99, 0.13);
  --bad: #e8898a;
  --bad-soft: rgba(232, 137, 138, 0.13);
  --grid-line: rgba(147, 180, 226, 0.045);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 60px -28px rgba(0, 0, 0, 0.75);
  --blur: blur(22px) saturate(140%);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "SFMono-Regular", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1100px 700px at 8% -10%, rgba(52, 88, 140, 0.38), transparent 60%),
    radial-gradient(900px 650px at 108% 10%, rgba(217, 139, 93, 0.10), transparent 60%),
    radial-gradient(1000px 800px at 50% 125%, rgba(52, 66, 104, 0.30), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
body::after {   /* drafting grid */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 0%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse at 30% 0%, #000 0%, transparent 75%);
}
::selection { background: rgba(143, 179, 232, 0.35); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 600; letter-spacing: 0; text-wrap: balance; }
h1 { font-size: 28px; font-weight: 600; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
svg { width: 16px; height: 16px; flex: none; vertical-align: middle; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; letter-spacing: 0.02em; }
.upper { text-transform: uppercase; letter-spacing: 0.1em; font-size: 11px; color: var(--muted); font-weight: 600; font-family: var(--font-display); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.gap-s { gap: 6px; } .gap-l { gap: 20px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mt-l { margin-top: 28px; }
.hidden { display: none !important; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- glass ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
}
.panel { padding: 20px 22px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head p { margin: 2px 0 0; }
.divider { height: 1px; background: var(--stroke); margin: 16px 0; border: 0; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px;
  border-right: 1px solid var(--stroke);
  background: rgba(10, 16, 28, 0.55);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, var(--copper-2), var(--copper));
  display: grid; place-items: center; color: var(--copper-ink); font-weight: 700; font-family: var(--font-display); font-size: 17px;
  box-shadow: 0 8px 22px -8px rgba(217, 139, 93, 0.7);
}
.brand-name { font-family: var(--font-display); font-weight: 650; line-height: 1.15; font-size: 14.5px; }
.brand-sub { color: var(--muted); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 10px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--glass-hover); color: var(--text); }
.nav a { transition: background 0.2s, color 0.2s; }
.nav a.active { background: var(--glass-strong); color: var(--text); box-shadow: inset 2px 0 0 var(--copper); }
.nav a.active svg { color: var(--copper-2); opacity: 1; }
.nav svg { width: 17px; height: 17px; opacity: 0.85; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--stroke); }
.main { padding: 30px 40px 64px; min-width: 0; }
.page { max-width: 1320px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--stroke-strong); background: var(--glass);
  color: var(--text); font: inherit; font-weight: 550; padding: 8px 14px; border-radius: 10px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:hover { background: var(--glass-hover); border-color: rgba(255, 255, 255, 0.26); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--copper-2), var(--copper)); color: var(--copper-ink); border-color: transparent; box-shadow: 0 8px 20px -10px rgba(217, 139, 93, 0.8); }
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--copper-2), var(--copper)); }
.btn:focus-visible, .seg button:focus-visible, a:focus-visible, .dept-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ok { background: rgba(124, 196, 164, 0.18); border-color: rgba(124, 196, 164, 0.45); }
.btn.danger { background: var(--bad-soft); border-color: rgba(229, 140, 140, 0.45); color: #f6d0d0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--glass-hover); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.btn svg { width: 16px; height: 16px; }
.btn .spinner { width: 14px; height: 14px; }

/* ---------- forms ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span:first-child { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.help { font-size: 12px; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: rgba(5, 9, 17, 0.45);
  border: 1px solid var(--stroke-strong); border-radius: 9px; padding: 8px 11px; outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(147, 180, 226, 0.18); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; }
select option { background: #111a2b; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; flex: none; padding: 0; accent-color: var(--accent); box-shadow: none; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(5, 9, 17, 0.3); cursor: pointer; }
.check:hover { border-color: var(--stroke-strong); }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 11px; background: rgba(5, 9, 17, 0.45); border: 1px solid var(--stroke); flex-wrap: wrap; }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 550;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.seg button:hover { color: var(--text); background: var(--glass-hover); }
.seg button.on { background: #dfe8f6; color: var(--accent-ink); }
.seg button:disabled { cursor: not-allowed; opacity: 0.6; }

.rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rating button {
  appearance: none; font: inherit; border: 1px solid var(--stroke); background: rgba(5, 9, 17, 0.35); color: var(--text-2);
  border-radius: 10px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.rating button b { font-size: 17px; color: var(--text); font-family: var(--font-display); }
.rating button span { font-size: 11px; }
.rating button.on { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; border: 1px solid var(--stroke); background: var(--glass); color: var(--text-2); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.plain::before { display: none; }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(124, 196, 164, 0.3); }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(230, 196, 99, 0.3); }
.pill.bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(229, 140, 140, 0.3); }
.pill.info { color: var(--accent); background: var(--accent-soft); border-color: rgba(143, 179, 232, 0.3); }
.pill.example { color: #c9d4e4; background: rgba(201, 212, 228, 0.08); border-style: dashed; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--stroke); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; background: rgba(5, 9, 17, 0.55); position: sticky; top: 0; z-index: 1; backdrop-filter: var(--blur); }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
td.num, th.num { text-align: right; }
tr.total td { font-weight: 650; background: rgba(255, 255, 255, 0.04); }
td input, td select { padding: 5px 8px; border-radius: 7px; font-size: 13px; }
.cell-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.best { color: var(--ok); font-weight: 650; }
.imputed { color: var(--warn); }

/* ---------- list rows ---------- */
.req-row {
  display: grid; grid-template-columns: minmax(0, 2.4fr) 1.1fr 0.7fr 1.6fr 0.9fr; gap: 16px; align-items: center;
  padding: 16px 20px; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.req-row:hover { background: var(--glass-hover); border-color: var(--stroke-strong); }
.project-card { cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.project-card:hover { background: var(--glass-hover); border-color: var(--stroke-strong); }
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-title { font-weight: 600; font-size: 15px; }

/* ---------- stepper ---------- */
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0 20px; }
.step {
  display: flex; gap: 11px; align-items: center; padding: 12px 14px; border-radius: 13px; cursor: pointer;
  border: 1px solid var(--stroke); background: var(--glass); transition: background 0.15s, border-color 0.15s; text-align: left;
  color: inherit; font: inherit;
}
.step:hover { background: var(--glass-hover); }
.step.active { border-color: rgba(143, 179, 232, 0.55); background: var(--accent-soft); }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--stroke-strong); color: var(--text-2); flex: none;
}
.step.done .step-num { background: var(--ok); color: #082016; border-color: transparent; }
.step.active .step-num { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.step-title { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.step-sub { font-size: 11.5px; color: var(--muted); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.workspace.full { grid-template-columns: minmax(0, 1fr); }
.workspace.full .aside { display: none; }
.aside { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }
.check-list { display: flex; flex-direction: column; gap: 7px; }
.check-item { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.dot { width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 1px; display: grid; place-items: center; border: 1px solid var(--stroke-strong); }
.dot.ok { background: var(--ok); border-color: transparent; }
.vrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--stroke); font-size: 12.5px; }
.vrow .chips { display: flex; gap: 4px; }
.chip { font-size: 10.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--stroke); color: var(--muted); }
.chip.ok { color: var(--ok); border-color: rgba(124, 196, 164, 0.35); background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: rgba(227, 178, 107, 0.35); background: var(--warn-soft); }
.dot.ok::after { content: ""; width: 7px; height: 4px; border-left: 2px solid #082016; border-bottom: 2px solid #082016; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--glass); font-size: 13px; }
.banner.info { border-color: rgba(143, 179, 232, 0.35); background: var(--accent-soft); }
.banner.warn { border-color: rgba(227, 178, 107, 0.35); background: var(--warn-soft); }
.banner.bad { border-color: rgba(229, 140, 140, 0.35); background: var(--bad-soft); }
.banner.ok { border-color: rgba(124, 196, 164, 0.35); background: var(--ok-soft); }
.banner .grow { color: var(--text); }

.issue { display: flex; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; border: 1px solid var(--stroke); background: rgba(5, 9, 17, 0.3); }
.issue .sev { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; padding-top: 2px; width: 64px; flex: none; }
.issue.critical .sev { color: var(--bad); }
.issue.warning .sev { color: var(--warn); }
.issue.info .sev { color: var(--accent); }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.dropzone {
  border: 1.5px dashed var(--stroke-strong); border-radius: 14px; padding: 22px; text-align: center; color: var(--text-2);
  background: rgba(5, 9, 17, 0.25); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { color: var(--text); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  appearance: none; font: inherit; border: 1px solid var(--stroke); background: var(--glass); color: var(--text-2);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 550; display: inline-flex; gap: 8px; align-items: center;
}
.tab.on { background: #dfe8f6; color: var(--accent-ink); border-color: transparent; }
.tab .mini { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.tab .mini.ok { background: var(--ok); }

.form-section { padding: 18px 0; border-top: 1px solid var(--stroke); display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
.form-section:first-child { border-top: 0; padding-top: 4px; }
.form-section h3 { margin-bottom: 4px; }

/* ---------- match decisions ---------- */
.decision { padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.decision .side { padding: 12px 14px; border-radius: 12px; background: rgba(5, 9, 17, 0.35); border: 1px solid var(--stroke); }
.decision .side .upper { margin-bottom: 4px; }
.decision .side .big { font-weight: 600; font-size: 14px; }
.decision .q { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.decision .q .ask { font-weight: 600; }
.decision.resolved { opacity: 0.86; }
.decision-head { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* ---------- result ---------- */
.hero { padding: 26px 28px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: auto -120px -160px auto; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 179, 232, 0.22), transparent 65%); pointer-events: none;
}
.hero-name { font-family: var(--font-display); font-size: 28px; font-weight: 650; line-height: 1.15; margin: 6px 0 8px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.kpi { padding: 12px 14px; border-radius: 12px; background: rgba(5, 9, 17, 0.35); border: 1px solid var(--stroke); }
.kpi .v { font-family: var(--font-display); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; font-variant-numeric: tabular-nums; }
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.vcard { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.vcard.rec { border-color: rgba(143, 179, 232, 0.55); box-shadow: var(--shadow), 0 0 0 1px rgba(143, 179, 232, 0.25) inset; }
.rank { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; background: var(--glass-strong); border: 1px solid var(--stroke); flex: none; }
.vcard.rec .rank { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, rgba(143, 179, 232, 0.65), var(--accent)); }
.bar-row { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; font-size: 12px; color: var(--text-2); }
.score-big { font-family: var(--font-display); font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.list { margin: 0; padding-left: 18px; }
.list li { margin: 4px 0; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary .chev { transition: transform 0.15s; display: inline-block; }
details[open] > summary .chev { transform: rotate(90deg); }

/* ---------- pdf review ---------- */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.pdf-frame { width: 100%; height: 76vh; border: 0; border-radius: 12px; background: #fff; }
.lines-scroll { max-height: 64vh; overflow: auto; }

/* ---------- overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: rgba(3, 6, 12, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.15s ease-out;
}
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 22px 24px; background: rgba(18, 26, 42, 0.82); }
.modal.wide { width: min(980px, 100%); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 15px; border-radius: 12px; background: rgba(18, 26, 42, 0.92); border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow); max-width: 420px; font-size: 13px; animation: fade 0.2s ease-out;
  backdrop-filter: var(--blur);
}
.toast.bad { border-color: rgba(229, 140, 140, 0.55); }
.toast.ok { border-color: rgba(124, 196, 164, 0.55); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18); border-top-color: var(--accent); animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.1), rgba(255,255,255,0.05)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(420px, 100%); padding: 32px 32px 28px; position: relative; animation: enter .7s var(--ease) both; }
.login h1 { font-size: 22px; margin-top: 18px; }
.login p { color: var(--muted); margin: 6px 0 22px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .aside { position: static; }
  .stepper { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .review { grid-template-columns: 1fr; }
  .form-section { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main { padding: 20px 16px; }
  .req-row { grid-template-columns: 1fr; gap: 6px; }
  .grid.c3, .grid.c4 { grid-template-columns: 1fr 1fr; }
  .decision { grid-template-columns: 1fr; }
}
input[type="range"] { accent-color: var(--accent); padding: 0; border: 0; background: transparent; box-shadow: none; }

div.field { display: flex; flex-direction: column; gap: 6px; }
div.field > span:first-child { font-size: 12.5px; color: var(--text-2); font-weight: 550; }

/* =====================================================================
   Welcome + department picker
   ===================================================================== */
.welcome { min-height: 100vh; display: grid; place-items: center; padding: 40px 24px; position: relative; overflow: hidden; }
.welcome-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.welcome-lines path, .welcome-lines line, .welcome-lines rect { fill: none; stroke: rgba(147, 180, 226, 0.22); stroke-width: 1; }
.welcome-lines .cu { stroke: rgba(217, 139, 93, 0.55); stroke-width: 1.4; }
.welcome-lines .draw { stroke-dasharray: var(--len, 1600); stroke-dashoffset: var(--len, 1600); animation: draw 2.2s var(--ease) forwards; }
.welcome-inner { position: relative; width: min(980px, 100%); display: flex; flex-direction: column; gap: 34px; }
.welcome-mark { display: flex; align-items: center; gap: 12px; }
.welcome-greet { font-family: var(--font-display); font-size: clamp(34px, 5.2vw, 58px); line-height: 1.04; font-weight: 600; letter-spacing: -0.005em; }
.welcome-greet .w { display: inline-block; opacity: 0; transform: translateY(18px); animation: rise 0.9s var(--ease) forwards; }
.welcome-greet .name { color: var(--copper-2); }
.welcome-sub { color: var(--text-2); font-size: 16px; max-width: 58ch; opacity: 0; animation: rise 0.8s var(--ease) 0.9s forwards; }
.dept-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dept-card {
  position: relative; text-align: left; font: inherit; color: var(--text); cursor: pointer; overflow: hidden;
  padding: 26px 26px 22px; border-radius: 20px; border: 1px solid var(--stroke-strong);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(26px) scale(0.98); animation: rise 0.9s var(--ease) forwards;
  transition: border-color 0.25s, transform 0.35s var(--ease), box-shadow 0.35s;
  display: flex; flex-direction: column; gap: 18px; min-height: 230px;
}
.dept-card::after {  /* copper sweep on hover */
  content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: linear-gradient(90deg, transparent, var(--copper), transparent);
  transform: scaleX(0); transition: transform 0.5s var(--ease);
}
.dept-card:hover { border-color: rgba(217, 139, 93, 0.55); transform: translateY(-4px); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(217, 139, 93, 0.15); }
.dept-card:hover::after { transform: scaleX(1); }
.dept-card.picked { animation: pick 0.6s var(--ease) forwards; border-color: var(--copper); }
.dept-card.faded { animation: fadeAway 0.45s var(--ease) forwards; }
.dept-code { font-family: var(--font-display); font-size: 64px; line-height: 0.9; font-weight: 700; letter-spacing: 0.02em; }
.dept-code small { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--muted); margin-top: 10px; text-transform: uppercase; }
.dept-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: auto; }
.dept-stats div { border-top: 1px solid var(--stroke); padding-top: 10px; }
.dept-stats b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dept-stats span { font-size: 11.5px; color: var(--muted); }
.dept-go { position: absolute; top: 24px; right: 24px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--stroke-strong); color: var(--text-2); transition: background 0.25s, color 0.25s, transform 0.35s var(--ease); }
.dept-card:hover .dept-go { background: var(--copper); color: var(--copper-ink); border-color: transparent; transform: translateX(3px); }
.welcome-foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; opacity: 0; animation: rise 0.6s var(--ease) 1.6s forwards; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes pick { 50% { transform: scale(1.02); } to { transform: scale(1.04); opacity: 0; } }
@keyframes fadeAway { to { opacity: 0; transform: translateY(10px) scale(0.97); } }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* page content enters with a short stagger (starts visible enough; transform-led) */
.enter > * { animation: enter 0.6s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: 0.05s; } .enter > *:nth-child(3) { animation-delay: 0.1s; }
.enter > *:nth-child(4) { animation-delay: 0.15s; } .enter > *:nth-child(5) { animation-delay: 0.2s; }
.enter > *:nth-child(6) { animation-delay: 0.25s; } .enter > *:nth-child(n+7) { animation-delay: 0.3s; }

/* sidebar department switch */
.dept-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--stroke); background: var(--glass); cursor: pointer; color: var(--text); font: inherit; width: 100%; text-align: left; }
.dept-switch:hover { border-color: rgba(217, 139, 93, 0.45); }
.dept-switch b { font-family: var(--font-display); font-size: 20px; letter-spacing: 0.04em; color: var(--copper-2); }

/* =====================================================================
   Department home
   ===================================================================== */
.home-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.home-hero .eyebrow { color: var(--copper-2); }
.home-hero h1 { font-size: 34px; }
.stat-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px 18px 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--stroke); position: relative; overflow: hidden; }
.stat .v { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.flag .v { color: var(--warn); }
.stat.lead { background: linear-gradient(160deg, rgba(217, 139, 93, 0.16), rgba(217, 139, 93, 0.03)); border-color: rgba(217, 139, 93, 0.3); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.home-grid > .col { gap: 16px; }
.progress { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--copper), var(--copper-2)); transform-origin: left; animation: grow 1.1s var(--ease) both; }

/* horizontal bar chart (single series) */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 13px; position: relative; }
.hbar .lab { color: var(--text-2); }
.hbar .track { height: 12px; border-radius: 0 4px 4px 0; background: rgba(255, 255, 255, 0.04); position: relative; }
.hbar .track i { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; background: var(--accent); transform-origin: left; animation: grow 1s var(--ease) both; }
.hbar:hover .track i { background: #b5cdee; }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--text); min-width: 92px; text-align: right; }
.hbar .tip { position: absolute; left: 200px; top: -30px; padding: 4px 9px; border-radius: 8px; background: #0f1828; border: 1px solid var(--stroke-strong); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 2; }
.hbar:hover .tip { opacity: 1; }

/* attention list */
.att { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 12px 0; border-top: 1px solid var(--stroke); cursor: pointer; }
.att:first-child { border-top: 0; padding-top: 2px; }
.att:hover .att-title { color: var(--copper-2); }
.att-title { font-weight: 600; transition: color 0.2s; }
.att-chips { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; }
.chip-flag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(230, 196, 99, 0.22); }
.chip-flag.critical { background: var(--bad-soft); color: var(--bad); border-color: rgba(232, 137, 138, 0.25); }
.gap-count { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--warn); }
.gap-count.critical { color: var(--bad); }
.gap-count::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.gap-count.live::before { animation: pulse 1.8s ease-in-out infinite; }

/* missing-information panel */
.gap-list { display: flex; flex-direction: column; gap: 8px; }
.gap-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(5, 9, 17, 0.28); }
.gap-item .sev { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.gap-item.critical .sev { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.gap-item.info .sev { background: var(--muted); }
.gap-item.done { opacity: 0.6; }
.gap-item.done .sev { background: var(--ok); }
.gap-item.noproof { border-color: rgba(230, 196, 99, 0.35); background: rgba(230, 196, 99, 0.06); align-items: start; }
.gap-item.noproof .sev { background: var(--warn); margin-top: 6px; }
.gap-item .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.gap-answer { grid-column: 2 / -1; display: flex; gap: 8px; }

@media (max-width: 1100px) { .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .dept-grid { grid-template-columns: 1fr; } .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hbar { grid-template-columns: minmax(0, 120px) minmax(0, 1fr) auto; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .welcome-lines .draw { stroke-dashoffset: 0; }
}
