/* ---- Theme tokens (dark = default; light overrides below). Theme is set on <html data-theme> before first paint. ---- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1118;
  --bg-elev: #141b24;
  --bg-card: #18212c;
  --border: #273140;
  --border-soft: #1e2834;
  --text: #e8eef6;
  --text-muted: #8b9aaf;
  --text-dim: #7f8ea3;
  --accent: #3db8a8;
  --accent-dim: rgba(61, 184, 168, 0.15);
  --accent-border: rgba(61, 184, 168, 0.40);
  --yellow: #e6b84d;
  --yellow-bg: rgba(230, 184, 77, 0.14);
  --red: #ef7676;
  --red-bg: rgba(224, 93, 93, 0.14);
  --green: #4ec98a;
  --green-bg: rgba(78, 201, 138, 0.14);
  --blue-bg: rgba(96, 165, 250, 0.16);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --th-bg: #10161e;
  --chip-bg: rgba(255, 255, 255, 0.06);
  --row-hover: rgba(61, 184, 168, 0.06);
  --row-sel: rgba(61, 184, 168, 0.12);
  --backdrop: rgba(0, 0, 0, 0.6);
  --banner-text: #f5c2c2;
  --glow-1: rgba(61, 184, 168, 0.12);
  --glow-2: rgba(80, 120, 200, 0.08);
  --viewas-bg: #7a4b00;
  --viewas-text: #ffffff;
  --changed-bg: rgba(230, 184, 77, 0.22);
  --conf-high-bg: rgba(78, 201, 138, 0.16);  --conf-high: #6ee7a8;
  --conf-medium-bg: rgba(230, 184, 77, 0.16); --conf-medium: #f2cc6b;
  --conf-low-bg: rgba(239, 118, 118, 0.16);   --conf-low: #f59a9a;
  --conf-none-bg: rgba(148, 163, 184, 0.14);  --conf-none: #b4c0cf;
  /* Entity links (agents, brokerages, offices, teams, contacts): warm sand, not blue */
  --link: #f2c48d;
  --link-hover: #f8dcb6;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "DM Sans", system-ui, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-elev: #ffffff;
  --bg-card: #f7f9fb;
  --border: #d3dbe5;
  --border-soft: #e3e8ef;
  --text: #111827;
  --text-muted: #475569;
  --text-dim: #5b6576;
  --accent: #0c655e;
  --accent-dim: rgba(12, 101, 94, 0.08);
  --accent-border: rgba(12, 101, 94, 0.45);
  --yellow: #8a5300;
  --yellow-bg: rgba(217, 150, 20, 0.16);
  --red: #b42318;
  --red-bg: rgba(220, 38, 38, 0.10);
  --green: #166534;
  --green-bg: rgba(22, 163, 74, 0.12);
  --blue-bg: rgba(37, 99, 235, 0.10);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
  --th-bg: #eef2f6;
  --chip-bg: rgba(15, 23, 42, 0.05);
  --row-hover: rgba(15, 118, 110, 0.05);
  --row-sel: rgba(15, 118, 110, 0.10);
  --backdrop: rgba(15, 23, 42, 0.45);
  --banner-text: #8f1d14;
  --glow-1: rgba(15, 118, 110, 0.07);
  --glow-2: rgba(80, 120, 200, 0.05);
  --viewas-bg: #fde68a;
  --viewas-text: #5c3a00;
  --changed-bg: #fef3c7;
  --conf-high-bg: #dcfce7;  --conf-high: #166534;
  --conf-medium-bg: #fef9c3; --conf-medium: #854d0e;
  --conf-low-bg: #fee2e2;   --conf-low: #991b1b;
  --conf-none-bg: #f1f5f9;  --conf-none: #475569;
  --link: #134e4a;
  --link-hover: #0b3b37;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, var(--glow-1), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--glow-2), transparent 50%);
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(145deg, #3db8a8, #2a7d9e);
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow);
  position: relative;
}
.logo-mark::after {
  content: "";
  position: absolute; inset: 10px 9px 14px;
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50% 50% 45% 45%;
  border-bottom-width: 3px;
}
h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
.date-block { display: flex; flex-direction: column; gap: 2px; }
.label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}
.value { font-size: 0.95rem; font-weight: 500; }
.mono { font-family: var(--mono); font-size: 0.85rem; }

.btn-primary {
  appearance: none;
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--row-sel); border-color: var(--accent); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: wait; }
.btn-primary.spinning .btn-icon { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--red-bg);
  border: 1px solid rgba(224,93,93,0.35);
  color: var(--banner-text);
  font-size: 0.9rem;
}
.status-banner.hidden { display: none; }

.section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-hint { color: var(--text-dim); font-size: 0.8rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card.accent {
  border-color: var(--accent-border);
  background: linear-gradient(160deg, var(--accent-dim), var(--bg-card) 60%);
}
.stat-card.weather { grid-column: span 2; }
@media (max-width: 960px) {
  .stat-card.weather { grid-column: span 2; }
}
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}
.stat-num {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-num.muted { color: var(--text-muted); font-size: 1.65rem; }

.mix-row, .pay-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.pill strong { color: var(--text); font-weight: 700; margin-right: 3px; }

.weather-body { display: flex; flex-direction: column; gap: 2px; }
.weather-temp { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.weather-cond { color: var(--text-muted); font-size: 0.9rem; }

.flag-summary { display: flex; gap: 8px; }
.chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.chip.yellow { background: var(--yellow-bg); color: var(--yellow); }
.chip.red { background: var(--red-bg); color: var(--red); }

.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border-soft); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
}
th {
  background: var(--th-bg);
  color: var(--text-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }
td.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px;
}
.flag-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
}
.flag-pill.YELLOW { background: var(--yellow-bg); color: var(--yellow); }
.flag-pill.RED { background: var(--red-bg); color: var(--red); }
.addr { color: var(--text-muted); max-width: 280px; }
.mono-cell { font-family: var(--mono); font-size: 0.82rem; }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .compare-grid { grid-template-columns: 1fr; }
}
.compare-body { display: flex; flex-direction: column; gap: 16px; }
.compare-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.compare-pair > div {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.delta-block {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}
.delta-block.up { color: var(--green); border-color: rgba(78,201,138,0.3); }
.delta-block.down { color: var(--red); border-color: rgba(224,93,93,0.3); }
.delta-block.flat { color: var(--text-muted); }

.footer {
  margin-top: 8px;
  padding-top: 8px;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.5;
}
.footer p { margin: 0; }

/* Shoot Issues (email) */
.agent-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.agent-email {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.also-flag {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: 2px 7px;
  width: fit-content;
}
.subj {
  max-width: 260px;
  color: var(--text);
}
.why {
  max-width: 280px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.thread-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--accent-border);
}
.thread-link:hover {
  border-bottom-color: var(--accent);
}
#email-issues .flag-summary {
  align-items: center;
}

/* Contact / photographer cells */
.contact-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  font-size: 0.82rem;
  line-height: 1.35;
}
.contact-cell a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-border);
  width: fit-content;
  word-break: break-all;
}
.contact-cell a:hover { border-bottom-color: var(--accent); }
.contact-cell .muted-dash { color: var(--text-dim); }
.photog-cell { max-width: 160px; color: var(--text); }
.status-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--text-muted);
}
.status-pill.SCHEDULED { background: var(--accent-dim); color: var(--accent); }
.status-pill.CANCELED { background: var(--red-bg); color: var(--red); }
#today-schedule .addr { max-width: 220px; }
#today-schedule .services-cell {
  max-width: 200px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ---- Client Pulse extensions ---- */
.app { max-width: 100%; padding: 22px 18px 40px; }
.stat-grid.pulse-stats { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) {
  .stat-grid.pulse-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .stat-grid.pulse-stats { grid-template-columns: repeat(2, 1fr); }
}
.stat-card .stat-sub {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}
.filters input, .filters select {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 8px 10px;
  border-radius: 8px;
  min-width: 140px;
}
.filters input[type="search"] { min-width: 220px; }
.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.table-wrap.wide {
  max-height: calc(100vh - 340px);
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}
.clients-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}
.clients-table th, .clients-table td {
  padding: 7px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.clients-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--th-bg);
  cursor: pointer;
  user-select: none;
}
.clients-table thead th:hover { color: var(--accent); }
.clients-table thead th.sorted { color: var(--accent); }
.clients-table tbody tr { cursor: pointer; }
.clients-table tbody tr:hover td { background: var(--row-hover); }
.clients-table tbody tr.selected td {
  background: var(--row-sel);
}
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 0.78rem; text-align: right; }
.client-name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.gap-pill, .health-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}
.gap-pill.Below\ Avg, .gap-pill.below { background: var(--red-bg); color: var(--red); }
.gap-pill.Above\ Avg, .gap-pill.above { background: var(--green-bg); color: var(--green); }
.gap-pill.At\ Avg, .gap-pill.at { background: var(--chip-bg); color: var(--text-muted); }
.health-pill.A\+, .health-pill.A { background: var(--green-bg); color: var(--green); }
.health-pill.B { background: var(--accent-dim); color: var(--accent); }
.health-pill.C { background: var(--yellow-bg); color: var(--yellow); }
.health-pill.D { background: var(--red-bg); color: var(--red); }

.detail-panel {
  display: none;
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.detail-panel.open { display: block; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 16px;
}
.detail-item .d-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
}
.detail-item .d-value {
  font-size: 0.9rem;
  margin-top: 2px;
  word-break: break-word;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-head h3 { margin: 0; font-size: 1.1rem; }
.contact-line a { color: var(--link); }
.meta-row { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }
.btn-ghost {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.result-hint { color: var(--text-dim); font-size: 0.8rem; }

/* ---- DHM Pulse additions ---- */
.hidden { display: none !important; }
.tabs { display: flex; gap: 6px; margin: 10px 0 4px; flex-wrap: wrap; }
.tab { border: 1px solid rgba(127,127,127,.3); background: transparent; color: inherit; padding: 6px 12px; border-radius: 8px; cursor: pointer; font: inherit; }
.tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.login-box { max-width: 360px; margin: 80px auto; display: flex; flex-direction: column; gap: 10px; }
.login-box input { padding: 9px 10px; font: inherit; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.clients-table tbody tr { cursor: pointer; }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 4px 12px; font-size: 13px; }
.small { font-size: 12px; } /* no opacity: it pushed muted text below WCAG AA */
.viewas { background: var(--viewas-bg); color: var(--viewas-text); padding: 6px 12px; border-radius: 6px; }

/* ---------- Phase 2 CRM ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 0.85rem; }
.btn-ghost:hover { border-color: var(--accent); }
.btn-small { padding: 3px 8px; font-size: 0.78rem; }
.filter-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.filter-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-row select, .filter-row input, .modal select, .modal input, .modal textarea, .inline-form select, .inline-form input, .inline-form textarea { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 0.85rem; }
.modal textarea, .inline-form textarea { width: 100%; min-height: 70px; }
.lvl { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.lvl-High { background: var(--red-bg); color: var(--red); }
.lvl-Medium { background: var(--yellow-bg); color: var(--yellow); }
.lvl-Low { background: var(--accent-dim); color: var(--accent); }
.lvl-None { background: var(--border-soft); color: var(--text-muted); }
.profile-head { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
@media (max-width: 900px) { .profile-head { grid-template-columns: 1fr; } }
.profile-name { font-size: 1.6rem; font-weight: 700; margin: 0; }
.profile-sub { color: var(--text-muted); margin: 2px 0 10px; }
.kv-mini { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 8px 16px; margin-top: 10px; }
.kv-mini > div > span:first-child { display: block; color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; }
.next-action { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.next-action h4 { margin: 0 0 4px; color: var(--text-dim); font-size: .75rem; letter-spacing: .08em; }
.next-action .act { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.next-action ul { margin: 6px 0; padding-left: 18px; }
.next-action .prot { color: var(--yellow); }
.actions-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0 10px; border-bottom: 1px solid var(--border-soft); }
.subtab { background: none; border: none; color: var(--text-muted); padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.subtab.active { color: var(--text); border-bottom-color: var(--accent); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.timeline .when { color: var(--text-dim); font-family: var(--mono); font-size: .78rem; }
.timeline .src { color: var(--text-dim); font-size: .72rem; margin-left: 6px; }
.not-connected { border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; color: var(--text-muted); margin: 6px 0; font-size: .85rem; }
.note-card { border: 1px solid var(--border-soft); border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
.note-type { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.modal { position: fixed; inset: 0; background: var(--backdrop); display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 50; }
.modal-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); width: min(620px, 94vw); max-height: 82vh; overflow: auto; padding: 16px 18px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; gap: 8px 10px; align-items: center; margin: 10px 0; }
.src-tag { font-size: .7rem; color: var(--text-dim); margin-left: 4px; }
.clients-table tr.clickable { cursor: pointer; }
.clients-table td.reason-cell { white-space: normal; min-width: 300px; max-width: 420px; color: var(--text-muted); font-size: .8rem; }
.clients-table td.wrap { white-space: normal; }
.issue-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.clients-table td.small, .clients-table td.mono { white-space: normal; max-width: 460px; word-break: break-word; }

/* ---- Phase 4/5: global search, dashboard, org + market pages */
.global-search { position: relative; margin: 8px 0 4px; }
.global-search input { width: 100%; max-width: 640px; padding: 8px 12px; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.gs-res { position: absolute; z-index: 40; top: 40px; left: 0; width: min(720px, 96vw); max-height: 70vh; overflow: auto; background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.gs-res .gs-item { display: flex; gap: 10px; padding: 7px 12px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.gs-res .gs-item:hover { background: var(--row-hover); }
.gs-type { min-width: 150px; font-size: 12px; color: var(--text-muted); }
.exc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.exc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.exc-card h4 { margin: 0 0 6px; }
.good { color: var(--green); } .bad { color: var(--red); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--chip-bg); color: var(--text-muted); }
.pill.behind { background: var(--red-bg); color: var(--red); } .pill.ahead { background: var(--green-bg); color: var(--green); } .pill.on_track { background: var(--blue-bg); color: var(--text); }
.conf-high { background: var(--conf-high-bg); color: var(--conf-high); }
.conf-medium { background: var(--conf-medium-bg); color: var(--conf-medium); }
.conf-low { background: var(--conf-low-bg); color: var(--conf-low); }
.conf-none { background: var(--conf-none-bg); color: var(--conf-none); }
.perm-matrix td.changed { background: var(--changed-bg); }
.perm-matrix td, .perm-matrix th { text-align: center; }
.perm-matrix td:first-child { text-align: left; }
.shoot-card { display: flex; gap: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: var(--bg-card); }
.shoot-time { font-size: 1.25rem; font-weight: 600; min-width: 110px; }
.shoot-main { flex: 1; display: grid; gap: 4px; }

/* ---- Theme toggle + global link / form styling (both modes) ---- */
a { color: var(--link); font-weight: 600; text-decoration: none; text-underline-offset: 2px; }
a:hover, a:focus-visible { color: var(--link-hover); text-decoration: underline; text-decoration-thickness: 1.5px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
a.btn-ghost, a.btn-primary { font-weight: 500; }
a.btn-ghost { color: var(--text); text-decoration: none; display: inline-block; }
a.btn-ghost:hover { text-decoration: none; color: var(--text); }
.contact-cell a { color: var(--link); border-bottom: none; }
.thread-link { color: var(--link); border-bottom: none; }
.thread-link:hover { text-decoration: underline; }
input, select, textarea { color-scheme: inherit; }
/* :where() keeps specificity 0 so component rules (.filters input, .modal input, ...) still win */
:where(select, input:not([type="checkbox"]):not([type="radio"]), textarea) { background-color: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font: inherit; }
:where(input, textarea)::placeholder { color: var(--text-dim); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
option { background: var(--bg-elev); color: var(--text); }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.theme-toggle .ti { font-size: 1rem; line-height: 1; }
.theme-toggle-login { position: fixed; top: 14px; right: 16px; z-index: 60; }
/* checkboxes inside .filters were getting appearance:none + min-width (invisible box) */
.filters input[type="checkbox"], .filters input[type="radio"] { appearance: auto; min-width: 0; width: 16px; height: 16px; padding: 0; margin: 6px 0; }
/* ---- booked-upcoming overlay ---- */
.exc-card.exc-wide { grid-column: 1 / -1; }
.booked-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.appt-link { white-space: nowrap; }
.next-appt-cell .small { white-space: normal; }
#booked-upcoming td { white-space: normal; vertical-align: top; }
#booked-upcoming td:nth-child(4) { min-width: 200px; }
#booked-upcoming td:nth-child(5) { min-width: 220px; max-width: 340px; }
#booked-upcoming td:nth-child(7) { min-width: 180px; }
#booked-upcoming .clients-table { width: 100%; }

/* ---- Communications (Quo calls/texts + email) ---- */
.comm-badge { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border-soft); white-space: nowrap; }
.comm-badge.cb-call { background: rgba(61, 184, 168, .16); color: var(--text); border-color: rgba(61, 184, 168, .5); }
.comm-badge.cb-text { background: rgba(242, 196, 141, .18); color: var(--text); border-color: rgba(242, 196, 141, .6); }
.comm-badge.cb-email { background: rgba(160, 140, 220, .18); color: var(--text); border-color: rgba(160, 140, 220, .6); }
.seg.cb-call { background: #3db8a8; } .seg.cb-text { background: #e0a85f; } .seg.cb-email { background: #9d8ad8; }
.comm-health-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 10px; }
.comm-health { font-size: .8rem; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--border-soft); }
.comm-health.ok { border-color: var(--accent-border); background: var(--accent-dim); }
.comm-health.warn { border-color: rgba(224, 168, 95, .6); background: rgba(224, 168, 95, .12); }
.comm-snippet { max-width: 520px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.comm-text { white-space: pre-wrap; max-height: 320px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 8px; font-size: .85rem; }
.comms-table td { vertical-align: top; }
.week-bars { display: flex; align-items: flex-end; gap: 6px; min-height: 160px; padding: 8px 0; overflow-x: auto; }
.week-bars .wb { display: flex; flex-direction: column; align-items: center; min-width: 34px; }
.week-bars .wb-stack { width: 22px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; }
.week-bars .wb-l, .week-bars .wb-n { font-size: .68rem; color: var(--text-dim); font-family: var(--mono); }
.kv th { text-align: left; padding: 2px 10px 2px 0; color: var(--text-dim); font-weight: 600; white-space: nowrap; vertical-align: top; }
.pill-filter { font-size: .8rem; align-self: end; }
.queue-actions { display: flex; gap: 4px; flex-wrap: wrap; min-width: 230px; }
.comms-table .comm-snippet { max-width: 420px; }

/* ---- Client Year Summary: per-account communications drawer ---- */
a.acct-comms { color: var(--link); }
a.acct-comms:hover { color: var(--link-hover); text-decoration: underline; }
.lc-cell { white-space: nowrap; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 90; }
.comm-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 96vw); z-index: 95; background: var(--bg-card); color: var(--text);
  border-left: 1px solid var(--border-soft); box-shadow: -12px 0 30px rgba(0, 0, 0, .25); display: flex; flex-direction: column; padding: 14px 16px; gap: 8px; }
.comm-drawer .cd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.comm-drawer h3 { margin: 0 0 4px; }
.cd-tools { display: flex; flex-direction: column; gap: 8px; }
.cd-tools input { width: 100%; }
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--border-soft); background: transparent; color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: .8rem; cursor: pointer; }
.chip.active { border-color: var(--accent-border); background: var(--accent-dim); color: var(--accent); font-weight: 700; }
.chip-n { color: var(--text-dim); font-family: var(--mono); font-size: .74rem; }
.chip.active .chip-n { color: inherit; }
.cd-touch { margin-left: auto; }
.cd-list { overflow-y: auto; flex: 1; padding-right: 4px; }
.cd-day-h { position: sticky; top: 0; background: var(--bg-card); font-weight: 700; font-size: .82rem; padding: 6px 0 4px; border-bottom: 1px solid var(--border-soft); z-index: 1; }
.cd-item { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: .86rem; }
.cd-when { color: var(--text-dim); font-size: .76rem; padding-top: 2px; }
.cd-body, .cd-vm { white-space: pre-wrap; margin-top: 3px; }
.cd-contact { font-size: .72rem; font-weight: 700; color: var(--accent); margin-left: 6px; }
.cd-more { text-align: center; padding: 10px 0; }

/* ---- Video section (high contrast; status colours from the theme tokens, never blue text) ---- */
.vbanner { border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px; padding: 8px 12px; margin: 8px 0; color: var(--text); }
.vok { color: var(--green); font-weight: 700; }
.vwarn { color: var(--yellow); font-weight: 700; }
.vstatus { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.vs-notoff { background: var(--chip-bg); color: var(--text); border-color: var(--border); }
.vs-new { background: var(--yellow-bg); color: var(--yellow); }
.vs-prog { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-border); }
.vs-done { background: var(--green-bg); color: var(--green); }
.vs-sent { background: var(--border-soft); color: var(--text-muted); }
.vs-hold { background: var(--red-bg); color: var(--red); }
.vs-other { background: var(--chip-bg); color: var(--text-muted); border-color: var(--border); }
.vrush { display: inline-block; background: var(--red); color: var(--bg); font-weight: 800; font-size: 0.7rem; letter-spacing: .05em; padding: 1px 7px; border-radius: 6px; }
.vflag { display: inline-block; background: var(--yellow-bg); color: var(--yellow); font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.vtag { display: inline-block; background: var(--chip-bg); color: var(--text); font-size: 0.72rem; font-weight: 600; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-soft); white-space: nowrap; }
.vboard { display: grid; grid-template-columns: minmax(0, 5fr) minmax(220px, 1fr); gap: 12px; margin-top: 10px; align-items: start; }
.vflow { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 10px; overflow-x: auto; }
.vside { display: grid; gap: 10px; border-left: 2px dashed var(--border); padding-left: 12px; }
.vcol { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px; padding: 8px; min-height: 120px; max-height: 78vh; overflow-y: auto; }
.vcol h3 { font-size: 0.9rem; margin: 2px 2px 8px; display: flex; gap: 6px; align-items: center; position: sticky; top: -8px; background: var(--bg-card); padding: 6px 0; }
.vcount { font-weight: 800; color: var(--text); }
.vcard { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; color: var(--text); }
.vcard:hover, .vcard:focus-visible { border-color: var(--accent); outline: none; }
.vcard.is-rush { border-left: 4px solid var(--red); }
.vcard-top { display: flex; gap: 6px; align-items: center; font-size: 0.78rem; }
.vtype { font-weight: 700; }
.vdate { margin-left: auto; color: var(--text-muted); font-weight: 600; }
.vcard-client { font-weight: 700; margin: 3px 0 1px; overflow-wrap: anywhere; }
.vcard-people { margin-top: 3px; }
.vcard-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.vfilters label { font-size: 0.8rem; }
.vcheck { display: inline-flex; align-items: center; gap: 4px; }
.vtable td { vertical-align: top; }
.vnotes { max-width: 260px; font-size: 0.8rem; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.vdetail h4 { margin: 16px 0 6px; color: var(--text); border-bottom: 1px solid var(--border-soft); padding-bottom: 3px; }
.vdetail-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vedit textarea { width: 100%; }
.vedit select, .vedit input, .vedit textarea { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font: inherit; }
.vpre { white-space: pre-wrap; overflow-wrap: anywhere; }
.vform summary { cursor: pointer; font-weight: 600; }
.vinactive td { color: var(--text-muted); text-decoration: line-through; }
.vinactive td input { text-decoration: none; }
.modal-card:has(.vdetail) { width: min(1000px, 96vw); }
@media (max-width: 1100px) { .vboard { grid-template-columns: 1fr; } .vside { border-left: none; padding-left: 0; } }
.filters label.vcheck { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 9px; color: var(--text); }
.filters .vcheck input[type="checkbox"] { appearance: auto; min-width: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }

/* ---- Video list layout (default for the Video board; also queue + all jobs) ---- */
.vbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.vbar > .small { flex: 1 1 320px; color: var(--text); }
.vmode { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.vmode-btn { background: var(--bg-elev); color: var(--text); border: none; padding: 6px 12px; font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.vmode-btn + .vmode-btn { border-left: 1px solid var(--border); }
.vmode-btn.active { background: var(--accent); color: var(--bg); }
.vmode-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.vlist-groups { display: grid; gap: 10px; }
.vgroup { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.vgroup.is-side { border-style: dashed; margin-top: 8px; }
.vgroup-h { width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--bg-elev); color: var(--text); border: none; border-bottom: 1px solid var(--border-soft); padding: 9px 12px; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.vgroup-h:hover, .vgroup-h:focus-visible { background: var(--accent-dim); outline: none; }
.vgroup-h .small { font-weight: 500; color: var(--text-muted); }
.vchev { width: 1em; color: var(--text); }
.vgroup .table-wrap { margin: 0; border: none; border-radius: 0; }
.vnone { padding: 10px 12px; }
.vmore { margin: 8px 12px 10px; }
.vlist { width: 100%; }
.vlist th.vth { padding: 0; white-space: nowrap; }
.vlist th.vth button { background: none; border: none; color: var(--text); font: inherit; font-weight: 700; padding: 8px 8px; cursor: pointer; width: 100%; text-align: left; }
.vlist th.vth button:hover, .vlist th.vth button:focus-visible { color: var(--accent); text-decoration: underline; outline: none; }
.vlist th.vth.sorted button { color: var(--accent); }
.vlist td { padding: 6px 8px; color: var(--text); font-size: 0.85rem; }
.vlist .vwrap { overflow-wrap: anywhere; min-width: 70px; }
.vlist td.vwrap:nth-child(2) { min-width: 120px; }
.vlist td.vwrap:nth-child(3) { min-width: 140px; }
.vrow { cursor: pointer; }
.vrow:hover td, .vrow:focus-visible td { background: var(--accent-dim); }
.vrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.vrow.is-rush td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.vhrs { font-weight: 700; }
.vdbx-cell { text-align: center; }
.vdbx { display: inline-flex; padding: 3px; border-radius: 6px; color: var(--link); }
.vdbx:hover, .vdbx:focus-visible { color: var(--link-hover); background: var(--accent-dim); }
@media (max-width: 1400px) { .vlist td, .vlist th.vth button { font-size: 0.8rem; padding-left: 6px; padding-right: 6px; } }
/* fixed column widths so every status group lines up */
.vlist { table-layout: fixed; min-width: 1080px; }
.vlist th.vc-date { width: 76px; } .vlist th.vc-client { width: 15%; } .vlist th.vc-address { width: 19%; }
.vlist th.vc-type { width: 11%; } .vlist th.vc-shooter { width: 10%; } .vlist th.vc-editor { width: 9%; }
.vlist th.vc-rush { width: 58px; } .vlist th.vc-order { width: 96px; } .vlist th.vc-status { width: 124px; }
.vlist th.vc-hours { width: 104px; } .vlist th.vc-dropbox { width: 76px; }
.vlist td { overflow: hidden; text-overflow: ellipsis; }
.vlist td.nowrap { white-space: nowrap; }

/* ---- Ops tab (beta). Theme tokens only; high contrast; no blue text. ---- */
:root, :root[data-theme="dark"] { --purple: #d2b0ff; --purple-bg: rgba(168, 115, 255, 0.18); }
:root[data-theme="light"] { --purple: #5b21b6; --purple-bg: rgba(109, 40, 217, 0.10); }
.beta-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase; background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); vertical-align: middle; }
.ops-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 12px; }
.ops-navbtn { font-size: 1.2rem; line-height: 1; padding: 4px 12px; }
.ops-date { display: flex; flex-direction: column; min-width: 150px; text-align: center; color: var(--text); }
.ops-nav input[type="date"] { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font: inherit; }
.ops-nav button[disabled] { opacity: 0.55; cursor: default; }
.ops-loading, .ops-err { padding: 18px; color: var(--text); }
.ops-err { color: var(--red); font-weight: 700; }
.stat-grid.ops-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ops-stats .stat-card .small { color: var(--text-muted); }
.ops-mix { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ops-wx { font-size: 1.35rem; }
.ops-compare { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 12px; margin: 14px 0; }
.ops-card { border: 1px solid var(--border); background: var(--bg-card); border-radius: 12px; padding: 12px 14px; color: var(--text); }
.ops-card h3, .ops-block h3 { margin: 0 0 4px; font-size: 1rem; color: var(--text); }
.ops-pair { display: flex; gap: 22px; margin: 8px 0 2px; }
.ops-delta { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; }
.ops-up { color: var(--green); } .ops-down { color: var(--red); } .ops-flat { color: var(--text-muted); }
.ops-legend { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-muted); }
.ops-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.ops-legend .sw.this, .ops-bar .b.this { background: var(--accent); }
.ops-legend .sw.last, .ops-bar .b.last { background: var(--text-dim); opacity: 0.55; }
.ops-bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin-top: 6px; }
.ops-bar { flex: 1; display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.ops-bar .pair { flex: 1; display: flex; align-items: flex-end; gap: 1px; }
.ops-bar .b { flex: 1; border-radius: 2px 2px 0 0; min-height: 0; }
.ops-bar .d { font-size: 10px; text-align: center; color: var(--text-muted); height: 13px; }
.ops-bar.today .d { color: var(--text); font-weight: 800; }
.ops-bar.today .pair { outline: 1px dashed var(--accent-border); }
.ops-block { margin: 16px 0; }
.ops-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.ops-table td { vertical-align: top; color: var(--text); }
.ops-table tbody tr { cursor: default; }
.ops-flag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 800; white-space: nowrap; }
.ops-flag-red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.ops-flag-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }
.ops-flag-new, .chip.ops-chip-new { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple); }
.ops-status { font-size: 0.74rem; font-weight: 700; color: var(--green); }
.ops-status-off { color: var(--red); }
.ops-row-off td { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-dim); }
.ops-row-off td .ops-status { text-decoration: none; }
.ops-count { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.ops-warn { color: var(--yellow); font-weight: 700; }
.ops-nowrap { white-space: nowrap; }
@media (max-width: 1100px) { .stat-grid.ops-stats { grid-template-columns: repeat(2, 1fr); } .ops-compare { grid-template-columns: 1fr; } }

/* Video: Order # -> Aryeo listing/order link. Entity-link colours (teal in light, sand in dark), never blue. */
a.vorder-link { color: var(--link); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; -webkit-user-drag: none; }
a.vorder-link:hover, a.vorder-link:focus-visible { color: var(--link-hover); background: var(--accent-dim); border-radius: 4px; text-decoration-thickness: 2px; }
a.vorder-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vtag a.vorder-link { font-weight: 700; }

/* ---- Fleet + Monthly & Annual tabs (beta; ported from Ops Pulse). Theme tokens only; high contrast; no blue text. ---- */
:root, :root[data-theme="dark"] { --fl-grey: #b4c0cf; --fl-grey-bg: rgba(148, 163, 184, 0.16); --mo-y1: #f2c48d; --mo-y2: #d2b0ff; }
:root[data-theme="light"] { --fl-grey: #475569; --fl-grey-bg: rgba(90, 104, 124, 0.12); --mo-y1: #9a5b13; --mo-y2: #5b21b6; }
.feed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.feed-head .flag-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-head #fleet-refetch, .feed-head #monthly-refetch { margin-left: auto; }
.feed-line { color: var(--text-muted); margin: 0 0 10px; }
.feed-line strong { color: var(--text); }
.feed-banner { border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 0.86rem; color: var(--text); line-height: 1.45; }
.feed-banner.warn { background: var(--red-bg); border: 1px solid var(--red); }
.feed-banner.snap { display: flex; gap: 12px; align-items: flex-start; background: var(--yellow-bg); border: 1px solid var(--yellow); }
.snap-tag { flex: none; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px;
  color: var(--yellow); border: 1px solid var(--yellow); background: var(--bg-elev); }
.snap-age { font-weight: 700; color: var(--yellow); }
.snap-age.old { color: var(--red); }
.feed-scroll { overflow-x: auto; max-width: 100%; }
.feed-scroll table { width: max-content; min-width: 100%; }
.chip.fl-stale, .fl-tag.stale, .fl-flag.stale { background: var(--purple-bg); color: var(--purple); }
.chip.fl-grey, .fl-tag.sold, .fl-flag.grey { background: var(--fl-grey-bg); color: var(--fl-grey); }
.fl-table th, .fl-table td { padding: 8px 10px; vertical-align: top; color: var(--text); }
.fl-table td.num, .fl-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-name { font-weight: 700; white-space: nowrap; }
.fl-sub { display: block; font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; }
.fl-sub.mono { font-family: var(--mono); font-size: 0.72rem; }
.fl-tag { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; margin-top: 3px; margin-right: 4px; }
.fl-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.fl-flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.fl-flag.red { background: var(--red-bg); color: var(--red); }
.fl-flag.yellow { background: var(--yellow-bg); color: var(--yellow); }
.fl-flag.green { background: var(--green-bg); color: var(--green); }
.fl-table tr.sold td { color: var(--text-muted); }
.fl-notes { display: block; font-size: 0.74rem; color: var(--text-muted); max-width: 240px; white-space: normal; margin-top: 3px; }
.fl-gapn { color: var(--text-dim); }
.fl-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 960px) { .fl-lower { grid-template-columns: 1fr; } }
.fl-box { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px; padding: 12px 16px; color: var(--text); }
.fl-list { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 0.86rem; display: flex; flex-direction: column; gap: 5px; }
.fl-list li { display: flex; gap: 8px; align-items: baseline; }
.fl-legend li { color: var(--text-muted); }
.fl-gaps { margin-top: 12px; font-size: 0.84rem; color: var(--text-muted); }
.fl-gaps summary { cursor: pointer; font-weight: 700; color: var(--text); }
.fl-gaps h4 { margin: 10px 0 4px; font-size: 0.84rem; color: var(--text); }
.fl-gaps ul { margin: 0; padding-left: 18px; }
.mo-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.mo-tab { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.mo-tab:hover { border-color: var(--accent); }
.mo-tab.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); font-weight: 800; }
.src-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.src-dot.aryeo { background: var(--accent); }
.src-dot.sheet { background: var(--text-dim); }
.src-tag { display: inline-block; font-size: 0.66rem; font-weight: 800; padding: 1px 6px; border-radius: 5px; vertical-align: middle; letter-spacing: 0.02em; }
.src-tag.aryeo { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.src-tag.sheet { background: var(--chip-bg); color: var(--text-muted); border: 1px solid var(--border); }
.src-mini { display: inline-block; min-width: 15px; text-align: center; font-size: 0.6rem; font-weight: 800; line-height: 14px; border-radius: 4px; margin-right: 5px; vertical-align: 1px; }
.src-mini.aryeo { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.src-mini.sheet { background: var(--chip-bg); color: var(--text-muted); border: 1px solid var(--border); }
.mo-meta, .mo-srckey { margin: 0 0 10px; color: var(--text-muted); }
.mo-ytd { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 960px) { .mo-ytd { grid-template-columns: 1fr; } }
.mo-ytd-note { margin: 0 0 12px; }
.mo-card { display: flex; flex-direction: column; gap: 8px; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; color: var(--text); }
.mo-pair { display: flex; gap: 24px; }
.mo-pair > div { display: flex; flex-direction: column; gap: 2px; }
.mo-table th, .mo-table td { padding: 8px 12px; color: var(--text); }
.mo-table th.num, .mo-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mo-table td.cur-year { background: var(--accent-dim); font-weight: 700; }
.mo-table td.chk, .mo-table th.chk { color: var(--text-muted); border-left: 1px dashed var(--border); }
.mo-table td.chk.warn { color: var(--yellow); font-weight: 700; }
.mo-table td.chk.ok { color: var(--green); }
.mo-table .mo-month { font-weight: 700; }
.mo-table tr.mo-total td { font-weight: 800; border-top: 2px solid var(--border); background: var(--th-bg); }
.mo-yoy { display: block; font-size: 0.72rem; font-weight: 700; }
.mo-yoy.up { color: var(--green); } .mo-yoy.down { color: var(--red); } .mo-yoy.flat { color: var(--text-muted); }
.mo-mtd { font-size: 0.64rem; font-weight: 800; color: var(--yellow); background: var(--yellow-bg); padding: 1px 5px; border-radius: 5px; }
.mo-proj { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.mo-note { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.mo-chart { margin: 14px 0 6px; }
.mo-svg { width: 100%; height: auto; max-height: 300px; }
.mo-svg .mo-grid { stroke: var(--border-soft); stroke-width: 1; }
.mo-svg .mo-axis { fill: var(--text-muted); font: 600 10px var(--sans); }
.mo-svg .mo-line { fill: none; stroke-width: 2; stroke: var(--text-dim); opacity: 0.4; }
.mo-svg .mo-line.dot { fill: var(--text-dim); stroke: none; }
.mo-svg .mo-line.y0 { stroke: var(--accent); opacity: 1; stroke-width: 2.6; }
.mo-svg .mo-line.y0.dot { fill: var(--accent); }
.mo-svg .mo-line.y1 { stroke: var(--mo-y1); opacity: 0.95; }
.mo-svg .mo-line.y1.dot { fill: var(--mo-y1); }
.mo-svg .mo-line.y2 { stroke: var(--mo-y2); opacity: 0.8; }
.mo-svg .mo-line.y2.dot { fill: var(--mo-y2); }
.mo-svg .mo-line.proj { stroke-dasharray: 4 3; fill: none; }
.mo-svg .mo-line.dot.hollow { fill: var(--bg-card); stroke: var(--accent); stroke-width: 2; }

/* ---- Team & Payroll tab (beta; ported from Ops Pulse's Team & Payroll). Theme tokens only; high contrast; no blue text. ---- */
.tp-badge { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); vertical-align: middle; margin-left: 4px; }
.tp-toolbar { justify-content: space-between; }
.tp-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.tp-allf { display: inline-flex; align-items: center; gap: 5px; color: var(--text); cursor: pointer; }
.tp-lock { margin: 10px 0 4px; }
.tp-lock-card { border: 1px dashed var(--accent-border); border-radius: 12px; padding: 18px 20px; background: var(--bg-card); max-width: 680px; color: var(--text); }
.tp-lock-card p { margin: 6px 0 12px; color: var(--text-muted); line-height: 1.45; }
.tp-lock-card form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tp-lock-card input { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); min-width: 240px; }
.tp-lock-card input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tp-lock-msg { color: var(--red); font-weight: 700; font-size: 0.86rem; }
.tp-pw-wrap { position: relative; display: inline-flex; align-items: center; }
.tp-lock-card .tp-pw-wrap input { padding-right: 44px; }
.tp-pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); cursor: pointer; }
.tp-pw-eye:hover { background: var(--bg-card); border-color: var(--border); }
.tp-pw-eye:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.tp-pw-eye[aria-pressed="true"] { background: var(--bg-card); border-color: var(--text); }
.tp-pw-eye:disabled { opacity: 0.45; cursor: not-allowed; }
.tp-pw-eye .tp-eye-shut, .tp-pw-eye[aria-pressed="true"] .tp-eye-open { display: none; }
.tp-pw-eye[aria-pressed="true"] .tp-eye-shut { display: block; }
.tp-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.tp-cards .mo-card { gap: 4px; }
.tp-cards .stat-num { font-size: 1.45rem; font-weight: 800; color: var(--text); }
.tp-sub { color: var(--text-muted); font-size: 0.8rem; line-height: 1.35; }
.tp-h3 { font-size: 0.98rem; font-weight: 700; margin: 18px 0 8px; color: var(--text); }
.tp-win { color: var(--text-muted); font-weight: 500; font-size: 0.85rem; margin-left: 6px; }
.tp-win button { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 0.82rem; cursor: pointer; margin-left: 4px; }
.tp-win button:hover { border-color: var(--accent); }
.tp-win button.on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); font-weight: 800; }
.tp-foot { color: var(--text-muted); line-height: 1.45; }
.tp-foot strong, .tp-foot p strong { color: var(--text); }
.tp-table { font-size: 0.84rem; }
.tp-table th, .tp-table td { padding: 7px 9px; color: var(--text); }
.tp-table th { white-space: nowrap; vertical-align: bottom; }
.tp-table td { vertical-align: top; }
.tp-table td.num, .tp-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-table td:first-child { min-width: 150px; }
.tp-table tr.tp-pending td { color: var(--text-muted); font-style: italic; }
.tp-table td.tp-pendnote { text-align: left; white-space: normal; }
.tp-table tr.tp-sum td { font-weight: 700; background: var(--th-bg); }
.tp-table tr.tp-sum + tr.tp-sum td, .tp-table tr:not(.tp-sum) + tr.tp-sum td { border-top: 2px solid var(--border); }
.tp-table th.tp-extra { border-left: 1px dashed var(--border); }
.tp-new { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; padding: 0 5px; border-radius: 5px; color: var(--yellow); border: 1px solid var(--yellow); background: var(--yellow-bg); }
.tp-up { color: var(--red); } .tp-down { color: var(--green); } .tp-flat { color: var(--text-muted); }
.tp-dim { color: var(--text-muted); font-size: 0.76rem; display: block; font-weight: 500; }
.tp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tp-kv { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.chip.green { background: var(--green-bg); color: var(--green); }
.tp-sublabel { display: block; margin-top: 10px; }
.tp-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 0.86rem; }
.tp-list li { padding: 4px 0; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; gap: 10px; color: var(--text); }
.tp-list li:last-child { border-bottom: 0; }
.tp-muted { color: var(--text-muted); }
#view-payroll.tp-blur .tp-money { filter: blur(7px); user-select: none; }
.tp-profit { margin-top: 16px; }
.tp-profit .tp-h3 { margin-top: 0; }
.tp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 10px; font-size: 0.8rem; }
.pf-pill, .pf-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
.pf-pill.green, .pf-badge.green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.pf-pill.yellow, .pf-badge.yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow); }
.pf-pill.red, .pf-badge.red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
.pf-pill.grey, .pf-badge.grey { background: var(--fl-grey-bg); color: var(--fl-grey); border: 1px solid var(--border); }
.pf-pill.grey { white-space: normal; }
.pf-badge { font-size: 0.86rem; min-width: 60px; text-align: center; }
.tp-table tr.pf-green td:first-child { box-shadow: inset 4px 0 0 var(--green); }
.tp-table tr.pf-yellow td:first-child { box-shadow: inset 4px 0 0 var(--yellow); }
.tp-table tr.pf-red td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.tp-table tr.pf-grey td { color: var(--text-muted); }
.tp-table tr.pf-term td { opacity: 0.7; }
.pf-warn { color: var(--yellow); cursor: help; font-size: 0.8rem; font-weight: 800; }
@media (max-width: 1000px) { .tp-cards { grid-template-columns: 1fr 1fr; } .tp-grid { grid-template-columns: 1fr; } }
/* Team & Payroll: tighter wide tables (headers and sub-lines wrap; the main figure never wraps); scroll sideways when wider. */
.tp-table th, .tp-table th.num { white-space: normal; min-width: 62px; line-height: 1.25; letter-spacing: 0.03em; }
.tp-table th .tp-dim { text-transform: none; letter-spacing: 0; font-size: 0.7rem; }
.tp-table td.num { white-space: normal; min-width: 70px; }
.tp-table td.num .tp-money, .tp-table td.num .tp-num, .tp-table td.num strong { white-space: nowrap; }
.tp-table td.num .tp-dim { white-space: normal; }
.tp-table td:first-child { max-width: 220px; }
#view-payroll .fl-box { font-size: 0.88rem; }
#view-payroll .tp-kv .tp-muted { font-size: 0.84rem; }

/* ---- Video > Time log > Efficiency (beta; copy of Ops Pulse Edit Efficiency). Theme tokens only, high contrast. ---- */
.ee-block { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); padding: 12px 14px; margin: 8px 0 16px; color: var(--text); }
.ee-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ee-head h3 { margin: 0; }
.ee-block h4 { margin: 14px 0 6px; font-size: 0.92rem; color: var(--text); }
.ee-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ee-tabs { display: inline-flex; gap: 4px; }
.ee-tab { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 3px 12px; font: inherit; font-size: 0.84rem; cursor: pointer; }
.ee-tab:hover { border-color: var(--text-muted); }
.ee-tab.on { background: var(--text); color: var(--bg-elev); border-color: var(--text); font-weight: 800; }
.ee-tab:focus-visible, #ee-refetch:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.ee-note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--yellow); background: var(--yellow-bg); color: var(--text); font-size: 0.86rem; line-height: 1.4; }
.ee-note.ee-bad { border-color: var(--red); background: var(--red-bg); }
.ee-meta { color: var(--text-muted); margin: 6px 0; }
.ee-table td.num, .ee-table th.num { text-align: right; white-space: nowrap; }
.ee-empty td { color: var(--text-muted); }
.ee-na { color: var(--text-muted); font-style: italic; }
.ee-money { font-weight: 700; color: var(--text); }
.ee-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 800; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); white-space: nowrap; }
.ee-pill.green { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.ee-pill.red { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.ee-pill.grey { background: var(--bg-elev); color: var(--text-muted); border-color: var(--text-dim); }
.ee-pill.ok { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.ee-jobs summary { cursor: pointer; margin: 10px 0 6px; font-weight: 700; }

/* ==== App shell: slim top bar + persistent left sidebar + breadcrumbs (navigation redesign, Sep 2026) ====
   High contrast on purpose: navigation text is always --text (never a coloured link tint); the accent only marks the
   active page (left bar + tint) and the active section icon. */
:root { --sb-w: 252px; --sb-w-collapsed: 64px; --topbar-h: 56px; }
.app { padding: 0; }
.topbar {
  position: sticky; top: 0; z-index: 60; min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 8px 16px;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; }
.topbar .brand:hover, .topbar .brand:focus-visible { color: var(--text); text-decoration: none; }
.topbar .logo-mark { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.topbar .logo-mark::after { inset: 7px 6px 10px; }
.brand-name { font-size: 1.05rem; letter-spacing: -0.01em; white-space: nowrap; }
.topbar .global-search { flex: 1 1 320px; max-width: 560px; margin: 0; }
.topbar .global-search input { max-width: none; padding: 7px 12px; }
.topbar .gs-res { top: 40px; }
.topbar .header-meta { margin-left: auto; gap: 12px; flex-wrap: nowrap; }
.sync-chip, .who-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync-chip .value, .who-chip .value { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); flex: none; }
.sync-dot.ok { background: var(--green); }
.sync-dot.bad { background: var(--red); }
.sync-dot.warn { background: var(--yellow); }
.nav-burger { display: none; padding: 5px 7px; }
.nav-burger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.shell-body { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  background: var(--bg-elev); border-right: 1px solid var(--border); padding: 10px 8px 28px;
}
.content { min-width: 0; padding: 14px 22px 40px; }
.content > .section:first-of-type { margin-top: 0; }

.sb-toggle, .sb-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px;
  background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.sb-toggle { border: 1px solid var(--border); font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.sb-toggle:hover, .sb-head:hover { background: var(--chip-bg); }
.sb-toggle:focus-visible, .sb-head:focus-visible, .sb-item:focus-visible, .crumb:focus-visible, .page-tabs a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.sb-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-head { font-weight: 700; font-size: 0.92rem; margin-top: 2px; }
.sb-label { flex: 1; min-width: 0; }
.sb-caret::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s;
}
.sb-sec.open > .sb-head .sb-caret::before { transform: rotate(45deg); }
.sb-sec.active > .sb-head .sb-icon { color: var(--accent); }
.sb-sec.active > .sb-head { background: var(--chip-bg); }
.sb-items { list-style: none; margin: 2px 0 8px; padding: 0 0 0 26px; display: none; }
.sb-sec.open > .sb-items { display: block; }
.sb-fly-title { display: none; }
.sb-item {
  display: block; margin: 1px 0; padding: 7px 10px 7px 12px; border-radius: 7px; border-left: 3px solid transparent;
  color: var(--text); font-weight: 500; font-size: 0.9rem; line-height: 1.25;
}
.sb-item:hover, .sb-item:focus-visible { background: var(--chip-bg); color: var(--text); text-decoration: none; }
.sb-item.active { background: var(--accent-dim); border-left-color: var(--accent); color: var(--text); font-weight: 700; }

@media (min-width: 901px) {
  body.sb-collapsed .shell-body { grid-template-columns: var(--sb-w-collapsed) minmax(0, 1fr); }
  body.sb-collapsed .sb-label, body.sb-collapsed .sb-caret { display: none; }
  body.sb-collapsed .sb-head, body.sb-collapsed .sb-toggle { justify-content: center; padding: 10px 0; }
  body.sb-collapsed .sb-toggle .sb-icon { transform: rotate(180deg); }
  body.sb-collapsed .sb-items { display: none !important; }
  body.sb-collapsed .sb-sec.active > .sb-head { background: var(--accent-dim); box-shadow: inset 3px 0 0 var(--accent); }
  body.sb-collapsed .sb-sec.flyout > .sb-items {
    display: block !important; position: fixed; z-index: 80; min-width: 240px; margin: 0; padding: 6px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  }
  body.sb-collapsed .sb-sec.flyout .sb-fly-title {
    display: block; padding: 6px 10px 4px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
  }
}
@media (max-width: 1280px) { .sync-chip .label, .who-chip .label { display: none; } }
@media (max-width: 900px) {
  .shell-body { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: min(300px, 86vw); z-index: 90;
    transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); padding-top: 14px;
  }
  body.sb-drawer-open .sidebar { transform: none; }
  .sb-toggle { display: none; }
  .nav-burger { display: inline-flex; }
  .sb-backdrop { position: fixed; inset: 0; z-index: 85; background: var(--backdrop); }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .topbar .global-search { order: 5; flex: 1 1 100%; max-width: none; }
  .topbar .header-meta { gap: 8px; }
  .who-chip .value { font-weight: 500; }
  .content { padding: 10px 10px 32px; }
}

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; min-height: 22px; font-size: 0.9rem; }
.crumb { color: var(--text-muted); font-weight: 600; }
a.crumb { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-dim); text-underline-offset: 3px; }
a.crumb:hover { color: var(--text); text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.crumb.current { color: var(--text); font-weight: 700; }
.crumb-sep { color: var(--text-dim); }
.page-tabs { margin: 0 0 10px; }
.page-tabs a.subtab { display: inline-block; color: var(--text-muted); font-weight: 600; text-decoration: none; }
.page-tabs a.subtab:hover { color: var(--text); }
.page-tabs a.subtab.active { color: var(--text); font-weight: 700; }

/* Phase 1: Aryeo sync health (Administration > Integrations & Sync) */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* Production foundation (admin preview) */
.prod-preview { background: var(--yellow-bg); color: var(--text); border: 1px solid var(--yellow); border-radius: 8px; padding: 8px 12px; margin: 6px 0 12px; font-size: 0.88rem; }
.prod-preview strong { color: var(--text); }
tr.muted td { color: var(--text-muted); }

/* Photo Turnover daily view (preview). High contrast; names/addresses use --text (no accent-coloured names). */
.pt-range { display: inline-flex; gap: 6px; align-items: center; margin-left: 10px; color: var(--text); }
.pt-order { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 8px 0; color: var(--text); }
.pt-order.pt-done { border-left: 4px solid var(--green); }
.pt-order.pt-is-upcoming { border-style: dashed; }
.pt-order-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.pt-order-meta { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.pt-addr strong { color: var(--text); font-size: 1rem; }
.pt-item { border-top: 1px solid var(--border-soft); padding: 6px 0 4px; }
.pt-item-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pt-item-main strong { color: var(--text); }
.pt-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.pt-st { font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--text); }
.pt-st-new { background: var(--bg-elev); }
.pt-st-edit { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow); }
.pt-st-done { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.pt-st-hold { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.pt-tag { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); color: var(--text); background: var(--bg-elev); }
.pt-tag-roll { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow); }
.pt-tag-over { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.pt-tag-up { background: var(--bg-elev); color: var(--text-muted); }
.pt-flag { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); border: 1px dashed var(--border); padding: 1px 6px; border-radius: 4px; }
.pt-check { color: var(--green); font-weight: 800; }
.pt-aryeo { font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-muted); }
.pt-aryeo-yes { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.pt-evidence { font-size: 0.84rem; color: var(--text-muted); margin: 4px 0 2px 2px; }
.pt-evidence.pt-ev-found { color: var(--text); font-weight: 600; }
.pt-c-done .stat-num { color: var(--green); }

/* ---- Ask Pulse (read-only Q&A drawer + admin pages). Theme tokens only: works in light and dark; names/links use
   --link (sand in dark, dark teal in light) for high contrast. ---- */
.ask-btn { display: inline-flex; align-items: center; gap: 6px; border-color: var(--accent-border); color: var(--text); font-weight: 700; }
.ask-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ask-btn[aria-expanded="true"] { background: var(--accent-dim); border-color: var(--accent); }
.ask-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 96; background: var(--bg-card); color: var(--text);
  border-left: 1px solid var(--border); box-shadow: -12px 0 30px rgba(0, 0, 0, .28); display: flex; flex-direction: column; padding: 14px 16px 12px; gap: 10px; }
.ask-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--border-soft); padding-bottom: 10px; }
.ask-head h3 { margin: 0 0 4px; font-size: 1.15rem; color: var(--text); }
.ask-head-btns { display: flex; gap: 6px; flex-shrink: 0; }
.ask-head-btns a.btn-ghost { color: var(--text); }
.ask-ro { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; vertical-align: middle;
  color: var(--green); background: var(--green-bg); border: 1px solid var(--green); }
.ask-chat { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.ask-chat.ask-full { height: calc(100vh - 250px); min-height: 420px; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px; }
.ask-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; min-height: 0; }
.ask-msg { display: flex; flex-direction: column; max-width: 100%; }
.ask-user { align-items: flex-end; }
.ask-bubble { padding: 9px 12px; border-radius: 12px; line-height: 1.5; font-size: .93rem; color: var(--text); overflow-wrap: anywhere; }
.ask-user .ask-bubble { background: var(--accent-dim); border: 1px solid var(--accent-border); max-width: 88%; white-space: pre-wrap; font-weight: 600; }
.ask-bot .ask-bubble { background: var(--bg-elev); border: 1px solid var(--border); width: 100%; }
.ask-bot.ask-notice .ask-bubble { background: var(--yellow-bg); border-color: var(--yellow); }
.ask-bubble p { margin: 0 0 8px; } .ask-bubble p:last-child { margin-bottom: 0; }
.ask-bubble ul, .ask-bubble ol { margin: 4px 0 8px; padding-left: 20px; } .ask-bubble li { margin: 2px 0; }
.ask-bubble h4 { margin: 6px 0 4px; font-size: .95rem; }
.ask-bubble code { font-family: var(--mono); font-size: .85em; background: var(--chip-bg); padding: 0 4px; border-radius: 4px; }
.ask-bubble strong { color: var(--text); font-weight: 700; }
a.ask-link { color: var(--link); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a.ask-link:hover, a.ask-link:focus-visible { color: var(--link-hover); background: var(--accent-dim); border-radius: 3px; }
.ask-table { margin: 6px 0; } .ask-table .clients-table { font-size: .84rem; } .ask-table th, .ask-table td { padding: 5px 8px; }
.ask-meta { font-size: .72rem; color: var(--text-muted); margin-top: 3px; font-family: var(--mono); }
.ask-thinking { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.ask-dots { display: inline-flex; gap: 3px; } .ask-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: askdot 1s infinite ease-in-out; }
.ask-dots i:nth-child(2) { animation-delay: .15s; } .ask-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes askdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ask-empty { color: var(--text); font-size: .92rem; } .ask-empty p { margin: 4px 0 10px; }
.ask-examples { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ask-examples .chip { text-align: left; font-size: .85rem; padding: 5px 12px; color: var(--text); border-color: var(--border); }
.ask-examples .chip:hover { border-color: var(--accent); background: var(--accent-dim); }
.ask-form { display: flex; gap: 8px; align-items: flex-end; }
.ask-input { flex: 1; resize: vertical; min-height: 44px; max-height: 180px; font: inherit; font-size: .93rem; color: var(--text); background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.ask-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ask-foot { color: var(--text-muted); }
.ask-off { color: var(--text); background: var(--yellow-bg); border: 1px solid var(--yellow); border-radius: 8px; padding: 6px 10px; }
.ask-page-tools { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 6px 0 10px; }
.ask-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 16px; align-items: end; margin-bottom: 8px; }
.ask-settings label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--text); }
.ask-settings label.ask-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.ask-settings input[type="number"], .ask-settings input[type="text"], .ask-settings select { font: inherit; color: var(--text); background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.ask-capbar { height: 8px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--border-soft); overflow: hidden; margin: 4px 0 14px; }
.ask-capbar span { display: block; height: 100%; background: var(--accent); }
.ask-history { display: flex; flex-direction: column; gap: 8px; }
.ask-hrow { border: 1px solid var(--border-soft); border-radius: 10px; padding: 8px 12px; background: var(--bg-elev); }
.ask-hq { font-weight: 700; color: var(--text); white-space: pre-wrap; }
.ask-ha { color: var(--text); } .ask-ha p { margin: 2px 0 6px; }
@media (max-width: 900px) { .ask-btn span { display: none; } .ask-drawer { width: 100vw; } }

/* ---- Editing Time (Operations › Editing Time, preview). High-contrast theme tokens only. ---- */
.et-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 4px 0 12px; }
.et-controls input[type="text"], .et-controls input:not([type]) { min-width: 260px; }
.et-toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--text); font-weight: 600; }
.et-table td.num, .et-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.et-path { color: var(--text-muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.et-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.et-card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; color: var(--text); }
.et-note { font-size: 12px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 4px; padding: 1px 6px; display: inline-block; }
.et-health { margin-top: 16px; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg-elev); color: var(--text); }
.et-field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; color: var(--text); font-weight: 600; }
.et-empty { padding: 16px; color: var(--text); border: 1px dashed var(--border); border-radius: 10px; }
.et-why { max-width: 420px; }
.clients-table.et-table { width: 100%; }
.clients-table.et-table td { white-space: normal; vertical-align: top; }
.clients-table.et-table td.num, .clients-table.et-table th.num { white-space: nowrap; }
.clients-table.et-table tbody tr { cursor: default; }
.et-table .et-note { max-width: 240px; }
.et-table a.vorder-link { white-space: nowrap; }

/* ---- Sortable table headers (static/tablesort.js, window.PulseSort; 29 Sep 2026). Theme text colour only (high contrast, no accent colour):
   the header is a real <button> (keyboard + screen reader), the active column is bold with ▲ / ▼, others show a faint ↕. */
th.ps-th { padding: 0 !important; }
th.ps-th .ps-btn { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 7px 9px; cursor: pointer; color: var(--text); font: inherit; text-align: inherit; line-height: inherit; letter-spacing: inherit; text-transform: inherit; }
th.ps-th.num .ps-btn { text-align: right; }
th.ps-th .ps-btn:hover { background: var(--bg-elev); }
th.ps-th .ps-btn:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
th.ps-th .ps-arrow { display: inline-block; margin-left: 4px; font-size: 0.72rem; color: var(--text-muted); opacity: 0.7; }
th.ps-th.ps-on { background: var(--bg-elev); box-shadow: inset 0 -2px 0 var(--text); }
th.ps-th.ps-on .ps-btn { font-weight: 800; }
th.ps-th.ps-on .ps-arrow { color: var(--text); opacity: 1; font-size: 0.8rem; }

/* ---- Photographer profitability: note under the table (rows not shown = non-field staff, Pulse's counts). Theme text
   colour, underlined link in the same colour (high contrast, no accent colour). */
.pf-hidden-note { margin: 8px 0 4px; color: var(--text); line-height: 1.5; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pf-hidden-note strong { color: var(--text); font-weight: 800; }
.pf-hidden-note a.pf-hidden-edit { color: var(--text); text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }
.pf-hidden-note a.pf-hidden-edit:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.pf-hidden-note .pf-ops-ex { color: var(--text); }
.tp-legend .pf-band-set { color: var(--text); }
.tp-legend a.pf-band-edit { color: var(--text); text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }
.tp-legend a.pf-band-edit:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* Coldwell Banker package credit (BUSINESS_RULES TP4): toggle + summary above the table; adjusted figures in the text colour */
.pf-cw { margin: 6px 0; color: var(--text); line-height: 1.5; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.pf-cw strong { color: var(--text); font-weight: 800; }
.pf-cw-toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--text); }
.pf-cw-toggle input { width: 16px; height: 16px; accent-color: var(--text); }
.pf-cw-toggle input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.tp-table .pf-cw-h { color: var(--text); font-weight: 600; }
.tp-table .pf-adj { color: inherit; }

/* Team & Payroll view mode (team = no pay, shareable | pay) + Team efficiency table. High contrast text in var(--text). */
.tp-mode { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-right: 10px; }
.tp-mode button { background: var(--bg-elev); color: var(--text); border: 0; border-right: 1px solid var(--border); padding: 5px 12px; font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.tp-mode button:last-child { border-right: 0; }
.tp-mode button:hover { background: var(--fl-grey-bg); }
.tp-mode button.on { background: var(--text); color: var(--bg); font-weight: 800; }
.tp-mode button:focus-visible { outline: 2px solid var(--text); outline-offset: -3px; }
.tp-mode-sub { font-size: 0.72rem; font-weight: 700; opacity: 0.9; margin-left: 2px; }
.te-card .tp-foot, .te-card .tp-foot strong { color: var(--text); }
.te-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 0.86rem; min-width: 52px; text-align: center; color: var(--text); border: 1px solid var(--border); background: var(--bg-elev); }
.te-badge.top { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.te-badge.low { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow); }
.te-row.te-grey td { color: var(--text); }
.te-badge.neutral { background: var(--bg-elev); color: var(--text); border-color: var(--text); }
.te-group { margin-top: 14px; }
.te-group-h { margin: 6px 0; font-size: 1rem; font-weight: 800; color: var(--text); }
.te-group-sub { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-left: 6px; }

/* Payroll: Missing Punches (static/punches.js). High contrast: theme text tokens only. */
.mp-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 4px 0 14px; }
.mp-controls label { display: flex; flex-direction: column; gap: 4px; color: var(--text); font-size: 13px; font-weight: 600; }
.mp-controls label.mp-toggle { flex-direction: row; align-items: center; font-weight: 500; }
.mp-controls select { min-width: 180px; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.mp-csv { margin-left: auto; }
a.btn-primary.mp-csv { color: var(--text); }
.mp-sub { color: var(--text); opacity: 0.82; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.mp-table td, .mp-table th { color: var(--text); vertical-align: top; }
.mp-rows td, .mp-rows th { white-space: normal; }
.mp-rows td:nth-child(1) { min-width: 100px; }
.mp-rows td, .mp-rows th { padding-left: 8px; padding-right: 8px; }
.mp-reply { font-style: italic; color: var(--text); }
.mp-notes { max-width: 220px; white-space: normal; color: var(--text); }
.mp-notes summary { cursor: pointer; font-weight: 600; color: var(--text); }
.mp-health { margin-top: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); line-height: 1.8; }
.mp-err { color: var(--red); font-weight: 600; }
