/* ==========================================================================
   Operational Work Management Platform — shared dashboard design system
   Static mockup only. See /CLAUDE.md for scope and data-model notes.
   ========================================================================== */

:root {
  color-scheme: light;
  --surface-0: #f9f9f7;   /* page plane */
  --surface-1: #fcfcfb;   /* card / panel surface */
  --surface-2: #ffffff;   /* raised surface (modal, popover) */
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: #e1e0d9;
  --accent: #2a78d6;
  --accent-strong: #184f95;
  --accent-wash: #e9f1fc;

  --status-good: #0ca30c;
  --status-good-wash: #e6f6e6;
  --status-warning: #b8790f;
  --status-warning-wash: #fdf1da;
  --status-serious: #c85a30;
  --status-serious-wash: #fbe9e1;
  --status-critical: #d03b3b;
  --status-critical-wash: #fbe3e3;
  --status-neutral: #52514e;
  --status-neutral-wash: #ececea;

  --shadow-1: 0 1px 2px rgba(11,11,11,0.06), 0 1px 1px rgba(11,11,11,0.04);
  --shadow-2: 0 8px 24px rgba(11,11,11,0.12), 0 2px 6px rgba(11,11,11,0.08);
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --sidebar-w: 248px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-0: #0d0d0d;
    --surface-1: #1a1a19;
    --surface-2: #232322;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --border: rgba(255,255,255,0.10);
    --border-strong: #2c2c2a;
    --accent: #3987e5;
    --accent-strong: #86b6ef;
    --accent-wash: #16283d;

    --status-good: #0ca30c;
    --status-good-wash: #123a16;
    --status-warning: #fab219;
    --status-warning-wash: #3d2f0d;
    --status-serious: #ec835a;
    --status-serious-wash: #3a2013;
    --status-critical: #e66767;
    --status-critical-wash: #3a1616;
    --status-neutral: #c3c2b7;
    --status-neutral-wash: #262624;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0d0d0d;
  --surface-1: #1a1a19;
  --surface-2: #232322;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --border: rgba(255,255,255,0.10);
  --border-strong: #2c2c2a;
  --accent: #3987e5;
  --accent-strong: #86b6ef;
  --accent-wash: #16283d;

  --status-good: #0ca30c;
  --status-good-wash: #123a16;
  --status-warning: #fab219;
  --status-warning-wash: #3d2f0d;
  --status-serious: #ec835a;
  --status-serious-wash: #3a2013;
  --status-critical: #e66767;
  --status-critical-wash: #3a1616;
  --status-neutral: #c3c2b7;
  --status-neutral-wash: #262624;
}

* { box-sizing: border-box; }

/* Shared inline-SVG icon size — see Icons in dashboard.js. Fixed 16px,
   currentColor everywhere, so every icon in the app matches the ink/accent
   color of whatever it's placed next to instead of rendering as full-color
   OS emoji. */
svg.i {
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: -3px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface-1);
  border-right: 1px solid var(--border-strong);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
}

.sidebar-brand .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}

.sidebar-brand .name {
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.sidebar-brand .sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 14px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-wash);
  color: var(--accent-strong);
}

.nav-link .icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-link .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 1px 7px;
}

.nav-link--disabled { opacity: .5; cursor: not-allowed; }

.sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.sidebar-foot .who .line1 { font-size: 12.5px; font-weight: 600; }
.sidebar-foot .who .line2 { font-size: 11px; color: var(--text-muted); }

/* ---------- Main column ---------- */

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  background: var(--surface-0);
  z-index: 5;
}

.topbar h1 {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
}

.search-box {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 7px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); }

.icon-btn .dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-critical);
  border: 1.5px solid var(--surface-0);
}

.content {
  padding: 20px;
  flex: 1;
  min-width: 0;
}

/* Opt-in modifier for pages whose main content must fill the remaining
   viewport height exactly (e.g. Work Manager's 3-pane layout) instead of
   growing with its content. Scoped per-page rather than applied to every
   .content, so pages that just stack cards (Dashboard, Client Workspace,
   etc.) keep normal document flow/scroll and are unaffected. */
.content--fill {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.content--fill > .pane-layout { flex: 1; min-height: 0; height: auto; }

.content-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.content-header h2 {
  font-size: 20px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.content-header p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  max-width: 60ch;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-weight: 550;
  font-size: 13px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------- Cards / stat tiles ---------- */

.grid { display: grid; gap: 14px; }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  padding: 16px;
}

.card-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-secondary);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-tile .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 550;
}

.stat-tile .stat-value {
  font-size: 28px;
  font-weight: 650;
  margin-top: 4px;
  letter-spacing: -0.02em;
  font-variant-numeric: proportional-nums;
}

.stat-tile .stat-delta {
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-muted);
}

.stat-tile.tone-critical .stat-value { color: var(--status-critical); }
.stat-tile.tone-warning .stat-value { color: var(--status-warning); }
.stat-tile.tone-good .stat-value { color: var(--status-good); }

/* ---------- Badges (status / priority) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.6;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

.badge-good { background: var(--status-good-wash); color: var(--status-good); }
.badge-good .dot { background: var(--status-good); }
.badge-warning { background: var(--status-warning-wash); color: var(--status-warning); }
.badge-warning .dot { background: var(--status-warning); }
.badge-serious { background: var(--status-serious-wash); color: var(--status-serious); }
.badge-serious .dot { background: var(--status-serious); }
.badge-critical { background: var(--status-critical-wash); color: var(--status-critical); }
.badge-critical .dot { background: var(--status-critical); }
.badge-neutral { background: var(--status-neutral-wash); color: var(--status-neutral); }
.badge-neutral .dot { background: var(--status-neutral); }

/* ---------- List rows (activity, recent, notifications) ---------- */

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 13px;
}
.list-row:last-child { border-bottom: none; }

.list-row .row-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  color: var(--text-secondary);
}

.list-row .row-main { min-width: 0; flex: 1; }
.list-row .row-title {
  font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row .row-sub { color: var(--text-muted); font-size: 12px; }
.list-row .row-meta { flex: none; text-align: right; font-size: 12px; color: var(--text-muted); }
.list-row.selected { background: var(--accent-wash); border-radius: var(--radius-s); }

/* ---------- Two/three pane layout (Work Manager, Job Workspace) ---------- */

.pane-layout {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--surface-1);
  min-height: 480px;
}

/* Two-pane variant (Inbox: triage list + processing form) */
.pane-layout--two { grid-template-columns: 440px 1fr; }

.inbox-row {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border-strong);
  cursor: pointer;
}
.inbox-row:hover { background: var(--surface-2); }
.inbox-row.active { background: var(--accent-wash); }
.inbox-row .channel-icon {
  width: 30px; height: 30px; flex: none;
  border-radius: var(--radius-s);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.inbox-row .row-title { font-weight: 600; font-size: 13px; }
.inbox-row .row-snippet {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inbox-row .row-snippet--2 {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* A reviewed communication reads like a read email — present, but no longer
   demanding attention the way an unreviewed one does. */
.inbox-row.reviewed .row-title { font-weight: 500; color: var(--text-secondary); }

.raw-message {
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.inline-add {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  margin-top: 4px;
  display: inline-block;
}

.pane {
  overflow-y: auto;
  min-width: 0;
}

.pane-left {
  border-right: 1px solid var(--border-strong);
  padding: 12px;
  background: var(--surface-0);
}

.pane-right {
  border-left: 1px solid var(--border-strong);
  padding: 16px;
}

.pane-center {
  display: flex;
  flex-direction: column;
}

/* ---------- Tree navigation ---------- */

.tree { font-size: 13px; }
.tree-node { }

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px;
  border-radius: var(--radius-s);
  cursor: pointer;
  color: var(--text-secondary);
}
.tree-row:hover { background: var(--surface-2); }
.tree-row.active { background: var(--accent-wash); color: var(--accent-strong); font-weight: 600; }

.tree-row .twirl {
  width: 14px; flex: none;
  color: var(--text-muted);
  transition: transform .12s ease;
  display: inline-flex;
  font-size: 10px;
}
.tree-node.collapsed > .tree-row .twirl { transform: rotate(-90deg); }
.tree-node.leaf > .tree-row .twirl { visibility: hidden; }

.tree-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .badge { margin-left: auto; }

.tree-children {
  margin-left: 16px;
  padding-left: 6px;
  border-left: 1px dashed var(--border-strong);
}
.tree-node.collapsed > .tree-children { display: none; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs .sep { color: var(--border-strong); }
.breadcrumbs .current { color: var(--text-primary); font-weight: 600; }

/* ---------- Grid / spreadsheet table ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  flex-wrap: wrap;
}

.toolbar .divider { width: 1px; align-self: stretch; background: var(--border-strong); margin: 0 2px; }
.toolbar .spacer { flex: 1; }
.toolbar .meta { font-size: 12px; color: var(--text-muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-secondary);
}
.chip.active { background: var(--accent-wash); border-color: var(--accent-wash); color: var(--accent-strong); font-weight: 600; }

table.grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.grid-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 650;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.grid-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-strong);
  vertical-align: middle;
}

.grid-table tbody tr { cursor: pointer; }
.grid-table tbody tr:hover { background: var(--surface-2); }
.grid-table tbody tr.selected { background: var(--accent-wash); }

.grid-table th.sortable-th { cursor: pointer; user-select: none; }
.grid-table th.sortable-th:hover { color: var(--text-primary); }
.grid-table th.sortable-th::after { content: "\2195"; margin-left: 5px; opacity: .35; }
.grid-table th.sortable-th.sort-asc::after { content: "\2191"; opacity: 1; }
.grid-table th.sortable-th.sort-desc::after { content: "\2193"; opacity: 1; }
.grid-table tbody tr.active-row { outline: 2px solid var(--accent); outline-offset: -2px; }

.grid-table .cell-title { font-weight: 550; }
.grid-table .cell-sub { color: var(--text-muted); font-size: 12px; }
.grid-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.checkbox-cell { width: 32px; }

/* ---------- Job / detail preview panel ---------- */

.detail-block { margin-bottom: 18px; }
.detail-block:last-child { margin-bottom: 0; }
.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 650;
  margin-bottom: 6px;
}
.detail-value { font-size: 13.5px; }
.detail-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13px; }
.detail-row .k { color: var(--text-muted); }
.detail-row .v { font-weight: 550; text-align: right; }

.kv-list .detail-row { border-bottom: 1px solid var(--border-strong); }
.kv-list .detail-row:last-child { border-bottom: none; }

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-strong);
  padding: 0 14px;
}
.tab {
  padding: 10px 4px;
  margin-right: 18px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab-panel { display: none; padding: 16px; }
.tab-panel.active { display: block; }

/* ---------- Checklist (procedure steps) ---------- */

.step-item {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-strong);
}
.step-item:last-child { border-bottom: none; }

.step-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex: none;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: transparent;
}
.step-item.completed .step-check { background: var(--status-good); border-color: var(--status-good); color: #fff; }
.step-item.skipped .step-check { background: var(--status-neutral-wash); border-color: var(--border-strong); }
.step-item.completed .step-title { text-decoration: line-through; color: var(--text-muted); }

.step-title { font-weight: 600; font-size: 13.5px; }
.step-instructions { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.step-meta { display: flex; gap: 10px; margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }
.step-warning {
  margin-top: 6px;
  font-size: 12px;
  color: var(--status-serious);
  background: var(--status-serious-wash);
  border-radius: var(--radius-s);
  padding: 6px 9px;
}

/* ---------- Rich text (Procedure step guides) ----------
   A step's guide is one flexible rich-text field (with inline images) rather
   than several rigid plain-text boxes. .richtext-content renders it
   read-only (job step guide, Procedure Preview); .richtext-editor is the
   editable contenteditable surface in Procedure Builder. */

.richtext-content { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.richtext-content p { margin: 0 0 8px; }
.richtext-content p:last-child { margin-bottom: 0; }
.richtext-content ul, .richtext-content ol { margin: 0 0 8px 20px; }
.richtext-content img { max-width: 100%; border-radius: var(--radius-s); margin: 6px 0; display: block; }

.richtext-toolbar {
  display: flex;
  gap: 2px;
  margin-bottom: 4px;
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-s) var(--radius-s) 0 0;
  background: var(--surface-1);
  padding: 3px;
}
.richtext-toolbar button {
  border: none;
  background: none;
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-s);
  cursor: pointer;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.richtext-toolbar button:hover { background: var(--surface-2); color: var(--text-primary); }

.richtext-editor {
  min-height: 90px;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-s) var(--radius-s);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--surface-0);
}
.richtext-editor:focus { outline: none; border-color: var(--accent); }
.richtext-editor img { max-width: 100%; border-radius: var(--radius-s); }

/* ---------- Scheduler: staff selector ---------- */

.staff-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.staff-tab {
  min-width: 168px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  border-radius: var(--radius-m);
  color: var(--text-primary);
  text-align: left;
  flex: none;
}
.staff-tab:hover { background: var(--surface-2); }
.staff-tab.active {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: 0 0 0 2px var(--accent-wash);
}
.staff-tab.drag-over { border-color: var(--accent); background: var(--accent-wash); }

.staff-tab .staff-name { font-weight: 650; font-size: 13.5px; }
.staff-tab .staff-role { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* ---------- Scheduler: planner (queues + calendar) ---------- */

.planner {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  background: var(--surface-1);
  overflow: hidden;
  min-height: 640px;
}

.queues {
  border-right: 1px solid var(--border-strong);
  background: var(--surface-0);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.queue-section {
  padding: 14px;
  border-bottom: 1px solid var(--border-strong);
}
.queue-section.flex {
  flex: 1;
  overflow-y: auto;
}
.queue-section.drag-over { background: var(--accent-wash); box-shadow: inset 0 0 0 2px var(--accent); }

.queue-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.queue-title h3 { margin: 0; font-size: 13.5px; }

.queue-help {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.job-card {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  background: var(--surface-1);
  border-radius: var(--radius-s);
  padding: 9px 10px;
  margin-bottom: 8px;
  cursor: grab;
  user-select: none;
}
.job-card:active { cursor: grabbing; }
.job-card.dragging { opacity: .45; }
.job-card.priority-1 { border-left-color: var(--status-critical); }
.job-card.priority-2 { border-left-color: var(--status-warning); }
.job-card.priority-3 { border-left-color: var(--status-neutral); }

.job-card .job-title { font-size: 13px; font-weight: 650; margin-bottom: 3px; }
.job-card .job-client { font-size: 11.5px; color: var(--text-muted); }
.job-card .job-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 7px;
  font-size: 11px;
  color: var(--text-muted);
}

.drop-hint {
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  padding: 12px;
  border-radius: var(--radius-s);
  text-align: center;
  font-size: 12px;
  background: var(--surface-1);
}

.calendar-wrap { min-width: 0; display: flex; flex-direction: column; }

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-strong);
  flex-wrap: wrap;
}
.calendar-toolbar .date-title { font-weight: 650; margin-left: 4px; }
.calendar-toolbar .spacer { flex: 1; }

.calendar { flex: 1; min-height: 0; overflow: auto; position: relative; }

.calendar-grid {
  display: grid;
  grid-template-columns: 64px repeat(5, minmax(150px, 1fr));
  min-width: 780px;
  position: relative;
}
/* Single-day variant (My Work) — one day column instead of five. */
.calendar-grid--single {
  grid-template-columns: 64px minmax(150px, 1fr);
  min-width: 0;
}

.calendar-grid .corner,
.calendar-grid .day-head {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-strong);
  height: 54px;
}
.calendar-grid .corner { left: 0; z-index: 7; border-right: 1px solid var(--border-strong); }

.calendar-grid .day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 650;
}
.calendar-grid .day-head span { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 550; }

.calendar-grid .time-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface-0);
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 11px;
  text-align: right;
  padding: 6px 8px 0 0;
  height: 60px;
}

.calendar-grid .slot {
  position: relative;
  height: 60px;
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-1);
}
.calendar-grid .slot.drag-over { background: var(--accent-wash); box-shadow: inset 0 0 0 2px var(--accent); }

.event {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 3px;
  min-height: 50px;
  background: var(--accent-wash);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-s);
  padding: 6px 8px;
  z-index: 3;
  overflow: hidden;
  color: var(--accent-strong);
}
.event.priority-1 { background: var(--status-critical-wash); border-left-color: var(--status-critical); color: var(--status-critical); }

.event-remove {
  position: absolute;
  top: 2px;
  right: 3px;
  background: none;
  border: none;
  color: inherit;
  opacity: .55;
  font-size: 13px;
  line-height: 1;
  padding: 2px;
  cursor: pointer;
}
.event-remove:hover { opacity: 1; }
.event.priority-3 { background: var(--status-neutral-wash); border-left-color: var(--status-neutral); color: var(--status-neutral); }

.event-split {
  position: absolute;
  top: 2px;
  right: 20px;
  background: none;
  border: none;
  color: inherit;
  opacity: .55;
  font-size: 13px;
  line-height: 1;
  padding: 2px;
  cursor: pointer;
}
.event-split:hover { opacity: 1; }

.event-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 7px;
  cursor: ns-resize;
}
.event-resize-handle::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
}
.event:hover .event-resize-handle::after { opacity: .4; }
.event-resize-handle:hover::after { opacity: .8 !important; }

.event .event-title { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.event .event-client,
.event .event-time { font-size: 10px; opacity: .85; line-height: 1.35; }

.capacity {
  padding: 10px 14px;
  border-top: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.capacity .capacity-bar {
  flex: 1;
  height: 7px;
  background: var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  max-width: 300px;
}
.capacity .capacity-fill { display: block; height: 100%; background: var(--accent); }

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,11,11,0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  z-index: 50;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface-2);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  width: 460px;
  max-width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-strong);
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px 18px; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border-strong);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Large, scrollable variant — content stays put, only the body scrolls
   (header/footer stay visible), for things too long for the default modal
   (e.g. a Procedure step's guide, which can run long with inline images). */
.modal-lg {
  width: 760px;
  max-width: 94vw;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-lg .modal-body { overflow-y: auto; flex: 1; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-1);
  color: var(--text-primary);
}
.field textarea { resize: vertical; min-height: 64px; }

/* ---------- Misc ---------- */

.muted { color: var(--text-muted); }
.text-sub { color: var(--text-secondary); font-size: 12.5px; }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.divider-line { height: 1px; background: var(--border-strong); margin: 14px 0; }

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border-strong);
  overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; }

.attachment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-strong);
  font-size: 13px;
}
.attachment-row:last-child { border-bottom: none; }

.comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-strong);
}
.comment:last-child { border-bottom: none; }
.comment .who { font-weight: 600; font-size: 12.5px; }
.comment .when { color: var(--text-muted); font-size: 11.5px; margin-left: 6px; }
.comment .body { font-size: 13px; margin-top: 3px; }
.comment.customer { background: var(--accent-wash); border-radius: var(--radius-s); padding: 10px; border-bottom: none; margin-bottom: 8px; }

/* ---------- Spacing/layout utilities ----------
   A handful of repeated one-off layout tweaks, consolidated onto the
   4px spacing scale instead of scattered inline style="" attributes with
   ad hoc pixel values. Reach for one of these before adding a new inline
   style — that scatter is exactly the inconsistency the design philosophy
   at the top of CLAUDE.md warns against. */

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.ml-auto { margin-left: auto; }
.cursor-pointer { cursor: pointer; }
.wrap { white-space: normal; }
.w-full { width: 100%; }
.span-2 { grid-column: span 2; }

.avatar-mini {
  width: 22px;
  height: 22px;
  font-size: 10px;
  display: inline-flex;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- Procedure Builder: step editor ---------- */

.builder-step {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  background: var(--surface-1);
  margin-bottom: 10px;
  overflow: hidden;
}
.builder-step.drag-over { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.builder-step.dragging { opacity: .4; }

.builder-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.builder-step-head:hover { background: var(--surface-2); }

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  flex: none;
  display: flex;
}
.drag-handle:active { cursor: grabbing; }

.builder-step-head .seq {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 650; color: var(--text-secondary);
  flex: none;
}

.builder-step-head .title { flex: 1; font-weight: 600; font-size: 13.5px; }
.builder-step-head .meta { font-size: 11.5px; color: var(--text-muted); flex: none; white-space: nowrap; }
.builder-step-head .chevron { transition: transform .12s ease; color: var(--text-muted); flex: none; }
.builder-step.expanded .builder-step-head .chevron { transform: rotate(180deg); }

.builder-step-body { display: none; padding: 4px 12px 14px; border-top: 1px solid var(--border-strong); }
.builder-step.expanded .builder-step-body { display: block; }

.builder-step-actions { display: flex; gap: 6px; flex: none; }

/* ---------- Searchable combobox (Clients/Deliverables/etc. at scale) ---------- */

.combobox { position: relative; }

.combobox-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-1);
  color: var(--text-primary);
}

.combobox-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  max-height: 260px;
  overflow-y: auto;
  z-index: 30;
}
.combobox-menu.open { display: block; }

.combobox-item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-strong);
}
.combobox-item:last-child { border-bottom: none; }
.combobox-item:hover, .combobox-item.active { background: var(--accent-wash); }

.combobox-item-label { font-size: 13px; font-weight: 600; }
.combobox-item-sub { font-size: 11.5px; color: var(--text-muted); }

.combobox-empty { padding: 10px; font-size: 12.5px; color: var(--text-muted); }
.combobox-action {
  padding: 9px 10px;
  font-size: 12.5px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
}
.combobox-action:last-child { border-bottom: none; }
.combobox-action:hover { background: var(--accent-wash); }

/* ========================================================================== 
   Responsive dashboard shell + shared topbar search
   ========================================================================== */

.sidebar-foot .who {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}
.sidebar-foot .who .line1,
.sidebar-foot .who .line2 {
  display: block;
  width: 100%;
}
.sidebar-foot .who .line1 {
  white-space: normal;
  overflow-wrap: anywhere;
  margin-bottom: 3px;
}
.sidebar-foot .who .line2 {
  white-space: normal;
  overflow-wrap: anywhere;
}

.staff-tab > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.staff-tab .staff-name,
.staff-tab .staff-role {
  display: block;
  width: 100%;
}
.staff-tab .staff-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.staff-tab .staff-role {
  white-space: normal;
  overflow-wrap: anywhere;
}

.search-box { position: relative; min-width: 180px; }
.global-search-results {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
}
.global-search-results.open { display: block; }
.global-search-result {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  padding: 9px 11px;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
}
.global-search-result:last-child { border-bottom: 0; }
.global-search-result:hover,
.global-search-result.active { background: var(--accent-wash); }
.global-search-result .gs-title {
  min-width: 0;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-result .gs-type {
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.global-search-result .gs-sub {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.mobile-menu-toggle,
.sidebar-scrim { display: none; }

/* Laptops / small desktops */
@media (max-width: 1200px) {
  :root { --sidebar-w: 220px; }
  .content { padding: 16px; }
  .pane-layout--two { grid-template-columns: minmax(300px, 38%) 1fr; }
  .planner { grid-template-columns: 260px minmax(0, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding-inline: 16px; }
  .search-box { max-width: 360px; }
}

/* Tablets: navigation becomes an off-canvas drawer and content gets full width. */
@media (max-width: 900px) {
  :root { --sidebar-w: 272px; }
  .app-shell { display: block; min-height: 100vh; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-w), 84vw);
    height: 100dvh;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform .18s ease;
    box-shadow: var(--shadow-2);
  }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0,0,0,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  body.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-s);
    background: var(--surface-1);
    color: var(--text-primary);
    padding: 0;
  }
  .main { width: 100%; min-width: 0; }
  .topbar {
    min-height: 56px;
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .topbar h1 { flex: 1; min-width: 120px; }
  .topbar .search-box {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    width: 100%;
  }
  .topbar-actions { margin-left: 0; }
  .content { padding: 14px; }
  .content-header { flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .pane-layout,
  .pane-layout--two {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: visible;
  }
  .content--fill > .pane-layout { flex: none; }
  .pane { overflow: visible; }
  .pane-left,
  .pane-right { border: 0; border-bottom: 1px solid var(--border-strong); }
  .pane-left { max-height: 360px; overflow-y: auto; }
  .pane-right { padding: 14px; }
  .planner {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    overflow: visible;
  }
  .queues {
    border-right: 0;
    border-bottom: 1px solid var(--border-strong);
    max-height: 320px;
  }
  .calendar-wrap { min-height: 560px; }
  .staff-tabs { margin-inline: -2px; padding-bottom: 6px; }
  .staff-tab { min-width: 160px; }
  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-table { min-width: 720px; }
  .card:has(.grid-table) { overflow-x: auto; }
  #workspace-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #tree-pane { position: static !important; }
  #client-tree { max-height: 340px !important; }
  .modal-overlay { padding: 4vh 12px 12px; }
  .modal, .modal-lg { width: 100%; max-width: 100%; }
}

/* Phones */
@media (max-width: 600px) {
  body { font-size: 13px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar h1 { font-size: 14px; }
  .topbar-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar-actions .btn { padding: 5px 8px; }
  .content { padding: 10px; }
  .content-header { margin-bottom: 12px; }
  .content-header h2 { font-size: 18px; }
  .content-header p { font-size: 12.5px; }
  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 12px; }
  .pane-left { max-height: 300px; }
  .pane-right { padding: 12px; }
  .staff-tab { min-width: 148px; padding: 8px 10px; }
  .planner { border-radius: var(--radius-s); }
  .queue-section { padding: 10px; }
  .calendar-toolbar { padding: 9px 10px; }
  .calendar-grid { grid-template-columns: 52px repeat(5, minmax(132px, 1fr)); min-width: 712px; }
  .calendar-grid--single { grid-template-columns: 52px minmax(220px, 1fr); min-width: 0; }
  .calendar-grid .time-cell { padding-right: 5px; }
  .capacity { align-items: flex-start; flex-direction: column; }
  .capacity .capacity-bar { width: 100%; max-width: none; }
  .tabs { overflow-x: auto; white-space: nowrap; }
  .tab { flex: none; }
  .builder-step-head { gap: 7px; padding: 9px; flex-wrap: wrap; }
  .builder-step-head .title { min-width: calc(100% - 90px); }
  .builder-step-head .meta { order: 4; width: 100%; margin-left: 38px; white-space: normal; }
  .builder-step-actions { margin-left: auto; }
  .form-grid, .detail-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .span-2 { grid-column: auto; }
  .list-row { align-items: flex-start; }
  .list-row .row-meta { white-space: normal; max-width: 35%; }
  .modal-overlay { align-items: stretch; padding: 8px; }
  .modal, .modal-lg { max-height: calc(100dvh - 16px); border-radius: var(--radius-m); }
  .modal-head, .modal-body, .modal-foot { padding-left: 12px; padding-right: 12px; }
  .modal-foot { flex-wrap: wrap; }
  .global-search-results { max-height: 52vh; }
}

/* ---------- Live sidebar counts ---------- */
.nav-link .count[hidden] { display: none !important; }

/* ---------- Inbox action alignment ---------- */
.job-intake-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.job-intake-actions .btn { width: auto; }

/* ---------- Attachment rows ---------- */
.attachment-row { min-width: 0; flex-wrap: wrap; }
.attachment-row .attachment-title {
  min-width: 0;
  flex: 1 1 180px;
  overflow-wrap: anywhere;
}
.attachment-row .btn { margin-left: auto; flex: none; }

/* Long legacy ticket text must never widen the client workspace. */
body[data-page="client-workspace"] .list-row .row-title,
body[data-page="client-workspace"] .list-row .row-sub {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
body[data-page="client-workspace"] .list-row { min-width: 0; }

/* Job Workspace: every detail tab remains usable at tablet/phone widths. */
@media (max-width: 900px) {
  body[data-page="job-workspace"] .job-detail-card-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body[data-page="job-workspace"] .tab-panel { min-width: 0; }
  body[data-page="job-workspace"] .tab-panel > .grid,
  body[data-page="job-workspace"] .tab-panel .card { min-width: 0; }
  body[data-page="job-workspace"] .grid-table {
    min-width: 620px;
  }
  body[data-page="job-workspace"] .tab-panel:has(.grid-table) {
    overflow-x: auto;
  }
}

@media (max-width: 600px) {
  body[data-page="job-workspace"] .tab-panel { padding: 10px; }
  body[data-page="job-workspace"] .job-detail-card-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body[data-page="job-workspace"] .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }
  body[data-page="job-workspace"] .detail-row .v {
    width: 100%;
    text-align: left;
    overflow-wrap: anywhere;
  }
  body[data-page="job-workspace"] .header-actions {
    width: auto;
    align-self: flex-start;
  }
  body[data-page="job-workspace"] .header-actions .btn { width: auto; }
  body[data-page="job-workspace"] .step-item { align-items: flex-start; }
  body[data-page="job-workspace"] .step-meta { flex-wrap: wrap; }
  body[data-page="job-workspace"] .attachment-row .btn {
    margin-left: 0;
  }
  .job-intake-actions {
    flex-wrap: nowrap;
  }
}

/* ---------- Authentication + account pages ---------- */
.auth-page {
  min-height: 100dvh;
  background: var(--surface-0);
}
.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(100%, 420px);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  border-radius: var(--radius-l);
  padding: 28px;
  box-shadow: var(--shadow-2);
}
.auth-brand { display:flex; align-items:center; gap:10px; margin-bottom:30px; }
.auth-brand .mark { width:36px; height:36px; border-radius:10px; display:grid; place-items:center; background:var(--accent); color:white; font-size:12px; font-weight:800; }
.auth-brand .name { font-weight:700; }
.auth-brand .sub { color:var(--text-muted); font-size:12px; }
.auth-copy h1 { margin:0 0 6px; font-size:24px; }
.auth-copy p { margin:0 0 22px; color:var(--text-secondary); }
.auth-form, .account-form { display:grid; gap:16px; }
.auth-submit { width:100%; justify-content:center; margin-top:2px; }
.form-field { min-width:0; }
.form-field label { display:block; margin:0 0 6px; font-size:12px; font-weight:650; color:var(--text-secondary); }
.form-control {
  width:100%; min-width:0; border:1px solid var(--border-strong); background:var(--surface-0); color:var(--text-primary);
  border-radius:var(--radius-s); padding:9px 10px; font:inherit; outline:none;
}
.form-control:focus { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-wash); }
.field-error { margin-top:5px; color:var(--status-critical); font-size:12px; }
.field-help { margin-top:6px; color:var(--text-muted); font-size:11px; line-height:1.5; }
.field-help ul { margin:6px 0 0 18px; padding:0; }
.form-alert { padding:10px 12px; border:1px solid var(--border-strong); border-radius:var(--radius-s); margin-bottom:16px; font-size:12.5px; }
.form-alert-error { color:#ffb4b4; border-color:rgba(239,68,68,.35); background:rgba(127,29,29,.18); }
.form-alert-success { color:#b7f7c5; border-color:rgba(34,197,94,.35); background:rgba(20,83,45,.18); }
.form-alert ul { margin:0; padding-left:18px; }
.account-content { max-width:1180px; width:100%; margin-inline:auto; }
.account-layout { display:grid; grid-template-columns:minmax(0, 1.6fr) minmax(260px, .7fr); gap:16px; align-items:start; }
.account-settings-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:16px; align-items:start; }
.account-card { min-width:0; }
.account-form-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
.account-actions { display:flex; justify-content:flex-end; padding-top:4px; }
.account-summary-card { text-align:center; position:sticky; top:76px; }
.account-avatar-large { width:68px; height:68px; border-radius:50%; display:grid; place-items:center; margin:0 auto 12px; background:var(--accent-wash); color:var(--accent-strong); font-weight:800; font-size:20px; }
.account-summary-card h3 { margin:0 0 18px; font-size:17px; }
.account-summary-list { display:grid; gap:0; text-align:left; border-top:1px solid var(--border); }
.account-summary-list > div { display:flex; gap:10px; justify-content:space-between; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--border); }
.account-summary-list span { color:var(--text-muted); font-size:12px; }
.account-summary-list strong { max-width:65%; text-align:right; overflow-wrap:anywhere; font-size:12px; }
.sidebar .nav-group-label + .nav-link { margin-top:2px; }

@media (max-width: 900px) {
  .account-layout, .account-settings-grid { grid-template-columns:minmax(0,1fr); }
  .account-summary-card { position:static; order:-1; }
}
@media (max-width: 600px) {
  .auth-shell { padding:12px; }
  .auth-card { padding:20px 16px; border-radius:var(--radius-m); }
  .auth-brand { margin-bottom:22px; }
  .account-form-grid { grid-template-columns:minmax(0,1fr); }
  .account-form-grid .span-2 { grid-column:auto; }
  .account-actions { justify-content:stretch; }
  .account-actions .btn { width:100%; justify-content:center; }
}

/* ========================================================================== 
   Inbox processing + All Jobs / archive
   ========================================================================== */
.inbox-list-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface-1);
}
.inbox-list-controls input,
.inbox-list-controls select { min-width: 0; }

.job-intake-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--surface-1);
  font-size: 11.5px;
  color: var(--text-muted);
}
.job-intake-meta strong { color: var(--text-secondary); font-weight: 650; }
.job-intake-section-title {
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.source-details {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  padding: 8px 10px;
  background: var(--surface-1);
}
.source-details summary { cursor: pointer; color: var(--text-secondary); font-weight: 650; }
.attachment-actions { display:flex; gap:8px; flex-wrap:wrap; }

.all-jobs-filters {
  display:grid;
  grid-template-columns:minmax(230px,1.4fr) repeat(4,minmax(140px,.7fr));
  gap:8px;
}
.all-jobs-table { min-width: 1060px; }
.clickable-row { cursor:pointer; }
.clickable-row:hover td { background: var(--accent-wash); }

.job-detail-title-row {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}
.job-detail-pills { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.job-description {
  white-space: pre-wrap;
  overflow-wrap:anywhere;
  color: var(--text-primary);
  line-height:1.55;
  font-size:13.5px;
}

@media (max-width: 1100px) {
  .all-jobs-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .all-jobs-filters > :first-child { grid-column:1 / -1; }
}

@media (max-width: 600px) {
  .inbox-list-controls { grid-template-columns:minmax(0,1fr); }
  .job-intake-meta { display:grid; grid-template-columns:minmax(0,1fr); gap:5px; }
  .attachment-actions .btn { flex:1 1 auto; }
  .all-jobs-filters { grid-template-columns:minmax(0,1fr); }
  .all-jobs-filters > :first-child { grid-column:auto; }
  .job-detail-title-row { flex-direction:column; }
  .job-detail-pills { justify-content:flex-start; }
}

/* ---------- Oct 2026 scheduler + Job Workspace refinements ---------- */
.staff-tab {
  min-width: 150px;
  justify-content: space-between;
  gap: 8px;
}
.staff-tab-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.staff-tab-copy .staff-name {
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.staff-tab-copy .staff-role {
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.staff-queue-badge {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-0);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}
.staff-tab.active .staff-queue-badge {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.job-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.job-card-head .job-title {
  min-width: 0;
  flex: 1;
}
.job-estimate {
  flex: none;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 700;
}
.job-card .job-deliverable {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-card .job-meta {
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.job-description-prominent {
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--surface-0);
  font-size: 14px;
  line-height: 1.65;
}
.client-summary-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}
.job-timer {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--surface-0);
}
.job-timer-clock {
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.job-timer-actions,
.time-entry-cost-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.job-timer-sessions {
  margin-top: 10px;
  max-height: 150px;
  overflow-y: auto;
}
.job-timer-session,
.time-entry-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--border-strong);
  font-size: 11.5px;
}
.job-timer-session:first-child,
.time-entry-quick-row:first-child { border-top: 0; }
.time-entry-recent { min-width: 0; }

@media (max-width: 900px) {
  .staff-tab { min-width: 142px; }
  .job-timer-clock { font-size: 24px; }
}

@media (max-width: 600px) {
  .staff-tab { min-width: 132px; padding: 8px 9px; }
  .staff-tab-copy .staff-name { font-size: 12.5px; }
  .staff-tab-copy .staff-role { font-size: 10.5px; }
  .job-card-head { gap: 6px; }
  .job-timer-actions .btn,
  .time-entry-cost-actions .btn { flex: 1 1 auto; }
  .job-timer-session,
  .time-entry-quick-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .job-description-prominent { min-height: 120px; }
}
.staff-tab > .staff-tab-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.staff-tab > .staff-queue-badge:last-child {
  min-width: 22px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Client operational workspace */
.client-profile-header h2 { margin-bottom: 4px; }
.client-service-badges { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.client-tabs, .billing-tabs, .agreements-tabs { overflow-x:auto; white-space:nowrap; }
.client-tree-summary,
.client-tree-history { border-top:1px solid var(--border-strong); margin-top:12px; padding-top:12px; }
.mini-stat-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:4px 0; font-size:12px; }
.tree-history-item { padding:6px 0; font-size:11.5px; line-height:1.35; border-bottom:1px solid var(--border); }
.tree-history-item:last-child { border-bottom:0; }
.tree-history-item span { display:block; color:var(--text-muted); font-size:10.5px; margin-top:2px; }
.no-contract-root > .tree-row { background:var(--surface-2); border-radius:6px; }
.contact-card { display:grid; grid-template-columns:minmax(170px,1fr) minmax(220px,1.2fr) auto; gap:14px; align-items:start; padding:12px 0; border-bottom:1px solid var(--border-strong); }
.contact-card:last-child { border-bottom:0; }
.metric-value { font-size:22px; font-weight:700; margin-top:4px; }
@media (max-width: 900px) {
  .contact-card { grid-template-columns:1fr 1fr; }
  .contact-card > :last-child { grid-column:1 / -1; }
}
@media (max-width: 600px) {
  .contact-card { grid-template-columns:1fr; }
  .contact-card > :last-child { grid-column:auto; }
  .client-profile-header .header-actions { width:100%; }
}
