/* Bendigo Heritage Tender Portal — premium re-skin
   Consumes tokens.css. Navy carries authority, gold stays precious,
   Libre Caslon Text for display headings, system sans for UI chrome. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-800);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--gold-800); text-decoration: none; }
a:hover { color: var(--brand); text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-display); color: var(--ink-900); font-weight: var(--fw-regular); line-height: var(--lh-heading); margin: 0; letter-spacing: var(--ls-tight); }
h1 { font-size: 32px; }
h2 { font-size: var(--fs-h2); margin: 0 0 var(--space-3); }
h3 { font-size: var(--fs-h3); margin: 0 0 var(--space-2); }

.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-600); }
.small { font-size: var(--fs-sm); }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: var(--space-3); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.spacer { height: var(--space-2); }
.hr { height: 1px; background: var(--line); margin: var(--space-4) 0; border: 0; }

/* Eyebrow / reference — the letter-spaced small-caps brand device */
.eyebrow { font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--ls-wider); color: var(--gold-800); }
.eyebrow.on-dark { color: var(--gold-500); }
.ref { font-family: var(--font-ui); font-size: var(--fs-sm); font-weight: var(--fw-semibold); letter-spacing: var(--ls-wide); color: var(--gold-800); }
.title-rule { width: 96px; height: 3px; background: var(--accent); border-radius: 2px; margin: var(--space-3) 0 0; }

/* ---------- Header ---------- */
header.top {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: var(--space-5);
  height: var(--header-h); padding: 0 var(--space-6);
  background: var(--navy-900);
  border-bottom: var(--rule-accent);
}
header.top .brand { display: flex; align-items: center; gap: var(--space-3); }
header.top .brand:hover { text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-divider { width: 1px; height: 22px; background: rgba(255,255,255,.22); }
.brand-eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--ls-wider); color: var(--gold-500); }
header.top nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
header.top nav a, header.top nav button {
  color: rgba(251,248,241,.86); background: transparent; border: 0;
  padding: 8px 12px; border-radius: var(--radius-md); font: inherit; font-weight: var(--fw-medium); cursor: pointer;
}
header.top nav a:hover, header.top nav button:hover { background: rgba(255,255,255,.08); color: var(--brand-ink); text-decoration: none; }
header.top nav .small { color: rgba(251,248,241,.72); }
.rolechip { font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--ls-wide); padding: 4px 10px; border-radius: var(--radius-pill); background: rgba(255,255,255,.12); color: var(--brand-ink); }
.rolechip.admin { background: var(--accent-solid); color: var(--accent-ink); }
.rolechip.evaluator { background: var(--navy-500); color: var(--brand-ink); }

/* ---------- Layout ---------- */
main { max-width: var(--container); margin: var(--space-6) auto; padding: 0 var(--space-6) var(--space-8); }
.row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4) var(--space-6); }
.stack > * + * { margin-top: var(--space-4); }
.center-wrap { max-width: 440px; margin: var(--space-8) auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: var(--space-5); margin-bottom: var(--space-4);
}
.card.pad0 { padding: 0; overflow: hidden; }
.card h2, .card h3 { color: var(--ink-900); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font: inherit; font-weight: var(--fw-semibold); cursor: pointer;
  padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--brand); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--navy-50); border-color: var(--navy-200); }
.btn.gold { background: var(--accent-solid); border-color: var(--accent-solid); color: var(--accent-ink); }
.btn.gold:hover { background: var(--accent-active); border-color: var(--accent-active); }
.btn.soft { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-active); }
.btn.soft:hover { background: var(--gold-200); }
.btn.danger { background: var(--surface); border-color: var(--error-line); color: var(--error-ink); }
.btn.danger:hover { background: var(--error-bg); }
.btn.sm { padding: 6px 12px; font-size: var(--fs-sm); border-radius: var(--radius-sm); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: var(--space-3); }
label.field > span { display: block; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--ink-700); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: var(--fs-body); color: var(--ink-900);
  padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
textarea { min-height: 76px; resize: vertical; line-height: var(--lh-snug); }
.inline { display: flex; gap: var(--space-3); align-items: flex-end; }
.inline > * { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: var(--ls-wide);
  padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid transparent;
}
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }
.pill.open { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-line); }
.pill.closed { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-line); }
.pill.draft { background: var(--ink-100); color: var(--ink-600); border-color: var(--ink-200); }
.pill.published { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.pill.evaluating, .pill.awarded { background: var(--warning-bg); color: var(--warning-ink); border-color: var(--warning-line); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; vertical-align: top; }
th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-wide); color: var(--ink-600); font-weight: var(--fw-semibold); background: var(--surface-raised); border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line-cool); }
tr:last-child td { border-bottom: 0; }
.tender-row { cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.tender-row:hover { background: var(--navy-50); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--space-5); flex-wrap: wrap; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: var(--fw-semibold); color: var(--ink-600); cursor: pointer; transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); }
.tabs button:hover { color: var(--ink-900); }
.tabs button.active { color: var(--ink-900); border-bottom-color: var(--accent); }

/* ---------- Banners ---------- */
.banner { border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: var(--space-4); font-size: var(--fs-body); display: flex; gap: var(--space-3); align-items: flex-start; border: 1px solid transparent; border-left-width: 4px; }
.banner .ic { font-size: 18px; line-height: 1.3; flex: none; }
.banner.info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); border-left-color: var(--info); }
.banner.warn { background: var(--warning-bg); color: var(--warning-ink); border-color: var(--warning-line); border-left-color: var(--warning); }
.banner.err { background: var(--error-bg); color: var(--error-ink); border-color: var(--error-line); border-left-color: var(--error); }
.banner.ok { background: var(--success-bg); color: var(--success-ink); border-color: var(--success-line); border-left-color: var(--success); }

/* ---------- Deadline hero (the navy vault) ---------- */
.deadline {
  display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap;
  background: var(--surface-vault); color: var(--brand-ink);
  border-radius: var(--radius-lg); border-top: 3px solid var(--accent);
  padding: var(--space-5) var(--space-6); box-shadow: var(--shadow-md);
}
.deadline-when { min-width: 260px; }
.deadline .lbl { font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--ls-wider); color: var(--gold-500); margin-bottom: 6px; }
.deadline-date { font-family: var(--font-display); font-size: var(--fs-h2); color: var(--brand-ink); line-height: var(--lh-tight); }
.deadline-note { font-size: var(--fs-sm); color: var(--navy-300); margin-top: 8px; }
.deadline .cd { margin-left: auto; }
/* segmented countdown */
.cd-seg { display: flex; gap: var(--space-5); }
.cd-seg .seg { text-align: center; }
.cd-seg .seg .n { font-family: var(--font-mono); font-size: var(--fs-countdown); font-weight: var(--fw-bold); color: var(--gold-400); line-height: 1; letter-spacing: -0.02em; }
.cd-seg .seg .u { display: block; font-size: var(--fs-xs); letter-spacing: var(--ls-wide); text-transform: uppercase; color: var(--navy-300); margin-top: 8px; }
/* compact countdown (footer / vault) */
.cd-compact { font-family: var(--font-mono); font-size: var(--fs-h2); font-weight: var(--fw-bold); color: var(--gold-400); letter-spacing: -0.01em; }
.deadline.closed { border-top-color: var(--error); }
.deadline.closed .cd-seg .seg .n, .deadline.closed .cd-compact, .deadline.closed .cd { color: var(--error-line); }
.deadline.closed .cd:not(.cd-seg) { font-family: var(--font-display); font-size: var(--fs-h1); color: #e6a49d; }

/* ---------- Sealed-submissions vault panel ---------- */
.vault { background: var(--surface-vault); color: var(--brand-ink); border-radius: var(--radius-lg); border-top: 3px solid var(--accent); padding: var(--space-6); box-shadow: var(--shadow-md); }
.vault-head { display: flex; align-items: center; gap: var(--space-4); }
.vault-lock { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--gold-700); color: var(--gold-500); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; flex: none; }
.vault h2 { font-family: var(--font-display); color: var(--brand-ink); font-size: var(--fs-h2); }
.vault p { color: var(--navy-200); }
.vault-rule { height: 1px; background: rgba(255,255,255,.12); margin: var(--space-5) 0; border: 0; }
.vault-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: var(--space-5); align-items: start; }
.vault-stat .big { font-family: var(--font-display); font-size: 44px; color: var(--brand-ink); line-height: 1; }
.vault-seelist { list-style: none; padding: 0; margin: 0; font-size: var(--fs-sm); }
.vault-seelist li { display: flex; gap: 8px; align-items: center; padding: 3px 0; color: var(--navy-200); }
.vault-seelist li .y { color: var(--success-line); }
.vault-seelist li .x { color: var(--navy-400); }
.vault-mono { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--navy-300); }

/* ---------- Checklist rows ---------- */
.check { display: flex; align-items: center; gap: var(--space-3); padding: 10px 4px; border-bottom: 1px solid var(--line-cool); }
.check:last-child { border-bottom: 0; }
.check .state { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; font-weight: var(--fw-bold); }
.check .state.yes { background: var(--success-bg); color: var(--success-ink); border: 1px solid var(--success-line); }
.check .state.no { background: var(--ink-100); color: var(--ink-500); border: 1px solid var(--ink-200); }
.req { color: var(--error-ink); font-weight: var(--fw-bold); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-wide); }

/* ---------- Key/value ---------- */
.kv { font-size: var(--fs-body); }
.kv b { display: block; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--ls-wide); color: var(--ink-600); font-weight: var(--fw-semibold); margin-bottom: 3px; }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; bottom: var(--space-5); right: var(--space-5); z-index: 80; display: flex; flex-direction: column; gap: var(--space-2); }
.toast { background: var(--navy-800); color: var(--brand-ink); padding: 12px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); max-width: 360px; font-size: var(--fs-sm); border-left: 3px solid var(--accent); animation: bhRise var(--dur-med) var(--ease-out); }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--error); }

@keyframes bhRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bhFade { from { opacity: 0; } to { opacity: 1; } }
#app > * { animation: bhFade var(--dur-med) var(--ease-out); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  main { padding: 0 var(--space-4) var(--space-7); }
  .grid2 { grid-template-columns: 1fr; }
  .deadline { gap: var(--space-4); }
  .deadline .cd { margin-left: 0; }
  .cd-seg { gap: var(--space-4); }
  .cd-seg .seg .n { font-size: 34px; }
  .vault-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  header.top { padding: 0 var(--space-4); gap: var(--space-3); }
  .brand-eyebrow { display: none; }
  main table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ============ Remediation additions (a11y, modals, mobile, icons) ============ */

/* Screen-reader-only + skip link (I2) */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.skip-link { position:absolute; left:8px; top:-52px; z-index:200; background:var(--surface); color:var(--brand); font-weight:600; padding:8px 14px; border-radius:8px; box-shadow:var(--shadow-md); transition:top var(--dur-fast) var(--ease-out); }
.skip-link:focus { top:8px; }
#app:focus { outline:none; }

/* Inline SVG icons (I1) */
.ic-svg { width:1em; height:1em; vertical-align:-0.15em; flex:none; }
.ic-svg.inline { width:13px; height:13px; vertical-align:-0.1em; opacity:.85; }
.banner .ic { display:inline-flex; align-items:center; }
.banner .ic .ic-svg { width:18px; height:18px; }
.pill .ic-svg { width:12px; height:12px; }
.btn .ic-svg { width:15px; height:15px; }
.check .state .ic-svg { width:13px; height:13px; }
.vault-seelist .ic-svg { width:14px; height:14px; }

/* Mobile nav toggle (U2) */
.nav-toggle { display:none; margin-left:auto; background:transparent; border:0; color:var(--brand-ink); width:42px; height:42px; border-radius:8px; cursor:pointer; align-items:center; justify-content:center; }
.nav-toggle svg { width:24px; height:24px; }
.nav-toggle:hover { background:rgba(255,255,255,.1); }
@media (max-width:720px) {
  .nav-toggle { display:inline-flex; }
  header.top nav {
    position:absolute; top:var(--header-h); left:0; right:0; margin:0;
    background:var(--navy-900); border-bottom:var(--rule-accent);
    flex-direction:column; align-items:stretch; gap:2px; padding:10px;
    display:none; box-shadow:var(--shadow-lg);
  }
  header.top.nav-open nav { display:flex; }
  header.top nav a, header.top nav button { width:100%; text-align:left; padding:12px; border-radius:8px; }
  header.top nav .rolechip { align-self:flex-start; margin:6px 12px 2px; }
  header.top nav .small { margin:0 12px 6px; }
}

/* Modals (U1) */
.modal-overlay { position:fixed; inset:0; background:rgba(11,24,38,.55); backdrop-filter:blur(2px); display:flex; align-items:center; justify-content:center; padding:1rem; z-index:100; animation:bhFade var(--dur-med) var(--ease-out); }
.modal { background:var(--surface); border:1px solid var(--line); border-top:3px solid var(--navy); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); max-width:470px; width:100%; padding:var(--space-5) var(--space-6); animation:bhRise var(--dur-med) var(--ease-out); }
.modal.danger { border-top-color:var(--error); }
.modal.ok { border-top-color:var(--success); }
.modal h2 { font-family:var(--font-display); margin-bottom:var(--space-3); }
.modal-body p { margin:0 0 .6rem; color:var(--body); }
.modal-body textarea { margin-top:.4rem; }
.modal-actions { display:flex; justify-content:flex-end; gap:.6rem; margin-top:var(--space-5); flex-wrap:wrap; }
.receipt { text-align:center; }
.receipt-icon { width:52px; height:52px; border-radius:50%; background:var(--success-bg); color:var(--success); display:inline-flex; align-items:center; justify-content:center; margin-bottom:.4rem; }
.receipt-icon .ic-svg { width:26px; height:26px; }
.receipt-dl { text-align:left; margin:.9rem 0 0; display:grid; gap:.1rem; }
.receipt-dl > div { display:flex; justify-content:space-between; gap:1rem; border-bottom:1px solid var(--line-2); padding:.4rem 0; }
.receipt-dl dt { color:var(--muted); font-size:.85rem; } .receipt-dl dd { margin:0; font-weight:600; color:var(--ink); }

/* Inline form errors (U5) */
.field-error { color:var(--error-ink); font-size:.85rem; min-height:1.1em; margin:-.2rem 0 .6rem; font-weight:600; }
.btn.ghost.danger { color:var(--error-ink); border-color:var(--error-line); background:var(--surface); }
.btn.ghost.danger:hover { background:var(--error-bg); }

/* Gold small-text contrast fix (I3): darker gold for eyebrow/reference on parchment */
.eyebrow { color:var(--gold-900); }
.ref { color:var(--gold-900); }
.eyebrow.on-dark { color:var(--gold-500); }

/* Programmatic focus targets (route change) shouldn't show a focus ring;
   real keyboard focus on controls still does via :focus-visible. */
[tabindex="-1"]:focus { outline: none; }

/* Two-factor screens */
.qr-box { display:flex; align-items:center; justify-content:center; padding:16px; background:#fff; border:1px solid var(--line); border-radius:10px; min-height:140px; }
.qr-box svg { width:190px; height:190px; }
.mfa-manual { margin-top:.6rem; }
.mfa-manual summary { cursor:pointer; color:var(--ink-600); }
.mfa-manual .mono { margin-top:.5rem; letter-spacing:2px; font-size:1.05rem; background:var(--surface-raised); padding:.6rem; border-radius:8px; text-align:center; word-break:break-all; }
.backup-codes { display:grid; grid-template-columns:1fr 1fr; gap:.35rem; background:var(--surface-raised); border:1px solid var(--line); border-radius:8px; padding:1rem; margin:.6rem 0; }
.backup-codes span { padding:.25rem; text-align:center; letter-spacing:1px; font-size:.95rem; }

/* ==========================================================================
   ADMIN CONSOLE
   Everything below serves one idea: an admin should be able to answer
   "what is waiting on me?" and "what does this tender look like right now?"
   without opening anything. Colour is used only to mean something — amber and
   red are reserved for outstanding work and passed deadlines.
   ========================================================================== */

/* ---------- Worklist ---------- */
.worklist { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-5); }
.worklist.calm { border-left-color: var(--success); }
.worklist-head { display: flex; align-items: center; gap: var(--space-2); }
.worklist-head h2 { font-size: var(--fs-h3); margin: 0; color: var(--ink-900); }
.worklist-head .ic-svg { color: var(--accent-active); width: 16px; height: 16px; }
.worklist.calm .worklist-head .ic-svg { color: var(--success); }
.worklist-head .muted { margin-left: auto; }
.worklist ul { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.work { display: flex; align-items: center; gap: var(--space-3); padding: 10px 0; border-top: 1px solid var(--line-cool); }
.work:first-child { border-top: 0; }
.work-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-300); }
.work.warn .work-dot { background: var(--warning); }
.work.ok   .work-dot { background: var(--success); }
.work.info .work-dot { background: var(--info); }
.work-body { min-width: 0; flex: 1; }
.work-ref { font-size: var(--fs-xs); color: var(--gold-900); letter-spacing: var(--ls-wide); }
.work-text { font-size: var(--fs-body); color: var(--ink-800); }
.work .btn { flex: none; }

/* ---------- Toolbar: search + status chips ---------- */
.toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.searchbox { flex: 1 1 260px; min-width: 200px; margin: 0; }
.searchbox input { width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  padding: 7px 12px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-700); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out); }
.chip:hover { background: var(--navy-50); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip .n { font-size: var(--fs-xs); opacity: .75; font-variant-numeric: tabular-nums; }

/* ---------- Admin tables ---------- */
.admin-table td { vertical-align: middle; }
.nowrap { white-space: nowrap; }
td.empty { padding: var(--space-6) var(--space-5); text-align: center; color: var(--ink-600); }
td.empty b { display: block; color: var(--ink-800); margin-bottom: 4px; }
.rel { color: var(--ink-600); font-variant-numeric: tabular-nums; }
.rel.near { color: var(--warning-ink); }
.rel.soon { color: var(--error-ink); font-weight: var(--fw-semibold); }
.rel.past { color: var(--ink-600); }
.tender-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Small inline metric chips inside a row */
.mini { display: inline-block; font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  padding: 3px 8px; border-radius: var(--radius-pill); background: var(--ink-100); color: var(--ink-700);
  white-space: nowrap; margin: 1px 0; }
.mini.strong { background: var(--info-bg); color: var(--info-ink); }
.mini.alert  { background: var(--warning-bg); color: var(--warning-ink); }

/* ---------- Tender header + facts strip ---------- */
.tender-head { margin: .3rem 0 var(--space-4); align-items: flex-start; gap: var(--space-4); }
.tender-head h1 { margin: 0; }
.flex.wrap { flex-wrap: wrap; justify-content: flex-end; }
.facts { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-4); }
.fact { background: var(--surface); padding: var(--space-3) var(--space-4); }
.fact .eyebrow { display: block; margin-bottom: 4px; }
.fact-v { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--ink-900); line-height: var(--lh-snug); }
.fact-v.alert { color: var(--warning-ink); }
.fact-sub { font-size: var(--fs-sm); color: var(--ink-600); margin-top: 2px; font-variant-numeric: tabular-nums; }
.fact-sub.near { color: var(--warning-ink); }
.fact-sub.soon { color: var(--error-ink); font-weight: var(--fw-semibold); }
.fact-sub.past { color: var(--ink-600); }
.fact-sub .cd { font-variant-numeric: tabular-nums; }

/* ---------- Publish readiness ---------- */
.readiness { background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4); }
.readiness.go { background: var(--success-bg); border-color: var(--success-line); }
.readiness h3 { margin: 0; font-size: var(--fs-h3); }
.rd-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.rd-list li { display: flex; align-items: center; gap: var(--space-2); padding: 5px 0; font-size: var(--fs-body); color: var(--ink-800); }
.rd-list li .small { margin-left: auto; }
.rd-ic { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; flex: none; }
.rd-list li.done { color: var(--ink-600); }
.rd-list li.done .rd-ic { color: var(--success); }
.rd-list li.todo .rd-ic { color: var(--warning); }
.rd-list li.block .rd-ic { color: var(--error); }
.rd-list li.block { font-weight: var(--fw-semibold); color: var(--error-ink); }

/* ---------- Tab badges ---------- */
.tabs button { display: inline-flex; align-items: center; gap: 6px; }
.tab-badge { font-size: var(--fs-xs); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums;
  min-width: 18px; padding: 1px 6px; border-radius: var(--radius-pill);
  background: var(--ink-100); color: var(--ink-600); }
.tabs button.active .tab-badge { background: var(--navy-100); color: var(--navy-700); }
.tab-badge.alert { background: var(--warning-bg); color: var(--warning-ink); }

/* ---------- Details tab ---------- */
.unset { color: var(--ink-600); font-style: italic; }
#detailsForm .hr { margin: var(--space-4) 0; }

/* ---------- Document version history ---------- */
.vhist { margin-top: 6px; }
.vhist summary { cursor: pointer; color: var(--ink-600); }
.vhist summary:hover { color: var(--ink-900); }
.vrow { padding: 3px 0 3px 14px; border-left: 2px solid var(--line); margin-top: 4px; }
.vrow a { margin-left: 6px; }

/* ---------- Collapsible add form ---------- */
.addform summary { cursor: pointer; list-style: none; }
.addform summary::-webkit-details-marker { display: none; }
.addform summary::before { content: ""; }
.addform[open] summary { border-bottom: 1px solid var(--line); padding-bottom: var(--space-3); }

@media (max-width: 780px) {
  .facts { grid-template-columns: 1fr 1fr; }
  .facts .fact.wide { grid-column: 1 / -1; }
  /* Four facts in two columns leave a hole on the last row; let the final one
     span the width rather than exposing the grid gap as an empty tile. */
  .facts .fact:last-child { grid-column: 1 / -1; }
  .work { flex-wrap: wrap; }
  .work .btn { margin-left: 18px; }
  /* Stacked, the search field must not also STRETCH vertically — `flex: 1 1`
     grows along the main axis, which is now the column. */
  .toolbar { flex-direction: column; align-items: stretch; }
  .searchbox { flex: 0 0 auto; }
}

/* Between tablet and phone the Activity column is the one worth dropping. */
@media (max-width: 780px) and (min-width: 641px) {
  .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
}

/* On a phone a five-column table scrolls the status and closing time out of
   sight — the two things you opened the console to see. Stack each row into a
   card instead, so nothing important lives off the right-hand edge. */
@media (max-width: 640px) {
  .admin-table thead { display: none; }
  /* The app's generic mobile table rule (`main table`) makes tables scroll
     sideways with white-space: nowrap. Stacked cards need the opposite, and
     nowrap INHERITS down to every cell — so it must be undone at the table. */
  .admin-table { overflow-x: visible; white-space: normal; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line-cool); }
  .admin-table tbody tr:last-child { border-bottom: 0; }
  .admin-table td { border: 0; padding: 3px 0; }
  .admin-table td.right { text-align: left; }
  .admin-table td.nowrap { white-space: normal; }
  .admin-table td.empty { padding: var(--space-6) var(--space-4); text-align: center; }
  /* Reference and status read as the row's label and badge, not as data cells. */
  .admin-table td.mono { font-size: var(--fs-xs); letter-spacing: var(--ls-wide); color: var(--gold-900); }
}

/* ==========================================================================
   WCAG remediation found in the pre-go-live audit
   ========================================================================== */

/* 1.4.3 Contrast — the base link gold (--gold-800, #8a6a2e) is fine on the
   parchment page (6.0:1) but only 4.30:1 on the info banner's #e9eef4, which
   fails AA for body-size text. Inside a banner, use the darker gold that the
   eyebrow/reference styles already adopted for the same reason: it clears 6:1
   on every banner background (info, warn, error, success). */
.banner a { color: var(--gold-900); }

/* 1.4.1 Use of Colour — a link sitting inside a block of running text must not
   be distinguished from that text by colour alone. Underline those; leave
   links that are already unmistakably interactive by shape or position
   (buttons, header nav, tab strips, table action links) exactly as they are. */
.banner a,
.modal-body a,
p a:not(.btn),
.kv a:not(.btn),
li a:not(.btn),
td a:not(.btn),
.small a:not(.btn) { text-decoration: underline; }
.btn, header.top nav a, .tabs a { text-decoration: none; }

/* 1.3.1 — a section heading inside a tab body sits under the page h1, so it is
   level 2. Kept visually identical to the h3 it replaces. */
.card h2.sec, h2.sec { font-size: var(--fs-h3); margin: 0 0 var(--space-2); }

/* 2.5.8 Target Size (Minimum, AA in WCAG 2.2) — 24px. Small standalone links
   and inline checkbox labels were 13-15px tall on a phone. Pad them out on
   touch-sized viewports rather than making them bigger on the desktop. */
@media (max-width: 780px) {
  a.small, .small a:not(.btn) { display: inline-block; padding: 6px 0; min-height: 24px; }
  label.field > span > input[type="checkbox"] { min-width: 22px; min-height: 22px; }
  label.field > span:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: 10px; min-height: 32px; }
  .rd-list li, .work { min-height: 32px; }
}

/* ---------- Support line ----------
   Shown to contractors wherever they might otherwise email the wrong place.
   Quiet by design: it must be findable when something has gone wrong, without
   competing with the closing countdown or the submit button. */
.support {
  display: flex; gap: var(--space-3); align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--navy-400);
  border-radius: var(--radius-md);
  padding: 14px 18px; margin: var(--space-5) 0 0;
  font-size: var(--fs-sm); line-height: var(--lh-snug); color: var(--ink-700);
}
.support b { color: var(--ink-900); }
.support a { color: var(--gold-900); text-decoration: underline; }
.support-ic { flex: none; color: var(--navy-500); display: inline-flex; padding-top: 1px; }
.support-ic .ic-svg { width: 15px; height: 15px; }
.support-rule {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  color: var(--ink-600);
}
.support-rule em { font-style: normal; font-weight: 600; color: var(--ink-800); }
.center-wrap .support { margin-top: var(--space-4); }

/* The engagement strip carries five figures rather than four. */
.facts.eng { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 980px) { .facts.eng { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .facts.eng { grid-template-columns: repeat(2, 1fr); } }
