/* MOSAIC-IBP — enterprise design system */

:root {
  color-scheme: light;

  /* Brand */
  --brand-600: oklch(0.48 0.09 245);
  --brand-500: oklch(0.55 0.10 245);
  --brand-400: oklch(0.65 0.10 245);
  --brand-50:  oklch(0.97 0.015 245);
  --brand-100: oklch(0.94 0.025 245);

  /* Neutrals (cool slate) */
  --ink-900: oklch(0.20 0.012 250);
  --ink-800: oklch(0.28 0.012 250);
  --ink-700: oklch(0.38 0.011 250);
  --ink-600: oklch(0.48 0.010 250);
  --ink-500: oklch(0.58 0.008 250);
  --ink-400: oklch(0.68 0.006 250);
  --ink-300: oklch(0.82 0.004 250);
  --ink-200: oklch(0.90 0.003 250);
  --ink-150: oklch(0.94 0.003 250);
  --ink-100: oklch(0.965 0.002 250);
  --ink-50:  oklch(0.985 0.001 250);
  --surface: #ffffff;
  --surface-translucent: rgba(255, 255, 255, 0.72);
  --on-brand: #ffffff;
  --bg: oklch(0.975 0.003 250);
  --modal-scrim: rgba(16, 24, 40, 0.45);
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");

  /* Status */
  --st-review-bg: oklch(0.96 0.04 75);
  --st-review-fg: oklch(0.45 0.10 70);
  --st-review-border: oklch(0.85 0.08 75);

  --st-blocked-bg: oklch(0.96 0.04 25);
  --st-blocked-fg: oklch(0.47 0.14 25);
  --st-blocked-border: oklch(0.85 0.08 25);

  --st-ok-bg: oklch(0.96 0.04 155);
  --st-ok-fg: oklch(0.42 0.10 155);
  --st-ok-border: oklch(0.85 0.07 155);

  --st-proc-bg: oklch(0.96 0.025 245);
  --st-proc-fg: oklch(0.45 0.08 245);
  --st-proc-border: oklch(0.85 0.04 245);

  --st-exp-bg: oklch(0.96 0.03 290);
  --st-exp-fg: oklch(0.44 0.12 290);
  --st-exp-border: oklch(0.85 0.06 290);

  --st-neutral-bg: oklch(0.96 0.002 250);
  --st-neutral-fg: oklch(0.45 0.008 250);
  --st-neutral-border: oklch(0.88 0.004 250);

  /* Detection overlay colors */
  --ov-door: oklch(0.55 0.14 245);
  --ov-window: oklch(0.60 0.12 195);
  --ov-wall: oklch(0.60 0.13 70);
  --ov-missing: oklch(0.55 0.18 25);
  --plan-paper: #fafaf7;
  --plan-title-bg: #ffffff;
  --plan-grid: oklch(0.92 0.003 250);
  --plan-label: oklch(0.50 0.01 250);
  --plan-label-bg: #ffffff;

  /* Radius + shadow */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --shadow-xs: 0 1px 0 rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-pop: 0 8px 28px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);

  /* Layout */
  --nav-w: 224px;
  --nav-w-collapsed: 64px;
  --topbar-h: 52px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --brand-600: oklch(0.70 0.12 245);
  --brand-500: oklch(0.75 0.12 245);
  --brand-400: oklch(0.80 0.10 245);
  --brand-50:  oklch(0.24 0.045 245);
  --brand-100: oklch(0.31 0.055 245);

  --ink-900: oklch(0.94 0.006 250);
  --ink-800: oklch(0.88 0.007 250);
  --ink-700: oklch(0.78 0.008 250);
  --ink-600: oklch(0.68 0.008 250);
  --ink-500: oklch(0.58 0.008 250);
  --ink-400: oklch(0.48 0.008 250);
  --ink-300: oklch(0.38 0.009 250);
  --ink-200: oklch(0.29 0.011 250);
  --ink-150: oklch(0.24 0.011 250);
  --ink-100: oklch(0.20 0.012 250);
  --ink-50:  oklch(0.17 0.013 250);
  --surface: oklch(0.155 0.012 250);
  --surface-translucent: color-mix(in oklch, var(--surface) 82%, transparent);
  --on-brand: #ffffff;
  --bg: oklch(0.115 0.014 250);
  --modal-scrim: rgba(2, 6, 23, 0.68);
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");

  --st-review-bg: oklch(0.24 0.045 75);
  --st-review-fg: oklch(0.82 0.13 75);
  --st-review-border: oklch(0.44 0.08 75);

  --st-blocked-bg: oklch(0.23 0.05 25);
  --st-blocked-fg: oklch(0.80 0.16 25);
  --st-blocked-border: oklch(0.44 0.09 25);

  --st-ok-bg: oklch(0.22 0.045 155);
  --st-ok-fg: oklch(0.80 0.12 155);
  --st-ok-border: oklch(0.42 0.08 155);

  --st-proc-bg: oklch(0.23 0.045 245);
  --st-proc-fg: oklch(0.80 0.10 245);
  --st-proc-border: oklch(0.43 0.07 245);

  --st-exp-bg: oklch(0.24 0.05 290);
  --st-exp-fg: oklch(0.82 0.12 290);
  --st-exp-border: oklch(0.43 0.08 290);

  --st-neutral-bg: oklch(0.22 0.010 250);
  --st-neutral-fg: oklch(0.76 0.010 250);
  --st-neutral-border: oklch(0.34 0.012 250);

  --ov-door: oklch(0.66 0.17 245);
  --ov-window: oklch(0.72 0.14 195);
  --ov-wall: oklch(0.70 0.15 70);
  --ov-missing: oklch(0.70 0.19 25);
  --plan-paper: oklch(0.96 0.006 90);
  --plan-title-bg: #ffffff;
  --plan-grid: oklch(0.86 0.006 250);
  --plan-label: oklch(0.43 0.015 250);
  --plan-label-bg: #ffffff;

  --shadow-xs: 0 1px 0 rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.34), 0 1px 4px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.38), 0 1px 3px rgba(0, 0, 0, 0.32);
  --shadow-pop: 0 18px 42px rgba(0, 0, 0, 0.48), 0 4px 14px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  font-size: 13px;
  color: var(--ink-900);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
.mono { font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-feature-settings: "zero"; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  min-width: 1280px;
}
.app.nav-collapsed {
  --nav-w: var(--nav-w-collapsed);
}
.topbar {
  grid-column: 1 / 3;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 20px 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--ink-150);
  gap: 18px;
  z-index: 5;
}
.brand-mark {
  display: flex; align-items: center; gap: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 14px;
  color: var(--ink-900);
}
.brand-glyph {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--ink-900);
  color: var(--bg);
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0;
}
.brand-sub {
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--ink-200);
}
.topbar-spacer { flex: 1; }

.topbar-search {
  flex: 0 1 360px;
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  background: var(--ink-100);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  gap: 8px;
  color: var(--ink-500);
  font-size: 12.5px;
}
.topbar-search:focus-within { border-color: var(--brand-400); background: var(--surface); }
.topbar-search input { border: none; outline: none; background: transparent; flex: 1; color: var(--ink-900); }
.kbd { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--ink-500); padding: 1px 5px; border: 1px solid var(--ink-200); border-radius: 3px; background: var(--surface); }

.topbar-btn {
  height: 30px; padding: 0 10px;
  background: transparent; border: 1px solid transparent;
  color: var(--ink-600); font-size: 12.5px;
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 6px;
}
.topbar-btn:hover { background: var(--ink-100); color: var(--ink-800); }
.theme-toggle {
  min-width: 76px;
  border-color: var(--ink-150);
  background: var(--ink-50);
  color: var(--ink-700);
}
.theme-toggle:hover {
  border-color: var(--ink-300);
  background: var(--ink-100);
  color: var(--ink-900);
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 8px 2px 2px;
  border-radius: 20px;
}
.topbar-user:hover { background: var(--ink-100); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), oklch(0.45 0.08 280));
  color: white; font-weight: 600; font-size: 11px;
  display: grid; place-items: center;
  letter-spacing: 0;
}
.topbar-user-meta { line-height: 1.15; font-size: 12px; }
.topbar-user-meta .role { color: var(--ink-500); font-size: 10.5px; }

/* ---------- Left nav ---------- */
.leftnav {
  background: var(--surface);
  border-right: 1px solid var(--ink-150);
  padding: 14px 10px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  transition: padding 0.14s ease;
}
.nav-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 32px;
  height: 30px;
  margin: 0 0 8px auto;
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-600);
  font-size: 12px;
  font-weight: 500;
}
.nav-toggle:hover { background: var(--ink-100); color: var(--ink-900); border-color: var(--ink-200); }
.nav-collapsed .leftnav {
  padding: 14px 8px;
  overflow-x: hidden;
}
.nav-collapsed .nav-toggle {
  width: 36px;
  align-self: center;
  margin: 0 0 8px;
  padding: 0;
}
.nav-collapsed .nav-label,
.nav-collapsed .nav-section {
  display: none;
}
.nav-section {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  padding: 12px 10px 6px;
}
.nav-row {
  display: block;
  border-radius: var(--r-md);
}
.nav-row.active {
  background: var(--brand-50);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--ink-100); color: var(--ink-900); }
.nav-collapsed .nav-row {
  display: flex;
  justify-content: center;
}
.nav-collapsed .nav-row.active {
  background: transparent;
}
.nav-collapsed .nav-item {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}
.nav-item.active {
  background: transparent;
  color: var(--brand-600);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
  background: var(--brand-600);
  border-radius: 0 3px 3px 0;
}
.nav-collapsed .nav-item.active {
  background: var(--brand-50);
}
.nav-collapsed .nav-item.active::before {
  left: -8px;
  top: 8px;
  bottom: 8px;
}
.nav-item .ico { width: 16px; height: 16px; color: currentColor; opacity: 0.8; }

/* ---------- Main region ---------- */
.main {
  overflow: auto;
  background: var(--bg);
  position: relative;
}
.page {
  padding: 24px 32px 48px;
  max-width: 1600px;
  margin: 0 auto;
}
.page-wide { padding: 0; max-width: none; }

/* Page header */
.pgh {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--ink-150);
}
.pgh h1 {
  font-size: 20px; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 4px;
}
.pgh .crumbs {
  font-size: 11.5px; color: var(--ink-500); margin-bottom: 6px;
  display: flex; gap: 6px; align-items: center;
}
.pgh .crumbs a { color: var(--ink-600); text-decoration: none; }
.pgh .crumbs a:hover { color: var(--brand-600); }
.pgh .sub { color: var(--ink-600); font-size: 13px; }
.pgh-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--ink-200);
  background: var(--surface);
  color: var(--ink-800);
  font-size: 12.5px; font-weight: 500;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
}
.btn:hover { background: var(--ink-100); border-color: var(--ink-300); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; background: var(--ink-100); color: var(--ink-500); border-color: var(--ink-200); }
.btn.primary { background: var(--brand-600); color: var(--on-brand); border-color: var(--brand-600); }
.btn.primary:hover { background: var(--brand-500); border-color: var(--brand-500); }
.btn.primary:disabled { background: var(--ink-300); border-color: var(--ink-300); cursor: not-allowed; color: var(--on-brand); }
.btn.danger { color: oklch(0.45 0.15 25); border-color: oklch(0.85 0.06 25); }
.btn.danger:hover { background: oklch(0.97 0.02 25); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--ink-100); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.xs { height: 22px; padding: 0 8px; font-size: 11.5px; }
.btn.ico-only { padding: 0; width: 28px; }

/* ---------- Chips / status ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
  line-height: 18px;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor;}
.chip.review { background: var(--st-review-bg); color: var(--st-review-fg); border-color: var(--st-review-border); }
.chip.blocked { background: var(--st-blocked-bg); color: var(--st-blocked-fg); border-color: var(--st-blocked-border); }
.chip.ok { background: var(--st-ok-bg); color: var(--st-ok-fg); border-color: var(--st-ok-border); }
.chip.proc { background: var(--st-proc-bg); color: var(--st-proc-fg); border-color: var(--st-proc-border); }
.chip.exp { background: var(--st-exp-bg); color: var(--st-exp-fg); border-color: var(--st-exp-border); }
.chip.neutral { background: var(--st-neutral-bg); color: var(--st-neutral-fg); border-color: var(--st-neutral-border); }
.chip.sq { border-radius: 4px; padding: 1px 6px; font-size: 10.5px; font-weight: 600; line-height: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  overflow: hidden;
}
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-150);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink-800); }
.card-head .sub { font-size: 11.5px; color: var(--ink-500); }
.card-body { padding: 14px 16px; }
.card-body.pad-sm { padding: 10px 12px; }
.card-body.pad-0 { padding: 0; overflow-x: auto; }
.card-ft { padding: 10px 16px; border-top: 1px solid var(--ink-150); font-size: 12px; color: var(--ink-600); display: flex; justify-content: space-between; align-items: center; }

/* Summary cards */
.kpi {
  background: var(--surface);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.kpi .label { font-size: 11.5px; color: var(--ink-600); font-weight: 500; display: flex; align-items: center; gap: 6px;}
.kpi .val { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; color: var(--ink-900); }
.kpi .val .suffix { font-size: 13px; color: var(--ink-500); margin-left: 4px; font-weight: 500;}
.kpi .delta { margin-top: 6px; font-size: 11.5px; color: var(--ink-500); }

/* ---------- Tables ---------- */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.tbl th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink-150);
  background: var(--ink-50);
  position: sticky; top: 0; z-index: 1;
}
.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ink-150);
  color: var(--ink-800);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--ink-50); }
.tbl tr.selected td { background: var(--brand-50); }
.tbl td .meta { font-size: 11px; color: var(--ink-500); margin-top: 2px; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: "IBM Plex Mono", monospace; }
.tbl td.actions { text-align: right; }
.tbl td.tight { padding: 8px 14px; }
.tbl .tlink { color: var(--ink-900); font-weight: 500; text-decoration: none;}
.tbl .tlink:hover { color: var(--brand-600); }

@media (max-width: 1360px) {
  .project-detail-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .project-detail-side {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; font-weight: 500; color: var(--ink-600); }
.inp {
  height: 30px; padding: 0 10px;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-900);
  outline: none;
  font-size: 12.5px;
}
.inp:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-50); }
select.inp { padding-right: 24px; appearance: none; background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 8px center; }

/* Create project intake */
.create-project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 18px;
  align-items: start;
}
.create-explain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.create-explain-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
}
.create-explain-item strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.create-explain-item p {
  margin: 0;
  color: var(--ink-600);
  font-size: 12px;
  line-height: 1.45;
}
.create-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.create-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.create-choice {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  background: var(--ink-50);
}
.create-choice input { margin: 2px 0 0; }
.create-choice strong {
  display: block;
  color: var(--ink-800);
  font-size: 12.5px;
  margin-bottom: 3px;
}
.create-choice em {
  display: block;
  color: var(--ink-600);
  font-size: 11.5px;
  font-style: normal;
  line-height: 1.4;
}
.create-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--brand-100);
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--ink-700);
  font-size: 12px;
  line-height: 1.4;
}

/* Dashboard onboarding */
.onboarding-box {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--brand-100);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface), var(--brand-50));
}
.onboarding-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.onboarding-intro h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}
.onboarding-intro p {
  margin: 0;
  color: var(--ink-600);
  font-size: 12.5px;
  line-height: 1.5;
}
.onboarding-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.onboarding-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.onboarding-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--ink-150);
  border-radius: var(--r-md);
  background: var(--surface-translucent);
}
.onboarding-step-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-50);
  color: var(--brand-600);
}
.onboarding-step-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-900);
}
.onboarding-step-sub {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-600);
  line-height: 1.35;
}
.onboarding-event {
  margin-top: 7px;
  color: var(--ink-500);
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1360px) {
  .create-project-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .onboarding-box {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1180px) {
  .create-explain-grid,
  .create-form-grid,
  .create-choice-grid,
  .onboarding-flow {
    grid-template-columns: minmax(0, 1fr);
  }
}

.segmented {
  display: inline-flex;
  padding: 2px; background: var(--ink-100);
  border-radius: var(--r-md);
  gap: 1px;
}
.segmented button {
  height: 26px; padding: 0 11px;
  background: transparent; border: none; border-radius: 4px;
  font-size: 12px; color: var(--ink-600); font-weight: 500;
}
.segmented button.on { background: var(--surface); color: var(--ink-900); box-shadow: var(--shadow-xs); }
.segmented button:hover:not(.on) { color: var(--ink-900); }

.checkbox {
  appearance: none;
  width: 14px; height: 14px;
  border: 1.5px solid var(--ink-300);
  border-radius: 3px;
  background: var(--surface);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox:checked { background: var(--brand-600); border-color: var(--brand-600); }
.checkbox:checked::after {
  content: ""; width: 8px; height: 4px;
  border-left: 1.5px solid white; border-bottom: 1.5px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--ink-150); margin: 14px 0; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 12px; }
.meta-list dt { color: var(--ink-500); font-weight: 500; }
.meta-list dd { color: var(--ink-900); margin: 0; }

.progress {
  width: 100%; height: 4px; background: var(--ink-150); border-radius: 4px; overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--brand-500); transition: width 0.3s; }
.progress.ok > span { background: oklch(0.60 0.12 155); }

.dot-stack { display: inline-flex; gap: 3px; align-items: center; }
.dot-stack .d { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-300); }
.dot-stack .d.on { background: var(--brand-500); }

.tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-700);
  padding: 1px 5px;
  background: var(--ink-100);
  border-radius: 3px;
  border: 1px solid var(--ink-150);
}

/* Subtle highlight for "needs attention" */
.needs {
  position: relative;
}
.needs::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--st-review-fg);
}

/* Pulse dot (processing) */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}
.pulse-dot { animation: pulseDot 1.5s ease-in-out infinite; }

/* Login page */
.login-wrap {
  position: fixed; inset: 0;
  display: grid; grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
  z-index: 100;
}
.login-left {
  background: linear-gradient(160deg, oklch(0.22 0.025 245), oklch(0.28 0.03 255));
  color: var(--on-brand);
  padding: 40px 56px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(oklch(1 0 0 / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, oklch(1 0 0 / 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 30% 40%, black 30%, transparent 75%);
}
.login-right {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-card {
  width: 400px;
  background: var(--surface);
  border: 1px solid var(--ink-150);
  border-radius: var(--r-lg);
  padding: 36px 36px 28px;
  box-shadow: var(--shadow-md);
}

/* workbench */
.split {
  display: grid;
  height: calc(100vh - var(--topbar-h));
}
.splitpane {
  overflow: auto;
}

.toolbar {
  height: 42px;
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--ink-150);
}
.toolbar .sep { width: 1px; height: 20px; background: var(--ink-200); margin: 0 4px; }

.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent; border-radius: var(--r-sm);
  color: var(--ink-600);
}
.icon-btn:hover { background: var(--ink-100); color: var(--ink-800); }
.icon-btn.on { background: var(--brand-50); color: var(--brand-600); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Plan canvas */
.review-rail {
  background: var(--surface);
  border-right: 1px solid var(--ink-150);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.review-rail-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--ink-150);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.rail-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.rail-title {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-900);
}
.rail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--ink-150);
  border-bottom: 1px solid var(--ink-150);
}
.rail-stats div {
  background: var(--ink-50);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rail-stats .mono {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-900);
}
.rail-stats span:last-child {
  font-size: 10.5px;
  color: var(--ink-500);
}
.rail-list {
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rail-page {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-sm);
  padding: 7px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  text-align: left;
  align-items: start;
}
.rail-page:hover { background: var(--ink-50); }
.rail-page.active {
  background: var(--brand-50);
  border-color: var(--brand-100);
}
.rail-thumb {
  aspect-ratio: 0.78;
  border: 1px solid var(--ink-250, var(--ink-200));
  background: var(--plan-paper);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--ink-600);
  border-radius: 2px;
}
.rail-page.active .rail-thumb {
  border-color: var(--brand-500);
  color: var(--brand-600);
  background: var(--plan-paper);
}
.rail-page-main { min-width: 0; }
.rail-page-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-800);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rail-page-meta {
  margin-top: 2px;
  font-size: 10.8px;
  color: var(--ink-500);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rail-state {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--ink-100);
}
.rail-state.done {
  color: var(--st-ok-fg);
  background: var(--st-ok-bg);
}
.rail-state.attention {
  color: var(--st-review-fg);
  background: var(--st-review-bg);
}
.rail-quality {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--st-review-fg);
  background: var(--st-review-bg);
  border: 1px solid var(--st-review-border);
}

.plan-canvas {
  position: relative;
  width: 100%; height: 100%;
  background:
    radial-gradient(circle at 12px 12px, var(--ink-200) 1px, transparent 1.2px) 0 0 / 24px 24px,
    var(--surface);
  overflow: hidden;
}
.plan-sheet {
  position: absolute;
  background: var(--plan-paper);
  border: 1px solid var(--ink-300);
  box-shadow: var(--shadow-md);
}

.legend {
  position: absolute; bottom: 14px; left: 14px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 12px;
  font-size: 11.5px;
  color: var(--ink-700);
}
.legend .lg-item { display: inline-flex; align-items: center; gap: 6px;}
.legend .lg-sw { width: 10px; height: 10px; border-radius: 2px; border: 1.5px solid currentColor; }

.mini-page {
  position: absolute; top: 14px; right: 14px;
  width: 180px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  font-size: 11.5px;
}
.mini-page .hd { padding: 8px 10px; border-bottom: 1px solid var(--ink-150); color: var(--ink-600); font-weight: 600; display:flex; justify-content: space-between;}

/* focus-visible */
button:focus-visible, .inp:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 1px;
}

/* Activity list */
.activity {
  display: flex; flex-direction: column;
}
.activity-row {
  display: grid; grid-template-columns: 24px 1fr max-content; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ink-150);
  font-size: 12.5px;
}
.activity-row:last-child { border-bottom: none; }
.activity-ico {
  width: 20px; height: 20px; border-radius: 4px;
  background: var(--ink-100); color: var(--ink-600);
  display: grid; place-items: center;
  margin-top: 1px;
}
.activity-time { color: var(--ink-500); font-size: 11.5px; white-space: nowrap;}
.activity-meta { color: var(--ink-500); font-size: 11.5px; margin-top: 2px; }

/* Vertical step list */
.steps {
  display: flex; flex-direction: column;
}
.step {
  display: grid; grid-template-columns: 22px 1fr max-content; gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  position: relative;
}
.step:not(:last-child)::before {
  content: ""; position: absolute;
  left: 10px; top: 28px; bottom: -2px;
  width: 1px;
  background: var(--ink-200);
}
.step-marker {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--ink-300);
  background: var(--surface);
  display: grid; place-items: center;
  color: var(--ink-500);
  font-size: 10px;
  font-weight: 600;
  z-index: 1;
}
.step.done .step-marker { background: oklch(0.60 0.12 155); border-color: oklch(0.60 0.12 155); color: var(--on-brand); }
.step.active .step-marker { background: var(--brand-600); border-color: var(--brand-600); color: var(--on-brand); }
.step.active .step-title { font-weight: 600; }
.step-title { font-size: 13px; color: var(--ink-800); }
.step-sub { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.step-side { font-size: 11.5px; color: var(--ink-500); font-family: "IBM Plex Mono", monospace; }

/* Timeline (audit) */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--ink-200); }
.tl-row { padding: 10px 0; position: relative; }
.tl-dot { position: absolute; left: -22px; top: 14px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-300); }
.tl-dot.b { border-color: var(--brand-500); }
.tl-dot.g { border-color: oklch(0.60 0.12 155); }
.tl-dot.a { border-color: oklch(0.60 0.14 70); }

/* Drawer panel on right (plan viewer inspector) */
.inspector {
  border-left: 1px solid var(--ink-150);
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--ink-150);
}
.inspector-tabs button {
  flex: 1; padding: 10px 12px;
  background: transparent; border: none;
  font-size: 12px; font-weight: 500;
  color: var(--ink-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.inspector-tabs button.on { color: var(--brand-600); border-bottom-color: var(--brand-600); }

/* selection box on plan */
.sel-handle {
  position: absolute; width: 8px; height: 8px; background: var(--surface);
  border: 1.5px solid var(--brand-600);
  border-radius: 1px;
}

/* dialog overlay for approve */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--modal-scrim);
  display: grid; place-items: center; z-index: 80;
}
.modal {
  width: 460px; background: var(--surface); border: 1px solid var(--ink-200);
  border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-pop);
}
.modal h3 { margin: 0 0 8px; font-size: 15px; font-weight: 650;}
.modal p { margin: 0 0 12px; color: var(--ink-600); font-size: 13px;}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* banners */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 12.5px;
}
.banner.blocked { background: var(--st-blocked-bg); border-color: var(--st-blocked-border); color: var(--st-blocked-fg); }
.banner.ok { background: var(--st-ok-bg); border-color: var(--st-ok-border); color: var(--st-ok-fg); }
.banner.info { background: var(--st-proc-bg); border-color: var(--st-proc-border); color: var(--st-proc-fg); }
.banner.review { background: var(--st-review-bg); border-color: var(--st-review-border); color: var(--st-review-fg); }

/* Small confidence meter */
.conf {
  display: inline-grid; grid-template-columns: auto auto; align-items: center; gap: 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px;
}
.conf-bar { width: 46px; height: 4px; background: var(--ink-150); border-radius: 4px; overflow: hidden; }
.conf-bar > span { display: block; height: 100%; background: oklch(0.60 0.12 155); }
.conf.low .conf-bar > span { background: oklch(0.60 0.14 70); }
.conf.bad .conf-bar > span { background: oklch(0.60 0.15 25); }
