/* =====================================================================
   Sourcing Management System — interface styles (on top of Bootstrap 5.3)
   Palette: petrol rail, cool grey canvas, one petrol-blue accent.
   Status colours are reserved for status — nowhere else.
   ===================================================================== */
:root {
    --ink: #1d2a35;
    --muted: #5e6e7b;
    --line: #dfe5ea;
    --line-strong: #c9d3da;
    --canvas: #f3f5f7;
    --surface: #ffffff;
    --rail: #13303d;
    --rail-ink: #c3d2da;
    --rail-ink-strong: #ffffff;
    --accent: #245a73;
    --accent-hover: #1b4659;
    --accent-soft: #e3edf2;
    --amber: #9a5f0c;
    --amber-soft: #fbf1e1;
    --red: #a8362b;
    --red-soft: #fbeae8;
    --green: #2c6e4b;
    --green-soft: #e5f2ea;
    --radius: 6px;
    --radius-sm: 4px;

    --bs-body-font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--canvas);
    --bs-border-color: var(--line);
    --bs-link-color: var(--accent);
    --bs-link-color-rgb: 36, 90, 115;
    --bs-link-hover-color: var(--accent-hover);
    --bs-link-hover-color-rgb: 27, 70, 89;
    --bs-primary: var(--accent);
    --bs-primary-rgb: 36, 90, 115;
    --bs-focus-ring-color: rgba(36, 90, 115, .3);
}

body { font-size: .9375rem; line-height: 1.5; font-feature-settings: "tnum" 1; }
h1, h2, h3 { color: var(--ink); }
a { text-underline-offset: 2px; }
.num, .table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.fw-medium { font-weight: 500; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

/* Buttons ------------------------------------------------------------ */
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: var(--canvas); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-strong); --bs-btn-active-bg: var(--line); --bs-btn-active-color: var(--ink); }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 0; color: var(--muted); font-size: 1.15rem; }
.btn-icon:hover { color: var(--ink); background: var(--canvas); }
.form-control, .form-select { border-radius: var(--radius-sm); border-color: var(--line-strong); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(36, 90, 115, .18); }
.form-label { font-weight: 500; font-size: .875rem; margin-bottom: .3rem; }
.form-check-input:checked, .form-check-input:indeterminate { background-color: var(--accent); border-color: var(--accent); }

/* Shell ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.rail { background: var(--rail) !important; color: var(--rail-ink); width: 248px; flex: 0 0 248px; } /* !important: .offcanvas-lg sets a transparent background at lg+ */
@media (min-width: 992px) {
    .rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
}
.rail.offcanvas-lg { --bs-offcanvas-width: 264px; --bs-offcanvas-bg: var(--rail); }
.rail-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.rail-brand-link { display: flex; align-items: center; gap: 10px; color: var(--rail-ink-strong); text-decoration: none; min-width: 0; }
.rail-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); background: #2f6a84; color: #fff; font-weight: 600; font-size: .8rem; letter-spacing: .02em; flex: none; }
.rail-mark-lg { width: 48px; height: 48px; font-size: 1rem; }
.rail-title { display: block; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.rail-sub { display: block; font-size: .75rem; color: var(--rail-ink); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.rail-nav { padding: 10px 10px 24px; }
.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-section { margin-top: 18px; }
.rail-section-label { display: block; padding: 0 10px 6px; font-size: .75rem; color: #8ea6b2; font-weight: 500; }
.rail-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--rail-ink); text-decoration: none; font-size: .875rem; }
.rail-link .bi { font-size: 1rem; width: 18px; text-align: center; opacity: .85; }
.rail-link:hover { background: rgba(255,255,255,.06); color: var(--rail-ink-strong); }
.rail-link.active { background: rgba(255,255,255,.1); color: var(--rail-ink-strong); box-shadow: inset 3px 0 0 #7fb3c9; }
.rail-link.is-disabled { opacity: .45; cursor: default; }
.rail-link.is-disabled:hover { background: none; color: var(--rail-ink); }
.rail-soon { margin-left: auto; font-size: .6875rem; border: 1px solid rgba(255,255,255,.25); border-radius: 3px; padding: 0 5px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.crumbs .breadcrumb { font-size: .8125rem; --bs-breadcrumb-divider-color: var(--muted); }
.crumbs .breadcrumb-item.active { color: var(--muted); }
.content { padding: 24px; max-width: 1480px; width: 100%; }
.content:focus { outline: none; }
@media (max-width: 575.98px) { .content { padding: 16px 12px; } .topbar { padding: 0 12px; } }

.user-chip { display: flex; align-items: center; gap: 8px; border: 0; padding: 4px 8px; }
.user-chip:hover { background: var(--canvas); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .75rem; }
.user-chip-name { display: block; font-weight: 500; font-size: .8125rem; line-height: 1.2; }
.user-chip-role { display: block; font-size: .75rem; color: var(--muted); line-height: 1.2; }

/* Notification bell */
.bell-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .6875rem; line-height: 18px; font-weight: 600; }
.bell-menu { width: 340px; max-width: calc(100vw - 24px); }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .875rem; }
.bell-empty { padding: 20px 14px; margin: 0; color: var(--muted); font-size: .875rem; }
.bell-item { display: block; padding: 10px 14px 10px 22px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); position: relative; }
.bell-item:hover { background: var(--canvas); }
.bell-item.unread::before { content: ""; position: absolute; left: 9px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.bell-item-title { display: block; font-size: .8125rem; font-weight: 500; }
.bell-item-msg { display: block; font-size: .8125rem; color: var(--muted); }
.bell-item-time { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.bell-all { display: block; text-align: center; padding: 10px; font-size: .8125rem; font-weight: 500; text-decoration: none; }

/* Page structure --------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-size: 1.5rem; font-weight: 600; margin: 0; letter-spacing: -.005em; }
.page-sub { color: var(--muted); margin: 4px 0 0; font-size: .875rem; max-width: 72ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.panel-narrow { max-width: 520px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-title { font-size: 1rem; font-weight: 600; margin: 0; }
.panel-hint { font-size: .8125rem; color: var(--muted); }
.empty { color: var(--muted); margin: 8px 0; font-size: .875rem; }
.grid-2, .grid-2-1, .grid-3 { display: grid; gap: 20px; }
.grid-2 > .panel, .grid-2-1 > .panel, .grid-3 > .panel { margin-bottom: 0; }
.grid-2, .grid-2-1, .grid-3 { margin-bottom: 20px; }
@media (min-width: 992px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-2-1 { grid-template-columns: 2fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.form-actions { display: flex; gap: 8px; align-items: center; }
.tag { display: inline-block; font-size: .6875rem; font-weight: 500; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 5px; vertical-align: 1px; }

/* Headline band: one bordered strip split into cells (not separate cards) */
.headline { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
@media (min-width: 768px) { .headline { grid-template-columns: 1.6fr repeat(4, 1fr); } }
.headline-cell { padding: 16px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (min-width: 768px) { .headline-cell { border-bottom: 0; } .headline-cell:last-child { border-right: 0; } }
.headline-primary { grid-column: 1 / -1; background: var(--accent-soft); }
@media (min-width: 768px) { .headline-primary { grid-column: auto; } }
.headline-label { font-size: .8125rem; color: var(--muted); font-weight: 500; }
.headline-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.headline-primary .headline-value { font-size: 2rem; color: var(--accent); }
.headline-note { font-size: .75rem; color: var(--muted); }
.headline-cell.is-alert { background: var(--amber-soft); }
.headline-cell.is-alert .headline-value { color: var(--amber); }

/* Pipeline: the lifecycle as one connected strip */
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(112px, 1fr); overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (min-width: 1280px) { .pipeline { grid-auto-columns: minmax(0, 1fr); overflow-x: visible; } }
.stage { position: relative; border-right: 1px solid var(--line); }
.stage:last-child { border-right: 0; }
.stage:not(:last-child)::after { content: ""; position: absolute; right: -6px; top: 22px; width: 10px; height: 10px; background: var(--surface); border-top: 1px solid var(--line); border-right: 1px solid var(--line); transform: rotate(45deg); z-index: 1; }
.stage-link { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 10px; height: 100%; color: var(--ink); text-decoration: none; }
a.stage-link:hover { background: var(--canvas); }
.stage-count { font-size: 1.5rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stage-label { font-size: .8125rem; font-weight: 500; line-height: 1.25; }
.stage-value { font-size: .75rem; color: var(--muted); }
.stage-bar { display: block; height: 3px; background: var(--line); margin-top: 8px; border-radius: 2px; overflow: hidden; }
.stage-bar span { display: block; height: 100%; background: var(--accent); }
.stage.is-empty .stage-count, .stage.is-empty .stage-label { color: #9aa8b2; }

.chart-box { position: relative; height: 240px; }
.chart-box-lg { height: 290px; }

.overdue-list { list-style: none; margin: 0; padding: 0; }
.overdue-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.overdue-list li:last-child { border-bottom: 0; }
.days-late { font-size: .8125rem; font-weight: 600; color: var(--amber); white-space: nowrap; }

/* Tables */
.data-table { --bs-table-bg: transparent; font-size: .875rem; }
.data-table thead th { font-size: .75rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-strong); white-space: nowrap; padding-top: 6px; padding-bottom: 8px; }
.data-table tbody tr:hover { background: #f8fafb; }
.data-table td { border-color: var(--line); }

/* Status badges — one tone per lifecycle meaning */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 500; padding: 2px 8px 2px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-draft      { background: #eef1f3; color: #55636e; }
.status-pending    { background: var(--amber-soft); color: var(--amber); }
.status-approved   { background: #e6eef8; color: #2d5a8c; }
.status-accepted   { background: #e3f1f1; color: #1f6566; }
.status-dispatched { background: #ece8f6; color: #554189; }
.status-transit    { background: #e8ecf8; color: #3b4f91; }
.status-delivered  { background: var(--green-soft); color: var(--green); }
.status-closed     { background: #f1f3f4; color: #3c4a54; border-color: var(--line-strong); }
.status-rejected   { background: var(--red-soft); color: var(--red); }
.status-cancelled  { background: #f3f3f3; color: #77828a; text-decoration: line-through; }

/* Vendor tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
@media (min-width: 768px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--surface); color: var(--ink); text-decoration: none; }
a.tile:hover { background: #f8fafb; }
.tile-count { font-size: 1.75rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-label { font-weight: 500; font-size: .875rem; }
.tile-note { font-size: .75rem; color: var(--muted); }
.tile.is-action { background: var(--accent-soft); }
.tile.is-action .tile-count { color: var(--accent); }
.tile.is-alert { background: var(--amber-soft); }
.tile.is-alert .tile-count { color: var(--amber); }

.po-list { list-style: none; margin: 0; padding: 0; }
.po-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.po-row:last-child { border-bottom: 0; }
.po-row-main { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.po-row-number { font-weight: 600; }
.po-row-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; margin: 0; font-size: .8125rem; }
@media (min-width: 768px) { .po-row-meta { grid-template-columns: repeat(5, 1fr); } }
.po-row-meta dt { font-weight: 400; color: var(--muted); font-size: .75rem; }
.po-row-meta dd { margin: 0; }

/* Facts list */
.facts { margin: 0; }
.facts > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { font-weight: 400; color: var(--muted); }
.facts dd { margin: 0; }

/* Notifications page */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif-body { flex: 1; display: block; padding: 12px 0 12px 16px; text-decoration: none; color: var(--ink); position: relative; }
.notif.unread .notif-body::before { content: ""; position: absolute; left: 2px; top: 19px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.notif-title { display: block; font-weight: 500; }
.notif.unread .notif-title { font-weight: 600; }
.notif-msg { display: block; color: var(--muted); font-size: .875rem; }
.notif-time { display: block; color: var(--muted); font-size: .75rem; margin-top: 2px; }
.nav-underline .nav-link { color: var(--muted); }
.nav-underline .nav-link.active { color: var(--ink); }
.pagination { --bs-pagination-active-bg: var(--accent); --bs-pagination-active-border-color: var(--accent); --bs-pagination-color: var(--accent); }

/* Roles */
.matrix-wrap { max-height: 70vh; }
.matrix { font-size: .8125rem; --bs-table-bg: transparent; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); font-weight: 600; font-size: .75rem; color: var(--muted); border-bottom: 1px solid var(--line-strong); z-index: 1; white-space: nowrap; }
.matrix-group th { background: var(--canvas) !important; font-size: .75rem; font-weight: 600; color: var(--ink); }
.perm-slug { font-size: .6875rem; color: var(--muted); background: none; }
.perm-grid { display: grid; gap: 16px; }
@media (min-width: 768px) { .perm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .perm-grid { grid-template-columns: repeat(3, 1fr); } }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px 12px; }
.perm-legend { float: none; width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: .875rem; font-weight: 600; margin-bottom: 8px; padding: 0; }
.perm-group .form-check { font-size: .875rem; margin-bottom: 4px; }

/* Toasts */
.toast { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); box-shadow: 0 6px 20px rgba(19, 48, 61, .12); font-size: .875rem; }
.toast-success { border-left-color: var(--green); }
.toast-danger  { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--amber); }

/* Auth -------------------------------------------------------------- */
.auth-body { background: var(--canvas); }
.auth { min-height: 100vh; display: grid; }
@media (min-width: 992px) { .auth { grid-template-columns: 5fr 7fr; } }
.auth-side { background: var(--rail); color: var(--rail-ink); display: none; }
@media (min-width: 992px) { .auth-side { display: flex; align-items: center; } }
.auth-side-inner { padding: 48px 56px; max-width: 600px; }
.auth-company { font-size: 1.5rem; font-weight: 600; color: #fff; margin: 20px 0 8px; line-height: 1.25; }
.auth-tagline { font-size: 1rem; max-width: 40ch; margin-bottom: 36px; }
.auth-flow { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0; counter-reset: step; }
.auth-flow li { counter-increment: step; font-size: .8125rem; color: #e4edf1; padding: 6px 14px 6px 0; margin-right: 14px; position: relative; }
.auth-flow li::before { content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; font-size: .6875rem; }
.auth-flow li:not(:last-child)::after { content: ""; position: absolute; right: -6px; top: 50%; width: 12px; border-top: 1px solid rgba(255,255,255,.35); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; }
.auth-portal { font-size: .8125rem; color: var(--accent); font-weight: 500; margin: 0 0 4px; }
.auth-title { font-size: 1.375rem; font-weight: 600; margin: 0 0 20px; }
.auth-switch { margin-top: 20px; font-size: .875rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
    .rail, .topbar, .toast-container { display: none !important; }
    .content { padding: 0; }
    .panel { border: 0; padding: 0; }
}

/* --- Phase 2: lists, forms, detail pages ---------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.filters .form-control, .filters .form-select { font-size: .875rem; }
.filters .filter-search { flex: 1 1 260px; max-width: 360px; }
.filters .filter-select { flex: 0 1 180px; }
.list-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.list-count { font-size: .8125rem; color: var(--muted); }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--ink); }
.sort-link .bi { font-size: .7rem; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { padding: 2px 8px; font-size: .8125rem; }
.cell-sub { display: block; font-size: .75rem; color: var(--muted); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; }

.form-section { padding-bottom: 6px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; }
.form-section-title { font-size: .875rem; font-weight: 600; margin: 0 0 12px; }
.form-text { font-size: .75rem; }
.req::after { content: " *"; color: var(--red); }
.form-actions-bar { position: sticky; bottom: 0; background: var(--canvas); padding: 12px 0; display: flex; gap: 8px; z-index: 5; }

.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--muted); margin-top: 6px; }
.detail-meta strong { color: var(--ink); font-weight: 500; }
.tabs-bar { border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; flex-wrap: nowrap; }
.tabs-bar .nav-link { color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; white-space: nowrap; font-size: .875rem; }
.tabs-bar .nav-link.active { color: var(--ink); border-bottom-color: var(--accent); background: none; font-weight: 500; }
.tabs-bar .nav-link .count { font-size: .75rem; color: var(--muted); margin-left: 4px; }
.facts-grid { display: grid; gap: 0 32px; }
@media (min-width: 992px) { .facts-grid { grid-template-columns: 1fr 1fr; } }
.addr { white-space: pre-line; }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 18px; }
@media (min-width: 768px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); padding: 12px 16px; }
.stat-value { display: block; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { display: block; font-size: .75rem; color: var(--muted); }
.preferred { color: #a8770b; }
.muted-row td { color: var(--muted); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.activity li:last-child { border-bottom: 0; }
.activity-when { font-size: .75rem; color: var(--muted); }
.activity-changes { font-size: .75rem; color: var(--muted); margin-top: 2px; word-break: break-word; }

.credential { background: var(--amber-soft); border: 1px solid #ecd3a6; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; }
.credential-code { font-size: .9375rem; background: var(--surface); border: 1px solid var(--line-strong); padding: 3px 8px; border-radius: var(--radius-sm); color: var(--ink); user-select: all; }
.calc { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
/* Inputs sit on white panels; Bootstrap would otherwise use the grey body background */
.form-control, .form-select, .input-group-text { background-color: var(--surface); }
.input-group-text { color: var(--muted); }
.form-control:disabled, .form-select:disabled { background-color: var(--canvas); }
/* Deep-linked tab panes receive focus from the URL hash; the active tab already shows position */
.tab-pane:focus, .tab-pane:focus-visible { outline: none; }
