/* Westech components — one class family per Figma component (implementer-notes.md §5).
   Part 1: app shell. Part 2: components. Part 3: legacy classes still used by older templates,
   restyled onto the tokens so every screen reads as one system until it is redrawn. */

/* ============ Type scale ============ */
.wt-display { font: 600 36px/44px var(--wt-font-sans); letter-spacing: -0.02em; }
.wt-h1 { font: 700 28px/36px var(--wt-font-sans); letter-spacing: -0.015em; margin: 0; }
.wt-h2 { font: 600 20px/28px var(--wt-font-sans); letter-spacing: -0.01em; margin: 0; }
.wt-h3 { font: 600 16px/24px var(--wt-font-sans); margin: 0; }
.wt-body { font: 400 14px/22px var(--wt-font-sans); }
.wt-body-strong { font: 600 14px/22px var(--wt-font-sans); }
.wt-small { font: 400 13px/20px var(--wt-font-sans); }
.wt-caption { font: 500 12px/16px var(--wt-font-sans); }
.wt-overline { font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); }
.wt-mono { font: 500 13px/20px var(--wt-font-mono); }
.wt-muted { color: var(--wt-text-secondary); }
.wt-num { font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) { .wt-h1 { font-size: 24px; line-height: 32px; } }

/* ============ Icons ============ */
.wt-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
.wt-icon-sm { width: 16px; height: 16px; }
.wt-icon-xs { width: 14px; height: 14px; }
.wt-icon-lg { width: 24px; height: 24px; }

/* ============ Part 1 — App shell ============ */
html, body { background: var(--wt-bg-page); }
.wt-app { display: flex; min-height: 100vh; }
.wt-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 0 32px 48px; gap: 20px; }
.wt-main > .wt-page-head:first-child { padding-top: 24px; }
.wt-content { min-width: 0; }

/* Sidebar (≥1280) */
.wt-sidebar { width: var(--wt-sidebar-width); flex: 0 0 var(--wt-sidebar-width); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; padding: 24px 16px 20px; overflow-y: auto; scrollbar-width: thin; }
.wt-brand { display: flex; align-items: center; gap: 12px; padding-left: 6px; margin-bottom: 20px; color: inherit; text-decoration: none; }
.wt-brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--wt-bg-inverse); color: var(--wt-bg-accent);
  display: inline-flex; align-items: center; justify-content: center; font: 600 16px/24px var(--wt-font-sans); flex: 0 0 auto; }
.wt-brand-name { font: 600 16px/24px var(--wt-font-sans); color: var(--wt-text-primary); }
.wt-brand-sub { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-accent); }
.wt-nav { display: flex; flex-direction: column; gap: 4px; }
.wt-nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: var(--wt-radius-full);
  color: var(--wt-text-primary); text-decoration: none; font: 400 14px/22px var(--wt-font-sans); }
.wt-nav-item:hover { background: rgba(14,17,22,.05); color: var(--wt-text-primary); }
.wt-nav-item.is-active { background: var(--wt-bg-accent); color: var(--wt-text-on-accent); font-weight: 600; }
.wt-nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; padding: 2px 8px;
  border-radius: var(--wt-radius-full); background: var(--wt-status-danger-fg); color: var(--wt-text-inverse); font: 500 12px/16px var(--wt-font-sans); }
.wt-nav-section { margin-top: 8px; }
.wt-nav-section-head { width: 100%; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border: 0; background: none;
  color: var(--wt-text-secondary); font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; border-radius: var(--wt-radius-sm); }
.wt-nav-section-head:hover { color: var(--wt-text-primary); }
.wt-nav-section-head > span:first-child { flex: 1 1 auto; text-align: left; }
.wt-nav-section-head .wt-chevron { transition: transform .15s ease; }
.wt-nav-section-head[aria-expanded="false"] .wt-chevron { transform: rotate(-90deg); }
.wt-nav-section-head[aria-expanded="true"] .wt-count { display: none; }
.wt-nav-section-body { display: flex; flex-direction: column; gap: 4px; }
.wt-nav-section-body[hidden] { display: none; }
.wt-sidebar-spacer { flex: 1 1 auto; min-height: 16px; }
.wt-field-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--wt-radius-lg);
  background: var(--wt-bg-inverse); color: var(--wt-bg-accent); text-decoration: none; margin-bottom: 8px; }
.wt-field-card:hover { color: var(--wt-bg-accent); background: #1b2027; }
.wt-field-card b { display: block; color: var(--wt-text-inverse); font: 600 14px/22px var(--wt-font-sans); }
.wt-field-card small { display: block; color: var(--wt-text-disabled); font: 500 12px/16px var(--wt-font-sans); }
.wt-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--wt-radius-full); background: var(--wt-bg-surface); }
.wt-avatar { width: 36px; height: 36px; border-radius: var(--wt-radius-full); background: var(--wt-bg-accent); color: var(--wt-text-on-accent);
  display: inline-flex; align-items: center; justify-content: center; font: 500 12px/16px var(--wt-font-sans); flex: 0 0 auto; text-transform: uppercase; }
.wt-user-meta { flex: 1 1 auto; min-width: 0; }
.wt-user-name { font: 600 14px/22px var(--wt-font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wt-user-role { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-icon-btn { width: 36px; height: 36px; border-radius: var(--wt-radius-full); background: var(--wt-bg-surface-muted); border: 0;
  display: inline-flex; align-items: center; justify-content: center; color: var(--wt-text-primary); flex: 0 0 auto; text-decoration: none; }
.wt-icon-btn:hover { background: var(--wt-border-default); color: var(--wt-text-primary); }
.wt-icon-btn .wt-icon { width: 18px; height: 18px; }

/* Rail (768–1279): icons only, labels become tooltips */
@media (min-width: 768px) and (max-width: 1279.98px) {
  .wt-sidebar { width: var(--wt-rail-width); flex-basis: var(--wt-rail-width); padding: 20px 12px; align-items: center; }
  .wt-brand { padding-left: 0; margin-bottom: 16px; }
  .wt-brand-text, .wt-nav-label, .wt-nav-section-head, .wt-user-meta, .wt-field-card div, .wt-user .wt-icon-btn { display: none; }
  .wt-sidebar .wt-nav-section-body[hidden] { display: flex !important; } /* rail shows every icon; Bootstrap's [hidden] is !important */
  .wt-nav-section { margin-top: 0; padding-top: 8px; border-top: 1px solid var(--wt-border-default); }
  .wt-nav-item { width: 48px; height: 48px; padding: 0; justify-content: center; position: relative; }
  .wt-nav-item .wt-count { position: absolute; top: 2px; right: 0; min-width: 18px; padding: 1px 5px; font-size: 10px; line-height: 14px; }
  .wt-field-card { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: var(--wt-radius-md); }
  .wt-user { padding: 0; background: none; }
  .wt-main { padding: 0 24px 40px; }
  .wt-topbar { margin: 0 -24px; padding: 12px 24px 6px; }
}

/* Top bar */
.wt-topbar { display: flex; align-items: center; gap: 12px; min-height: 56px; position: sticky; top: 0; z-index: 1020;
  background: var(--wt-bg-page); margin: 0 -32px; padding: 16px 32px 6px; }
.wt-crumbs { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; font: 400 13px/20px var(--wt-font-sans);
  color: var(--wt-text-secondary); white-space: nowrap; overflow: hidden; }
.wt-crumbs a { color: var(--wt-text-secondary); text-decoration: none; }
.wt-crumbs a:hover { color: var(--wt-text-primary); }
.wt-crumbs .is-current { color: var(--wt-text-primary); overflow: hidden; text-overflow: ellipsis; }
.wt-crumbs .wt-icon { width: 14px; height: 14px; }
.wt-global-search { display: flex; align-items: center; gap: 10px; width: 380px; max-width: 40vw; height: 44px; padding: 0 8px 0 16px;
  border-radius: var(--wt-radius-full); background: var(--wt-bg-surface); color: var(--wt-text-secondary); }
.wt-global-search .wt-icon { width: 18px; height: 18px; }
.wt-global-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-primary); }
.wt-global-search input::placeholder { color: var(--wt-text-disabled); }
.wt-global-search:focus-within { box-shadow: 0 0 0 3px rgba(14,17,22,.12); }
.wt-kbd { font: 500 13px/20px var(--wt-font-mono); color: var(--wt-text-secondary); background: var(--wt-bg-surface-muted); padding: 2px 8px; border-radius: 8px; }
.wt-round-btn { width: 44px; height: 44px; border-radius: var(--wt-radius-full); background: var(--wt-bg-surface); border: 0; position: relative;
  display: inline-flex; align-items: center; justify-content: center; color: var(--wt-text-primary); text-decoration: none; flex: 0 0 auto; }
.wt-round-btn:hover { color: var(--wt-text-primary); background: var(--wt-bg-surface-muted); }
.wt-round-btn .wt-dot { position: absolute; top: 10px; left: 26px; width: 8px; height: 8px; border-radius: 50%; background: var(--wt-status-danger-fg); border: 1.5px solid var(--wt-bg-surface); }
.wt-segment-chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px 0 6px; border-radius: var(--wt-radius-full);
  background: var(--wt-bg-surface); border: 0; color: var(--wt-text-primary); font: 600 14px/22px var(--wt-font-sans); flex: 0 0 auto; }
.wt-segment-chip::after { display: none; }
.wt-segment-swatch { width: 32px; height: 32px; border-radius: var(--wt-radius-full); background: var(--wt-bg-accent); flex: 0 0 auto; }
.wt-segment-swatch.is-engineering { background: #D6F36A; }
.wt-segment-swatch.is-service { background: #8FE3CF; }
.wt-segment-menu .dropdown-item .wt-segment-swatch { width: 20px; height: 20px; }
.wt-menu-btn { display: none; }

/* Phone (<768): no sidebar, compact top bar, bottom tab bar */
@media (max-width: 767.98px) {
  .wt-sidebar { display: none; }
  .wt-main { padding: 0 16px calc(112px + env(safe-area-inset-bottom)); gap: 16px; }
  .wt-main > .wt-page-head:first-child { padding-top: 16px; }
  .wt-topbar { margin: 0 -16px; padding: 8px 16px; min-height: 56px; }
  .wt-global-search, .wt-topbar .wt-bell { display: none; }
  .wt-menu-btn { display: inline-flex; }
  .wt-segment-chip { padding-right: 10px; }
  .wt-segment-chip .wt-segment-name { display: none; }
  body.wt-no-tabbar .wt-main { padding-bottom: 32px; }
}
@media (min-width: 768px) and (max-width: 1023.98px) { .wt-global-search { width: 240px; } }

/* Bottom tab bar (phone) */
.wt-tabbar { display: none; }
@media (max-width: 767.98px) {
  .wt-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; align-items: center; justify-content: space-between;
    padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); background: var(--wt-bg-surface); border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 10px rgba(13,18,23,.08); }
  body.wt-no-tabbar .wt-tabbar { display: none; }
}
.wt-tab { width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--wt-text-secondary);
  text-decoration: none; font: 500 12px/16px var(--wt-font-sans); background: none; border: 0; padding: 0; }
.wt-tab-icon { width: 56px; height: 32px; border-radius: var(--wt-radius-full); display: inline-flex; align-items: center; justify-content: center; }
.wt-tab.is-active { color: var(--wt-text-primary); }
.wt-tab.is-active .wt-tab-icon { background: var(--wt-bg-accent); color: var(--wt-text-on-accent); }
.wt-tab-scan { width: 56px; height: 56px; border-radius: var(--wt-radius-full); background: var(--wt-bg-inverse); color: var(--wt-bg-accent);
  display: inline-flex; align-items: center; justify-content: center; }
.wt-tab-scan .wt-icon { width: 24px; height: 24px; }

/* Drawer (phone "More") reuses the nav markup */
.wt-drawer .offcanvas-body { padding: 8px 16px 24px; }
.wt-drawer .wt-nav-item, .wt-drawer .wt-nav-section-head { width: 100%; }

/* Page head */
.wt-page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.wt-page-head-text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wt-page-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wt-page-sub { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-page-sub:empty { display: none; }
.wt-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wt-page-actions:empty { display: none; }
.wt-page-actions form { margin: 0; }
@media (max-width: 767.98px) {
  .wt-page-actions { width: 100%; }
  .wt-page-actions > .btn, .wt-page-actions > a.btn, .wt-page-actions > form { flex: 1 1 auto; }
  .wt-page-actions > form .btn { width: 100%; }
}

/* Messages rendered as banners in the page flow (toasts come from wt.js) */
.wt-messages { display: flex; flex-direction: column; gap: 8px; }

/* ============ Part 2 — Components ============ */
.wt-card { background: var(--wt-bg-surface); border-radius: var(--wt-radius-xl); padding: 20px; }
.wt-card-title { font: 600 16px/24px var(--wt-font-sans); margin: 0 0 4px; }
.wt-card-sub { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); margin: 0 0 12px; }
.wt-section-label { font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); margin: 0 0 14px; }

/* Status badge: dot + text, never colour alone */
.wt-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--wt-radius-full);
  font: 500 12px/16px var(--wt-font-sans); white-space: nowrap; background: var(--wt-status-neutral-bg); color: var(--wt-status-neutral-fg); }
.wt-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.wt-badge-success { background: var(--wt-status-success-bg); color: var(--wt-status-success-fg); }
.wt-badge-warning { background: var(--wt-status-warning-bg); color: var(--wt-status-warning-fg); }
.wt-badge-danger { background: var(--wt-status-danger-bg); color: var(--wt-status-danger-fg); }
.wt-badge-info { background: var(--wt-status-info-bg); color: var(--wt-status-info-fg); }
.wt-badge-credit { background: var(--wt-status-credit-bg); color: var(--wt-status-credit-fg); }
.wt-badge-chairman { background: var(--wt-status-chairman-bg); color: var(--wt-status-chairman-fg); }

/* Doc number: mono, exactly as stored, tap copies */
.wt-doc { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 10px; border-radius: var(--wt-radius-sm);
  background: var(--wt-bg-surface-muted); color: var(--wt-text-primary); font: 500 13px/20px var(--wt-font-mono); white-space: nowrap; border: 0; }
button.wt-doc { cursor: copy; }
button.wt-doc:hover { background: var(--wt-border-default); }
.wt-doc .wt-icon { width: 14px; height: 14px; color: var(--wt-text-secondary); }

/* KPI tile — value wraps, never clips */
.wt-kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); align-content: start; }
.wt-kpi { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; border-radius: var(--wt-radius-xl);
  background: var(--wt-bg-surface); color: var(--wt-text-primary); min-width: 0; text-decoration: none; }
a.wt-kpi:hover { color: inherit; box-shadow: var(--wt-shadow-card); }
.wt-kpi-label { font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); }
.wt-kpi-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; font: 700 28px/36px var(--wt-font-sans);
  letter-spacing: -0.015em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wt-kpi-value small { font: 600 14px/22px var(--wt-font-sans); letter-spacing: 0; }
.wt-kpi-meta { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-kpi-dark { background: var(--wt-bg-inverse); color: var(--wt-text-inverse); }
.wt-kpi-dark .wt-kpi-label { color: var(--wt-text-inverse); }
.wt-kpi-dark .wt-kpi-meta { color: var(--wt-bg-accent); }
.wt-kpi-accent { background: var(--wt-bg-accent); color: var(--wt-text-on-accent); }
.wt-kpi-accent .wt-kpi-label, .wt-kpi-accent .wt-kpi-meta { color: var(--wt-text-on-accent); }
@media (max-width: 575.98px) { .wt-kpi { padding: 18px 20px; } .wt-kpi-value { font-size: 24px; line-height: 32px; } }

/* Module tile */
.wt-modules { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
@media (max-width: 575.98px) { .wt-modules { grid-template-columns: 1fr 1fr; gap: 12px; } .wt-module { padding: 16px; } }
.wt-module { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 24px; background: var(--wt-bg-surface);
  color: var(--wt-text-primary); text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; min-width: 0; }
.wt-module:hover { color: var(--wt-text-primary); box-shadow: var(--wt-shadow-card); transform: translateY(-1px); }
.wt-module-top { display: flex; align-items: center; gap: 8px; }
.wt-module-icon { width: 44px; height: 44px; border-radius: var(--wt-radius-md); background: var(--wt-bg-surface-muted);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.wt-module-top .wt-count { margin-left: auto; padding: 3px 10px; }
.wt-module-title { font: 600 14px/22px var(--wt-font-sans); margin: 0; }
.wt-module-sub { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); margin: -8px 0 0; }

/* "Needs you" list */
.wt-needs { background: var(--wt-bg-surface); border-radius: var(--wt-radius-xl); padding: 20px 20px 8px; }
.wt-needs-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--wt-border-default);
  color: var(--wt-text-primary); text-decoration: none; }
.wt-needs-row:hover { color: var(--wt-text-primary); }
.wt-needs-row:hover .wt-needs-title { text-decoration: underline; }
.wt-needs-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--wt-bg-surface-muted); display: inline-flex;
  align-items: center; justify-content: center; flex: 0 0 auto; }
.wt-needs-icon .wt-icon, .wt-needs-row > .wt-icon { width: 18px; height: 18px; }
.wt-needs-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wt-needs-title { font: 600 14px/22px var(--wt-font-sans); }
.wt-needs-sub { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-needs-empty { padding: 12px 0 16px; border-top: 1px solid var(--wt-border-default); color: var(--wt-text-secondary); font: 400 13px/20px var(--wt-font-sans); }

/* Search field + filter chips */
.wt-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wt-filterbar-spacer { flex: 1 1 auto; }
.wt-search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border-radius: var(--wt-radius-full);
  background: var(--wt-bg-surface); border: 1px solid var(--wt-border-default); color: var(--wt-text-secondary); width: 280px; max-width: 100%; }
.wt-search .wt-icon { width: 18px; height: 18px; }
.wt-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--wt-text-primary); font: 400 14px/22px var(--wt-font-sans); }
.wt-search:focus-within { border-color: var(--wt-border-focus); box-shadow: 0 0 0 3px rgba(14,17,22,.12); }
.wt-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.wt-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--wt-radius-full);
  background: var(--wt-bg-surface); border: 1px solid var(--wt-border-default); color: var(--wt-text-primary); text-decoration: none;
  font: 400 14px/22px var(--wt-font-sans); white-space: nowrap; }
.wt-chip:hover { color: var(--wt-text-primary); border-color: var(--wt-border-strong); }
.wt-chip small { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-chip.is-selected { background: var(--wt-bg-inverse); border-color: var(--wt-bg-inverse); color: var(--wt-text-inverse); font-weight: 600; }
.wt-chip.is-selected small { color: var(--wt-text-disabled); }
.wt-select-pill { height: 44px; min-height: 44px; border-radius: var(--wt-radius-full); border-color: var(--wt-border-default); padding-left: 16px; font-size: 13px; width: auto; }
@media (max-width: 767.98px) {
  .wt-search { width: 100%; }
  .wt-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .wt-chip { min-height: 44px; }
}

/* Document table (≥992) and stack cards (<992) */
.wt-table-card { background: var(--wt-bg-surface); border-radius: var(--wt-radius-xl); overflow: hidden; }
.wt-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.wt-table thead th { background: var(--wt-bg-surface-muted); padding: 14px 12px; font: 600 11px/16px var(--wt-font-sans);
  letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); white-space: nowrap; text-align: left; }
.wt-table thead th:first-child, .wt-table tbody td:first-child { padding-left: 24px; }
.wt-table thead th:last-child, .wt-table tbody td:last-child { padding-right: 16px; }
.wt-table tbody td { padding: 12px; border-bottom: 1px solid var(--wt-border-default); vertical-align: middle; }
.wt-table tbody tr { cursor: pointer; }
.wt-table tbody tr:not([data-href]) { cursor: default; }
.wt-table tbody tr:last-child td { border-bottom: 0; }
.wt-table tbody tr:hover td { background: var(--wt-bg-surface-muted); }
.wt-table .is-num { text-align: right; white-space: nowrap; }
.wt-table .wt-cell-strong { font: 600 14px/22px var(--wt-font-sans); color: var(--wt-text-primary); text-decoration: none; }
.wt-table .wt-cell-sub { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-table .wt-cell-muted { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); white-space: nowrap; }
.wt-table .wt-row-chevron { width: 34px; color: var(--wt-text-disabled); }
.wt-table-foot { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 24px; font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-table-foot > span { flex: 1 1 auto; }
.wt-stack { display: flex; flex-direction: column; gap: 12px; }
.wt-stack-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--wt-radius-lg); background: var(--wt-bg-surface);
  color: var(--wt-text-primary); text-decoration: none; }
.wt-stack-card:hover { color: var(--wt-text-primary); }
.wt-stack-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wt-stack-title { font: 600 14px/22px var(--wt-font-sans); }
.wt-stack-sub { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-stack-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wt-stack-total { font: 600 16px/24px var(--wt-font-sans); font-variant-numeric: tabular-nums; }

/* Empty state */
.wt-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
.wt-empty-icon, .wt-state-ring { width: 64px; height: 64px; border-radius: var(--wt-radius-full); background: var(--wt-bg-surface-muted);
  display: inline-flex; align-items: center; justify-content: center; color: var(--wt-text-secondary); margin-bottom: 8px; }
.wt-empty-icon .wt-icon, .wt-state-ring .wt-icon { width: 28px; height: 28px; }
.wt-empty-title { font: 600 16px/24px var(--wt-font-sans); margin: 0; }
.wt-empty-body { font: 400 14px/22px var(--wt-font-sans); color: var(--wt-text-secondary); max-width: 44ch; margin: 0 0 8px; }

/* Banner (replaces alerts used as status; green lock banner on confirmed docs) */
.wt-banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--wt-radius-lg);
  background: var(--wt-status-neutral-bg); color: var(--wt-status-neutral-fg); font: 400 14px/22px var(--wt-font-sans); }
.wt-banner .wt-icon { margin-top: 1px; }
.wt-banner b { font-weight: 600; }
.wt-banner-success { background: var(--wt-status-success-bg); color: var(--wt-status-success-fg); }
.wt-banner-warning { background: var(--wt-status-warning-bg); color: var(--wt-status-warning-fg); }
.wt-banner-danger { background: var(--wt-status-danger-bg); color: var(--wt-status-danger-fg); }
.wt-banner-info { background: var(--wt-status-info-bg); color: var(--wt-status-info-fg); }
.wt-banner-chairman { background: var(--wt-status-chairman-bg); color: var(--wt-status-chairman-fg); }

/* Directors-only card (superuser data; never rendered for other roles) */
.wt-directors { background: var(--wt-status-chairman-bg); border-radius: var(--wt-radius-xl); padding: 20px; }
.wt-directors .wt-overline { color: var(--wt-status-chairman-fg); }

/* Toasts: bottom-right on desktop, above the tab bar on phone */
.wt-toasts { position: fixed; right: 24px; bottom: 24px; z-index: 1090; display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.wt-toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: var(--wt-radius-lg);
  background: var(--wt-bg-inverse); color: var(--wt-text-inverse); box-shadow: var(--wt-shadow-raised); font: 400 14px/22px var(--wt-font-sans);
  animation: wt-toast-in .18s ease-out; }
.wt-toast-mark { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.wt-toast-mark .wt-icon { width: 14px; height: 14px; stroke-width: 3; }
.wt-toast-success .wt-toast-mark { background: #3ccf73; color: var(--wt-bg-inverse); }
.wt-toast-warning .wt-toast-mark { background: #ffc24a; color: var(--wt-bg-inverse); }
.wt-toast-error .wt-toast-mark { background: #ff6b5e; color: var(--wt-bg-inverse); }
.wt-toast-info .wt-toast-mark { background: #8fb4ff; color: var(--wt-bg-inverse); }
.wt-toast-text { flex: 1 1 auto; min-width: 0; }
.wt-toast-action { color: var(--wt-bg-accent); font-weight: 600; background: none; border: 0; text-decoration: none; padding: 4px 8px; }
.wt-toast-close { background: none; border: 0; color: var(--wt-text-disabled); padding: 4px; display: inline-flex; border-radius: 50%; }
.wt-toast-close:hover { color: var(--wt-text-inverse); }
@keyframes wt-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 767.98px) {
  .wt-toasts { left: 16px; right: 16px; bottom: calc(108px + env(safe-area-inset-bottom)); max-width: none; align-items: stretch; }
  body.wt-no-tabbar .wt-toasts { bottom: 16px; }
}

/* QR scan overlay (phone tab bar centre button) */
.wt-scan { position: fixed; inset: 0; z-index: 1100; background: #000; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 24px; color: #fff; text-align: center; padding: 24px; }
.wt-scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wt-scan-frame { position: relative; width: 240px; height: 240px; border: 3px solid var(--wt-bg-accent); border-radius: var(--wt-radius-xl);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.wt-scan p, .wt-scan .btn { position: relative; }

/* Skeleton rows */
.wt-skeleton-row { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--wt-border-default); }
.wt-skel { height: 12px; border-radius: var(--wt-radius-full); background: linear-gradient(90deg, var(--wt-bg-surface-muted), var(--wt-border-default), var(--wt-bg-surface-muted));
  background-size: 200% 100%; animation: wt-shimmer 1.2s linear infinite; }
@keyframes wt-shimmer { to { background-position: -200% 0; } }
.htmx-indicator { display: none; } .htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: block; }

/* Confirm dialog: consequence list + tick enables the action */
.wt-consequences { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.wt-consequences li { display: flex; gap: 10px; align-items: flex-start; font: 400 14px/22px var(--wt-font-sans); }
.wt-consequences li .wt-icon { color: var(--wt-text-secondary); margin-top: 1px; }
.wt-tick { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--wt-radius-md); background: var(--wt-bg-surface-muted); }
.wt-tick .form-check-input { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 auto; }

/* System state page (403 / 404 / 500 / offline / expired) */
.wt-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 64px 24px; background: var(--wt-bg-surface);
  border-radius: var(--wt-radius-xl); max-width: 640px; margin: 24px auto; width: 100%; }
.wt-state-ring.is-warning { background: var(--wt-status-warning-bg); color: var(--wt-status-warning-fg); }
.wt-state-ring.is-danger { background: var(--wt-status-danger-bg); color: var(--wt-status-danger-fg); }
.wt-state-ring.is-neutral { background: var(--wt-status-neutral-bg); color: var(--wt-status-neutral-fg); }
.wt-state h1 { font: 700 24px/32px var(--wt-font-sans); letter-spacing: -0.015em; margin: 0; }
.wt-state p { font: 400 14px/22px var(--wt-font-sans); color: var(--wt-text-secondary); max-width: 46ch; margin: 0; }
.wt-state-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.wt-state-ref { font: 500 12px/16px var(--wt-font-mono); color: var(--wt-text-secondary); margin-top: 12px; }

/* Entry screens: login and choose segment */
.wt-entry { min-height: 100vh; display: flex; padding: 24px; gap: 24px; background: var(--wt-bg-page); }
.wt-entry-brand { flex: 1 1 auto; position: relative; overflow: hidden; border-radius: 32px; background: var(--wt-bg-inverse); color: var(--wt-text-inverse);
  padding: 56px; display: flex; flex-direction: column; justify-content: space-between; min-height: calc(100vh - 48px); }
.wt-entry-brand::before { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; background: #C7E06A; top: -120px; right: -60px; }
.wt-entry-logo { display: flex; align-items: center; gap: 14px; position: relative; font: 600 20px/28px var(--wt-font-sans); letter-spacing: -0.01em; }
.wt-entry-logo span { width: 48px; height: 48px; border-radius: var(--wt-radius-md); background: var(--wt-bg-accent); color: var(--wt-text-on-accent);
  display: inline-flex; align-items: center; justify-content: center; }
.wt-entry-claim { position: relative; display: flex; flex-direction: column; gap: 16px; }
.wt-entry-claim h2 { font: 600 44px/52px var(--wt-font-sans); letter-spacing: -0.02em; max-width: 560px; margin: 0; }
.wt-entry-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.wt-entry-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 8px; border-radius: var(--wt-radius-full);
  background: var(--wt-bg-surface); color: var(--wt-text-primary); font: 600 14px/22px var(--wt-font-sans); }
.wt-entry-pill i { width: 20px; height: 20px; border-radius: 50%; display: inline-block; }
.wt-entry-foot { position: relative; font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-disabled); }
.wt-entry-form-side { flex: 0 0 560px; display: flex; align-items: center; justify-content: center; }
.wt-entry-form { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; }
.wt-entry-form .wt-field { display: flex; flex-direction: column; gap: 6px; }
.wt-entry-form .form-control { border-width: 1px; }
.wt-entry-form .form-control:focus { border-width: 2px; box-shadow: none; padding: 5px 11px; }
@media (max-width: 1099.98px) { .wt-entry-form-side { flex-basis: 460px; } .wt-entry-claim h2 { font-size: 36px; line-height: 44px; } }
@media (max-width: 899.98px) {
  .wt-entry { flex-direction: column; padding: 16px; }
  .wt-entry-brand { min-height: 0; padding: 24px; border-radius: var(--wt-radius-xl); gap: 32px; }
  .wt-entry-brand::before { width: 200px; height: 200px; top: -90px; right: -60px; }
  .wt-entry-claim h2 { font-size: 26px; line-height: 34px; }
  .wt-entry-foot { display: none; }
  .wt-entry-form-side { flex: 1 1 auto; align-items: flex-start; padding: 8px 4px 24px; }
  .wt-entry-form { width: 100%; }
}

.wt-segments { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; max-width: 980px; width: 100%; }
.wt-segment-card { display: flex; flex-direction: column; gap: 16px; padding: 28px; border-radius: var(--wt-radius-xl); text-decoration: none;
  color: var(--wt-text-on-accent); min-height: 300px; transition: transform .15s ease, box-shadow .15s ease; }
.wt-segment-card:hover { color: var(--wt-text-on-accent); transform: translateY(-2px); box-shadow: var(--wt-shadow-raised); }
.wt-segment-card.is-engineering { background: #D6F36A; }
.wt-segment-card.is-service { background: #8FE3CF; }
.wt-segment-card-top { display: flex; align-items: center; justify-content: space-between; }
.wt-segment-card-icon { width: 56px; height: 56px; border-radius: var(--wt-radius-md); background: var(--wt-bg-inverse); display: inline-flex;
  align-items: center; justify-content: center; }
.wt-segment-card.is-engineering .wt-segment-card-icon { color: #D6F36A; }
.wt-segment-card.is-service .wt-segment-card-icon { color: #8FE3CF; }
.wt-segment-card-go { width: 56px; height: 56px; border-radius: 50%; background: var(--wt-bg-surface); display: inline-flex; align-items: center; justify-content: center; }
.wt-segment-card h2 { font: 700 28px/36px var(--wt-font-sans); letter-spacing: -0.015em; margin: 0; }
.wt-segment-card p { font: 400 14px/22px var(--wt-font-sans); margin: 0; }
.wt-segment-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.wt-segment-tags span { padding: 4px 12px; border-radius: var(--wt-radius-full); background: rgba(255,255,255,.55); font: 500 12px/16px var(--wt-font-sans); }
@media (max-width: 575.98px) { .wt-segment-card { min-height: 0; padding: 20px; } .wt-segment-card h2 { font-size: 22px; line-height: 30px; } }

/* ============ Document pages (quotation / PFI / tax invoice) ============ */
.wt-back { width: 44px; height: 44px; border-radius: var(--wt-radius-full); background: var(--wt-bg-surface); display: inline-flex;
  align-items: center; justify-content: center; color: var(--wt-text-primary); flex: 0 0 auto; text-decoration: none; }
.wt-back:hover { color: var(--wt-text-primary); background: var(--wt-bg-surface-muted); }
.wt-doc-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 24px; }
.wt-doc-head-text { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wt-doc-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 767.98px) {
  .wt-doc-head { padding-top: 16px; align-items: flex-start; }
  .wt-doc-head-text { flex: 1 1 0; }
  .wt-doc-head .wt-page-actions { width: 100%; }
  .wt-doc-head .wt-h1 { font-size: 22px; line-height: 30px; }
}

.wt-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--wt-bg-surface);
  border-radius: var(--wt-radius-xl); padding: 16px 8px; }
.wt-summary > div { padding: 0 16px; border-left: 1px solid var(--wt-border-default); min-width: 0; }
.wt-summary > div:first-child { border-left: 0; }
.wt-summary dt { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); margin: 0 0 2px; }
.wt-summary dd { font: 600 14px/22px var(--wt-font-sans); margin: 0; overflow-wrap: anywhere; }
.wt-summary dd a { color: inherit; }
@media (max-width: 767.98px) {
  .wt-summary { grid-template-columns: 1fr 1fr; row-gap: 12px; }
  .wt-summary > div:nth-child(odd) { border-left: 0; }
}

.wt-doc-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.wt-doc-main, .wt-doc-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.wt-doc-side { position: sticky; top: 76px; }
@media (max-width: 1199.98px) { .wt-doc-body { grid-template-columns: 1fr; } .wt-doc-side { position: static; } }

.wt-panel { background: var(--wt-bg-surface); border-radius: var(--wt-radius-xl); padding: 20px; }
.wt-panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.wt-panel-head h2 { flex: 0 0 auto; }
.wt-panel-head .wt-spacer { flex: 1 1 auto; }
.wt-panel-foot { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); padding-top: 14px; }
.wt-panel-flush { padding: 0; overflow: hidden; }
.wt-panel-flush > .wt-panel-head { padding: 20px 24px 0; }
.wt-panel-flush > .wt-panel-foot { padding: 14px 24px 18px; }
.wt-count-badge { display: inline-flex; padding: 4px 10px; border-radius: var(--wt-radius-full); background: var(--wt-bg-surface-muted);
  font: 500 12px/16px var(--wt-font-sans); color: var(--wt-status-neutral-fg); }

/* Toggle pill (Discounts / VAT) */
.wt-toggle { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 6px 0 14px; border-radius: var(--wt-radius-full);
  border: 1px solid var(--wt-border-strong); background: var(--wt-bg-surface); color: var(--wt-text-primary); font: 500 13px/20px var(--wt-font-sans); }
.wt-toggle:hover { background: var(--wt-bg-surface-muted); }
.wt-toggle-track { width: 40px; height: 24px; border-radius: var(--wt-radius-full); background: var(--wt-border-strong); position: relative; transition: background .15s ease; }
.wt-toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.wt-toggle[aria-pressed="true"] .wt-toggle-track { background: var(--wt-bg-inverse); }
.wt-toggle[aria-pressed="true"] .wt-toggle-track::after { left: 19px; }

/* Line editor */
.wt-add-line { display: flex; align-items: center; gap: 10px; width: 100%; height: 48px; padding: 0 16px; border-radius: var(--wt-radius-md);
  border: 1px dashed var(--wt-border-strong); background: var(--wt-bg-surface-muted); color: var(--wt-text-secondary); font: 400 14px/22px var(--wt-font-sans); text-align: left; }
.wt-add-line:hover { color: var(--wt-text-primary); border-color: var(--wt-text-primary); }
.wt-lines-head, .wt-line { display: grid; grid-template-columns: 20px minmax(0, 1fr) 64px 124px 100px 118px 36px; gap: 8px; align-items: start; }
.wt-lines-head { padding: 10px 20px 10px 16px; background: var(--wt-bg-surface-muted); font: 600 11px/16px var(--wt-font-sans);
  letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); }
.wt-lines-head .is-num, .wt-line .is-num { text-align: right; }
.wt-line { padding: 14px 20px 14px 16px; border-bottom: 1px solid var(--wt-border-default); }
.wt-line-no { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); padding-top: 12px; }
.wt-line .form-control, .wt-line .form-select { min-height: 40px; }
.wt-line .wt-num-input { text-align: right; font-variant-numeric: tabular-nums; }
.wt-line-total { font: 600 14px/22px var(--wt-font-sans); text-align: right; padding-top: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wt-line-product { display: flex; flex-direction: column; gap: 6px; }
.wt-line-product .form-select { font-weight: 600; }
.wt-line-extra { display: flex; flex-direction: column; gap: 6px; }
.wt-line-extra textarea { min-height: 58px; font-size: 13px; line-height: 20px; }
.wt-line-extra input { max-width: 160px; min-height: 36px !important; font-size: 13px; }
.wt-line-del { width: 36px; height: 40px; border: 0; background: none; color: var(--wt-text-secondary); border-radius: var(--wt-radius-sm); display: inline-flex; align-items: center; justify-content: center; }
.wt-line-del:hover { color: var(--wt-status-danger-fg); background: var(--wt-status-danger-bg); }
.wt-line-ro .wt-line-name { font: 600 14px/22px var(--wt-font-sans); }
.wt-line-ro .wt-line-desc { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); white-space: pre-line; }
.wt-line-ro .wt-line-cell { padding-top: 0; font: 400 14px/22px var(--wt-font-sans); font-variant-numeric: tabular-nums; }
.wt-line-ro .wt-line-total, .wt-line-ro .wt-line-no { padding-top: 0; }
.wt-line-ro .wt-line-no { line-height: 22px; }
.wt-cell-label { display: none; }
@media (max-width: 767.98px) {
  .wt-lines-head { display: none; }
  .wt-line { grid-template-columns: 1fr 1fr; padding: 16px; gap: 10px; }
  .wt-line > .wt-line-no { display: none; }
  .wt-line > .wt-line-product { grid-column: 1 / -1; }
  .wt-line > .wt-line-total { grid-column: 1 / 2; text-align: left; padding-top: 0; }
  .wt-line > .wt-line-del { justify-self: end; }
  .wt-cell-label { display: block; font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); margin-bottom: 4px; }
  .wt-line-ro .wt-line-cell { text-align: left !important; }
}

/* Service job items: no discount column (6 columns). Phone falls back to the 2-column card above. */
@media (min-width: 768px) {
  .wt-sj-head, .wt-sj-line { grid-template-columns: 20px minmax(0, 1fr) 64px 124px 118px 36px; }
}
.wt-sj-line form { margin: 0; }
.wt-sj-add { border-bottom: 1px solid var(--wt-border-default); }

/* Key / value list inside a side panel (linked records). */
.wt-kv { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.wt-kv > div { display: flex; justify-content: space-between; gap: 12px; }
.wt-kv dt { font: 500 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-kv dd { margin: 0; font: 600 13px/20px var(--wt-font-sans); text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* Totals panel */
.wt-totals { display: flex; flex-direction: column; gap: 6px; }
.wt-totals-row { display: flex; justify-content: space-between; gap: 12px; font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-totals-row span:last-child { color: var(--wt-text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wt-totals-row.is-negative span:last-child { color: var(--wt-status-danger-fg); }
.wt-totals-row.is-struck span { text-decoration: line-through; color: var(--wt-text-disabled) !important; }
.wt-totals-grand { border-top: 1px solid var(--wt-border-default); margin-top: 8px; padding-top: 12px; }
.wt-totals-grand .wt-overline { display: block; margin-bottom: 2px; }
.wt-totals-grand b { font: 700 20px/28px var(--wt-font-sans); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.wt-totals-grand.is-struck b { text-decoration: line-through; color: var(--wt-text-disabled); }
.wt-chairman-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding: 12px 14px;
  border-radius: var(--wt-radius-md); background: var(--wt-status-chairman-bg); color: var(--wt-status-chairman-fg); }
.wt-chairman-total b { font: 700 18px/26px var(--wt-font-sans); font-variant-numeric: tabular-nums; }

.wt-chairman { background: var(--wt-status-chairman-bg); border-radius: var(--wt-radius-xl); padding: 20px; color: var(--wt-text-primary); }
.wt-chairman h2 { color: var(--wt-status-chairman-fg); }
.wt-chairman p { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-status-chairman-fg); margin: 8px 0 12px; }
.wt-chairman .btn-outline-secondary { --bs-btn-border-color: transparent; }
.wt-hint { border: 1.5px dashed var(--wt-border-strong); border-radius: var(--wt-radius-xl); padding: 16px 20px; font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.wt-hint.is-warning { border-color: var(--wt-status-warning-fg); color: var(--wt-status-warning-fg); display: flex; gap: 10px; }

/* Machines (serials) card on tax invoices */
.wt-machine-line { padding: 14px 0; border-top: 1px solid var(--wt-border-default); }
.wt-serials { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 8px; }
.wt-serial { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 6px 4px 12px; border-radius: var(--wt-radius-md);
  background: var(--wt-bg-surface-muted); margin: 0; }
.wt-serial a { color: var(--wt-text-primary); text-decoration: none; }
.wt-serial.is-missing { background: var(--wt-bg-surface); border: 1.5px dashed var(--wt-status-warning-fg); color: var(--wt-text-secondary); }
div.wt-serial.is-missing { grid-column: 1 / -1; display: block; padding: 12px 14px; }
.wt-serial .form-select { flex: 1 1 auto; min-height: 36px; box-shadow: none; }

/* Read-only field (confirmed documents) */
.wt-ro { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 14px; border-radius: var(--wt-radius-md);
  background: var(--wt-bg-surface-muted); color: var(--wt-text-secondary); font: 400 14px/22px var(--wt-font-sans); }
.wt-ro > span { flex: 1 1 auto; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; }
.wt-ro .wt-icon { width: 16px; height: 16px; color: var(--wt-text-disabled); }
.wt-field-label { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); margin-bottom: 6px; display: block; }

/* Sticky phone action bar (edit screens hide the tab bar) */
.wt-actionbar { display: none; }
@media (max-width: 767.98px) {
  .wt-actionbar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--wt-bg-surface); box-shadow: 0 -4px 10px rgba(13,18,23,.08); border-radius: 24px 24px 0 0; }
  .wt-actionbar > * { flex: 1 1 0; }
  body.wt-has-actionbar .wt-tabbar { display: none; }
  body.wt-has-actionbar .wt-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.wt-has-actionbar .wt-doc-head .wt-page-actions .wt-hide-phone { display: none; }
}

/* ============ Part 3 — Legacy classes on the new tokens ============ */
.filter-shell, .form-shell, .table-shell, .metric-shell, .dashboard-panel, .dashboard-stage, .dashboard-hero, .app-card {
  background: var(--wt-bg-surface); border: 0; border-radius: var(--wt-radius-xl); box-shadow: none; padding: 20px; overflow: hidden; }
.dashboard-stage { background: transparent; padding: 0; overflow: visible; }
.dashboard-panel, .dashboard-hero { padding: 0; height: 100%; }
.dashboard-panel-header { padding: 20px 20px 12px; border-bottom: 1px solid var(--wt-border-default); }
.dashboard-panel-body { padding: 16px 20px 20px; }
.dashboard-hero .card-body { padding: 24px; }
.dashboard-hero::before, .dashboard-hero::after, .metric-tile::after, .dashboard-stat-card::after, .module-tile::before, .dashboard-group-accent::before { display: none !important; }
.filter-shell .card-body, .form-shell .card-body, .table-shell .card-body, .metric-shell .card-body { padding: 0; }
.panel-title { font: 600 16px/24px var(--wt-font-sans); margin-bottom: 4px; color: var(--wt-text-primary); letter-spacing: 0; }
.panel-subtitle { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); margin-bottom: 16px; }
.page-note { font: 400 13px/20px var(--wt-font-sans); color: var(--wt-text-secondary); }
.section-divider { margin: 24px 0; border-top: 1px solid var(--wt-border-default); }
.table-shell .table-responsive { margin: 16px -20px -20px; border-radius: 0; }
.table-shell > .table-responsive:first-child { margin-top: -20px; }
.table-shell .table { margin-bottom: 0; }
.table-shell .table thead th:first-child, .table-shell .table tbody td:first-child { padding-left: 24px; }
.table-shell .table thead th:last-child, .table-shell .table tbody td:last-child { padding-right: 20px; }
.table-shell .table tbody tr:last-child td { border-bottom: 0; }
.table-responsive { scrollbar-width: thin; }
.compact-table td, .compact-table th { padding-top: 10px; padding-bottom: 10px; }

.metric-tile, .dashboard-stat-card { height: 100%; background: var(--wt-bg-surface); border: 0; border-radius: var(--wt-radius-xl); box-shadow: none;
  padding: 0; position: relative; overflow: visible; color: var(--wt-text-primary); }
.metric-tile .card-body { padding: 22px 24px; }
.dashboard-stat-card { padding: 22px 24px; }
.metric-label { font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); margin-bottom: 8px; }
.metric-value { font: 700 28px/36px var(--wt-font-sans); font-size: clamp(20px, 1.85vw, 28px); letter-spacing: -0.015em; color: var(--wt-text-primary);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-meta { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); margin-top: 8px; }
.metric-tile.metric-tile-dark, .dashboard-stat-card.is-dark { background: var(--wt-bg-inverse); color: var(--wt-text-inverse); }
.metric-tile.metric-tile-dark .metric-label, .metric-tile.metric-tile-dark .metric-value { color: var(--wt-text-inverse); }
.metric-tile.metric-tile-dark .metric-meta { color: var(--wt-bg-accent); }
.metric-tile.metric-tile-accent, .dashboard-stat-card.is-accent { background: var(--wt-bg-accent); color: var(--wt-text-on-accent); }
.metric-tile.metric-tile-accent .metric-label, .metric-tile.metric-tile-accent .metric-value, .metric-tile.metric-tile-accent .metric-meta,
.dashboard-stat-card.is-accent .metric-label, .dashboard-stat-card.is-accent .metric-value, .dashboard-stat-card.is-accent .metric-meta { color: var(--wt-text-on-accent); }
.dashboard-mini-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 575.98px) { .metric-value { font-size: 22px; line-height: 30px; } .dashboard-mini-grid { grid-template-columns: 1fr; } }

.module-tile { height: 100%; background: var(--wt-bg-surface); border: 1px solid var(--wt-border-default); border-radius: 24px; box-shadow: none;
  transition: box-shadow .15s ease, transform .15s ease; }
.module-tile:hover { transform: translateY(-1px); border-color: var(--wt-border-strong); box-shadow: var(--wt-shadow-card); background: var(--wt-bg-surface); }
.module-tile .card-body { padding: 20px; }
.module-title { font: 600 14px/22px var(--wt-font-sans); color: var(--wt-text-primary); margin-bottom: 4px; }
.module-tile:hover .module-title { color: var(--wt-text-primary); }
.module-copy { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }

.stack-list { display: grid; gap: 12px; }
.stack-card { background: var(--wt-bg-surface); border: 1px solid var(--wt-border-default); border-radius: var(--wt-radius-lg); box-shadow: none; padding: 16px; }
.stack-card-title { font: 600 14px/22px var(--wt-font-sans); color: var(--wt-text-primary); margin-bottom: 2px; }
.stack-card-copy { font: 500 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); }
.info-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.info-chip { padding: 12px 14px; border: 0; border-radius: var(--wt-radius-md); background: var(--wt-bg-surface-muted); }
.info-chip-label { font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--wt-text-secondary); margin-bottom: 4px; }
.info-chip-value { font: 600 14px/22px var(--wt-font-sans); color: var(--wt-text-primary); overflow-wrap: anywhere; }
@media (max-width: 575.98px) { .info-grid { grid-template-columns: 1fr 1fr; } }

.action-strip { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.action-strip-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; flex: 1 1 auto; }
.action-strip-side { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.dashboard-kicker, .dashboard-group-chip, .dashboard-tag { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: var(--wt-radius-full);
  background: var(--wt-bg-accent-soft); color: var(--wt-text-accent); font: 600 11px/16px var(--wt-font-sans); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 12px; border: 0; }
.dashboard-group-chip.is-stock, .dashboard-group-chip.is-other { background: var(--wt-bg-surface-muted); color: var(--wt-text-secondary); }
.dashboard-title { font: 700 28px/36px var(--wt-font-sans); letter-spacing: -0.015em; color: var(--wt-text-primary); margin-bottom: 8px; }
.dashboard-copy { font: 400 14px/22px var(--wt-font-sans); color: var(--wt-text-secondary); max-width: 60ch; }
.dashboard-table-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dashboard-pillnav { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
.dashboard-pillnav .pill { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 48px; padding: 8px 14px;
  border-radius: var(--wt-radius-full); background: var(--wt-bg-surface-muted); color: var(--wt-text-primary); font: 600 13px/20px var(--wt-font-sans); text-decoration: none; border: 0; }
.dashboard-pillnav .pill:hover { background: var(--wt-bg-accent); color: var(--wt-text-on-accent); }
.segment-card { border: 0; border-radius: var(--wt-radius-xl); background: var(--wt-bg-surface); }
.rounded-4 { border-radius: var(--wt-radius-lg) !important; }
.shadow-sm { box-shadow: var(--wt-shadow-card) !important; }
@media (max-width: 767.98px) {
  .filter-shell, .form-shell, .table-shell, .metric-shell { padding: 16px; border-radius: var(--wt-radius-lg); }
  .table-shell .table-responsive { margin: 12px -16px -16px; }
  .table-shell > .table-responsive:first-child { margin-top: -16px; }
  .action-strip, .action-strip-main, .action-strip-side { flex-direction: column; align-items: stretch; }
  .dashboard-pillnav { grid-template-columns: 1fr; }
  .row.g-2 > .col-12.col-md-auto, .row.g-3 > .col-12.col-md-auto { flex: 1 1 100%; }
}

/* Document lines: note under the "Discounted price" box (line_row.html) */
.wt-line-disc-note { font: 500 11px/16px var(--wt-font-sans); color: var(--wt-text-secondary); text-align: right; min-height: 16px; margin-top: 2px; }
.wt-line-disc-note.is-error { color: var(--wt-text-danger, #b42318); }

/* Terms & conditions editor (ui/partials/terms_editor.html, 2026-11-10) */
.wt-terms-row { border: 1px solid var(--wt-border, #dfe2e6); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--wt-surface, #fff); }
.wt-terms-row-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.wt-terms-row-head input { flex: 1; font-weight: 600; }
.wt-terms-no { min-width: 1.6em; font-weight: 700; color: var(--wt-text-muted, #5a6170); }
.wt-terms-body { font-family: var(--wt-font-mono, ui-monospace, monospace); font-size: 13px; line-height: 1.5; }
.wt-terms-help { font-size: 13px; color: var(--wt-text-muted, #5a6170); }
.wt-terms-help summary { cursor: pointer; font-weight: 600; }
.wt-terms-preview h4 { font-size: 14px; font-weight: 700; margin: 12px 0 4px; }
.wt-terms-preview p { margin: 0 0 6px; }
.wt-terms-preview .hl { color: #d00; }

/* ---- Searchable item picker on document lines (wt.js, 2026-11-16) ---- */
.wt-picker { position: relative; }
.wt-picker-native { display: none !important; }
.wt-picker-input { font-weight: 600; }
.wt-picker-input::placeholder { font-weight: 400; }
.wt-picker-list {
  position: fixed; z-index: 1060; /* top / left / width / max-height set by wt.js (place) */
  max-height: 340px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--wt-bg-surface, #fff); border: 1px solid var(--wt-border-strong, #C9CED6);
  border-radius: var(--wt-radius-sm, 10px); box-shadow: var(--wt-shadow-raised);
}
.wt-picker-item { padding: 7px 10px; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.wt-picker-item small { display: block; color: var(--wt-text-muted, #5a6170); font-size: 12px; margin-top: 1px; }
.wt-picker-item.is-active, .wt-picker-item:hover { background: var(--wt-bg-surface-muted, #F6F7F9); }
.wt-picker-item.is-selected { font-weight: 600; }
.wt-picker-item.is-new { color: #0d6efd; font-weight: 600; }
.wt-picker-item mark { padding: 0; background: #fff3a3; color: inherit; border-radius: 2px; }
.wt-picker-group { padding: 8px 10px 4px; font-size: 12px; font-weight: 700; color: var(--wt-text-muted, #5a6170); text-transform: uppercase; letter-spacing: .04em; }
.wt-picker-empty { padding: 8px 10px; font-size: 13px; color: var(--wt-text-muted, #5a6170); }

/* Rounded grand total note under the Totals card (ui/partials/round_total.html, 2026-11-16) */
.wt-round-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-top: 8px; font-size: 12px; color: var(--wt-text-muted, #5a6170); }

/* Toggle buttons (2026-11-18): <input class="btn-check" type="checkbox" id=x> + <label class="wt-toggle" for=x>.
   Same checkbox underneath (posts "on" when on), shown as a pill that is accent + "On" when checked. */
.wt-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border-radius: var(--wt-radius-full);
  border: 1.5px solid var(--wt-border-default); background: var(--wt-bg-surface); color: var(--wt-text-primary);
  font: 500 14px/20px var(--wt-font-sans); cursor: pointer; user-select: none; transition: background .15s, border-color .15s; }
.wt-toggle:hover { border-color: var(--wt-border-strong); }
.wt-toggle-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wt-text-disabled); flex: none; }
.wt-toggle-state { font: 600 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); padding-left: 4px; }
.wt-toggle-state::before { content: attr(data-off); }
.btn-check:checked + .wt-toggle { background: var(--wt-bg-accent); border-color: var(--wt-bg-accent); color: var(--wt-text-on-accent); }
.btn-check:checked + .wt-toggle .wt-toggle-dot { background: currentColor; }
.btn-check:checked + .wt-toggle .wt-toggle-state { color: inherit; }
.btn-check:checked + .wt-toggle .wt-toggle-state::before { content: attr(data-on); }
.btn-check:focus-visible + .wt-toggle { box-shadow: 0 0 0 3px rgba(14,17,22,.2); }
.btn-check:disabled + .wt-toggle { opacity: .55; cursor: not-allowed; }
.wt-toggle-help { display: block; font: 400 12px/16px var(--wt-font-sans); color: var(--wt-text-secondary); margin-top: 4px; }

/* Search on every long dropdown (2026-11-18): the blank "All …" choice, and pills in filter bars. */
.wt-picker-item.is-blank { color: var(--wt-text-secondary); font-style: italic; }
.wt-filterbar .wt-picker { width: 240px; max-width: 100%; }
.wt-filterbar .wt-picker-input.wt-select-pill { height: 44px; border-radius: var(--wt-radius-full); padding-left: 16px; }
@media (max-width: 767.98px) { .wt-filterbar .wt-picker { width: 100%; } }
