﻿/* FUSION – Supplier Management mockup
   Layout: fixed dark sidebar + light work area; tables and comparison matrices scroll inside their own containers.
   Single light theme by design (management-specified palette). */
:root {
  --primary: #1a6bcc;
  --primary-dark: #1557a6;
  --primary-tint: #e8f1fc;
  --sidebar: #0f2744;
  --sidebar-2: #163457;
  --sidebar-text: #c9d6e6;
  --success: #22c55e;
  --success-text: #15803d;
  --success-tint: #e8f8ee;
  --warning: #f59e0b;
  --warning-text: #a16207;
  --warning-tint: #fef5e4;
  --danger: #ef4444;
  --danger-text: #b91c1c;
  --danger-tint: #fdecec;
  --teal: #14b8a6;
  --teal-text: #0f766e;
  --teal-tint: #e3f7f4;
  --border: #dce3ed;
  --bg: #f0f4f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #13233a;
  --muted: #5b6b80;
  --neutral-tint: #eef1f5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 39, 68, .06), 0 2px 8px rgba(15, 39, 68, .05);
  --shadow-lg: 0 10px 40px rgba(15, 39, 68, .22);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 68px;
  color-scheme: light;
}

* { 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;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100%; transition: grid-template-columns .18s ease; }
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo-mark {
  flex: none; width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .02em;
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; color: #fff; font-size: 16px; letter-spacing: .08em; }
.brand-text span { display: block; font-size: 11px; color: #8fa6c2; white-space: nowrap; }
.nav { padding: 8px 8px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-top: 10px; padding: 6px 10px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #7f97b5; white-space: nowrap; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none; white-space: nowrap; font-size: 13.5px;
}
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ico { flex: none; width: 20px; height: 20px; display: grid; place-items: center; }
.nav a .ico svg { width: 18px; height: 18px; }
.nav a .tag { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 10px; background: rgba(255,255,255,.12); color: #dbe6f3; }
.sidebar-foot { margin-top: auto; padding: 12px 16px; font-size: 11px; color: #7f97b5; border-top: 1px solid rgba(255,255,255,.07); }
.app.collapsed .brand-text, .app.collapsed .nav-group, .app.collapsed .nav a .lbl,
.app.collapsed .nav a .tag, .app.collapsed .sidebar-foot { display: none; }
.app.collapsed .nav a { justify-content: center; }
.app.collapsed .brand { justify-content: center; padding-inline: 8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; flex-wrap: wrap;
}
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 36px; height: 36px;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.search-wrap { position: relative; flex: 1 1 260px; max-width: 460px; min-width: 0; }
.search-wrap input {
  width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px 0 34px; background: var(--surface-2);
}
.search-wrap svg { position: absolute; left: 10px; top: 9px; width: 18px; height: 18px; color: var(--muted); }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 40; padding: 6px;
}
.search-results button {
  display: flex; width: 100%; text-align: left; gap: 10px; align-items: baseline; padding: 8px 10px; border: 0; background: none;
  border-radius: 6px; cursor: pointer;
}
.search-results button:hover, .search-results button:focus { background: var(--primary-tint); }
.search-results .kind { font-size: 11px; color: var(--muted); width: 74px; flex: none; text-transform: uppercase; letter-spacing: .06em; }
.topbar select.cat { height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-tint); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.demo-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--warning-tint); color: var(--warning-text); border: 1px solid #f6d48f; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.demo-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }

.content { padding: 18px 24px 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs .sep { opacity: .6; }
.crumbs .cur { color: var(--text); font-weight: 600; }
.page-head { display: flex; gap: 12px 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Context / stepper ---------- */
.context-bar {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 10px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); font-size: 13px;
}
.context-bar b { font-weight: 650; }
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.stepper a {
  flex: none; font-size: 12px; text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--muted); background: var(--surface); white-space: nowrap;
}
.stepper a.done { color: var(--success-text); border-color: #bfe9cf; background: var(--success-tint); }
.stepper a.cur { color: #fff; background: var(--primary); border-color: var(--primary); }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 0 16px 16px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
.span2 { grid-column: span 2; }
.kpi {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi:hover { border-color: var(--primary); }
.kpi .k-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .k-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); }
.kpi .k-link { font-size: 12px; color: var(--primary); margin-top: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.stat .s-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .s-val { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s-sub { font-size: 12px; color: var(--muted); }
.stat.hl { background: var(--primary-tint); border-color: #bcd6f5; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 550; font-size: 13px;
  white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); border-color: #c6d1df; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.success { background: var(--success-text); border-color: var(--success-text); color: #fff; }
.btn.danger { color: var(--danger-text); border-color: #f5c2c2; }
.btn.sim::after { content: "SIM"; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: var(--warning-tint); color: var(--warning-text); }
.btn.primary.sim::after { background: rgba(255,255,255,.22); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-weight: 550; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.5;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.b-success { background: var(--success-tint); color: var(--success-text); border-color: #bfe9cf; }
.b-warning { background: var(--warning-tint); color: var(--warning-text); border-color: #f6d48f; }
.b-danger { background: var(--danger-tint); color: var(--danger-text); border-color: #f5c2c2; }
.b-info { background: var(--primary-tint); color: var(--primary-dark); border-color: #bcd6f5; }
.b-teal { background: var(--teal-tint); color: var(--teal-text); border-color: #aee6de; }
.b-neutral { background: var(--neutral-tint); color: var(--muted); border-color: var(--border); }
.tag-label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; }
.tag-proposed { background: #f1e9fd; color: #6d28d9; }
.tag-sim { background: var(--warning-tint); color: var(--warning-text); }
.tag-demo { background: var(--warning-tint); color: var(--warning-text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; contain: paint; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650;
  background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.mono { white-space: nowrap; }
.tbl tbody tr:hover td { background: #f8fbff; }
.tbl tr.sel td { background: var(--primary-tint); }
.tbl tr.excluded td { color: var(--muted); }
.tbl tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); }
.tbl .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl th.sticky-col { background: var(--surface-2); z-index: 2; }
.row-actions { display: flex; gap: 4px; flex-wrap: nowrap; }
.needs-review { color: var(--warning-text); font-weight: 600; white-space: nowrap; }
.needs-review::before { content: "⚠ "; }

/* comparison matrix */
.matrix td.cell { cursor: pointer; min-width: 170px; }
.matrix td.cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.matrix .offered { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.matrix tr.critical td:first-child::after { content: "Critical"; margin-left: 6px; font-size: 10px; font-weight: 700; color: var(--danger-text); background: var(--danger-tint); padding: 1px 5px; border-radius: 4px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--surface); width: 100%; min-width: 0;
}
textarea.input { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 12.5px; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 0 1 190px; }
.filters .field.grow { flex: 1 1 240px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 12px; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; cursor: pointer; font-weight: 550; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Notices ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13px; }
.notice > div { min-width: 0; }
.notice.info { background: var(--primary-tint); border-color: #bcd6f5; color: #123e73; }
.notice.warn { background: var(--warning-tint); border-color: #f6d48f; color: #6b4304; }
.notice.danger { background: var(--danger-tint); border-color: #f5c2c2; color: #7f1d1d; }
.notice.ok { background: var(--success-tint); border-color: #bfe9cf; color: #14532d; }
.notice.proposed { background: #f6f0fe; border-color: #dccbfa; color: #4c1d95; }
.notice strong { font-weight: 650; }

/* ---------- Lists ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, 42%) minmax(0, 1fr); gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--muted); font-size: 12px; white-space: nowrap; width: 78px; flex: none; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--success-tint); color: var(--success-text); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.checklist .tick.warn { background: var(--warning-tint); color: var(--warning-text); }
.evidence { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.evidence button { font-size: 11.5px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; cursor: pointer; color: var(--primary-dark); }
.evidence button:hover { border-color: var(--primary); }

/* ---------- Tree ---------- */
.tree { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.tree ul { list-style: none; margin: 0; padding-left: 16px; border-left: 1px dashed var(--border); margin-left: 9px; }
.tree button { border: 0; background: none; cursor: pointer; padding: 5px 8px; border-radius: 6px; text-align: left; width: 100%; display: flex; gap: 6px; align-items: center; }
.tree button:hover { background: var(--surface-2); }
.tree button.active { background: var(--primary-tint); color: var(--primary-dark); font-weight: 600; }
.tree .count { margin-left: auto; font-size: 11px; color: var(--muted); }
.tree .caret { width: 12px; flex: none; color: var(--muted); font-size: 10px; }

/* ---------- Workflow map ---------- */
.flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; counter-reset: step; }
.flow-node {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 10px; background: var(--surface);
  cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.flow-node:hover { border-color: var(--primary); }
.flow-node.optional { border-style: dashed; }
.flow-node .n { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.flow-node .t { font-weight: 650; font-size: 13.5px; }
.flow-node .d { font-size: 12px; color: var(--muted); }
.flow-node .gates { display: flex; gap: 4px; flex-wrap: wrap; }
.flow-src { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; white-space: pre; overflow-x: auto; line-height: 1.6; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .grid-line { stroke: #e7ecf3; stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.bar-row { display: grid; grid-template-columns: 60px minmax(0, 1fr) 56px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-track { height: 10px; background: var(--neutral-tint); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.score-pill { display: inline-block; min-width: 46px; text-align: center; font-weight: 700; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; background: var(--neutral-tint); }

/* ---------- Drawer / modal / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 39, 68, .45); z-index: 60; display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: flex-start; padding: 6vh 16px 16px; overflow-y: auto; }
.drawer {
  width: min(560px, 100%); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .18s ease;
}
.modal { width: min(640px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: 88vh; }
.modal.wide { width: min(920px, 100%); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes slideIn { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--sidebar); color: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.toast .tag-label { flex: none; }

/* document preview */
.doc-page { background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 26px 30px; box-shadow: var(--shadow); font-size: 12.5px; position: relative; overflow: hidden; }
.doc-page::after {
  content: "SIMULATED PREVIEW · DEMO DATA"; position: absolute; top: 44%; left: -10%; right: -10%; text-align: center;
  transform: rotate(-18deg); font-size: 30px; font-weight: 800; color: rgba(26, 107, 204, .07); pointer-events: none; letter-spacing: .1em;
}
.doc-page h4 { font-size: 15px; margin-bottom: 4px; }
.doc-page table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.doc-page td, .doc-page th { border: 1px solid #d5dce6; padding: 5px 7px; text-align: left; }
.hl-field { background: #fff3c4; outline: 1px dashed #e0a800; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.login-left {
  background: radial-gradient(1200px 500px at -10% -10%, #1c4a7d 0%, transparent 60%), radial-gradient(800px 400px at 110% 110%, #0f5e5a 0%, transparent 55%), var(--sidebar);
  color: #dbe6f3; padding: 48px 56px; display: flex; flex-direction: column; gap: 28px;
}
.login-left .logo-box { display: flex; align-items: center; gap: 14px; }
.logo-placeholder { width: 56px; height: 56px; border-radius: 12px; border: 1.5px dashed rgba(255,255,255,.35); display: grid; place-items: center; font-size: 10px; color: #9fb4cf; text-align: center; line-height: 1.2; }
.login-left h1 { font-size: 40px; letter-spacing: .14em; color: #fff; font-weight: 800; }
.login-left .tagline { font-size: 18px; color: #c9d6e6; max-width: 30ch; }
.feature-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 620px; }
.feature-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px; }
.feature-card b { color: #fff; display: block; margin-bottom: 4px; font-size: 14px; }
.feature-card span { font-size: 12.5px; color: #aebfd4; }
.login-right { background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.ms-btn { height: 44px; border: 1px solid #8c8c8c; background: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; border-radius: 6px; cursor: pointer; }
.ms-btn:hover { background: #f5f5f5; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Report view ---------- */
.report { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; display: flex; flex-direction: column; gap: 16px; }
.report-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--sidebar); padding-bottom: 12px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.mobile-open .sidebar { transform: none; }
  .app.collapsed .brand-text, .app.collapsed .nav-group, .app.collapsed .nav a .lbl, .app.collapsed .nav a .tag, .app.collapsed .sidebar-foot { display: revert; }
  .app.collapsed .nav a { justify-content: flex-start; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-left { padding: 32px 20px; }
  .login-left h1 { font-size: 30px; }
  .user-chip .who { display: none; }
}
@media (max-width: 560px) {
  .content { padding: 14px 16px 32px; }
  .topbar { padding: 10px 16px; }
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .feature-cards { grid-template-columns: minmax(0, 1fr); }
  .report { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toasts, .page-head .actions, .context-bar .stepper { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card, .report { box-shadow: none; border: 0; }
  .table-wrap { overflow: visible; contain: none; }
  .tbl th { position: static; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Production additions ---------- */
.logo-img { width: 36px; height: 36px; border-radius: 9px; flex: none; background: #fff; object-fit: contain; }
.search-wrap input { padding-left: 12px; }
.bell { position: relative; text-decoration: none; color: var(--text); }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; }
.user-chip { text-decoration: none; color: var(--text); }
a.btn { text-decoration: none; }
.chip { display: inline-block; font-size: 11.5px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; color: var(--primary-dark); text-decoration: none; margin: 1px 2px; }
.chip:hover { border-color: var(--primary); }
.pager { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 16px; }
.pager a, .pager span { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; font-size: 12.5px; }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
form.inline { display: inline; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
.req::after { content: " *"; color: var(--danger-text); }
fieldset.box { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 0; }
fieldset.box legend { font-size: 12.5px; font-weight: 600; padding: 0 4px; }
.tabs a { display: inline-block; padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
details.card > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
details.card[open] > summary { border-bottom: 1px solid var(--border); }
.empty { padding: 18px 16px; color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.input.num { text-align: right; }
.danger-zone { border-color: #f5c2c2; }
dialog.confirm { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; max-width: 460px; width: calc(100% - 32px); }
dialog.confirm::backdrop { background: rgba(15, 39, 68, .45); }
dialog.confirm .panel-body { padding: 18px; }
.chart-box { position: relative; height: 300px; }
.small-table td, .small-table th { padding: 6px 10px; }
.kv-wide { grid-template-columns: minmax(140px, 30%) minmax(0, 1fr); }
@media print { .no-print { display: none !important; } }

.tree a.tree-link, .tree > li > a { display: flex; gap: 6px; align-items: center; padding: 5px 8px; border-radius: 6px; text-decoration: none; color: inherit; }
.tree a.tree-link:hover { background: var(--surface-2); }
.tree a.active { background: var(--primary-tint); color: var(--primary-dark); font-weight: 600; }

/* Long review messages wrap outside tables; stay compact inside table cells. */
.needs-review { white-space: normal; overflow-wrap: anywhere; }
td .needs-review { white-space: nowrap; }

@media (max-width: 700px) { .report table { display: block; overflow-x: auto; } }

/* ---------- v2: Ask FUSION, knowledge base ---------- */
.ask-box { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.ask-box textarea { flex: 1 1 420px; min-height: 64px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font: inherit; font-size: 15px; resize: vertical; background: var(--surface); color: var(--text); }
.ask-box textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.examples { display: flex; flex-wrap: wrap; gap: 6px; }
.examples a { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; text-decoration: none; color: var(--text); }
.examples a:hover { border-color: var(--primary); color: var(--primary-dark); }
.read-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.read-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--primary-tint); color: var(--primary-dark); font-size: 12.5px; font-weight: 600; }
.read-chip.warn { background: var(--warning-tint); color: var(--warning-text); }
.read-chip a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: rgba(26,107,204,.15); color: inherit; border-radius: 50%; width: 18px; height: 18px; font-size: 13px; line-height: 1; }
.seg a { display: inline-block; padding: 6px 12px; font-size: 12.5px; border-right: 1px solid var(--border); text-decoration: none; color: var(--text); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--primary); color: #fff; }
.card.answer { border-left: 4px solid var(--primary); }
.card.answer.limited { border-left-color: var(--warning); }
.card.answer.none { border-left-color: var(--danger); }
.answer h2.big, h2.big { font-size: 24px; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.coverage-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--neutral-tint); margin-top: 8px; }
.coverage-bar span { display: block; height: 100%; }
.chiplist { display: flex; flex-wrap: wrap; gap: 6px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }
.site-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.conf-low td, .conf-low th { background: var(--warning-tint); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 100px 16px minmax(0, 1fr); gap: 10px; padding: 7px 0; font-size: 13px; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; background: var(--neutral-tint); border: 2px solid var(--border); }
.timeline .dot.done { background: var(--success); border-color: var(--success); }
.timeline .dot.now { background: var(--primary); border-color: var(--primary); }
.nav .count-tag { margin-left: auto; font-size: 10.5px; padding: 1px 7px; border-radius: 10px; background: var(--warning); color: #3a2600; font-weight: 700; }
.reg-wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 40px; }
.reg-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
