/*
 * Tender status board — screen 1, the app's front door since s54. Built ENTIRELY on
 * the theme tokens (theme.css). The shared chrome (topbar, wrap, card, spinner,
 * banner) was folded IN from the retired screen.css when the price-a-tender screen
 * left with its endpoint (s54 review F1: the board must not depend on a dead sheet).
 * Board-specific rules are scoped under `#s-workqueue` so the screen lifts into the
 * quotebench shell as an `s-` section later without a restyle.
 *
 * State vocabulary (theme.css): `--ready` clean, `--look` waiting/attention, `--gap-ink`
 * blocked/overdue/unpriced. Overdue chips and the gaps pill carry that weight — no new
 * colour is introduced.
 */

/* ── Shared chrome (ex-screen.css) ───────────────────────────────────── */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Visible focus everywhere — keyboard users must always see where they are. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px var(--gap);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tenant-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  padding: 2px 8px;
  border-radius: 999px;
}

.topnav {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.topnav a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.topnav a:hover {
  background: var(--paper-2);
}
.topnav a[aria-current="page"] {
  color: var(--brand-ink);
  background: var(--brand-soft);
  border-color: var(--brand);
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--gap);
  flex: 1;
}
.lede h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
}
.lede .sub {
  color: var(--ink-2);
  max-width: 58ch;
  margin: 0 0 var(--gap);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: var(--gap);
}

.placeholder {
  color: var(--ink-2);
}
.placeholder[data-state="loading"] {
  display: flex;
  align-items: center;
  gap: 10px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

/* Error banner (board.js renders .banner.gap when the fetch fails). */
.banner {
  border-radius: var(--r);
  border: 1px solid;
  padding: var(--gap);
}
.banner h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.banner.gap {
  background: var(--gap-bg);
  border-color: var(--gap-ink);
  color: var(--ink);
}
.banner.gap h2 {
  color: var(--gap-ink);
}

/* ── Lane grid ────────────────────────────────────────────────────────────
 * Vertical stack on narrow screens; a responsive multi-column board on wide.
 * Low tender volume (~1/week) reads better stacked than as scrolling kanban
 * columns, and every lane stays visible (the whole pipeline is the point).
 *
 * s91: ten lanes now, not six — the register stopped collapsing the domain's
 * statuses, so the three waiting states arrive as lanes of their own. Ten in
 * rows of three would leave an orphan on the last row, so the wide breakpoints
 * step 2 → 3 → 4 and a fifth column arrives only when there is genuinely room. */
#s-workqueue .board {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: start;
}
@media (min-width: 720px) {
  #s-workqueue .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1080px) {
  #s-workqueue .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1400px) {
  #s-workqueue .board {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 1750px) {
  #s-workqueue .board {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

#s-workqueue .lane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px;
}

/* The three "blocked on someone else" lanes (s91). The tinted left edge is the
 * whole visual weight this earns — it must read as *where to look*, not as an
 * error, because waiting is a normal state of a tender and an alarming board is
 * one people stop reading. The accessible signal is the "waiting" text in the
 * lane head; this is reinforcement, never the only cue. */
#s-workqueue .lane--waiting {
  border-left-color: var(--look);
  background: linear-gradient(to right, var(--look-bg) 0 3px, var(--panel) 3px);
}

#s-workqueue .lane-flag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--look);
  background: var(--look-bg);
}

#s-workqueue .lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
#s-workqueue .lane-name {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}
#s-workqueue .lane-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  min-width: 22px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--paper-2);
}
#s-workqueue .lane-empty {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.85rem;
}
#s-workqueue .lane-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Tender card ──────────────────────────────────────────────────────────*/
/* The card is an <a> to tender.html (s56 U1), so it must be reset out of the
   default link look — the whole card is the target, not a blue phrase inside
   it — and given a visible hover/focus affordance so it still READS clickable. */
#s-workqueue .tender {
  display: block;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}
#s-workqueue .tender:hover {
  border-color: var(--accent, var(--ink-2));
}
#s-workqueue .tender:focus-visible {
  outline: 2px solid var(--accent, var(--ink));
  outline-offset: 2px;
}
#s-workqueue .tender-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
#s-workqueue .project {
  font-weight: 600;
  color: var(--ink);
}
/* The latest-quote sub-line: kind/version/status of the newest quote, plus the
   gaps pill when it still has unpriced lines. */
#s-workqueue .tender-sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
#s-workqueue .quoteline {
  font-size: 0.8rem;
  color: var(--ink-2);
}
#s-workqueue .quoteline.none {
  color: var(--ink-3);
  font-style: italic;
}

#s-workqueue .tender-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
#s-workqueue .builder {
  font-size: 0.85rem;
  color: var(--ink-2);
}
#s-workqueue .tid {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-3);
}

/* ── Urgency chip — the only pressure signal (from due_date, server-computed) ── */
#s-workqueue .chip {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
}
#s-workqueue .chip.overdue {
  color: var(--gap-ink);
  background: var(--gap-bg);
  border-color: var(--gap-ink);
}
#s-workqueue .chip.due-soon {
  color: var(--look);
  background: var(--look-bg);
  border-color: var(--look);
}
#s-workqueue .chip.calm {
  color: var(--ink-3);
  background: var(--paper-2);
  border-color: var(--line);
}

/* ── Gaps pill — the money gate's gap count (§6 r10, on the latest quote).
   A count in the blocked colour pair; never a dollar figure. ────────────────*/
#s-workqueue .pill.gaps {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--gap-ink);
  background: var(--gap-bg);
  border: 1px solid var(--gap-ink);
}

/* ── Sign out — shared chrome, so it sits in board.css beside .topnav rather
   than in any one screen's stylesheet (s72). A button, not a link, because
   ending a session is a POST: api.js wires #signout on every page that has
   one, so no screen carries its own copy of the logout call. ───────────────*/
.topbar .signout {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 44px;
  cursor: pointer;
}
.topbar .signout:hover {
  background: var(--paper-2);
}

/* ── The signed-out page (login.html). No script on that page, so everything
   here is static chrome: one card, one obvious action. ────────────────────*/
#s-login .login-card {
  max-width: 460px;
  margin: 8vh auto 0;
  padding: calc(var(--gap) * 1.5);
  text-align: left;
}
#s-login h1 {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 0 0 8px;
}
#s-login .sub {
  color: var(--ink-2);
  margin: 0 0 var(--gap);
}
#s-login .signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  font-weight: 700;
  text-decoration: none;
  color: var(--brand-ink);
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 8px;
}
#s-login .signin:hover {
  filter: brightness(0.96);
}
#s-login .note {
  margin: var(--gap) 0 0;
  font-size: 0.82rem;
  color: var(--ink-3);
}
