/* MBI Process Map - estate dark theme (topbar, test banner, panels, forms, modals shared with the estate)
   plus the Process Map visual language: value-stream lanes, department colors, the lead-time ladder. */
:root {
  color-scheme: dark;
  --bg: #080e15;
  --bg-2: #0d151f;
  --panel: #111a25;
  --panel-2: #16212e;
  --panel-3: #1b2836;
  --border: #213042;
  --border-2: #2c3e53;
  --text: #eef4fb;
  --muted: #a3b4c7;
  --muted-2: #7d90a6;
  --primary: #2b7de0;
  --primary-hover: #2169c0;
  --primary-soft: #14304f;
  --accent: #2cc39a;
  --warn: #f2b84b;
  --warn-soft: #3a2d12;
  --danger: #e5484d;
  --danger-bg: #2a1418;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);
  /* value-stream colors */
  --va: #2cc39a;
  --nva: #ef6f86;
  --inc: #95a3b3;
  --unc: #6f7f92;
  --wait: #f07a8e;
  --wait-2: #c94c64;
  --unknown: #f2b84b;
  --step-w: 228px;
  --wait-w: 96px;
  --end-w: 190px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Arial, Helvetica, sans-serif; }
body { background: radial-gradient(1200px 500px at 50% -120px, #12233a 0%, rgba(8, 14, 21, 0) 70%), var(--bg); background-attachment: fixed; }
a { color: #8ec3ff; }
a:hover { color: #b9dbff; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid #4fa3ff; outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3a4d; border-radius: 10px; }
::-webkit-scrollbar-track { background: #0b121b; }
* { scrollbar-color: #2a3a4d #0b121b; }

/* ---------- topbar: centered brand row above a centered tab row; API pill top-right ---------- */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 20px 12px; background: rgba(9, 15, 23, 0.94); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
body.test-banner-active .topbar { top: 48px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font-weight: 800; }
.brand-icon { width: 42px; height: 42px; }
.brand-title { white-space: nowrap; font-size: 22px; letter-spacing: .01em; }
.nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.nav-btn { position: relative; padding: 8px 13px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 700; }
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn.active { background: var(--primary-soft); color: #d6e9ff; }
.nav-count { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #241a05; font-size: 11px; line-height: 18px; text-align: center; font-weight: 800; }
.nav-count:empty { display: none; }
.admin-only { display: none; }
body.is-admin .admin-only { display: inline-flex; }
.status-pill { position: absolute; top: 14px; right: 20px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-pill.ok { color: #9be7c4; border-color: #1f5c46; }
.status-pill.bad { color: #ffb4b8; border-color: #6b2b30; }
.nav-search { width: 260px; padding: 8px 12px 8px 32px; border-radius: 10px; border: 1px solid var(--border-2); background: #0b131d url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237d90a6' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l4 4'/%3E%3C/svg%3E") no-repeat 10px 50%; color: var(--text); margin-left: 8px; }

/* ---------- layout ---------- */
.container { max-width: 1480px; margin: 0 auto; padding: 24px 24px 72px; transition: padding-right .2s ease; }
body.drawer-open .container { padding-right: 500px; }
h1 { font-size: 24px; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .spacer, .spacer { flex: 1; }
.lede { color: var(--muted); margin: -6px 0 18px; max-width: 900px; }
.subtle { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted-2); }
.pre { white-space: pre-wrap; }
.warn-text { color: var(--warn); }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.empty-state { color: var(--muted); padding: 34px; text-align: center; }

/* panels + grid */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 14px; align-items: start; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.panel-head h2, .panel-head h3 { margin: 0; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
a.kpi:hover { border-color: var(--border-2); background: var(--panel-3); }
.kpi .n { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi .s { color: var(--muted-2); font-size: 12px; }
.kpi.warn .n { color: var(--warn); }
.kpi.good .n { color: var(--accent); }

/* attention checklist */
.attention { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--radius); border: 1px solid #5c4413; background: linear-gradient(180deg, #1e180d, #18140c); }
.attention-title { font-weight: 800; color: #ffd27a; margin-right: 4px; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #2a2010; border: 1px solid #4a3812; color: #ffe2a6; font-size: 13px; text-decoration: none; }
a.att:hover { background: #33270f; color: #fff1cf; }
.att b { color: #fff; }

/* tables */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; z-index: 1; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th.sorted-asc::after { content: ' ▲'; } .table th.sorted-desc::after { content: ' ▼'; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.table tr.clickable { cursor: pointer; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty { color: var(--muted); text-align: center; padding: 26px; }
.table .row-link { color: var(--text); text-decoration: none; font-weight: 700; }
.table .row-link:hover { color: #b9dbff; text-decoration: underline; }
.table tr.group-row td { background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding-top: 7px; padding-bottom: 7px; }
table.table.fixed { table-layout: fixed; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: var(--primary-soft); color: #8ec3ff; white-space: nowrap; vertical-align: middle; }
.pill.warn { background: #4d2916; color: #ffbf8e; }
.pill.ok { background: #14392e; color: #7fe0b8; }
.pill.danger { background: #3d1a1e; color: #ffb4b8; }
.pill.info { background: #1f2f57; color: #b2c6ff; }
.pill.muted { background: #252c36; color: #a7b1bd; }
.pill.current { background: var(--primary-soft); color: #8ec3ff; }
.pill.future { background: #2a2357; color: #c6b8ff; }
.pill.k-idea { background: #1f2f57; color: #b2c6ff; }
.pill.k-planned { background: #3a2d12; color: #ffd27a; }
.pill.k-active { background: #4d2916; color: #ffbf8e; }
.pill.k-complete { background: #14392e; color: #7fe0b8; }
.pill.k-canceled { background: #252c36; color: #8e99a6; }
.pill.q { background: #3a2d12; color: #ffd27a; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; }
label.field, div.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.field.wide { grid-column: 1 / -1; }
label.field.inline { flex-direction: row; align-items: center; text-transform: none; font-weight: 500; font-size: 13px; letter-spacing: 0; }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: #0b131d; color: var(--text); font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 400;
}
.input { width: auto; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43, 125, 224, 0.25); }
select option { background: #0b131d; color: var(--text); }
.field textarea { min-height: 90px; resize: vertical; }
.field input[type="checkbox"], .field input[type="radio"] { width: auto; }
.field .hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted-2); }
.input.sm { padding: 5px 8px; font-size: 12px; }
.pair { display: flex; gap: 6px; }
.pair input { flex: 1 1 64px; min-width: 0; }
.pair select { flex: 1 1 100px; min-width: 96px; }
.form-error { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid #7e3743; background: var(--danger-bg); color: #ffd6dc; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 10px; max-height: 190px; overflow: auto; padding: 8px; border: 1px solid var(--border-2); border-radius: 10px; background: #0b131d; text-transform: none; letter-spacing: 0; font-weight: 400; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search { min-width: 240px; flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; }
.seg button { padding: 7px 12px; border: 0; background: var(--panel-2); color: var(--muted); font-weight: 700; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border-2); }
.seg button.on { background: var(--primary-soft); color: #d6e9ff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #3d5670; background: var(--panel-3); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: transparent; border-color: #6b2b30; color: #ffb4b8; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: #8ec3ff; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.menu-list[hidden] { display: none; }
.menu-list button, .menu-list a { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; text-decoration: none; font-weight: 600; cursor: pointer; }
.menu-list button:hover, .menu-list a:hover { background: var(--panel-3); }
.menu-list .danger { color: #ffb4b8; }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 5px 2px; }

/* modal + drawer + toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 10070; display: grid; place-items: center; background: rgba(3, 7, 12, 0.74); padding: 20px; }
.modal { width: min(820px, 100%); max-height: min(90vh, 920px); display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.modal.wide { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); }
.modal-close { border: 0; background: transparent; color: #c7d4e8; font: 700 22px/1 Arial, Helvetica, sans-serif; cursor: pointer; border-radius: 8px; padding: 2px 8px; }
.modal-close:hover { background: var(--panel-3); }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 10090; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 14px; border-radius: 12px; background: #172231; border: 1px solid var(--border-2); color: var(--text); box-shadow: var(--shadow); max-width: 440px; animation: fadeIn .2s ease; }
.toast.ok { border-color: #1f5c46; }
.toast.error { border-color: #7e3743; background: var(--danger-bg); color: #ffd6dc; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.update-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 10080; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--primary-soft); border: 1px solid #2f5a8a; }

/* test-environment banner (env-agnostic; shows only on *-test hosts) */
body.test-banner-active { padding-top: 48px; }
.test-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 10050; display: none; align-items: center; justify-content: center; gap: 14px; background: #8a1f2d; color: #fff; text-align: center; font: 800 13px/1.2 Arial, Helvetica, sans-serif; letter-spacing: .12em; padding: 12px 16px; box-shadow: 0 10px 24px #0004; }
body.test-banner-active .test-banner { display: flex; }

/* ---------- department colors (where responsibility falls) ---------- */
.dept { --d: #5b7a99; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--d, #5b7a99); flex: none; }
.dept-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--muted); }
.dept-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- home: value streams ---------- */
.stream { position: relative; margin: 0 0 18px; padding: 16px 18px 18px; border-radius: 18px; background: linear-gradient(180deg, rgba(22, 33, 46, .75), rgba(17, 26, 37, .75)); border: 1px solid var(--border); }
.stream::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: var(--s, var(--primary)); }
.stream.depth-1, .stream.depth-2 { margin: 14px 0 0; background: rgba(9, 15, 23, .45); }
.stream-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.stream-head h2, .stream-head h3 { margin: 0; }
.map-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; }
.map-card { position: relative; display: flex; flex-direction: column; gap: 10px; width: 320px; padding: 15px 16px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border-2); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .12s ease, border-color .12s ease; }
.map-card:hover { transform: translateY(-2px); border-color: #3f6a96; color: var(--text); }
.map-card.future { border-style: dashed; }
.map-card-head { display: flex; flex-wrap: wrap; gap: 6px; }
.map-card-title { font-weight: 800; font-size: 16px; line-height: 1.3; }
.map-card-lead { display: flex; align-items: baseline; gap: 8px; }
.map-card-lead .big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.map-card-lead .partial { color: var(--warn); font-size: 12px; font-weight: 700; }
.ww-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: #1c2836; }
.ww-bar .w { background: var(--va); } .ww-bar .q { background: var(--wait); } .ww-bar .u { background: repeating-linear-gradient(45deg, #3a4757 0 4px, #2a3644 4px 8px); }
.map-card-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.map-card-stats b { color: var(--text); }
.burst-count { color: #9be15d; font-weight: 700; }
.q-count { color: #ffd27a; font-weight: 700; }
.handoff-arrow { align-self: center; display: flex; align-items: center; color: #4fb0f6; }
.handoff-arrow svg { width: 40px; height: 22px; }

/* ---------- map page ---------- */
.map-head { align-items: flex-start; }
.map-title-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 520px; }
.map-title-block h1 { margin: 0; }
.map-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.map-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13px; }
.map-meta b { color: var(--text); font-weight: 600; }
.map-purpose { color: var(--muted); max-width: 1000px; margin: 10px 0 0; }
.provenance { margin-top: 8px; font-size: 12px; color: var(--muted-2); }
.provenance summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.provenance p { margin: 6px 0 0; max-width: 1000px; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; margin: 12px 0 0; border-radius: 12px; border: 1px solid #5c4413; background: #1d170c; color: #ffe2a6; }
.notice.info { border-color: #2f5a8a; background: #0f1e30; color: #cfe5ff; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin: 16px 0 16px; }
.tab { padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: #d6e9ff; border-bottom-color: var(--primary); }
.map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: -4px 0 12px; }

/* a lane: header + scrolling value-stream canvas */
.lane { margin-bottom: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); overflow: hidden; }
.lane-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.lane-head h3 { margin: 0; font-size: 16px; }
.lane-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: #0b131d; border: 1px solid var(--border-2); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip b { color: var(--text); }
.chip.lead b { font-size: 13px; }
.chip.partial { border-color: #5c4413; color: #ffd27a; background: #1d170c; }
.chip.complete { border-color: #1f5c46; color: #9be7c4; }
.lane-desc { padding: 8px 16px 0; font-size: 12px; color: var(--muted-2); }
.lane-scroll { overflow-x: auto; padding: 18px 16px 14px; background:
  linear-gradient(90deg, rgba(79, 176, 246, .04) 1px, transparent 1px) 0 0 / 24px 24px,
  linear-gradient(rgba(79, 176, 246, .04) 1px, transparent 1px) 0 0 / 24px 24px, #0a1119; }
.vsm { display: grid; grid-auto-rows: auto; align-items: stretch; min-width: max-content; }
.lanes.compact .vsm { zoom: .62; }

/* the wait column: triangle over a push arrow */
.wait-cell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; }
.push { position: relative; width: 100%; height: 2px; background: linear-gradient(90deg, #3a6ea5, #4fb0f6); }
.push::after { content: ''; position: absolute; right: -1px; top: -5px; border-left: 9px solid #4fb0f6; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.tri { position: relative; display: inline-flex; align-items: flex-end; justify-content: center; width: 80px; height: 62px; padding-bottom: 8px; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: linear-gradient(180deg, #ffadbb, var(--wait) 60%, var(--wait-2)); color: #3d0d18; font-size: 11px; font-weight: 800; text-align: center; line-height: 1.1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .4)); }
.tri .i { position: absolute; top: 22px; left: 0; right: 0; font-size: 13px; font-weight: 900; opacity: .55; }
.tri.unknown { background: linear-gradient(180deg, #ffe3a3, var(--unknown) 65%, #b8841f); color: #3a2706; }
.tri.sm { width: 52px; height: 30px; font-size: 9px; padding-bottom: 3px; vertical-align: middle; }
.tri.sm .i { display: none; }
.ins { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; border: 1px solid #3f6a96; background: #12304f; color: #d6e9ff; font-weight: 800; line-height: 22px; cursor: pointer; opacity: .55; transition: opacity .12s ease, transform .12s ease; }
.wait-cell:hover .ins, .ins:focus { opacity: 1; transform: translateX(-50%) scale(1.08); }

/* the process box */
.step-card { position: relative; display: flex; flex-direction: column; align-items: stretch; width: var(--step-w); height: 100%; min-height: 178px; padding: 0; border-radius: 12px; background: #f6f1e3; border: 1px solid #d8cba7; color: #1c2430; text-align: left; cursor: pointer; font: inherit; overflow: hidden; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); transition: transform .12s ease, box-shadow .12s ease; }
.step-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.step-card.selected { outline: 3px solid #4fb0f6; outline-offset: 3px; }
.step-head { display: flex; align-items: center; gap: 7px; padding: 7px 10px; background: var(--d, #5b7a99); color: #fff; font-size: 12px; font-weight: 800; }
.step-head .n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; background: rgba(0, 0, 0, .28); font-size: 12px; }
.step-head .owner { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.step-head .more { font-weight: 700; opacity: .85; }
.step-card.no-owner .step-head { background: repeating-linear-gradient(45deg, #8a2e3d 0 8px, #74263a 8px 16px); }
.step-head .rv { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #ffd27a; color: #3a2706; font-size: 11px; font-weight: 900; flex: none; }
.step-body { display: flex; flex-direction: column; gap: 7px; flex: 1; padding: 9px 11px 8px; }
.step-title { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.step-systems { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.sys { padding: 2px 7px; border-radius: 6px; background: #e4ddc8; border: 1px solid #cfc29b; font-size: 11px; font-weight: 700; color: #3c4655; }
.drill { font-size: 11px; color: #5b3fc4; font-weight: 800; }
.step-foot { display: flex; align-items: center; gap: 8px; padding: 6px 11px; border-top: 1px solid #e0d5b6; background: #efe7d2; font-size: 12px; color: #3c4655; }
.step-foot .pt { font-weight: 800; }
.step-foot .pt.none { color: #a0773a; }
.vt { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-size: 11px; font-weight: 700; }
.vt::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.vt-value_add { --c: var(--va); } .vt-non_value_add { --c: var(--nva); } .vt-incidental { --c: var(--inc); } .vt-unclassified { --c: transparent; }
.vt.vt-unclassified::before { border: 1.5px dashed #8b97a6; }
.burst { position: absolute; top: 38px; right: 8px; display: inline-grid; place-items: center; width: 26px; height: 26px; clip-path: polygon(50% 0, 61% 31%, 95% 25%, 72% 50%, 95% 75%, 61% 69%, 50% 100%, 39% 69%, 5% 75%, 28% 50%, 5% 25%, 39% 31%); background: #8fd14f; color: #173a07; font-size: 10px; font-weight: 900; }

/* lane end: lead-time data box and hand-off */
.end-cell { display: flex; flex-direction: column; gap: 10px; align-items: stretch; justify-content: center; padding: 0 0 0 14px; }
.lt-box { padding: 10px 12px; border-radius: 12px; background: #0f1a26; border: 1px solid var(--border-2); font-size: 12px; color: var(--muted); }
.lt-box .big { display: block; margin: 2px 0 4px; font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.lt-box.partial { border-color: #5c4413; }
.lt-box.partial .big { color: #ffd27a; }
.lt-row { display: flex; justify-content: space-between; gap: 10px; }
.add-step { border-style: dashed; }
.handoff { display: block; padding: 10px 12px; border-radius: 12px; border: 1px dashed #2f5a8a; color: #8ec3ff; text-decoration: none; font-size: 12px; }
.handoff:hover { background: #0f1e30; }

/* the lead-time ladder: waits ride the upper rail, process time the lower one */
.tl { height: 46px; margin-top: 14px; font-size: 11px; display: flex; justify-content: center; color: var(--muted); }
.tl-wait { align-items: flex-start; border-top: 2px solid var(--wait); border-left: 2px solid var(--wait); border-right: 2px solid var(--wait); color: #ffb4c0; padding-top: 4px; }
.tl-wait.unknown { border-top-color: var(--unknown); border-left-color: var(--unknown); border-right-color: var(--unknown); border-top-style: dashed; border-left-style: dashed; border-right-style: dashed; color: #ffd27a; }
.tl-wait.none { border-color: transparent; }
.tl-work { align-items: flex-end; border-bottom: 2px solid var(--va); color: #9be7c4; padding-bottom: 4px; }
.tl-work.none { border-bottom: 2px dashed #3a4757; color: var(--muted-2); }
.tl-total { align-items: center; color: var(--text); padding-left: 14px; justify-content: flex-start; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 4px 0 18px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* step drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10040; width: min(480px, 100%); overflow: auto; padding: 18px 20px 24px; background: var(--bg-2); border-left: 1px solid var(--border-2); box-shadow: var(--shadow); }
body.test-banner-active .drawer { top: 48px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawer h2 { font-size: 17px; line-height: 1.35; }
.drawer-owner { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin: 6px 0 10px; border-radius: 10px; background: var(--panel-2); border-left: 4px solid var(--d, #5b7a99); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 7px 14px; margin: 12px 0; }
.facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.facts dd { margin: 0; }
.source { font-size: 12px; color: var(--muted-2); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }

/* table tab: fast entry */
.step-table td { vertical-align: middle; }
.step-table th.n, .step-table td.n { width: 40px; text-align: right; }
.step-table th, .step-table td { padding: 8px 8px; }
.step-table td.t { min-width: 280px; width: 34%; }
.step-table .grow { width: 100%; min-width: 260px; resize: vertical; }
.step-table .pair { min-width: 168px; }
.step-table .pair input { width: 60px; flex: 0 0 60px; padding: 8px 8px; }
.step-table .pair select { min-width: 100px; flex: 1 1 100px; padding: 8px 6px; }
.step-table select.owner { min-width: 180px; width: 100%; }
.step-table select.value { min-width: 132px; }
.step-table td.sys { max-width: 130px; }
.step-table .state { display: inline-block; width: 64px; font-size: 11px; color: var(--muted-2); }
.step-table .state.saving { color: #8ec3ff; } .step-table .state.saved { color: #7fe0b8; } .step-table .state.bad { color: #ffb4b8; }
.step-table .bad-field { border-color: #9a3a49 !important; box-shadow: 0 0 0 2px rgba(229, 72, 77, .25); }
.quick-add td { background: #0e1824; }
.table td.actions { white-space: nowrap; text-align: right; }

/* who does what */
.who-lane { margin-top: 2px; }
.who-lane + .who-lane { margin-top: 8px; }
.who-lane .ln { font-size: 11px; color: var(--muted-2); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.who-steps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.who-steps a { display: inline-block; min-width: 26px; padding: 1px 7px; border-radius: 7px; background: var(--panel-3); border: 1px solid var(--border-2); color: var(--text); text-decoration: none; font-size: 12px; font-weight: 700; text-align: center; }
.who-steps a.own { background: #14304f; border-color: #2f5a8a; color: #d6e9ff; }
.who-steps a:hover { border-color: #4fa3ff; }

/* responsibilities */
.duty-list { margin: 0; padding-left: 22px; }
.duty-list li { padding: 4px 0; }

/* improvements */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; align-items: start; }
.board-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 75vh; overflow: auto; }
.board-head { position: sticky; top: -10px; display: flex; gap: 8px; align-items: center; padding: 6px 2px; background: var(--panel); }
.k-card { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.k-card:hover { border-color: #3d5670; }
.k-title { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* to confirm */
.q-card { padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.q-card + .q-card { margin-top: 10px; }
.q-card.resolved { opacity: .78; }
.q-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.q-text { font-size: 14px; line-height: 1.5; }
.q-options { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.q-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border-2); background: #0b131d; cursor: pointer; }
.q-option:hover { border-color: #3f6a96; }
.q-option input { margin-top: 3px; }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.q-actions .input { flex: 1; min-width: 220px; }
.q-resolution { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #10241d; border: 1px solid #1f5c46; color: #c8f1de; font-size: 13px; }

/* history */
.history li { line-height: 1.55; }
.chg { display: block; margin: 3px 0 0 2px; font-size: 12px; color: var(--muted); }
.chg .from { color: #ffb4c0; text-decoration: line-through; }
.chg .to { color: #9be7c4; }

/* print: a document, not a screenshot: every lane as a full-text table with the legend and revision */
.print-doc { display: none; }
@media print {
  @page { size: landscape; margin: 12mm; }
  body { background: #fff !important; color: #000; font-size: 11px; }
  body > *:not(main), .topbar, .test-banner, .drawer, #toastRoot, .update-bar { display: none !important; }
  body.test-banner-active { padding-top: 0; }
  .container { max-width: none; padding: 0 !important; }
  .container > *:not(.print-doc) { display: none !important; }
  .print-doc { display: block !important; color: #000; }
  .print-doc h1 { font-size: 18px; margin: 0 0 4px; }
  .print-doc .meta { font-size: 11px; margin-bottom: 8px; }
  .print-doc h2 { font-size: 13px; margin: 12px 0 4px; break-after: avoid; }
  .print-doc table { width: 100%; border-collapse: collapse; font-size: 10px; }
  .print-doc th, .print-doc td { border: 1px solid #999; padding: 3px 5px; text-align: left; vertical-align: top; }
  .print-doc thead { display: table-header-group; }
  .print-doc tr { break-inside: avoid; }
  .print-doc .legend-p { font-size: 10px; margin-top: 8px; }
}

@media (max-width: 1100px) {
  body.drawer-open .container { padding-right: 24px; }
}
@media (max-width: 900px) {
  :root { --step-w: 196px; --wait-w: 84px; }
  .nav-search { width: 100%; margin: 6px 0 0; }
  .container { padding: 16px 12px 60px; }
  .map-card { width: 100%; }
  .handoff-arrow { transform: rotate(90deg); margin: 0 auto; }
}
