/*
 * Quattro Workbench — shared styles
 * Extends quattro.css visual language for the assessor app shell.
 * Imports quattro.css tokens; adds workbench-specific layout.
 */

/* ------------------------------------------------------------------
   IMPORT BASE TOKEN LAYER
   ------------------------------------------------------------------ */
@import url('../quattro.css');

/* ------------------------------------------------------------------
   WORKBENCH SHELL LAYOUT
   Three-region layout:
     - .wb-topbar   — fixed top bar (town name, FY, user)
     - .wb-sidebar  — fixed left nav
     - .wb-content  — scrollable main area
   ------------------------------------------------------------------ */

:root {
  /* ── φ-based spacing scale (Fibonacci: each step ≈ 1.618× previous) ──
     --wb-sp-1   4px   (micro: icon gaps, inset nudges)
     --wb-sp-2   8px   (tight: badge padding, avatar gap, small gaps)
     --wb-sp-3  13px   (base: nav padding, stat card padding, alert gap)
     --wb-sp-4  21px   (medium: content padding, panel body, section gap)
     --wb-sp-5  34px   (section: major margins, content top/side padding)
     --wb-sp-6  55px   (page: large section separation, bottom padding)
  */
  --wb-sp-1:  4px;
  --wb-sp-2:  8px;
  --wb-sp-3: 13px;
  --wb-sp-4: 21px;
  --wb-sp-5: 34px;
  --wb-sp-6: 55px;

  /* ── φ-based modular type scale (base 13px; each step × 1.25 ≈ φ^(2/3)) ──
     --wb-t-xs  10px   (labels, badges, timestamp)
     --wb-t-sm  12px   (muted captions, secondary text)
     --wb-t-md  13px   (base body, table, nav links)
     --wb-t-rg  14px   (default body, form inputs)
     --wb-t-lg  16px   (sub-heading, CTA title)
     --wb-t-xl  20px   (page title, stat value)
     --wb-t-2xl 26px   (hero stat, error code sub)
  */
  --wb-t-xs:  10px;
  --wb-t-sm:  12px;
  --wb-t-md:  13px;
  --wb-t-rg:  14px;
  --wb-t-lg:  16px;
  --wb-t-xl:  20px;
  --wb-t-2xl: 26px;

  /* ── Line-height rhythm (anchored to 1.618) ── */
  --wb-lh-tight:  1.25;   /* headings, stats */
  --wb-lh-base:   1.45;   /* body copy, nav */
  --wb-lh-relaxed: 1.618; /* multi-line descriptive text */

  /* ── Shell dimensions ── */
  --wb-topbar-h: 52px;
  --wb-sidebar-w: 220px;

  /* ── Sidebar palette — retoned onto civic-ledger (navy/gold) 2026-07-20;
       variable names unchanged, values now alias the shared tokens ── */
  --wb-sidebar-bg: var(--cl-navy-ink, #1a1a2e);
  --wb-sidebar-border: rgba(233,198,107,0.14);
  /* NOTE: the sidebar is permanently dark chrome even though these pages are
     .cl-page (light mode) — do not use --ms-text/--ms-text-2 here, they flip
     to dark-on-light under .cl-page and would be unreadable on this bg. */
  --wb-sidebar-text: #c8cdd4;
  --wb-sidebar-text-active: var(--cl-white, #ffffff);
  --wb-sidebar-accent: var(--cl-gold, #d4a017);
  --wb-sidebar-hover-bg: rgba(255,255,255,0.06);
  --wb-sidebar-active-bg: rgba(201,169,98,0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--q-bg);
  color: var(--q-text);
  font-family: var(--q-font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------
   TOP BAR
   ------------------------------------------------------------------ */
.wb-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--wb-topbar-h);
  background: var(--q-nav-bg);
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  padding: 0 var(--wb-sp-4);
  gap: var(--wb-sp-3);
  z-index: 900;
}

.wb-brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--q-nav-accent);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: var(--wb-sp-2);
  text-decoration: none;
  flex-shrink: 0;
}
.wb-collaboration-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,.22);
  flex: 0 0 auto;
}
.wb-collaboration-seal {
  display: block;
  width: auto;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
}
@media (max-width: 720px) {
  .wb-collaboration-seal { height: 26px; }
  .wb-collaboration-divider { height: 19px; }
}
.wb-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: var(--q-radius);
  background: linear-gradient(135deg, var(--q-nav-accent) 0%, var(--q-nav-accent-2) 100%);
  color: var(--cl-navy-ink, #1c1c1c);
  font-size: var(--wb-t-md);
  font-weight: 900;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.wb-topbar-town {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: var(--wb-sp-2);
}
.wb-town-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: var(--wb-lh-tight);
}
.wb-fy-badge {
  font-size: var(--wb-t-xs);
  font-weight: 700;
  color: var(--q-nav-accent);
  background: rgba(201,169,98,0.15);
  border: 1px solid rgba(201,169,98,0.3);
  border-radius: 3px;
  padding: 2px var(--wb-sp-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Town-switch dropdown (shown for multi-town assessors / admins) */
.wb-town-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.08)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23fff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 5px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--q-font);
  line-height: var(--wb-lh-tight);
  padding: 4px 28px 4px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  max-width: 180px;
}
.wb-town-select:hover,
.wb-town-select:focus {
  background-color: rgba(255,255,255,0.14);
  border-color: rgba(201,169,98,0.6);
  outline: none;
}
.wb-town-select option {
  background: var(--cl-navy-ink, #1a1a2e);
  color: #fff;
  font-weight: 600;
}

.wb-topbar-user {
  display: flex;
  align-items: center;
  gap: var(--wb-sp-2);
  font-size: var(--wb-t-sm);
  color: var(--q-nav-text-muted);
  flex-shrink: 0;
}

/* ── Role badge (signed-in role pill + username) ─────────────────────────────
   Shared with piai-shell + the Quattro viewer. Solid colored pill, white text. */
.pia-rolebadge { display:inline-flex; align-items:center; gap:8px; flex:0 0 auto; min-width:0; }
.pia-rolebadge__pill {
  display:inline-block; padding:3px 10px; border-radius:999px;
  font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.05em;
  color:#fff; white-space:nowrap; line-height:1.45;
}
.pia-rolebadge__user {
  font-size:12px; font-weight:600; color:#cbd5e1; white-space:nowrap;
  max-width:230px; overflow:hidden; text-overflow:ellipsis;
}
.pia-rolebadge__pill.founder, .pia-rolebadge__pill.ceo     { background:#c89b1e; }
.pia-rolebadge__pill.admin, .pia-rolebadge__pill.superuser { background:#7c3aed; }
.pia-rolebadge__pill.town_manager                          { background:#0ea5e9; }
.pia-rolebadge__pill.assessor                              { background:#16a34a; }
.pia-rolebadge__pill.deputy_assessor                       { background:#1f9a55; }
.pia-rolebadge__pill.editor                                { background:#d97706; }
.pia-rolebadge__pill.treasurer                             { background:#b07d10; }
.pia-rolebadge__pill.collector                             { background:#dc2626; }
.pia-rolebadge__pill.clerk                                 { background:#0891b2; }
.pia-rolebadge__pill.select_board                          { background:#6366f1; }
.pia-rolebadge__pill.viewer, .pia-rolebadge__pill.user     { background:#64748b; }
@media (max-width: 640px) { .pia-rolebadge__user { display:none; } }
.wb-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--q-nav-accent);
  color: var(--cl-navy-ink, #1c1c1c);
  display: grid;
  place-items: center;
  font-size: var(--wb-t-xs);
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ------------------------------------------------------------------
   SIDEBAR NAV
   ------------------------------------------------------------------ */
.wb-sidebar {
  position: fixed;
  top: var(--wb-topbar-h);
  left: 0;
  bottom: 0;
  width: var(--wb-sidebar-w);
  background: var(--wb-sidebar-bg);
  border-right: 1px solid var(--wb-sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 800;
  overflow-y: auto;
}

.wb-nav {
  padding: var(--wb-sp-3) 0;
  flex: 1;
}

.wb-nav-label {
  padding: var(--wb-sp-1) var(--wb-sp-3) var(--wb-sp-1);
  font-size: var(--wb-t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  margin-top: var(--wb-sp-2);
}
.wb-nav-label:first-child { margin-top: 0; }

.wb-nav a {
  display: flex;
  align-items: center;
  gap: var(--wb-sp-2);
  padding: var(--wb-sp-2) var(--wb-sp-3);
  font-size: var(--wb-t-md);
  font-weight: 500;
  color: var(--wb-sidebar-text);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  line-height: var(--wb-lh-tight);
  border-left: 2px solid transparent;
}
.wb-nav a:hover {
  background: var(--wb-sidebar-hover-bg);
  color: var(--wb-sidebar-text-active);
  text-decoration: none;
}
.wb-nav a.active {
  background: var(--wb-sidebar-active-bg);
  color: var(--wb-sidebar-text-active);
  font-weight: 600;
  border-left-color: var(--wb-sidebar-accent);
  padding-left: calc(var(--wb-sp-3) - 2px);
}
.wb-nav .wb-nav-icon {
  font-size: 15px;
  width: var(--wb-sp-4);
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}
.wb-nav a.active .wb-nav-icon,
.wb-nav a:hover .wb-nav-icon { opacity: 1; }

.wb-nav-divider {
  margin: var(--wb-sp-2) var(--wb-sp-3);
  border: none;
  border-top: 1px solid var(--wb-sidebar-border);
}

/* ------------------------------------------------------------------
   MAIN CONTENT AREA
   ------------------------------------------------------------------ */
.wb-content {
  margin-left: var(--wb-sidebar-w);
  margin-top: var(--wb-topbar-h);
  min-height: calc(100vh - var(--wb-topbar-h));
  padding: var(--wb-sp-4) var(--wb-sp-5) var(--wb-sp-6);
}

/* ------------------------------------------------------------------
   PAGE HEADER (within content area)
   ------------------------------------------------------------------ */
.wb-page-header {
  margin-bottom: var(--wb-sp-4);
}
.wb-page-title {
  font-size: var(--wb-t-xl);
  font-weight: 700;
  color: var(--q-text);
  margin: 0 0 var(--wb-sp-1);
  line-height: var(--wb-lh-tight);
  letter-spacing: -0.01em;
}
.wb-page-subtitle {
  font-size: var(--wb-t-md);
  color: var(--q-text-muted);
  line-height: var(--wb-lh-relaxed);
}

/* ------------------------------------------------------------------
   STAT CARDS (Dashboard)
   ------------------------------------------------------------------ */
.wb-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--wb-sp-3);
  margin-bottom: var(--wb-sp-4);
}
/* 3-column variant — wraps to 1-col on very small screens */
.wb-stats-grid--3col { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 480px) {
  .wb-stats-grid--3col { grid-template-columns: 1fr 1fr 1fr; }
}

.wb-stat-card {
  background: var(--q-surface);
  border: 1px solid var(--q-border);
  border-radius: var(--q-radius-lg);
  /* φ proportion: label area ≈ 10px+6px = ~16px; value ≈ 26px; total interior ~52px.
     Padding top:bottom at 13px:8px approximates the 1:φ^-1 split. */
  padding: var(--wb-sp-3) var(--wb-sp-3) var(--wb-sp-2);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.wb-stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--q-border-strong);
  opacity: 0;
  transition: opacity 0.15s ease;
}
a.wb-stat-card {
  cursor: pointer;
}
a.wb-stat-card:hover {
  border-color: var(--q-focus);
  box-shadow: var(--q-shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
a.wb-stat-card:hover::after { opacity: 1; background: var(--q-focus); }
.wb-stat-label {
  font-size: var(--wb-t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--q-text-faint);
  margin-bottom: var(--wb-sp-1);
  line-height: var(--wb-lh-tight);
}
.wb-stat-value {
  font-size: var(--wb-t-2xl);
  font-weight: 800;
  color: var(--q-text);
  line-height: var(--wb-lh-tight);
  letter-spacing: -0.02em;
}
.wb-stat-value.good { color: var(--q-positive); }
.wb-stat-value.warn { color: var(--q-warning); }
.wb-stat-value.bad  { color: var(--q-negative); }

/* ------------------------------------------------------------------
   PROGRESS BAR
   ------------------------------------------------------------------ */
.wb-progress-wrap {
  margin-bottom: var(--wb-sp-4);
}
.wb-progress-label {
  font-size: var(--wb-t-sm);
  color: var(--q-text-muted);
  margin-bottom: var(--wb-sp-1);
  display: flex;
  justify-content: space-between;
  line-height: var(--wb-lh-base);
}
.wb-progress-bar {
  height: 6px;
  background: var(--q-border);
  border-radius: 3px;
  overflow: hidden;
}
.wb-progress-fill {
  height: 100%;
  background: var(--q-positive);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ------------------------------------------------------------------
   ALERT BANNER
   ------------------------------------------------------------------ */
.wb-alert {
  display: flex;
  align-items: center;
  gap: var(--wb-sp-2);
  padding: var(--wb-sp-2) var(--wb-sp-3);
  border-radius: var(--q-radius);
  margin-bottom: var(--wb-sp-3);
  font-size: var(--wb-t-md);
  font-weight: 500;
  line-height: var(--wb-lh-base);
}
.wb-alert.warn {
  background: rgba(185,122,0,0.08);
  border: 1px solid rgba(185,122,0,0.28);
  color: var(--q-warning);
}
.wb-alert.error {
  background: rgba(194,57,43,0.07);
  border: 1px solid rgba(194,57,43,0.22);
  color: var(--q-negative);
}
.wb-alert a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

/* ------------------------------------------------------------------
   PANEL (generic card)
   ------------------------------------------------------------------ */
.wb-panel {
  background: var(--q-surface);
  border: 1px solid var(--q-border);
  border-radius: var(--q-radius-lg);
  margin-bottom: var(--wb-sp-3);
  overflow: hidden;
  box-shadow: var(--q-shadow-sm);
}
.wb-panel-head {
  /* φ proportion: header height ≈ 13px text + 2×8px padding = 37px;
     body padding 21px achieves a ~1:1.618 head:body visual weight. */
  padding: var(--wb-sp-2) var(--wb-sp-3);
  border-bottom: 1px solid var(--q-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--q-surface-alt);
}
.wb-panel-title {
  font-size: var(--wb-t-md);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--q-text-muted);
  line-height: var(--wb-lh-tight);
}
.wb-panel-body {
  padding: var(--wb-sp-3) var(--wb-sp-3);
}

/* ------------------------------------------------------------------
   TABLE
   ------------------------------------------------------------------ */
.wb-table-wrap {
  overflow-x: auto;
}
.wb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wb-t-md);
  font-variant-numeric: tabular-nums; /* aligns figure columns — dense assessor grids */
}
.wb-table th {
  padding: var(--wb-sp-2) var(--wb-sp-3);
  text-align: left;
  font-size: var(--wb-t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--q-text-muted);
  background: var(--q-surface-alt);
  border-bottom: 1px solid var(--q-border);
  white-space: nowrap;
  line-height: var(--wb-lh-tight);
}
.wb-table td {
  padding: var(--wb-sp-2) var(--wb-sp-3);
  border-bottom: 1px solid var(--q-border);
  vertical-align: middle;
  line-height: var(--wb-lh-base);
}
.wb-table tr:last-child td { border-bottom: none; }
.wb-table tr:hover td { background: var(--q-row-hover); }
.wb-table .mono { font-family: var(--q-mono); font-size: var(--wb-t-sm); }

/* ------------------------------------------------------------------
   PLACEHOLDER / LOADING STATES
   ------------------------------------------------------------------ */
.wb-loading {
  text-align: center;
  padding: var(--wb-sp-5);
  color: var(--q-text-muted);
  font-size: var(--wb-t-rg);
  line-height: var(--wb-lh-base);
}
.wb-placeholder {
  border: 2px dashed var(--q-border);
  border-radius: var(--q-radius-lg);
  padding: var(--wb-sp-5);
  text-align: center;
  color: var(--q-text-muted);
  font-size: var(--wb-t-rg);
  line-height: var(--wb-lh-relaxed);
}
.wb-placeholder strong { color: var(--q-text); display: block; margin-bottom: var(--wb-sp-1); }

/* ------------------------------------------------------------------
   403 / ERROR PAGE
   ------------------------------------------------------------------ */
.wb-error-page {
  max-width: 480px;
  margin: var(--wb-sp-6) auto;
  text-align: center;
  padding: 0 var(--wb-sp-4);
}
.wb-error-code {
  font-size: 72px;
  font-weight: 800;
  color: var(--q-border-strong);
  line-height: var(--wb-lh-tight);
  margin-bottom: var(--wb-sp-2);
}
.wb-error-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--wb-sp-3);
  line-height: var(--wb-lh-tight);
  letter-spacing: -0.01em;
}
.wb-error-body {
  font-size: var(--wb-t-rg);
  color: var(--q-text-muted);
  line-height: var(--wb-lh-relaxed);
  margin-bottom: var(--wb-sp-4);
}
.wb-btn {
  display: inline-block;
  padding: var(--wb-sp-2) var(--wb-sp-4);
  background: var(--q-link);
  color: #fff;
  border-radius: var(--q-radius);
  font-size: var(--wb-t-md);
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}
.wb-btn:hover { background: var(--q-link-hover); color: #fff; text-decoration: none; box-shadow: var(--q-shadow-sm); }
.wb-btn.secondary {
  background: transparent;
  color: var(--q-link);
  border: 1px solid var(--q-link);
}
.wb-btn.secondary:hover { background: var(--q-row-hover); color: var(--q-link-hover); }

/* ------------------------------------------------------------------
   COMMITMENT CTA BANNER — unsigned state
   Prominent top-of-page action card shown when active FY is not signed.
   ------------------------------------------------------------------ */
.wb-commit-cta {
  background: rgba(185,122,0,0.07);
  border: 1px solid rgba(185,122,0,0.32);
  border-left: 3px solid var(--q-warning);
  border-radius: var(--q-radius-lg);
  padding: var(--wb-sp-4) var(--wb-sp-4);
  margin-bottom: var(--wb-sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--wb-sp-3);
}
.wb-commit-cta__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--wb-sp-3);
  flex-wrap: wrap;
}
.wb-commit-cta__title {
  font-size: var(--wb-t-lg);
  font-weight: 700;
  color: var(--q-text);
  margin: 0;
  line-height: var(--wb-lh-tight);
  letter-spacing: -0.01em;
}
.wb-commit-cta__title .wb-commit-cta__fy {
  color: var(--q-warning);
}
.wb-commit-cta__stats {
  display: flex;
  gap: var(--wb-sp-4);
  flex-wrap: wrap;
  font-size: var(--wb-t-md);
  color: var(--q-text-muted);
}
.wb-commit-cta__stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--wb-sp-1);
}
.wb-commit-cta__stat-value {
  font-size: var(--wb-t-xl);
  font-weight: 700;
  color: var(--q-text);
  font-family: var(--q-mono);
  line-height: var(--wb-lh-tight);
  letter-spacing: -0.02em;
}
.wb-commit-cta__stat-value.warn { color: var(--q-warning); }
.wb-commit-cta__stat-label {
  font-size: var(--wb-t-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--q-text-muted);
}
.wb-commit-cta__actions {
  display: flex;
  align-items: center;
  gap: var(--wb-sp-3);
  flex-wrap: wrap;
}
.wb-commit-cta__statutory {
  font-size: var(--wb-t-xs);
  color: var(--q-text-faint, var(--q-text-muted));
  line-height: var(--wb-lh-relaxed);
  font-style: italic;
}

/* Signed pill — compact, scrolls with content, not pinned */
.wb-commit-signed-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--wb-sp-2);
  background: rgba(28,138,58,0.07);
  border: 1px solid rgba(28,138,58,0.22);
  border-radius: 20px;
  padding: var(--wb-sp-1) var(--wb-sp-3);
  font-size: var(--wb-t-sm);
  font-weight: 600;
  color: var(--q-positive);
  margin-bottom: var(--wb-sp-3);
}
.wb-commit-signed-pill__check {
  font-size: var(--wb-t-rg);
}
.wb-commit-signed-pill__hash {
  font-family: var(--q-mono);
  font-size: var(--wb-t-xs);
  font-weight: 400;
  color: var(--q-text-muted);
}

@media (max-width: 768px) {
  .wb-commit-cta {
    padding: var(--wb-sp-3) var(--wb-sp-3);
    gap: var(--wb-sp-2);
  }
  .wb-commit-cta__title {
    font-size: var(--wb-t-rg);
  }
  .wb-commit-cta__stats {
    gap: var(--wb-sp-3);
  }
  .wb-commit-cta__stat-value {
    font-size: 18px;
  }
  .wb-commit-cta__head {
    flex-direction: column;
    gap: var(--wb-sp-2);
  }
}

/* ------------------------------------------------------------------
   QUICK LINKS ROW
   ------------------------------------------------------------------ */
.wb-quick-links {
  display: flex;
  gap: var(--wb-sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--wb-sp-4);
}

/* ------------------------------------------------------------------
   HAMBURGER BUTTON — visible only on mobile, toggling the sidebar
   ------------------------------------------------------------------ */
.wb-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  cursor: pointer;
  color: var(--wb-sidebar-text);
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}
.wb-hamburger:hover { background: rgba(255,255,255,0.08); }
.wb-hamburger svg { display: block; }

/* ------------------------------------------------------------------
   SIDEBAR OVERLAY (mobile) — dark backdrop behind the open sidebar
   ------------------------------------------------------------------ */
.wb-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 799;
}
.wb-sidebar-overlay.is-open { display: block; }

/* ------------------------------------------------------------------
   RESPONSIVE — mobile-first layout improvements
   ------------------------------------------------------------------ */

/* ── Tablet / small desktop (≤900px) ── */
@media (max-width: 900px) {
  :root {
    --wb-sidebar-w: 200px;
  }
  .wb-content {
    padding: var(--wb-sp-3) var(--wb-sp-4) var(--wb-sp-6);
  }
  .wb-stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--wb-sp-2);
  }
  .wb-stat-value {
    font-size: 22px;
  }
}

/* ── Mobile (≤768px) — sidebar becomes a slide-in drawer ── */
@media (max-width: 768px) {
  /* Show hamburger button */
  .wb-hamburger {
    display: inline-flex;
  }

  /* Sidebar: fixed left, off-screen by default, slides in when open */
  .wb-sidebar {
    display: flex !important; /* override the old display:none */
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 850;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    top: 0; /* slides over everything including topbar */
  }
  .wb-sidebar.is-open {
    transform: translateX(0);
  }

  /* Content fills full width, no left margin */
  .wb-content {
    margin-left: 0;
    padding: var(--wb-sp-3) var(--wb-sp-3) 80px;
  }

  /* Topbar: tighten spacing, hide email label to save space */
  .wb-topbar {
    padding: 0 var(--wb-sp-3);
    gap: var(--wb-sp-2);
  }
  .wb-user-email { display: none; }

  /* Town pill: smaller on mobile */
  .wb-town-name {
    font-size: var(--wb-t-md);
  }
  .wb-fy-badge {
    font-size: var(--wb-t-xs);
    padding: 1px var(--wb-sp-1);
  }

  /* Stat cards: 2-column grid */
  .wb-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--wb-sp-2);
  }
  .wb-stat-value {
    font-size: 22px;
  }
  .wb-stat-label {
    font-size: var(--wb-t-xs);
  }

  /* Quick links: stack vertically */
  .wb-quick-links {
    flex-direction: column;
    gap: var(--wb-sp-2);
  }
  .wb-btn {
    text-align: center;
    padding: var(--wb-sp-2) var(--wb-sp-3);
  }

  /* Panel bodies: tighter padding */
  .wb-panel-body {
    padding: var(--wb-sp-2) var(--wb-sp-3);
  }
  .wb-panel-head {
    padding: var(--wb-sp-2) var(--wb-sp-3);
    flex-wrap: wrap;
    gap: var(--wb-sp-1);
  }

  /* Table: allow horizontal scroll, minimum touch target for rows */
  .wb-table td, .wb-table th {
    padding: var(--wb-sp-2) var(--wb-sp-2);
  }

  /* Safety net: any data table inside the content area (including pages with
     their own custom table classes like .permit-table / plats / reval-queue
     that are NOT wrapped in .wb-table-wrap) scrolls horizontally within the
     content column instead of widening the whole document — a wide table
     otherwise stretches the page and drags the fixed topbar's right-side
     controls (View-as / Apps / avatar) off-screen on mobile. */
  .wb-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Page title: slightly smaller */
  .wb-page-title { font-size: 18px; }
  .wb-page-subtitle { font-size: var(--wb-t-sm); }

  /* Progress bar label: stack */
  .wb-progress-label { flex-direction: column; gap: var(--wb-sp-1); }
}

/* ── Small mobile (≤480px) — single-column stat cards ── */
@media (max-width: 480px) {
  .wb-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .wb-stat-card {
    padding: var(--wb-sp-2) var(--wb-sp-2) var(--wb-sp-1);
  }
  .wb-brand {
    font-size: var(--wb-t-lg);
  }
}

/* ── Touch / pointer: coarse (stylus / finger input) ── */
@media (pointer: coarse) {
  /* Enlarge nav link touch targets */
  .wb-nav a {
    padding: var(--wb-sp-3) var(--wb-sp-3);
    min-height: 44px;
  }
  /* Larger buttons */
  .wb-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* Larger table rows */
  .wb-table td {
    padding: var(--wb-sp-3) var(--wb-sp-2);
  }
}

/* ------------------------------------------------------------------
   Workbench visual layer — retoned onto civic-ledger (navy/gold) 2026-07-23.
   Was a PostHog-inspired cream/olive/yellow palette (DESIGN.md); reverted to
   the platform-standard navy/gold civic-ledger system per decision this date.
   Visual styling only: the Workbench DOM, application states, and JS hooks
   deliberately remain unchanged. Token NAMES below are unchanged from the
   PostHog layer so the shape of this block stays diffable; only the color
   VALUES now alias civic-ledger.css's --cl-*/--ms-* tokens (each with a
   literal hex fallback matching civic-ledger's own value).
   ------------------------------------------------------------------ */

:root {
  --wb-canvas: var(--cl-paper, #fbfaf7);
  --wb-surface: var(--cl-white, #ffffff);
  --wb-surface-soft: var(--ms-surface-2, #f3f1ec);
  --wb-ink: var(--cl-navy-ink, #0a1826);
  --wb-body: var(--ms-text-2, #2b3d52);
  --wb-muted: var(--ms-muted, #5a6b7f);
  --wb-hairline: var(--ms-border-2, #bcb5a4);
  --wb-hairline-soft: var(--ms-border, #ded9cd);
  --wb-primary: var(--cl-navy, #0d1f33);
  --wb-primary-pressed: var(--cl-navy-4, #1e4470);
  --wb-link: var(--cl-navy-4, #1e4470);
  --wb-focus: rgba(138,98,6,0.5);
  --wb-sidebar-bg: var(--wb-canvas);
  --wb-sidebar-border: var(--wb-hairline);
  --wb-sidebar-text: var(--wb-body);
  --wb-sidebar-text-active: var(--wb-ink);
  --wb-sidebar-accent: var(--wb-primary);
  --wb-sidebar-hover-bg: var(--wb-surface-soft);
  --wb-sidebar-active-bg: var(--wb-surface);
  --wb-topbar-h: 56px;
  --wb-sidebar-w: 240px;
}

html, body {
  background: var(--wb-canvas);
  color: var(--wb-body);
  font-family: var(--q-font);
  font-size: 16px;
  line-height: 1.5;
}

.wb-topbar {
  background: var(--wb-canvas);
  border-bottom-color: var(--wb-hairline);
  box-shadow: none;
}
.wb-topbar .wb-collaboration-divider { background: var(--wb-hairline); }
.wb-brand, .wb-town-name { color: var(--wb-ink); }
.wb-brand { font-size: 16px; font-weight: 700; letter-spacing: 0; }
.wb-brand-mark, .wb-avatar {
  background: var(--wb-primary);
  color: var(--cl-white, #ffffff);
  border-radius: 6px;
  box-shadow: none;
}
.wb-fy-badge {
  color: var(--wb-ink);
  background: var(--wb-surface-soft);
  border-color: var(--wb-hairline);
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.wb-topbar-user, .pia-rolebadge__user { color: var(--wb-muted); }
.wb-town-select {
  background-color: var(--wb-surface);
  border-color: var(--wb-hairline);
  color: var(--wb-ink);
  border-radius: 6px;
  font-family: inherit;
}
.wb-town-select option { background: var(--wb-surface); color: var(--wb-ink); }

.wb-sidebar { background: var(--wb-sidebar-bg); border-right-color: var(--wb-sidebar-border); }
.wb-nav-label { color: var(--wb-muted); letter-spacing: .08em; }
.wb-nav a { color: var(--wb-sidebar-text); border-left-color: transparent; }
.wb-nav a:hover { background: var(--wb-sidebar-hover-bg); color: var(--wb-sidebar-text-active); }
.wb-nav a.active {
  background: var(--wb-sidebar-active-bg);
  color: var(--wb-sidebar-text-active);
  border-left-color: var(--wb-sidebar-accent);
}
.wb-nav-divider { border-top-color: var(--wb-hairline-soft); }

.wb-content { background: var(--wb-canvas); }
.wb-page-title, .wb-error-title, .wb-commit-cta__title, .wb-placeholder strong { color: var(--wb-ink); }
.wb-page-title { font-size: 24px; font-weight: 800; letter-spacing: -.6px; }
.wb-page-subtitle, .wb-error-body { color: var(--wb-muted); }

.wb-stat-card, .wb-panel {
  background: var(--wb-surface);
  border-color: var(--wb-hairline);
  border-radius: 6px;
  box-shadow: none;
}
a.wb-stat-card:hover { border-color: var(--wb-ink); box-shadow: none; transform: none; }
.wb-stat-label, .wb-panel-title, .wb-table th { color: var(--wb-muted); }
.wb-stat-value, .wb-commit-cta__stat-value { color: var(--wb-ink); }
.wb-panel-head, .wb-table th { background: var(--wb-surface-soft); border-color: var(--wb-hairline); }
.wb-table td { border-color: var(--wb-hairline-soft); }
.wb-table tr:hover td { background: #fcfcfa; }

.wb-btn {
  min-height: 40px;
  padding: 8px 16px;
  background: var(--wb-primary);
  color: var(--cl-white, #ffffff);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}
.wb-btn:hover { background: var(--wb-primary-pressed); color: var(--cl-white, #ffffff); box-shadow: none; }
.wb-btn.secondary { background: var(--wb-surface-soft); color: var(--wb-ink); border-color: var(--wb-hairline); }
.wb-btn.secondary:hover { background: var(--wb-surface); color: var(--wb-ink); border-color: var(--wb-ink); }

.wb-alert, .wb-commit-cta { border-radius: 6px; }
.wb-alert.warn, .wb-commit-cta { background: rgba(138,98,6,0.08); border-color: var(--ms-warn, #8a6206); color: var(--wb-ink); }
.wb-alert.error { background: rgba(163,36,29,0.07); border-color: var(--ms-crit, #a3241d); color: var(--wb-ink); }
.wb-commit-cta { border-left-color: var(--ms-warn, #8a6206); }
.wb-commit-signed-pill { background: rgba(30,125,79,0.08); border-color: var(--ms-good, #1e7d4f); border-radius: 999px; }

.wb-progress-bar { background: var(--wb-surface-soft); border-radius: 6px; }
.wb-progress-fill { background: var(--ms-good, #1e7d4f); border-radius: 6px; }
.wb-placeholder { border-color: var(--wb-hairline); border-radius: 6px; }
.wb-error-code { color: var(--wb-hairline); }

.wb-btn:focus-visible, .wb-nav a:focus-visible, .wb-town-select:focus-visible,
.wb-hamburger:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--wb-focus);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .wb-sidebar { box-shadow: none; }
  .wb-hamburger { color: var(--wb-ink); border-color: var(--wb-hairline); border-radius: 6px; }
  .wb-hamburger:hover { background: var(--wb-surface-soft); }
}
