/* ═══════════════════════════════════════════════════════════════════════
   FieldDocs design system
   ───────────────────────────────────────────────────────────────────────
   Loaded AFTER app.css / fsm-office.css so it normalizes what they set.

   Direction (Phase 0 lock): ops-desk craft for the signed-in app.
   Border-first surfaces, Roboto, rounded cards, custom icons kept.
   Login / signup visuals are frozen — see login isolation at file end.

   Strategy: redefine --fd-* tokens here (propagates across app.css call
   sites), then unify primitives by bridging existing class names.
   See docs/design-system.md for the product design system lock.
   ═══════════════════════════════════════════════════════════════════════ */

/*
 * Structural tokens (type, space, icon size, radius) live on bare :root so they
 * exist in dark mode too. Color/surface tokens stay light-scoped so they cannot
 * overwrite theme-2026-dark.css. Without this, rules like
 * `width: var(--fd-icon-md)` become invalid in dark and PNG marks blow up to
 * their 160px intrinsic size over Home cards.
 */
:root {
  /* ── Type ── */
  --fd-font: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fd-font-display: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fd-font-metric: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* ── Type ramp (professional SaaS density) ── */
  --fd-text-2xs: 0.6875rem; /* 11px — micro labels, table headers, status */
  --fd-text-xs: 0.75rem; /* 12px — captions, helper, meta */
  --fd-text-sm: 0.8125rem; /* 13px — secondary body, filters */
  --fd-text-base: 0.875rem; /* 14px — UI default */
  --fd-text-md: 1rem; /* 16px — card titles, emphasis */
  --fd-text-lg: 1.125rem; /* 18px — section headings */
  --fd-text-xl: 1.375rem; /* 22px — page titles */
  --fd-text-2xl: 1.75rem; /* 28px — KPI / money heroes */
  --fd-text-3xl: 2.125rem; /* 34px — rare display metrics */

  /* Semantic type roles */
  --fd-type-page-title: var(--fd-text-xl);
  --fd-type-section: var(--fd-text-lg);
  --fd-type-card-title: var(--fd-text-md);
  --fd-type-body: var(--fd-text-base);
  --fd-type-label: var(--fd-text-xs);
  --fd-type-table: var(--fd-text-sm);
  --fd-type-helper: var(--fd-text-xs);
  --fd-type-button: var(--fd-text-base);
  --fd-type-status: var(--fd-text-2xs);
  --fd-type-kpi: var(--fd-text-2xl);

  --fd-leading-tight: 1.25;
  --fd-leading-normal: 1.45;
  --fd-leading-loose: 1.55;

  /* ── Spacing scale (4px base) ── */
  --fd-space-1: 0.25rem; /* 4 */
  --fd-space-2: 0.5rem; /* 8 */
  --fd-space-3: 0.75rem; /* 12 */
  --fd-space-4: 1rem; /* 16 */
  --fd-space-5: 1.25rem; /* 20 */
  --fd-space-6: 1.5rem; /* 24 */
  --fd-space-8: 2rem; /* 32 */
  --fd-space-10: 2.5rem; /* 40 */
  --fd-space-12: 3rem; /* 48 */

  /* ── Controls ── */
  --fd-control-h: 2.25rem; /* 36px — inputs, primary buttons */
  --fd-control-h-sm: 1.875rem; /* 30px — dense table actions */
  --fd-row-h: 2.75rem; /* table body row target */
  --fd-icon-sm: 1rem;
  --fd-icon-md: 1.25rem;
  --fd-icon-lg: 1.5rem;

  /* ── Shape: rounded but not pill-everything ── */
  --fd-radius-sm: 8px;
  --fd-radius: 10px;
  --fd-radius-lg: 14px;
  --fd-radius-pill: 999px;
}

:root:not([data-theme="dark"]),
[data-theme="light"] {
  /* ── Ink: higher contrast ── */
  --fd-ink: #0b1520;
  --fd-ink-soft: #2a3b48;
  --fd-muted: #5a6b78;
  --fd-muted-soft: #7a8b98;

  /* ── Surfaces: cooler desk ── */
  --fd-bg: #eef2f5;
  --fd-bg-subtle: #e4ebf0;
  --fd-surface: #ffffff;
  --fd-surface-raised: #ffffff;
  --fd-surface-muted: #fafbfc;
  --fd-border: #c5d0d9;
  --fd-border-strong: #9aafbd;
  --fd-hover: rgba(11, 21, 32, 0.04);
  --fd-row-hover: #f5f8fb;
  --fd-row-selected: #f3f8fc;

  /* ── Brand: actions / active only ── */
  --fd-blue: #2468b4;
  --fd-blue-dark: #0b4c8c;
  --fd-blue-soft: #e4eef8;
  --fd-blue-tint: #d3e4f7;
  --fd-navy: #14344a;
  --fd-btn-bg: #2468b4;
  --fd-btn-bg-hover: #0b4c8c;

  /* ── Status language (one meaning → one treatment) ── */
  --fd-success: #0a6c39;
  --fd-success-soft: #dcfce7;
  --fd-success-border: #7ddaa4;
  --fd-warn: #8a5a06;
  --fd-warn-soft: #fef3c7;
  --fd-warn-border: #f4cf6a;
  --fd-danger: #b3261e;
  --fd-danger-soft: #fee4e2;
  --fd-danger-border: #f5a8a2;
  --fd-info: #14549e;
  --fd-info-soft: #dbeafe;
  --fd-info-border: #94c2f0;
  --fd-neutral-soft: #eef2f6;
  --fd-neutral-border: #d3dde6;
  --fd-scheduled: #b45309;
  --fd-scheduled-soft: #fffbeb;
  --fd-scheduled-border: #fcd34d;
  --fd-progress: #0b4c8c;
  --fd-progress-soft: #e4eef8;
  --fd-progress-border: #93c5fd;

  /* ── Elevation: border-first; shadow reserved for overlays ── */
  --fd-shadow-sm: none;
  --fd-shadow-md: none;
  --fd-shadow-lg: 0 12px 32px rgba(11, 21, 32, 0.18);
  --fd-focus-ring: 0 0 0 3px rgba(36, 104, 180, 0.22);

  --fd-nav-bg: #f7f9fb;
  --fd-nav-hover: #e8f1fb;
  --fd-nav-active: #e4eef8;
  --fd-nav-text: #2a3b48;
  --fd-nav-text-active: #0b1520;
  --fd-chrome-bg: #ffffff;
  --fd-chrome-border: #c5d0d9;
}

/* ═══════════════════════════════════════════════════════════════════
   Status pills — unifies badge--*, ts-status--*, inv-status--*,
   status-badge, plans-badge onto one shape.
   ═══════════════════════════════════════════════════════════════════ */

.badge,
.ts-status,
.inv-status-pill,
.status-pill,
.customer-message-status,
.home-mini-tag,
.status-badge,
.plans-badge,
.home-today-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  border-radius: var(--fd-radius-pill);
  padding: 0.1875rem 0.5rem;
  font-size: var(--fd-type-status);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  white-space: nowrap;
  border: 1px solid var(--fd-neutral-border);
  background: var(--fd-neutral-soft);
  color: var(--fd-ink-soft);
  box-shadow: none;
}

.badge--green,
.ts-status--approved,
.inv-status--available,
.customer-message-status--received {
  background: var(--fd-success-soft);
  border-color: var(--fd-success-border);
  color: var(--fd-success);
}

.badge--blue {
  background: var(--fd-info-soft);
  border-color: var(--fd-info-border);
  color: var(--fd-info);
}

.badge--amber,
.inv-status--low {
  background: var(--fd-warn-soft);
  border-color: var(--fd-warn-border);
  color: var(--fd-warn);
}

.badge--red,
.ts-status--rejected,
.inv-status--out,
.customer-message-status--failed {
  background: var(--fd-danger-soft);
  border-color: var(--fd-danger-border);
  color: var(--fd-danger);
}

.badge--neutral {
  background: var(--fd-neutral-soft);
  border-color: var(--fd-neutral-border);
  color: var(--fd-ink-soft);
}

/* Job / schedule status language → shared tokens */
#app-shell .status-pill.status-scheduled,
#app-shell .home-today-pill.status-scheduled {
  background: var(--fd-scheduled-soft) !important;
  border-color: var(--fd-scheduled-border) !important;
  color: var(--fd-scheduled) !important;
  box-shadow: none !important;
}

#app-shell .status-pill.status-on_the_way,
#app-shell .status-pill.status-dispatched {
  background: var(--fd-progress-soft) !important;
  border-color: var(--fd-progress-border) !important;
  color: var(--fd-progress) !important;
  box-shadow: none !important;
}

#app-shell .status-pill.status-arrived_on_site,
#app-shell .status-pill.status-on_site,
#app-shell .status-pill.status-work_in_progress,
#app-shell .status-pill.status-in_progress {
  background: var(--fd-info-soft) !important;
  border-color: var(--fd-info-border) !important;
  color: var(--fd-info) !important;
  box-shadow: none !important;
}

#app-shell .status-pill.status-completed,
#app-shell .status-pill.status-active,
#app-shell .status-badge--success,
#app-shell .badge--green {
  background: var(--fd-success-soft) !important;
  border-color: var(--fd-success-border) !important;
  color: var(--fd-success) !important;
  box-shadow: none !important;
}

#app-shell .status-pill.status-paused,
#app-shell .status-badge--muted {
  background: var(--fd-neutral-soft) !important;
  border-color: var(--fd-neutral-border) !important;
  color: var(--fd-ink-soft) !important;
  box-shadow: none !important;
}

#app-shell .inv-status--available,
#app-shell .ts-status--approved {
  background: var(--fd-success-soft) !important;
  border-color: var(--fd-success-border) !important;
  color: var(--fd-success) !important;
  box-shadow: none !important;
}

#app-shell .inv-status--out,
#app-shell .inv-status--damaged,
#app-shell .ts-status--rejected {
  background: var(--fd-danger-soft) !important;
  border-color: var(--fd-danger-border) !important;
  color: var(--fd-danger) !important;
  box-shadow: none !important;
}

#app-shell .inv-status--maint,
#app-shell .inv-status--low {
  background: var(--fd-warn-soft) !important;
  border-color: var(--fd-warn-border) !important;
  color: var(--fd-warn) !important;
  box-shadow: none !important;
}

#app-shell .inv-status--lost,
#app-shell .inv-status--retired,
#app-shell .ts-status--draft,
#app-shell .ts-status--submitted {
  background: var(--fd-neutral-soft) !important;
  border-color: var(--fd-neutral-border) !important;
  color: var(--fd-ink-soft) !important;
  box-shadow: none !important;
}

/* Filter selects must not inherit pill chrome */
#app-shell select.records-hub-status,
#app-shell select.field.records-hub-status,
#app-shell .customers-list-status {
  display: block;
  border-radius: var(--fd-radius);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  background: var(--fd-surface);
  border: 1px solid var(--fd-border);
  color: var(--fd-ink);
  box-shadow: none;
  padding: 0.4rem 0.65rem;
  min-height: var(--fd-control-h);
}

/* ═══════════════════════════════════════════════════════════════════
   Stat tiles — unifies home-money-chip, ts-summary-cell, bi-stat-cell,
   customer-stat-card onto one card.
   ═══════════════════════════════════════════════════════════════════ */

.home-money-chip,
.ts-summary-cell,
.bi-stat-cell,
.customer-stat-card,
.crew-overview-stat {
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-1);
  padding: var(--fd-space-4) var(--fd-space-5);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
  box-shadow: none;
  min-width: 0;
}

.home-money-chip-label,
.ts-summary-label,
.bi-stat-label,
.customer-stat-label,
.crew-overview-stat-label {
  font-size: var(--fd-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fd-muted);
  line-height: var(--fd-leading-tight);
}

/* Proportional figures, not tabular. tabular-nums gives every digit the width
   of a zero, which reads loose at display sizes; it is reserved below for
   columns that must align vertically (table cells, row amounts). */
.home-money-chip-value,
.ts-summary-value,
.bi-stat-value,
.customer-stat-value,
.crew-overview-stat-value {
  font-family: var(--fd-font-metric);
  font-size: var(--fd-type-kpi);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--fd-leading-tight);
  color: var(--fd-ink);
  font-variant-numeric: proportional-nums;
}

.home-money-chip-value--positive,
.ts-summary-value--ok {
  color: var(--fd-success);
}

.bi-stat-value--warn {
  color: var(--fd-warn);
}

.bi-stat-hint {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   Home — reference implementation of the Phase 2 layout primitives.
   Snapshot strip full width, then work queue + supporting rail.
   ═══════════════════════════════════════════════════════════════════ */

.home-layout {
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-5);
}

.home-money-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--fd-space-4);
}

.home-money-strip--single {
  grid-template-columns: minmax(13rem, 22rem);
}

.home-money-chip[data-goto-tab] {
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease;
}

.home-money-chip[data-goto-tab]:hover {
  border-color: var(--fd-blue);
  background: var(--fd-blue-soft);
}

.home-money-chip-top {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
}

/* Value and sparkline share a baseline row; the trend sits right of the number
   rather than stealing a line. */
.home-money-chip-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--fd-space-3);
}

.home-spark {
  display: block;
  flex: none;
  color: var(--fd-muted-soft);
  overflow: visible;
}

.home-spark-head {
  fill: var(--fd-blue);
}

.home-money-chip-hint {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
  line-height: var(--fd-leading-tight);
}

/* Direction is carried by the arrow and the word, not by hue alone — the
   success/danger pair separates at only ΔE 7.2 under deutan simulation. */
.home-money-chip-delta {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: var(--fd-text-xs);
  font-weight: 600;
  line-height: var(--fd-leading-tight);
}

.home-money-chip-delta--up {
  color: var(--fd-success);
}

.home-money-chip-delta--down {
  color: var(--fd-danger);
}

.home-money-chip-delta-arrow {
  font-size: 0.625rem;
}

.home-money-chip-delta-period {
  font-weight: 500;
  color: var(--fd-muted);
}

/* ── Primary actions in the page header ── */

.home-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--fd-space-2);
}

/* ── Work queue: aggregate triage counts, above the detailed panels ── */

.home-queue {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--fd-space-3);
}

.home-queue-tile {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 var(--fd-space-2);
  padding: var(--fd-space-3) var(--fd-space-4);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
  box-shadow: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.home-queue-tile:hover {
  border-color: var(--fd-blue);
  background: var(--fd-blue-soft);
}

.home-queue-tile:focus-visible {
  outline: none;
  box-shadow: var(--fd-focus-ring);
}

.home-queue-tile .home-action-icon {
  grid-row: 1 / span 2;
}

.home-queue-tile-count {
  font-family: var(--fd-font-metric);
  font-size: var(--fd-text-lg);
  font-weight: 700;
  line-height: 1.1;
  color: var(--fd-ink);
  font-variant-numeric: proportional-nums;
}

.home-queue-tile-label {
  grid-column: 2;
  font-size: var(--fd-text-xs);
  font-weight: 500;
  line-height: 1.3;
  color: var(--fd-muted);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: var(--fd-space-5);
  align-items: start;
}

.home-grid-main,
.home-grid-rail {
  display: flex;
  flex-direction: column;
  gap: var(--fd-space-5);
  min-width: 0;
}

/* Rail is supporting content — one column is enough below 1100px. */
@media (max-width: 1100px) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-panel {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
  box-shadow: none;
  overflow: hidden;
}

.home-panel-title {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
  margin: 0;
  padding: var(--fd-space-3) var(--fd-space-4);
  font-size: var(--fd-text-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fd-ink);
  background: #fafbfc;
  border-bottom: 1px solid var(--fd-border);
}

.home-panel-body {
  padding: 0 var(--fd-space-5) var(--fd-space-4);
}

.home-panel-footer {
  padding: var(--fd-space-3) var(--fd-space-5);
  border-top: 1px solid var(--fd-border);
  background: var(--fd-bg);
}

/* ── Needs attention ── */

.home-priority-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--fd-space-3);
  padding: var(--fd-space-2) 0;
  border-bottom: 1px solid var(--fd-border);
}

.home-priority-list > .home-priority-row:last-child {
  border-bottom: none;
}

.home-priority-row-open {
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  min-width: 0;
  padding: var(--fd-space-2);
  margin-left: calc(var(--fd-space-2) * -1);
  border: none;
  border-radius: var(--fd-radius-sm);
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.home-priority-row-open:hover {
  background: var(--fd-blue-soft);
}

.home-priority-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  min-width: 0;
}

.home-priority-row-client {
  font-size: var(--fd-text-base);
  font-weight: 600;
  color: var(--fd-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-priority-row-doc {
  display: flex;
  align-items: center;
  gap: var(--fd-space-2);
}

.home-priority-row-num {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
  font-variant-numeric: tabular-nums;
}

.home-priority-row-amount {
  font-size: var(--fd-text-base);
  font-weight: 700;
  color: var(--fd-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.home-priority-row-action {
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
  padding: 0.375rem 0.75rem;
  font-family: inherit;
  font-size: var(--fd-text-sm);
  font-weight: 600;
  color: var(--fd-blue);
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.home-priority-row-action:hover {
  background: var(--fd-blue-soft);
  border-color: var(--fd-blue);
}

.home-priority-row-action:focus-visible,
.home-priority-row-open:focus-visible {
  outline: none;
  box-shadow: var(--fd-focus-ring);
}

/* Stack the action under the row when the panel gets narrow. */
@media (max-width: 560px) {
  .home-priority-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .home-priority-row-action {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* ── Setup checklist in the rail ──
   Its summary is a 4-across grid built for full width; stack it here. */

.home-grid-rail .home-getting-started-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  row-gap: 0.1875rem;
}

.home-grid-rail .home-getting-started-summary-label,
.home-grid-rail .home-getting-started-summary-meta,
.home-grid-rail .home-getting-started-summary-next {
  grid-column: 1;
  white-space: normal;
}

.home-grid-rail .home-getting-started-dismiss {
  grid-column: 2;
  grid-row: 1;
}

/* Meter: fill is the accent, unfilled track a lighter step of the same ramp so
   the state reads across the whole bar. */
.home-getting-started-summary-bar {
  grid-column: 1 / -1;
  display: block;
  height: 5px;
  margin-top: var(--fd-space-2);
  border-radius: var(--fd-radius-pill);
  background: var(--fd-blue-tint);
  overflow: hidden;
}

.home-getting-started-summary-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--fd-blue);
}

/* ── Today: time / detail / status ── */

.home-today-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-today-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--fd-space-3);
  width: 100%;
  padding: var(--fd-space-2);
  margin-left: calc(var(--fd-space-2) * -1);
  border: none;
  border-radius: var(--fd-radius-sm);
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.home-today-row:hover {
  background: var(--fd-blue-soft);
}

.home-today-row:focus-visible {
  outline: none;
  box-shadow: var(--fd-focus-ring);
}

.home-today-time {
  font-size: var(--fd-text-sm);
  font-weight: 700;
  color: var(--fd-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 0.0625rem;
}

.home-today-main {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.home-today-title {
  font-size: var(--fd-text-base);
  font-weight: 600;
  color: var(--fd-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-today-meta,
.home-today-address {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-today-address {
  color: var(--fd-muted-soft);
}

.home-today-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

/* ── Recent activity ── */

.home-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-activity-row {
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  width: 100%;
  padding: var(--fd-space-2);
  margin-left: calc(var(--fd-space-2) * -1);
  border: none;
  border-radius: var(--fd-radius-sm);
  background: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.home-activity-row--static {
  cursor: default;
}

.home-activity-row:not(.home-activity-row--static):hover {
  background: var(--fd-blue-soft);
}

.home-activity-row:focus-visible {
  outline: none;
  box-shadow: var(--fd-focus-ring);
}

.home-activity-main {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  flex: 1;
}

.home-activity-title {
  font-size: var(--fd-text-base);
  font-weight: 600;
  color: var(--fd-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-activity-meta {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-activity-date {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted-soft);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   Schedule
   ═══════════════════════════════════════════════════════════════════ */

.schedule-list-card {
  padding: 0;
  overflow: hidden;
}

.schedule-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--fd-space-3);
  padding: var(--fd-space-4) var(--fd-space-5);
  border-bottom: 1px solid var(--fd-border);
}

.schedule-list-title-head {
  margin: 0;
  font-size: var(--fd-text-md);
  font-weight: 700;
  color: var(--fd-ink);
}

.schedule-list-count {
  font-size: var(--fd-text-xs);
  font-weight: 600;
  color: var(--fd-muted);
  font-variant-numeric: tabular-nums;
}

/* Column widths: the date column was unconstrained, so "Fri, Feb 27, 8:35 AM"
   wrapped onto four lines while Job sat nearly empty. */
.schedule-list-table {
  table-layout: fixed;
}

.schedule-list-table th:nth-child(1),
.schedule-list-table td:nth-child(1) {
  width: 9.5rem;
}

.schedule-list-table th:nth-child(3),
.schedule-list-table td:nth-child(3) {
  width: 12rem;
}

.schedule-list-table th:nth-child(4),
.schedule-list-table td:nth-child(4) {
  width: 9rem;
}

.schedule-list-table th:nth-child(5),
.schedule-list-table td:nth-child(5) {
  width: 8.5rem;
}

.schedule-list-when {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
}

.schedule-list-date {
  font-size: var(--fd-text-base);
  font-weight: 600;
  color: var(--fd-ink);
  white-space: nowrap;
}

.schedule-list-time {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.schedule-list-job {
  min-width: 0;
}

.schedule-list-title {
  display: block;
  font-weight: 600;
  color: var(--fd-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-list-site {
  display: block;
  font-size: var(--fd-text-xs);
  color: var(--fd-muted-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* app.css sets display:flex on this <td>, which drops the cell out of the
   table's column model so it stops aligning with its header. Keep the cell a
   real table-cell and lay the buttons out in an inner wrapper instead. */
.schedule-list-table td.schedule-list-actions {
  display: table-cell;
  text-align: right;
  vertical-align: middle;
}

/* Actions were two full-size stacked buttons, making every row ~64px tall. */
.schedule-list-actions-inner {
  display: inline-flex;
  gap: var(--fd-space-2);
  align-items: center;
  justify-content: flex-end;
}

.schedule-list-btn {
  border: 1px solid var(--fd-border-strong);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-surface);
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: var(--fd-text-xs);
  font-weight: 600;
  color: var(--fd-ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.schedule-list-btn:hover {
  background: var(--fd-bg-subtle);
  border-color: var(--fd-muted-soft);
}

/* Destructive action reads as destructive only on approach, so it does not
   compete with Edit at rest. */
.schedule-list-btn--danger:hover {
  background: var(--fd-danger-soft);
  border-color: var(--fd-danger-border);
  color: var(--fd-danger);
}

.schedule-list-btn:focus-visible {
  outline: none;
  box-shadow: var(--fd-focus-ring);
}

/* ═══════════════════════════════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════════════════════════════ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════════════════════ */

.card {
  border-radius: var(--fd-radius-lg);
  border: 1px solid var(--fd-border);
  background: var(--fd-surface);
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════
   Tables — scannable at density: sticky-ready header, row hover,
   tabular figures, no heavy internal rules.
   ═══════════════════════════════════════════════════════════════════ */

.data-table,
.docs-table,
.table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.data-table th,
.docs-table th,
.table th {
  background: var(--fd-bg-subtle);
  color: var(--fd-muted);
  font-size: var(--fd-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: var(--fd-space-2) var(--fd-space-3);
  border-bottom: 1px solid var(--fd-border);
}

.data-table td,
.docs-table td,
.table td {
  padding: var(--fd-space-3);
  font-size: var(--fd-text-base);
  color: var(--fd-ink-soft);
  border-bottom: 1px solid var(--fd-border);
}

.data-table tbody tr:hover td,
.docs-table tbody tr:hover td,
.table tbody tr:hover td {
  background: var(--fd-blue-soft);
}

/* Money and counts line up column-wise. */
.data-table td[data-numeric],
.data-table th[data-numeric] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════════ */

.btn-primary,
button.btn-primary,
.btn-secondary,
button.btn-secondary,
.btn-danger,
button.btn-danger,
.btn-ghost,
button.btn-ghost,
.btn-tertiary,
button.btn-tertiary {
  border-radius: var(--fd-radius);
  font-size: var(--fd-type-button);
  font-weight: 600;
  letter-spacing: 0;
  padding: 0.5rem 0.875rem;
  min-height: var(--fd-control-h);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.btn-primary,
button.btn-primary {
  background: var(--fd-btn-bg);
  border: 1px solid var(--fd-btn-bg);
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover,
button.btn-primary:hover {
  background: var(--fd-btn-bg-hover);
  border-color: var(--fd-btn-bg-hover);
  transform: translateY(-1px);
}

.btn-secondary,
button.btn-secondary {
  background: var(--fd-surface);
  border: 1px solid var(--fd-border-strong);
  color: var(--fd-ink);
}

/* Secondary CTAs (New estimate / New invoice / etc.): fill blue on hover. */
.btn-secondary:hover,
button.btn-secondary:hover,
.portal-header .btn-secondary:hover,
.home-header-actions .btn-secondary:hover,
.portal-header-actions .btn-secondary:hover {
  background: var(--fd-blue);
  border-color: var(--fd-blue);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 104, 180, 0.22);
}

.btn-ghost,
button.btn-ghost,
.btn-tertiary,
button.btn-tertiary {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fd-muted);
  box-shadow: none;
}

.btn-ghost:hover,
button.btn-ghost:hover,
.btn-tertiary:hover,
button.btn-tertiary:hover {
  background: var(--fd-hover);
  color: var(--fd-ink);
  transform: none;
  box-shadow: none;
}

.btn-danger,
button.btn-danger {
  background: var(--fd-danger-soft);
  border: 1px solid var(--fd-danger-border);
  color: var(--fd-danger);
  box-shadow: none;
}

.btn-danger:hover,
button.btn-danger:hover {
  background: var(--fd-danger);
  border-color: var(--fd-danger);
  color: #fff;
}

.btn-secondary:active,
button.btn-secondary:active,
.btn-primary:active,
button.btn-primary:active,
.btn-ghost:active,
button.btn-ghost:active {
  transform: translateY(0);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-ghost:focus-visible,
.btn-tertiary:focus-visible {
  outline: none;
  box-shadow: var(--fd-focus-ring);
}

/* ═══════════════════════════════════════════════════════════════════
   Sidebar nav — larger, calmer labels (was 13px/700, cramped).
   ═══════════════════════════════════════════════════════════════════ */

.tab-btn {
  border-radius: var(--fd-radius);
  font-size: var(--fd-text-base);
  font-weight: 500;
  color: var(--fd-nav-text);
  min-height: 2.25rem;
  border-left: none;
  padding-left: 0.75rem;
}

.tab-btn:hover {
  background: var(--fd-nav-hover);
}

.tab-btn.active {
  background: var(--fd-nav-active);
  color: var(--fd-nav-text-active);
  font-weight: 600;
  border-left: none;
}

/* ═══════════════════════════════════════════════════════════════════
   Phases 3–7 — shell, hubs, ops canvases, secondary, overlays, cleanup
   Bridge existing class names onto the ops-desk language.
   ═══════════════════════════════════════════════════════════════════ */

#app-shell {
  font-family: var(--fd-font);
  color: var(--fd-ink);
  background: var(--fd-bg);
}

#app-shell .app-main,
#app-shell .main-content,
.app-main {
  background: var(--fd-bg);
}

/* ── Shell: sidebar + utility bar ── */

.side-nav {
  background: var(--fd-nav-bg) !important;
  border-right: 1px solid var(--fd-border);
  box-shadow: none !important;
}

.side-brand,
.side-powered-text {
  letter-spacing: -0.01em;
}

.global-utility-bar {
  background: var(--fd-chrome-bg) !important;
  border-bottom: 1px solid var(--fd-chrome-border) !important;
  box-shadow: none !important;
}

.mobile-nav-drawer,
#mobile-nav-drawer {
  border-radius: var(--fd-radius-lg) var(--fd-radius-lg) 0 0;
  box-shadow: var(--fd-shadow-lg);
}

/* ── Page headers (portalPage + hub titles) ── */

.portal-header {
  gap: var(--fd-space-3);
  margin-bottom: var(--fd-space-4);
  align-items: flex-start;
}

.portal-title {
  font-size: var(--fd-type-page-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fd-ink);
  line-height: var(--fd-leading-tight);
}

.portal-subtitle,
.portal-header-main .portal-subtitle {
  font-size: var(--fd-type-helper);
  color: var(--fd-muted);
  margin-top: 0.15rem;
  line-height: var(--fd-leading-normal);
}

.jobs-list-title,
.customers-list-title,
.docs-list-title,
.messages-list-title {
  font-size: var(--fd-text-md);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fd-ink);
}

/* ── Hub shells (Jobs family, Clients, Messages) ── */

.jobs-hub,
.customers-hub,
.messages-layout {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
  box-shadow: none;
  overflow: hidden;
}

.jobs-list-pane,
.customers-list-pane,
.messages-list-pane,
.messages-sidebar {
  border-right: 1px solid var(--fd-border);
  background: var(--fd-surface);
}

.jobs-list-header,
.customers-list-header,
.docs-list-header,
.messages-list-header {
  border-bottom: 1px solid var(--fd-border);
  background: #fafbfc;
  padding: var(--fd-space-3) var(--fd-space-4);
}

.jobs-list-card,
.docs-list-card,
.customers-list-item,
.messages-convo,
.portal-record {
  border-radius: 0;
  border-left: 3px solid transparent;
  box-shadow: none !important;
  transition: background 120ms ease;
}

.jobs-list-card:hover,
.docs-list-card:hover,
.customers-list-item:hover,
.messages-convo:hover,
.portal-record:hover {
  background: #f5f8fb;
}

.jobs-list-card.is-selected,
.jobs-list-card.is-active,
.docs-list-card.is-selected,
.docs-list-card.is-active,
.customers-list-item.is-selected,
.customers-list-item.is-active,
.messages-convo.is-selected,
.messages-convo.is-active,
.portal-record.is-selected {
  background: #f3f8fc !important;
  border-left-color: var(--fd-blue) !important;
  box-shadow: none !important;
}

.jobs-list-card.is-selected::before,
.jobs-list-card.is-active::before,
.docs-list-card.is-selected::before,
.docs-list-card.is-active::before {
  content: none !important;
  display: none !important;
}

/* Filter chips: soft blue active (not solid white-on-blue squares) */
.jobs-filter-chip,
.messages-filter,
.reports-range-chip,
.docs-filter-chip,
.home-filter-chip {
  border-radius: var(--fd-radius-pill) !important;
  border: 1px solid var(--fd-border);
  background: var(--fd-surface);
  color: var(--fd-muted);
  font-weight: 600;
  font-size: var(--fd-text-xs);
  box-shadow: none !important;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.jobs-filter-chip.is-active,
.jobs-filter-chip[aria-selected="true"],
.messages-filter.is-active,
.messages-filter[aria-pressed="true"],
.reports-range-chip.is-active,
.docs-filter-chip.is-active {
  background: var(--fd-blue-soft) !important;
  border-color: var(--fd-blue) !important;
  color: var(--fd-blue-dark) !important;
}

/* ── Forms ── */

.field input,
.field select,
.field textarea,
.hub-field input,
.hub-field select,
.hub-field textarea,
.ts-field input,
.ts-field select,
.ts-field textarea,
.job-form input,
.job-form select,
.job-form textarea,
.fd-feedback-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="search"],
input[type="date"],
input[type="time"],
select,
textarea {
  border-radius: var(--fd-radius) !important;
}

#app-shell .field input,
#app-shell .field select,
#app-shell .field textarea,
#app-shell .hub-field input,
#app-shell .hub-field select,
#app-shell .hub-field textarea,
#app-shell input.field,
#app-shell select.field,
#app-shell textarea.field,
#app-shell .ts-field input,
#app-shell .ts-field select,
#app-shell .ts-field textarea {
  border: 1px solid var(--fd-border);
  background: var(--fd-surface);
  color: var(--fd-ink);
  min-height: var(--fd-control-h);
  font-family: inherit;
  font-size: var(--fd-type-body);
  border-radius: var(--fd-radius) !important;
  box-shadow: none;
}

#app-shell .field input:focus,
#app-shell .field select:focus,
#app-shell .field textarea:focus,
#app-shell .hub-field input:focus,
#app-shell .hub-field select:focus,
#app-shell .hub-field textarea:focus,
#app-shell input.field:focus,
#app-shell select.field:focus,
#app-shell textarea.field:focus {
  outline: none;
  border-color: var(--fd-blue);
  box-shadow: var(--fd-focus-ring);
}

#app-shell label,
#app-shell .field-label,
#app-shell .form-label,
#app-shell .profile-label,
#app-shell .settings-label {
  font-size: var(--fd-type-label);
  font-weight: 600;
  color: var(--fd-ink-soft);
  letter-spacing: 0.01em;
}

#app-shell .field-hint,
#app-shell .profile-hint,
#app-shell .helper-text,
#app-shell .form-help {
  font-size: var(--fd-type-helper);
  color: var(--fd-muted);
  line-height: var(--fd-leading-normal);
}

/* ── Empty states ── */

.jobs-detail-empty,
.portal-empty,
.messages-empty,
.inventory-empty,
.ts-crew-empty,
.reports-hub-empty,
.customers-detail-empty,
.docs-detail-empty {
  color: var(--fd-muted);
  font-size: var(--fd-text-sm);
  line-height: var(--fd-leading-normal);
}

/* ── Schedule / Timesheet / Insights / Reports ── */

.schedule-toolbar,
.ts-toolbar,
.docs-bulk-toolbar,
.portal-list-toolbar,
.inventory-toolbar {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
  box-shadow: none !important;
  padding: var(--fd-space-3) var(--fd-space-4);
}

.schedule-board,
.fc,
.fc .fc-scrollgrid,
.bi-panel,
.reports-hub-card,
.reports-panel,
.insights-panel {
  border-radius: var(--fd-radius-lg) !important;
  box-shadow: none !important;
}

.bi-panel,
.reports-hub-card,
.settings-panel,
.profile-section,
.detail-card,
.pricing-card,
.inventory-card,
.plans-card,
.home-dispatch {
  border: 1px solid var(--fd-border) !important;
  border-radius: var(--fd-radius-lg) !important;
  background: var(--fd-surface) !important;
  box-shadow: none !important;
}

.settings-panel-head,
.profile-section-title,
.bi-panel-title,
.reports-hub-title {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fd-ink);
}

/* ── Pricing / Inventory / Settings / Profile / Plans ── */

.pricing-table,
.inventory-table,
.portal-table {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius-lg);
  overflow: hidden;
  background: var(--fd-surface);
}

.settings-nav-item.is-active,
.settings-nav button.is-active {
  background: var(--fd-nav-active);
  color: var(--fd-nav-text-active);
  border-left: 2px solid var(--fd-blue);
  font-weight: 600;
}

/* ── Overlays / sheets / toasts (keep elevation) ── */

.portal-overlay-panel,
.schedule-modal,
.schedule-modal-panel,
.pricing-form-panel,
.pricing-form-card,
.ts-modal,
.ts-modal-panel,
.fd-feedback-dialog,
.email-compose-overlay,
.email-compose-panel,
#global-search-panel,
#notification-panel,
#global-account-panel,
.customer-create-modal,
.customer-create-modal-panel {
  border-radius: var(--fd-radius-lg) !important;
  border: 1px solid var(--fd-border) !important;
  box-shadow: var(--fd-shadow-lg) !important;
  background: var(--fd-surface);
}

.fd-toast,
.fd-toast-stack .fd-toast {
  border-radius: var(--fd-radius) !important;
  box-shadow: var(--fd-shadow-lg) !important;
  border: 1px solid var(--fd-border);
  font-family: var(--fd-font);
}

/* ── Status pills: soft rounded tags ── */

.badge,
.ts-status,
.inv-status-pill,
.status-pill,
.records-hub-status,
.customers-list-status,
.customer-message-status,
.home-mini-tag {
  border-radius: var(--fd-radius-pill);
}

/* ── Kill leftover soft card shadows inside app shell ── */

#app-shell .card,
#app-shell .home-panel,
#app-shell .home-money-chip,
#app-shell .home-queue-tile,
#app-shell .home-dispatch,
#app-shell .detail-card,
#app-shell .settings-panel,
#app-shell .profile-section,
#app-shell .bi-stat-cell,
#app-shell .ts-summary-cell,
#app-shell .reports-column,
#app-shell .reports-filters,
#app-shell .portal-kpi,
#app-shell .portal-records,
#app-shell .side-fielddocs-logo {
  box-shadow: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   Design depth pass — Reports, hub density, headers, empties, tables
   ═══════════════════════════════════════════════════════════════════ */

:root:not([data-theme="dark"]),
[data-theme="light"] {
  --fd-surface-muted: #fafbfc;
  --fd-row-hover: #f5f8fb;
  --fd-row-selected: #f3f8fc;
}

/* Page headers: quieter title block, not a full-bleed toolbar strip */
#app-shell .portal-header {
  align-items: flex-end;
  gap: var(--fd-space-4);
  margin: 0 0 var(--fd-space-5);
  padding: var(--fd-space-4) 0 var(--fd-space-3);
  background: transparent;
  border-bottom: none;
}

#app-shell .portal-title,
#tab-schedule .portal-title {
  font-size: var(--fd-type-page-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fd-ink);
  line-height: var(--fd-leading-tight);
}

#app-shell .portal-subtitle {
  margin-top: 0.2rem;
  font-size: var(--fd-type-helper);
  color: var(--fd-muted);
  max-width: 42rem;
  line-height: var(--fd-leading-normal);
}

#app-shell .portal-header-actions,
#app-shell .home-header-actions {
  align-self: center;
  gap: var(--fd-space-2);
}

/* Reports hub (real markup: .reports-column / .reports-item) */
.reports-hub {
  gap: var(--fd-space-4);
}

.reports-column,
.reports-filters {
  border: 1px solid var(--fd-border) !important;
  border-radius: var(--fd-radius-lg) !important;
  background: var(--fd-surface) !important;
  box-shadow: none !important;
  overflow: hidden;
}

.reports-column-head {
  display: flex;
  align-items: center;
  gap: var(--fd-space-3);
  background: var(--fd-surface-muted);
  border-bottom: 1px solid var(--fd-border);
  padding: var(--fd-space-3) var(--fd-space-4);
}

.reports-column-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--fd-radius-sm);
  background: var(--fd-neutral-soft) !important;
  color: var(--fd-ink-soft) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reports-column-title {
  margin: 0;
  font-size: var(--fd-text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fd-muted);
}

.reports-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 1rem;
  border: 0;
  border-bottom: 1px solid #e8eef3;
  border-left: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  font: inherit;
  transition: background 120ms ease, border-color 120ms ease;
}

.reports-item:last-child {
  border-bottom: 0;
}

.reports-item:hover,
.reports-item:focus-visible {
  background: var(--fd-row-hover);
  outline: none;
}

.reports-item-title {
  display: block;
  font-size: var(--fd-text-base);
  font-weight: 600;
  color: var(--fd-ink);
  letter-spacing: -0.01em;
}

.reports-item-desc {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.15rem;
  font-size: var(--fd-text-xs);
  color: var(--fd-muted-soft);
  line-height: 1.35;
}

.reports-hub-toolbar {
  padding: var(--fd-space-3) 0;
  gap: var(--fd-space-3);
}

/* Hub list density + one selected-row language (single left rail only) */
#app-shell .jobs-list-card,
#app-shell .docs-list-card,
#app-shell .customers-list-item,
#app-shell .messages-convo,
#app-shell .portal-record {
  position: relative;
  border-radius: 0 !important;
  border: 0 !important;
  border-left: 3px solid transparent !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding-block: 0.55rem;
  padding-inline: 0.85rem 1rem;
  background: transparent;
}

/* Kill app.css ::before rails so only one blue line shows */
#app-shell .jobs-list-card.is-selected::before,
#app-shell .jobs-list-card.is-active::before,
#app-shell .docs-list-card.is-selected::before,
#app-shell .docs-list-card.is-active::before,
#app-shell .customers-list-item.is-selected::before,
#app-shell .customers-list-item.is-active::before,
#app-shell .messages-convo.is-selected::before,
#app-shell .messages-convo.is-active::before,
#app-shell .portal-record.is-selected::before {
  content: none !important;
  display: none !important;
  width: 0 !important;
  background: transparent !important;
}

#app-shell .jobs-list-card.is-selected,
#app-shell .jobs-list-card.is-active,
#app-shell .docs-list-card.is-selected,
#app-shell .docs-list-card.is-active,
#app-shell .customers-list-item.is-selected,
#app-shell .customers-list-item.is-active,
#app-shell .messages-convo.is-selected,
#app-shell .messages-convo.is-active,
#app-shell .portal-record.is-selected {
  background: var(--fd-row-selected) !important;
  border-left: 3px solid var(--fd-blue) !important;
  box-shadow: none !important;
}

#app-shell .jobs-list-card:hover,
#app-shell .docs-list-card:hover,
#app-shell .customers-list-item:hover,
#app-shell .messages-convo:hover,
#app-shell .portal-record:hover {
  background: var(--fd-row-hover);
}

.jobs-list-card-title,
.customers-list-name,
.messages-convo-name,
.docs-list-card-title {
  font-size: var(--fd-text-base);
  font-weight: 600;
  color: var(--fd-ink);
  letter-spacing: -0.01em;
}

.jobs-list-card-line,
.customers-list-meta,
.messages-convo-snippet,
.docs-list-card-meta {
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
}

/* Sidebar polish */
#app-shell .side-nav .tab-btn,
#app-shell .side-nav .tab-btn.active,
#app-shell .mobile-nav-drawer .tab-btn,
#app-shell .mobile-nav-drawer .tab-btn.active {
  border-left: none !important;
  box-shadow: none;
}

#app-shell .side-nav .tab-btn.active {
  background: var(--fd-nav-active);
  color: var(--fd-nav-text-active);
  font-weight: 600;
}

.side-fielddocs-logo {
  box-shadow: none !important;
  border: 1px solid var(--fd-border);
  background: var(--fd-surface);
  border-radius: var(--fd-radius-sm);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.25rem;
}

.side-brand-name {
  display: none !important;
}

@media (min-width: 768px) and (max-width: 1099px) {
  .side-fielddocs-logo {
    width: 2.1rem;
    height: 2.1rem;
    padding: 0.2rem;
  }
}

@media (max-width: 767px) {
  .side-fielddocs-logo {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0.22rem;
  }
}

.side-group {
  font-size: var(--fd-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fd-muted-soft);
}

.side-footer {
  border-top: 1px solid var(--fd-border);
  padding-top: var(--fd-space-2);
}

/* Tables */
#app-shell .portal-table,
#app-shell .reports-table,
#app-shell .pricing-table,
#app-shell .data-table,
#app-shell .docs-table {
  border-collapse: separate;
  border-spacing: 0;
}

#app-shell .portal-table th,
#app-shell .reports-table th,
#app-shell .pricing-table th,
#app-shell .data-table th,
#app-shell .docs-table th,
#app-shell .table th {
  background: var(--fd-surface-muted);
  font-size: var(--fd-type-status);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fd-muted);
  padding: var(--fd-space-2) var(--fd-space-3);
  border-bottom: 1px solid var(--fd-border);
  height: 2.25rem;
}

#app-shell .portal-table td,
#app-shell .reports-table td,
#app-shell .pricing-table td,
#app-shell .data-table td,
#app-shell .docs-table td,
#app-shell .table td {
  padding: 0.55rem var(--fd-space-3);
  font-size: var(--fd-type-table);
  color: var(--fd-ink-soft);
  border-bottom: 1px solid #e8eef3;
  height: var(--fd-row-h);
  vertical-align: middle;
}

#app-shell .portal-table tbody tr:hover td,
#app-shell .reports-table tbody tr:hover td,
#app-shell .pricing-table tbody tr:hover td,
#app-shell .data-table tbody tr:hover td,
#app-shell .docs-table tbody tr:hover td {
  background: var(--fd-row-hover);
}

.reports-cell--num,
#app-shell .portal-table .doc-amt,
#app-shell .docs-table .doc-amt {
  font-variant-numeric: tabular-nums;
  font-family: var(--fd-font-metric);
}

/* Empty states */
.reports-hub-empty,
.jobs-detail-empty,
.portal-empty,
.portal-records-empty,
.customers-detail-empty,
.customers-list-empty,
.docs-detail-empty,
.messages-empty,
.inventory-empty,
.ts-crew-empty,
.job-tab-empty,
.jobs-list-empty,
.timeline-empty,
.dispatch-backlog-empty,
.notification-empty {
  border: 1px dashed var(--fd-border);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-surface);
  padding: var(--fd-space-8) var(--fd-space-5);
  text-align: center;
  color: var(--fd-muted);
  font-size: var(--fd-type-helper);
  line-height: var(--fd-leading-normal);
}

.reports-hub-empty-title,
.jobs-detail-empty-title {
  margin: 0 0 var(--fd-space-2);
  font-size: var(--fd-text-md);
  font-weight: 700;
  color: var(--fd-ink);
  letter-spacing: -0.02em;
}

.reports-hub-empty-body,
.jobs-detail-empty-text {
  margin: 0 auto;
  max-width: 22rem;
  font-size: var(--fd-text-sm);
  color: var(--fd-muted);
  line-height: 1.45;
}

/* Flatten settings / KPI / money chip leftovers */
.settings-panel-head {
  background: var(--fd-surface-muted) !important;
  border-bottom: 1px solid var(--fd-border);
}

.portal-kpi,
.portal-records,
.portal-records-empty {
  border-radius: var(--fd-radius) !important;
  box-shadow: none !important;
  border: 1px solid var(--fd-border);
  background: var(--fd-surface);
}

#app-shell .home-money-chip,
#app-shell .reports-summary-chip {
  border-radius: var(--fd-radius) !important;
  box-shadow: none !important;
}

/* Schedule view tabs as segmented control */
.schedule-view-tabs {
  background: var(--fd-bg-subtle);
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  padding: 2px;
  gap: 2px;
  display: inline-flex;
}

.schedule-view-tab {
  border-radius: calc(var(--fd-radius) - 2px);
  border: 0;
  background: transparent;
  color: var(--fd-muted);
  font-weight: 600;
  font-size: var(--fd-text-xs);
  padding: 0.35rem 0.7rem;
  transition: background 140ms ease, color 140ms ease;
}

.schedule-view-tab.is-active,
.schedule-view-tab[aria-selected="true"] {
  background: var(--fd-surface);
  color: var(--fd-ink);
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════
   Design polish 1–5 — Schedule blue, money hero, search chips,
   messages, home money hierarchy. Login remains frozen below.
   ═══════════════════════════════════════════════════════════════════ */

/* 1) FullCalendar / schedule: brand blue instead of indigo/purple */
#app-shell .fc,
#dispatch-calendar .fc {
  --fc-today-bg-color: rgba(36, 104, 180, 0.05);
  --fc-now-indicator-color: var(--fd-blue);
  --fc-event-border-color: var(--fd-blue);
  --fc-event-bg-color: var(--fd-blue-soft);
  --fc-button-bg-color: var(--fd-blue);
  --fc-button-border-color: var(--fd-blue);
  --fc-button-hover-bg-color: var(--fd-blue-dark);
  --fc-button-hover-border-color: var(--fd-blue-dark);
  --fc-button-active-bg-color: var(--fd-blue-dark);
  --fc-button-active-border-color: var(--fd-blue-dark);
}

#app-shell .fc .fc-highlight,
#dispatch-calendar .fc .fc-highlight {
  background: rgba(36, 104, 180, 0.08) !important;
  border-color: rgba(36, 104, 180, 0.45) !important;
}

#app-shell .fc .fc-daygrid-event,
#app-shell .fc .fc-timegrid-event-harness .fc-timegrid-event {
  border-radius: var(--fd-radius-sm);
}

#app-shell .backlog-card-hours {
  color: var(--fd-blue) !important;
}

/* 2) Invoice / estimate detail: money-document hero */
#app-shell .detail-card--summary .detail-doc-summary {
  align-items: stretch;
  gap: var(--fd-space-4) var(--fd-space-5);
}

#app-shell .detail-doc-amount {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 11.5rem;
  padding: var(--fd-space-4) var(--fd-space-5);
  border: 1px solid var(--fd-blue-tint);
  border-radius: var(--fd-radius-lg);
  background: linear-gradient(180deg, var(--fd-blue-soft) 0%, var(--fd-surface) 100%);
  text-align: right;
}

#app-shell .detail-doc-amount-label {
  margin: 0 0 0.35rem;
  font-size: var(--fd-text-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fd-blue-dark);
}

#app-shell .detail-doc-amount-value {
  margin: 0;
  font-family: var(--fd-font-metric);
  font-size: clamp(1.65rem, 2.4vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--fd-ink);
  font-variant-numeric: proportional-nums;
}

#app-shell .detail-doc-amount-sub {
  margin: 0.4rem 0 0;
  font-size: var(--fd-text-xs);
  color: var(--fd-muted);
}

#app-shell .detail-doc-amount--balance {
  border-color: var(--fd-warn-border);
  background: linear-gradient(180deg, #fff7ed 0%, var(--fd-surface) 100%);
}

#app-shell .detail-doc-amount--balance .detail-doc-amount-label,
#app-shell .detail-doc-amount--balance .detail-doc-amount-value {
  color: #9a3412;
}

@media (max-width: 560px) {
  #app-shell .detail-doc-amount {
    width: 100%;
    text-align: left;
  }
}

/* 3) Global search: type icon + chip */
#app-shell .global-search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--fd-radius);
}

#app-shell .global-search-result-icon {
  display: inline-flex;
  width: 1.65rem;
  height: 1.65rem;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--fd-blue);
}

#app-shell .global-search-result-icon img,
#app-shell .global-search-result-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

#app-shell .global-search-result-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

#app-shell .global-search-result-chip {
  flex-shrink: 0;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--fd-border);
  background: var(--fd-bg-subtle);
  color: var(--fd-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

#app-shell .global-search-result:hover .global-search-result-chip,
#app-shell .global-search-result:focus-visible .global-search-result-chip {
  border-color: var(--fd-blue-tint);
  background: var(--fd-blue-soft);
  color: var(--fd-blue-dark);
}

/* 4) Messages: outbound brand blue + composer polish */
#app-shell .messages-bubble--outbound {
  background: var(--fd-blue);
  color: #fff;
  border: 0;
  box-shadow: none;
}

#app-shell .messages-bubble--outbound .messages-bubble-tag,
#app-shell .messages-bubble--outbound .messages-bubble-meta {
  opacity: 0.78;
}

#app-shell .messages-bubble--inbound {
  border-radius: var(--fd-radius-lg);
  border-bottom-left-radius: 0.35rem;
}

#app-shell .messages-composer {
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  background: var(--fd-surface-muted, var(--fd-bg-subtle));
  border-top: 1px solid var(--fd-border);
}

#app-shell .messages-composer-input {
  border: 1px solid var(--fd-border);
  border-radius: var(--fd-radius);
  background: var(--fd-surface);
  padding: 0.7rem 0.85rem;
  min-height: 2.6rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

#app-shell .messages-composer-input:focus {
  outline: none;
  border-color: var(--fd-blue);
  box-shadow: 0 0 0 3px rgba(36, 104, 180, 0.18);
}

#app-shell .messages-send-btn {
  border-radius: var(--fd-radius);
  min-height: 2.6rem;
}

[data-theme="dark"] #app-shell .messages-bubble--outbound {
  background: var(--fd-blue-dark);
  color: #e8f1fb;
}

/* 5) Home money strip: primary / secondary / tertiary hierarchy */
#app-shell .home-money-strip:not(.home-money-strip--single) {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 0.9fr);
}

#app-shell .home-money-chip--primary {
  border-color: var(--fd-warn-border);
  background: linear-gradient(180deg, #fff8f0 0%, var(--fd-surface) 72%);
}

#app-shell .home-money-chip--primary .home-money-chip-value {
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

#app-shell .home-money-chip--primary .home-money-chip-label {
  color: #9a3412;
}

#app-shell .home-money-chip--secondary {
  border-color: var(--fd-border);
}

#app-shell .home-money-chip--tertiary {
  border-color: var(--fd-border);
  background: var(--fd-surface-muted, var(--fd-bg-subtle));
}

#app-shell .home-money-chip--tertiary .home-money-chip-value {
  font-size: var(--fd-text-lg);
  font-weight: 700;
  color: var(--fd-ink-soft);
}

#app-shell .home-money-chip--tertiary .home-money-chip-label {
  color: var(--fd-muted);
}

@media (max-width: 900px) {
  #app-shell .home-money-strip:not(.home-money-strip--single) {
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  }
}

/* Notification popover: escape sidebar clip; open into main column on desktop */
@media (min-width: 768px) {
  #app-shell .side-nav {
    overflow: visible !important;
  }

  #app-shell .side-nav:has(.notification-center.is-open) {
    z-index: 70;
  }

  #app-shell .side-footer,
  #app-shell .notification-center {
    overflow: visible;
  }

  #app-shell .notification-panel {
    left: calc(100% + 0.55rem) !important;
    right: auto !important;
    bottom: 0 !important;
    top: auto !important;
    width: min(24rem, calc(100vw - 5rem)) !important;
    max-height: min(32rem, calc(100vh - 2rem));
  }
}

/* ═══════════════════════════════════════════════════════════════════
   Design cleanup 7–9 — base dialects, indigo leftovers, quiet cards.
   ═══════════════════════════════════════════════════════════════════ */

#app-shell .backlog-card,
#app-shell .portal-card--clickable,
#app-shell .portal-record-card,
#app-shell .plans-card--featured.is-recommended {
  box-shadow: none !important;
}

#app-shell .backlog-card:hover,
#app-shell .portal-card--clickable:hover,
#app-shell .portal-card--clickable:focus-visible,
#app-shell .portal-record-card:hover,
#app-shell .portal-record-card:focus-visible {
  transform: none !important;
  box-shadow: none !important;
  border-color: var(--fd-blue);
  background: var(--fd-blue-soft);
}

#app-shell #dispatch-calendar .fc-event.is-drag-ready,
#app-shell #dispatch-calendar .fc .fc-timegrid-event:hover {
  box-shadow: none !important;
}

#app-shell .inv-status--assigned {
  background: var(--fd-blue-soft) !important;
  color: var(--fd-blue-dark) !important;
  box-shadow: inset 0 0 0 1px rgba(36, 104, 180, 0.28) !important;
}

#app-shell .customer-avatar--v0 { background: #c5daf0 !important; }
#app-shell .customer-avatar--v1 { background: #d3e4f7 !important; }
#app-shell .customer-avatar--v6 { background: #e4eef8 !important; }

#app-shell .home-action-icon--violet,
#app-shell .home-action-icon--purple {
  color: var(--fd-blue) !important;
}

#app-shell .home-action-icon--violet {
  color: var(--fd-blue-dark) !important;
}

[data-theme="dark"] #app-shell .customer-avatar--v0 { background: #2468b4 !important; }
[data-theme="dark"] #app-shell .customer-avatar--v1 { background: #0b4c8c !important; }
[data-theme="dark"] #app-shell .customer-avatar--v6 { background: #1e4a70 !important; }
[data-theme="dark"] #app-shell .home-action-icon--violet,
[data-theme="dark"] #app-shell .home-action-icon--purple {
  color: #93c5fd !important;
}
[data-theme="dark"] #app-shell .inv-status--assigned {
  background: rgba(36, 104, 180, 0.18) !important;
  color: #93c5fd !important;
  box-shadow: inset 0 0 0 1px rgba(36, 104, 180, 0.35) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   2026 Roboto design-system pass — page structure, density, motion
   ═══════════════════════════════════════════════════════════════════ */

#app-shell {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Standard page header hierarchy: title / description / primary action */
#app-shell .portal-header,
#app-shell .home-topbar,
#app-shell .bi-header,
#app-shell .settings-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--fd-space-4);
  margin-bottom: var(--fd-space-5);
}

#app-shell .portal-header-actions,
#app-shell .home-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fd-space-2);
}

#app-shell .home-panel-title,
#app-shell .bi-panel-title,
#app-shell .detail-panel-title,
#app-shell .settings-panel-title,
#app-shell .profile-section-title {
  font-size: var(--fd-type-section);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--fd-ink);
  line-height: var(--fd-leading-tight);
}

#app-shell .jobs-list-title,
#app-shell .customers-list-title,
#app-shell .docs-list-title,
#app-shell .messages-list-title {
  font-size: var(--fd-type-card-title);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Filters / toolbars under the header */
#app-shell .portal-list-toolbar,
#app-shell .docs-bulk-toolbar,
#app-shell .schedule-toolbar,
#app-shell .inventory-toolbar,
#app-shell .ts-toolbar,
#app-shell .jobs-hub-filters,
#app-shell .home-filters {
  margin-bottom: var(--fd-space-4);
}

/* Money / KPI hierarchy */
#app-shell .detail-doc-amount-value,
#app-shell .home-money-chip-value,
#app-shell .bi-stat-value {
  font-family: var(--fd-font-metric);
  font-variant-numeric: proportional-nums;
  letter-spacing: -0.02em;
}

#app-shell .detail-doc-amount-label,
#app-shell .home-money-chip-label,
#app-shell .bi-stat-label {
  font-size: var(--fd-type-label);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fd-muted);
}

/* Selected table / hub rows */
#app-shell .portal-table tbody tr.is-selected td,
#app-shell .docs-table tbody tr.is-selected td,
#app-shell .data-table tbody tr.is-selected td {
  background: var(--fd-row-selected);
}

/* Overlay motion: fast and professional */
#app-shell .portal-overlay-panel,
#app-shell .schedule-modal-panel,
#app-shell .ts-modal-panel,
#app-shell .email-compose-panel,
#app-shell #global-search-panel,
#app-shell #notification-panel,
#app-shell #global-account-panel {
  transition: opacity 140ms ease, transform 160ms ease;
}

/* Icon sizing consistency inside shell chrome */
#app-shell .nav-icon svg,
#app-shell .global-utility-icon .nav-icon svg {
  width: var(--fd-icon-md, 1.25rem);
  height: var(--fd-icon-md, 1.25rem);
}

#app-shell .home-action-icon svg,
#app-shell .home-action-icon img {
  width: var(--fd-icon-md, 1.25rem);
  height: var(--fd-icon-md, 1.25rem);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Slightly quieter radius on dense ops surfaces */
#app-shell .portal-table,
#app-shell .docs-table,
#app-shell .data-table,
#app-shell .pricing-table {
  border-radius: var(--fd-radius) !important;
}

@media (max-width: 767px) {
  #app-shell .portal-title,
  #tab-schedule .portal-title {
    font-size: 1.2rem;
  }

  #app-shell .home-money-chip-value,
  #app-shell .bi-stat-value,
  #app-shell .ts-summary-value {
    font-size: 1.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   LOCKED: Login / signup visuals are frozen (Phase 0+).
   Do not restyle login.css. Product redesign tokens must not leak
   into the auth screen when design-system.css loads last.
   See docs/design-system-phase-0.md.
   ═══════════════════════════════════════════════════════════════════ */
#login-screen,
.login-screen {
  --fd-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fd-font-display: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fd-font-metric: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fd-radius-sm: 8px;
  --fd-radius: 10px;
  --fd-radius-lg: 16px;
  --fd-bg: #f5f8fa;
  --fd-surface: #ffffff;
  --fd-border: #dde5eb;
  --fd-ink: #16232b;
  --fd-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --fd-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
}

