/* TSG Operations Control — Command Center design system.
   Construction operations + executive command center + modern software.
   Every color used anywhere in this file traces back to a token below —
   change the palette here, not per-component, per the Owner's design
   directive (redesign milestone, 2026-08-26). */

:root {
  /* ---- Brand palette ---- */
  --navy-900: #101826;
  --navy-800: #16213a;
  --navy-700: #1c2b4a;
  --navy-600: #24365c;
  --steel-500: #5b6a80;
  --steel-300: #94a2b8;
  --steel-100: #e4e8ee;
  --gold-500: #c8952f;
  --gold-400: #dba94a;
  --gold-100: #f7ecd6;

  /* ---- Surfaces ---- */
  --bg: #f2f1ec;
  --surface: #ffffff;
  --surface-sunken: #f7f6f1;
  --panel: var(--surface);
  --panel-border: #e2ded4;
  --border-strong: #d3cebf;

  /* ---- Text ---- */
  --text: #1b2230;
  --text-muted: #626b7a;
  --text-faint: #8991a0;
  --heading: var(--navy-900);
  --on-dark: #eef1f6;
  --on-dark-muted: #9aa7bd;

  /* ---- Accent (interactive) ---- */
  --accent: var(--navy-700);
  --accent-strong: var(--navy-800);
  --accent-soft: #eaeefb;
  --gold: var(--gold-500);
  --gold-soft: var(--gold-100);

  /* ---- Status system (used everywhere — Today, Tasks, Projects,
     Messages, Reports. See doc comment above: change here only.) ---- */
  --status-blue-bg: #e2ecfc; --status-blue-text: #1c4fa3; --status-blue-solid: #2f63c2;
  --status-green-bg: #e1f4e6; --status-green-text: #1b7a3d; --status-green-solid: #2c9752;
  --status-amber-bg: #fdf1d6; --status-amber-text: #8a5a00; --status-amber-solid: #c98a1c;
  --status-orange-bg: #fbe6d8; --status-orange-text: #a3480f; --status-orange-solid: #d5691f;
  --status-red-bg: #fbe2e0; --status-red-text: #a3271b; --status-red-solid: #cc3624;
  --status-purple-bg: #ece5f9; --status-purple-text: #5b3aa3; --status-purple-solid: #7c53c9;
  --status-neutral-bg: #eceef1; --status-neutral-text: #4d5563; --status-neutral-solid: #6b7484;

  --shadow-sm: 0 1px 2px rgba(16, 24, 38, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 24, 38, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 38, 0.16);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --sidebar-w: 248px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.5;
}

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

svg.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* =================================================================
   APP SHELL — sidebar + top command bar + main column
   ================================================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

/* ---------- Sidebar ---------- */

.app-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800) 60%);
  color: var(--on-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem; letter-spacing: -0.02em;
  flex: 0 0 auto;
}
.sidebar-brand-text { min-width: 0; }
.sidebar-brand-title { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; line-height: 1.2; }
.sidebar-brand-subtitle { font-size: 0.72rem; color: var(--on-dark-muted); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 14px 10px 20px; }
.sidebar-group { margin-bottom: 18px; }
.sidebar-group-pinned {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-link-home {
  font-size: 0.98rem;
  border: 1px solid rgba(219,169,74,0.35);
}
.sidebar-link-home:not(.active) { color: var(--gold-400); }
.sidebar-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
  padding: 0 12px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--on-dark);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); text-decoration: none; }
.sidebar-link.active { background: rgba(219,169,74,0.16); color: var(--gold-400); }
.sidebar-link.active svg.icon { stroke: var(--gold-400); }
.sidebar-link svg.icon { opacity: 0.9; }

.sidebar-foot {
  padding: 12px 20px 18px;
  font-size: 0.72rem;
  color: var(--on-dark-muted);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-close-btn, .sidebar-toggle-btn { display: none; }

/* ---------- Top command bar ---------- */

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

.app-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--panel-border);
  padding: 0 24px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--heading); white-space: nowrap; }
.topbar-date { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  min-width: 220px;
}
.topbar-search input {
  border: none; background: transparent; outline: none;
  font-size: 0.88rem; font-family: inherit; color: var(--text); width: 100%;
}
.topbar-search svg.icon { color: var(--text-faint); }

.topbar-quick-create {
  display: flex; align-items: center; gap: 6px;
  background: var(--gold); color: var(--navy-900);
  border: none; border-radius: var(--radius-sm);
  padding: 8px 14px; font-weight: 700; font-size: 0.85rem; cursor: pointer;
  white-space: nowrap;
}
.topbar-quick-create:hover { background: var(--gold-400); }
.topbar-quick-create-menu { position: relative; }
.topbar-quick-create-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px; z-index: 20;
  background: var(--surface, #fff); border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  min-width: 140px; display: flex; flex-direction: column; padding: 4px;
}
.topbar-quick-create-dropdown[hidden] { display: none; }
.topbar-quick-create-dropdown a {
  padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none;
  color: var(--heading, #1a1a1a); font-size: 0.88rem; font-weight: 600;
}
.topbar-quick-create-dropdown a:hover { background: var(--surface-sunken); }

/* Weekly Sunday-Saturday company calendar (calendar.html only). */
.cal-week-nav {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0;
}
.cal-week-range { font-weight: 700; margin-left: 8px; }
.cal-week-grid {
  display: grid; grid-template-columns: repeat(7, minmax(128px, 1fr));
  gap: 6px; min-width: 924px;
}
.cal-week-day {
  border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  background: var(--surface, #fff); min-height: 220px; display: flex; flex-direction: column;
}
.cal-week-day-today { border-color: var(--gold); border-width: 2px; }
.cal-week-day-header {
  padding: 8px; border-bottom: 1px solid var(--panel-border); text-align: center;
  background: var(--surface-sunken);
}
.cal-week-day-name { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.cal-week-day-date { font-size: 0.95rem; font-weight: 700; }
.cal-week-day-body { padding: 6px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cal-week-day-empty { color: var(--text-muted); font-size: 0.8rem; text-align: center; margin-top: 12px; }
.cal-week-event {
  border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: 0.78rem; background: var(--surface-sunken);
}
.cal-week-event:hover { background: var(--gold-100, #fff3d6); }
.cal-week-event-time { font-weight: 700; }
.cal-week-event-title { font-weight: 600; }
.cal-week-event-project { color: var(--text-muted); font-size: 0.72rem; }

.topbar-viewer-mount { min-width: 0; }
.topbar-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--heading); padding: 6px;
}
.topbar-hamburger svg { width: 22px; height: 22px; }

.sidebar-backdrop { display: none; }

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

main.app-main {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  padding: 22px 24px 60px;
}

footer.app-footer {
  max-width: 1320px;
  padding: 10px 24px 40px;
  color: var(--text-faint);
  font-size: 0.78rem;
}

/* =================================================================
   PAGE HEADER / PANELS (base "card" primitive — reused everywhere)
   ================================================================= */

.page-header { margin-bottom: 18px; }
.page-header h1 { margin: 0 0 4px; font-size: 1.5rem; color: var(--heading); letter-spacing: -0.01em; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 0.92rem; max-width: 780px; }

section.panel {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 20px;
}

section.panel h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

section.panel h2 .count {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.88rem;
}

.panel-note {
  color: var(--text-muted);
  font-size: 0.87rem;
  margin: -6px 0 14px;
}

/* ---------- Permits page — per-authority section dividers ---------- */

section.panel.permit-section-title {
  background: var(--surface-sunken);
  border-left: 4px solid var(--accent);
  padding: 14px 22px;
  margin-bottom: 4px;
}
section.panel.permit-section-title h2 { margin-bottom: 4px; }
section.panel.permit-section-title .panel-note { margin: 0; }

/* ---------- Permits page — property panels & per-permit inspections/fees ---------- */

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-header-row h2 { margin: 0; }

.jaxepics-detail h3 {
  margin: 22px 0 10px;
  font-size: 1rem;
}
.jaxepics-detail h3:first-child { margin-top: 0; }

.hold-box {
  background: var(--status-amber-bg);
  border-left: 4px solid var(--status-amber-solid);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.hold-box .hold-title { font-weight: 700; color: var(--status-amber-text); }
.hold-box .hold-meta { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0 6px; }
.hold-box .hold-reason { font-size: 0.88rem; }

.required-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; padding: 0; list-style: none; }
.required-item {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--status-neutral-bg);
  color: var(--status-neutral-text);
}
.required-item.done { background: var(--status-green-bg); color: var(--status-green-text); }

.inspection-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 4px 0 0;
  max-width: 46ch;
}

/* ---------- Tables ---------- */

table.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data-table th {
  text-align: left;
  background: var(--surface-sunken);
  border-bottom: 2px solid var(--panel-border);
  padding: 9px 10px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data-table td { padding: 11px 10px; border-bottom: 1px solid var(--panel-border); vertical-align: top; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--surface-sunken); }
.overflow-x { overflow-x: auto; }

/* =================================================================
   STATUS BADGES — one system, reused across Today/Tasks/Projects/
   Messages/Reports (Owner directive §21). Two families:
   .badge-<legacy>  — pre-existing project/doc/action classification
   .badge-status-*, .badge-flag-*  — task lifecycle (execution engine)
   ================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-active { background: var(--status-green-bg); color: var(--status-green-text); }
.badge-hold { background: var(--status-amber-bg); color: var(--status-amber-text); }
.badge-complete { background: var(--status-neutral-bg); color: var(--status-neutral-text); }
.badge-prospective { background: var(--status-purple-bg); color: var(--status-purple-text); }
.badge-unknown { background: var(--status-neutral-bg); color: var(--status-neutral-text); }
.badge-overdue { background: var(--status-red-bg); color: var(--status-red-text); }
.badge-manual { background: var(--status-neutral-bg); color: var(--status-neutral-text); }
.badge-real { background: var(--status-green-bg); color: var(--status-green-text); }
.badge-unverified { background: var(--status-amber-bg); color: var(--status-amber-text); }
.badge-historical { background: var(--status-neutral-bg); color: var(--status-neutral-text); }
.badge-template { background: var(--status-purple-bg); color: var(--status-purple-text); }

/* Task lifecycle status (execution-engine.js STATUS values) */
.badge-status-neutral { background: var(--status-neutral-bg); color: var(--status-neutral-text); }
.badge-status-blue { background: var(--status-blue-bg); color: var(--status-blue-text); }
.badge-status-orange { background: var(--status-orange-bg); color: var(--status-orange-text); }
.badge-status-amber { background: var(--status-amber-bg); color: var(--status-amber-text); }
.badge-status-green { background: var(--status-green-bg); color: var(--status-green-text); }

/* Derived attention flags (execution-engine.js ATTENTION_FLAGS) */
.badge-flag-blue { background: var(--status-blue-bg); color: var(--status-blue-text); }
.badge-flag-amber { background: var(--status-amber-bg); color: var(--status-amber-text); }
.badge-flag-red { background: var(--status-red-bg); color: var(--status-red-text); }
.badge-flag-purple { background: var(--status-purple-bg); color: var(--status-purple-text); font-weight: 800; }

/* =================================================================
   SUMMARY / STAT CARDS — Today + Reports executive rows
   ================================================================= */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .12s ease, border-color .12s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-card.active-filter { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; color: var(--heading); line-height: 1; }
.stat-card .stat-label { margin-top: 6px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card.tone-red .stat-value { color: var(--status-red-solid); }
.stat-card.tone-orange .stat-value { color: var(--status-orange-solid); }
.stat-card.tone-amber .stat-value { color: var(--status-amber-solid); }
.stat-card.tone-blue .stat-value { color: var(--status-blue-solid); }
.stat-card.tone-green .stat-value { color: var(--status-green-solid); }
.stat-card.tone-purple .stat-value { color: var(--status-purple-solid); }

/* ---------- Alert cards (exceptions that need to be loud) ---------- */

.alert-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--status-neutral-solid);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--surface);
}
.alert-card.tone-red { border-left-color: var(--status-red-solid); background: #fdf5f4; }
.alert-card.tone-orange { border-left-color: var(--status-orange-solid); background: #fdf7f2; }
.alert-card.tone-amber { border-left-color: var(--status-amber-solid); background: #fdf8ee; }
.alert-card.tone-purple { border-left-color: var(--status-purple-solid); background: #f8f5fd; }
.alert-card .alert-body { flex: 1; min-width: 0; font-size: 0.9rem; }
.alert-card .alert-meta { color: var(--text-muted); font-size: 0.8rem; margin-top: 3px; }

/* =================================================================
   PERSON AVATAR
   ================================================================= */

.person-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.74rem; font-weight: 700; flex: 0 0 auto;
}
.person-avatar.sm { width: 24px; height: 24px; font-size: 0.66rem; }
.person-inline { display: inline-flex; align-items: center; gap: 8px; }

/* =================================================================
   BUTTONS (shared primitive; .exec-btn kept as the working alias so
   existing JS class references keep working unchanged)
   ================================================================= */

.btn, .exec-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover, .exec-btn:hover { border-color: var(--border-strong); background: var(--surface-sunken); }
.btn-primary, .exec-btn-primary, .find-action-btn {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover, .exec-btn-primary:hover, .find-action-btn:hover { background: var(--accent-strong); }
.btn-gold {
  background: var(--gold); color: var(--navy-900); border-color: var(--gold);
}
.btn-gold:hover { background: var(--gold-400); }
.btn-secondary, .exec-btn-secondary, .find-action-btn-secondary {
  background: transparent; color: var(--text-muted); border-color: var(--panel-border);
}
.exec-terminal-note { color: var(--text-faint); font-size: 0.85rem; font-style: italic; }

/* =================================================================
   FORMS (drawer/inline)
   ================================================================= */

.exec-inline-form, .drawer-panel {
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}
.exec-inline-form h4, .drawer-panel h4 { margin: 0 0 12px; font-size: 0.95rem; color: var(--heading); }
.exec-form-fields { display: flex; flex-direction: column; gap: 10px; }
.exec-form-fields label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.78rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em;
}
.exec-form-fields label.checkbox-field {
  flex-direction: row; align-items: center; gap: 8px;
  text-transform: none; font-weight: 600; font-size: 0.86rem; color: var(--text);
}
.exec-form-fields label.checkbox-field input { width: auto; }
.exec-form-fields input[type="text"],
.exec-form-fields input[type="datetime-local"],
.exec-form-fields select {
  padding: 8px 10px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  text-transform: none;
  letter-spacing: normal;
}
.exec-form-actions { display: flex; gap: 8px; margin-top: 12px; }
.exec-form-error { color: var(--status-red-text); font-size: 0.82rem; margin: 8px 0 0; }
.exec-form-error[hidden] { display: none; }

/* Drawer overlay (Create/Assign Task) */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(16,24,38,0.45);
  display: flex; justify-content: flex-end; z-index: 50;
}
.drawer-sheet {
  width: min(420px, 100%); height: 100%; background: var(--surface);
  box-shadow: var(--shadow-lg); overflow-y: auto; padding: 22px;
  animation: drawer-in .15s ease-out;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.drawer-header h3 { margin: 0; font-size: 1.1rem; color: var(--heading); }
.drawer-close-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); line-height: 1; }

/* =================================================================
   TABS / FILTER CHIPS
   ================================================================= */

.exec-filter-bar, .tab-bar, .report-profile-bar, .msg-tab-bar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px;
}
.exec-filter-chip, .tab-chip {
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.exec-filter-chip:hover, .tab-chip:hover { background: var(--accent-soft); }
.exec-filter-chip.active, .tab-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* =================================================================
   EMPTY STATE
   ================================================================= */

.empty-state {
  color: var(--text-faint);
  font-style: italic;
  padding: 18px 6px;
  text-align: center;
}

/* =================================================================
   TASK CARD (Today)
   ================================================================= */

.exec-task-list { display: flex; flex-direction: column; gap: 12px; }

.exec-card {
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--status-neutral-solid);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.exec-card[data-accent="blue"] { border-left-color: var(--status-blue-solid); }
.exec-card[data-accent="orange"] { border-left-color: var(--status-orange-solid); }
.exec-card[data-accent="amber"] { border-left-color: var(--status-amber-solid); }
.exec-card[data-accent="green"] { border-left-color: var(--status-green-solid); }
.exec-card[data-accent="red"] { border-left-color: var(--status-red-solid); }
.exec-card[data-accent="purple"] { border-left-color: var(--status-purple-solid); }

.exec-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.exec-card-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; color: var(--heading); }
.exec-flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.exec-desc { margin: 8px 0; font-size: 0.88rem; color: var(--text-muted); }

.exec-fields {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 6px 14px;
  margin: 12px 0;
  font-size: 0.86rem;
}
.exec-fields dt { color: var(--text-faint); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.exec-fields dd { margin: 0; }
.exec-muted { color: var(--text-muted); font-size: 0.85rem; }

.exec-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.exec-controls .exec-btn:first-child { background: var(--accent); color: #fff; border-color: var(--accent); }
.exec-controls .exec-btn:first-child:hover { background: var(--accent-strong); }

.exec-activity-toggle { margin-top: 10px; border-top: 1px dashed var(--panel-border); padding-top: 10px; }
.exec-activity-timeline { list-style: none; margin: 10px 0; padding: 0; }
.exec-activity-timeline li { padding: 8px 0; border-bottom: 1px solid var(--panel-border); font-size: 0.85rem; }
.exec-activity-timeline li:last-child { border-bottom: none; }
.exec-activity-timeline .activity-meta { color: var(--text-faint); display: block; font-size: 0.76rem; margin-top: 2px; }
.exec-related-docs { margin-top: 10px; }
.exec-related-docs h4 { margin: 0 0 6px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-faint); font-weight: 700; }

/* =================================================================
   REPORTS
   ================================================================= */

.report-section { margin-bottom: 18px; }
.report-section h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px; margin-bottom: 8px; font-weight: 700;
}
.report-item-list { list-style: none; margin: 0; padding: 0; }
.report-item-list li { padding: 9px 0; border-bottom: 1px solid var(--panel-border); font-size: 0.88rem; }
.report-item-list li:last-child { border-bottom: none; }
.report-item-meta { color: var(--text-faint); font-size: 0.78rem; display: block; margin-top: 3px; }

.voice-brief-box {
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  padding: 14px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--navy-900);
}
.voice-brief-meta { color: var(--text-muted); font-size: 0.8rem; margin-top: 10px; }

.doctrine-candidate-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--surface);
}
.doctrine-candidate-card h4 { margin: 0 0 6px; font-size: 0.96rem; color: var(--heading); }
.doctrine-candidate-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.doctrine-candidate-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* =================================================================
   VIEWER SWITCHER (now hosted inside the top bar)
   ================================================================= */

.viewer-switcher-bar { display: flex; align-items: center; gap: 10px; }
.viewer-switcher-label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.viewer-switcher-label select {
  padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--panel-border);
  font-family: inherit; font-size: 0.82rem; background: var(--surface);
}
.viewer-switcher-note { display: none; }

/* =================================================================
   MESSAGING — General Activity / threads / composer
   ================================================================= */

.msg-feed { display: flex; flex-direction: column; gap: 10px; }

.msg-entry, .activity-item {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  background: var(--surface);
}
.msg-entry.unread { border-left: 4px solid var(--gold); }
.msg-entry-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; align-items: center; }
.msg-entry-sender { font-weight: 700; color: var(--heading); display: inline-flex; align-items: center; gap: 8px; }
.msg-entry-body { font-size: 0.92rem; margin-bottom: 8px; }
.msg-entry-task-ref {
  font-size: 0.82rem; color: var(--text-muted);
  background: var(--accent-soft); border: 1px solid #d7e0f7;
  border-radius: var(--radius-sm); padding: 9px 11px; margin-bottom: 8px;
}
.msg-entry-task-ref strong { color: var(--accent); }
.msg-entry-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.msg-thread-list { list-style: none; margin: 0; padding: 0; }
.msg-thread-list li {
  padding: 11px 12px; border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; background: var(--surface);
}
.msg-thread-list li:hover { background: var(--accent-soft); }
.msg-thread-list li.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.msg-thread-list .thread-title { font-weight: 700; color: var(--heading); }
.msg-thread-list .thread-preview { color: var(--text-muted); font-size: 0.84rem; margin-top: 2px; }

.msg-composer { display: flex; gap: 8px; margin-top: 12px; }
.msg-composer input[type="text"] {
  flex: 1; padding: 9px 12px; border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 0.9rem; background: var(--surface);
}
.msg-restricted-note {
  border-left: 3px solid var(--status-purple-solid); background: var(--status-purple-bg);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.86rem; color: var(--status-purple-text);
}

/* Message bubble variant (private/group thread detail) */
.message-bubble { max-width: 80%; }
.message-bubble.mine { margin-left: auto; }

/* =================================================================
   RELATED DOCUMENT CARD
   ================================================================= */

.role-doc-list { list-style: none; margin: 0; padding-left: 0; font-size: 0.86rem; }
.role-doc-list li {
  margin-bottom: 8px; padding: 10px 12px;
  border: 1px solid var(--panel-border); border-left: 3px solid var(--steel-300);
  border-radius: var(--radius-sm); background: var(--surface-sunken);
}
.role-doc-list .doc-path { color: var(--text-faint); font-family: Consolas, monospace; font-size: 0.76rem; display: block; word-break: break-all; margin-top: 2px; }
.doc-action-status { display: inline-block; margin-left: 8px; font-size: 0.75rem; color: var(--text-muted); font-style: italic; }
.doc-action-status-error { color: var(--status-red-text); font-style: normal; }
.doc-action-btn {
  display: inline-block; margin-top: 6px; padding: 4px 10px;
  border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-muted);
  font-size: 0.76rem; font-weight: 700; cursor: not-allowed;
}
.doc-action-btn-enabled {
  background: var(--status-green-bg); color: var(--status-green-text);
  border-color: var(--status-green-solid); cursor: pointer; text-decoration: none;
}
.doc-action-btn-enabled:hover { background: var(--status-green-solid); color: #fff; text-decoration: none; }

/* =================================================================
   PROJECT CARDS
   ================================================================= */

.project-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card {
  border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 16px 18px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.project-card h3 { margin: 0 0 4px; font-size: 1rem; color: var(--heading); }
.project-card .project-year { color: var(--text-faint); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.project-card .project-note { color: var(--text-muted); font-size: 0.82rem; margin-top: 8px; }
.project-card dl { display: grid; grid-template-columns: 90px 1fr; gap: 5px 10px; margin: 12px 0 0; font-size: 0.82rem; }
.project-card dt { color: var(--text-faint); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; }
.project-card dd { margin: 0; }

/* =================================================================
   RULES LIST / ROLE CARDS / SOP GROUPS / ONBOARDING / ADMIN
   (unchanged structure, restyled)
   ================================================================= */

.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { padding: 10px 0; border-bottom: 1px solid var(--panel-border); display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.attention-list li:last-child { border-bottom: none; }
.attention-list .item-text { flex: 1; }
.attention-list .item-meta { color: var(--text-faint); font-size: 0.83rem; white-space: nowrap; }

.rules-list { margin: 0; padding-left: 20px; }
.rules-list li { margin-bottom: 10px; }
.rule-block { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; margin-bottom: 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rule-block h3 { margin: 0 0 4px; font-size: 0.98rem; color: var(--heading); }
.rule-block p { margin: 0; font-size: 0.9rem; }

.sop-group { margin-bottom: 22px; }
.sop-group h3 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); border-bottom: 1px solid var(--panel-border); padding-bottom: 6px; margin-bottom: 10px; font-weight: 700; }
.sop-entry { padding: 12px 0; border-bottom: 1px solid var(--panel-border); }
.sop-entry:last-child { border-bottom: none; }
.sop-entry .sop-title { font-weight: 700; }
.sop-entry .sop-desc { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; }
.sop-entry .sop-path { color: var(--text-faint); font-size: 0.78rem; font-family: Consolas, monospace; }

.onboarding-step { display: flex; gap: 16px; align-items: flex-start; }
.onboarding-step .step-num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.92rem;
  display: flex; align-items: center; justify-content: center;
}
.onboarding-step .step-body { flex: 1; min-width: 0; }
.onboarding-step h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--heading); }
.onboarding-step p { margin: 0 0 8px; font-size: 0.9rem; }
.onboarding-step .step-path { color: var(--text-faint); font-size: 0.78rem; font-family: Consolas, monospace; word-break: break-all; }
.onboarding-step .step-path-note { color: var(--text-faint); font-size: 0.8rem; margin: 4px 0 0; }

.admin-note-panel summary { cursor: pointer; font-weight: 700; color: var(--heading); font-size: 0.9rem; }
.admin-note-panel summary::marker { color: var(--accent); }
.admin-note-panel p { margin: 10px 0 0; font-size: 0.88rem; color: var(--text-muted); }

.role-card h3 { margin: 0 0 10px; font-size: 1.1rem; color: var(--heading); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.role-compact { font-size: 0.9rem; margin-bottom: 10px; }
.role-compact .compact-row { padding: 4px 0; display: flex; gap: 8px; }
.role-compact .compact-label { color: var(--text-faint); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; flex: 0 0 140px; }
.role-compact .empty-value { color: var(--text-faint); font-style: italic; }
.role-doorway { margin: 4px 0 12px; font-size: 0.8rem; color: var(--text-muted); }
.role-doorway a { font-weight: 600; }

details:not([open]) > *:not(summary) { display: none !important; }
.role-card > details, .admin-section > details { margin-top: 10px; border-top: 1px solid var(--panel-border); padding-top: 10px; }
.admin-section > details { margin-top: 0; }
.role-card details summary, .admin-section details summary { cursor: pointer; font-weight: 700; color: var(--accent); font-size: 0.88rem; list-style: none; }
.role-card details summary::-webkit-details-marker, .admin-section details summary::-webkit-details-marker { display: none; }
.role-card details summary::marker, .admin-section details summary::marker { content: ""; }
.role-card details > summary::before, .admin-section details > summary::before { content: "▸ "; color: var(--accent); }
.role-card details[open] > summary::before, .admin-section details[open] > summary::before { content: "▾ "; }

.role-fields { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 14px 0 0; font-size: 0.9rem; }
.role-fields dt { color: var(--text-faint); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; padding-top: 2px; }
.role-fields dd { margin: 0; }
.role-fields .empty-value { color: var(--text-faint); font-style: italic; }

.role-note { border-left: 3px solid var(--status-amber-solid); background: var(--status-amber-bg); padding: 8px 12px; margin-top: 12px; font-size: 0.84rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.admin-section { border: 1px dashed var(--panel-border); background: var(--surface-sunken); }
.admin-section h2 { color: var(--text-muted); font-size: 1rem; }
.admin-section > details { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--panel-border); }
.admin-section > details:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.no-doc-roles { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.no-doc-roles .role-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 0.86rem; }

/* ---------- Actions page ---------- */

.action-search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.action-search-input {
  flex: 1 1 320px; min-width: 200px; padding: 10px 14px;
  border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: inherit; background: var(--surface);
}
.action-search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.action-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.shortcut-chip {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--panel-border);
  border-radius: 999px; background: var(--surface-sunken); color: var(--text);
  font-size: 0.85rem; cursor: pointer; text-decoration: none;
}
.shortcut-chip:hover { background: var(--accent-soft); border-color: var(--accent); text-decoration: none; }

.action-entry-panel { border-color: var(--accent); background: var(--accent-soft); }
#not-mapped-panel { border-color: var(--status-amber-solid); }
#not-mapped-panel h2 { color: var(--status-amber-text); }

#results-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 22px; }

.nested-details { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--panel-border); }
.nested-details summary { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); }
.nested-details .role-fields { font-size: 0.84rem; }

/* ---------- Placeholder / not-populated pages ---------- */

.not-populated { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.not-populated h2 { color: var(--heading); }

.future-widget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.future-widget-card {
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  padding: 16px; background: var(--surface-sunken); text-align: left;
}
.future-widget-card h4 { margin: 0 0 4px; font-size: 0.92rem; color: var(--heading); }
.future-widget-card p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Today: greeting + overview (adaptive Owner/Employee) ---------- */

.overview-greeting { margin-bottom: 4px; }
.overview-greeting h1 { margin: 0 0 4px; font-size: 1.4rem; color: var(--heading); }
.overview-greeting p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.overview-columns { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 960px) { .overview-columns { grid-template-columns: 1fr; } }

.overview-mini-list { list-style: none; margin: 0; padding: 0; }
.overview-mini-list li {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--panel-border); font-size: 0.88rem;
}
.overview-mini-list li:last-child { border-bottom: none; }
.overview-mini-list .mini-meta { color: var(--text-faint); font-size: 0.78rem; white-space: nowrap; }

.project-pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.project-pill {
  border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 0.82rem; background: var(--surface-sunken);
}
.project-pill strong { color: var(--heading); }

/* ---------- Home / Command Center hero ---------- */

.home-hero {
  background: linear-gradient(120deg, var(--navy-900), var(--navy-700));
  color: var(--on-dark);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.home-hero::after {
  content: "";
  position: absolute; right: -40px; top: -40px; width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(219,169,74,0.22), transparent 70%);
}
.home-hero h1 {
  margin: 0 0 6px; font-size: 1.7rem; letter-spacing: 0.02em; color: #fff;
}
.home-hero-subtitle { margin: 0; color: var(--on-dark-muted); font-size: 1rem; }
.home-hero #home-greeting, .home-hero .panel-note { color: var(--on-dark-muted) !important; }

/* ---------- Quick Start Processes — big operating-gateway tiles ---------- */

.process-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.process-tile {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: box-shadow .12s ease, transform .12s ease;
}
.process-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.process-tile-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.process-tile-icon svg { width: 22px; height: 22px; }
.process-tile h4 { margin: 0; font-size: 1.02rem; color: var(--heading); }
.process-tile-sub {
  font-size: 0.74rem; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 0.03em; margin-bottom: 10px;
}
.process-tile-action {
  margin-top: auto;
  display: inline-block;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--panel-border);
  background: var(--surface-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
}
a.process-tile-action.doc-action-btn-enabled {
  background: var(--status-green-bg); color: var(--status-green-text);
  border-color: var(--status-green-solid); cursor: pointer;
}
a.process-tile-action.doc-action-btn-enabled:hover { background: var(--status-green-solid); color: #fff; }

/* ---------- Personal Workspaces — compact horizontal rows ---------- */

.workspace-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.workspace-row:last-child { margin-bottom: 0; }
.workspace-identity { display: flex; align-items: center; gap: 10px; flex: 1 1 190px; min-width: 170px; }
.workspace-identity .role-line { color: var(--text-muted); font-size: 0.78rem; }
.workspace-stats { display: flex; gap: 8px; flex: 0 0 auto; }
.workspace-stat-chip {
  text-align: center; min-width: 54px; padding: 4px 8px;
  border-radius: var(--radius-sm); background: var(--surface-sunken);
  font-size: 0.72rem; color: var(--text-muted);
}
.workspace-stat-chip strong { display: block; font-size: 0.98rem; color: var(--heading); }
.workspace-bar-track { flex: 1 1 90px; height: 6px; border-radius: 4px; background: var(--steel-100); overflow: hidden; min-width: 60px; }
.workspace-bar-fill { height: 100%; background: var(--status-blue-solid); }

/* ---------- General Activity — clean timeline (Home preview) ---------- */

.activity-timeline { list-style: none; margin: 0; padding: 0; }
.activity-timeline li {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.87rem;
}
.activity-timeline li:last-child { border-bottom: none; }
.activity-timeline .timeline-dot {
  flex: 0 0 auto; margin-top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--steel-300);
}
.activity-timeline .timeline-body { flex: 1; min-width: 0; }
.activity-timeline .timeline-meta { color: var(--text-faint); font-size: 0.78rem; white-space: nowrap; }

/* ---------- Compact deadline rows ---------- */

.deadline-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--panel-border);
  font-size: 0.87rem;
}
.deadline-row:last-child { border-bottom: none; }
.deadline-row .deadline-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.deadline-row .deadline-title { flex: 1; min-width: 0; }
.deadline-row .deadline-title strong { display: block; }
.deadline-row .deadline-title span { color: var(--text-faint); font-size: 0.78rem; }
.deadline-row .deadline-countdown { flex: 0 0 auto; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }

/* ---------- Compact document cards ---------- */

.doc-card-list { display: flex; flex-direction: column; gap: 8px; }
.doc-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 11px 13px; border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm); background: var(--surface);
}
.doc-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.doc-card-icon {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 800;
}
.doc-card-body { flex: 1; min-width: 0; }
.doc-card-body strong {
  display: block; font-size: 0.88rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.doc-card-body span {
  color: var(--text-faint); font-size: 0.74rem; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-card-action { flex: 0 0 auto; align-self: flex-start; }
.doc-card-action .doc-action-btn { margin-top: 0; white-space: normal; text-align: left; }

/* ---------- Project Pulse ---------- */

.pulse-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pulse-card {
  border: 1px solid var(--panel-border); border-radius: var(--radius-md);
  padding: 14px 16px; background: var(--surface);
}
.pulse-card h4 { margin: 0 0 8px; font-size: 0.95rem; color: var(--heading); }
.pulse-card-stats { display: flex; gap: 8px; margin-top: 8px; }

/* =================================================================
   AUTH — login page + protected-page pending guard
   ================================================================= */

/* Set on <body> from the start on every protected page, before any JS
   runs, so authenticated data is never briefly rendered pre-redirect —
   js/session-guard.js removes this class only after a session is
   confirmed. */
body.tsg-auth-pending .app-shell { display: none; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700) 60%, var(--navy-800));
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 30px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.login-brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; flex: 0 0 auto;
}
.login-headline { font-size: 1.3rem; font-weight: 800; color: var(--heading); letter-spacing: 0.01em; }
.login-subtitle { margin: 0 0 24px; color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.login-form input {
  padding: 11px 13px; border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  font-size: 0.96rem; font-family: inherit; color: var(--text); background: var(--surface);
}
.login-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.login-submit {
  margin-top: 6px; padding: 11px 14px; border: none; border-radius: var(--radius-sm);
  background: var(--gold); color: var(--navy-900); font-weight: 800; font-size: 0.94rem;
  letter-spacing: 0.03em; cursor: pointer;
}
.login-submit:hover { background: var(--gold-400); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  margin-top: 2px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--status-red-bg); color: var(--status-red-text); font-size: 0.85rem;
}
.login-error[hidden] { display: none; }

.login-footnote { margin: 18px 0 0; text-align: center; color: var(--text-faint); font-size: 0.76rem; }

/* =================================================================
   RESPONSIVE
   ================================================================= */

@media (max-width: 960px) {
  .app-sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%);
    transition: transform .18s ease-out;
    box-shadow: var(--shadow-lg);
  }
  .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(16,24,38,0.45); z-index: 15;
  }
  .sidebar-close-btn {
    display: inline-flex; margin-left: auto; background: none; border: none;
    color: var(--on-dark); font-size: 1.3rem; cursor: pointer;
  }
  .topbar-hamburger { display: inline-flex; }
  .topbar-search { display: none; }
  .topbar-title { font-size: 1rem; }
  main.app-main { padding: 16px 14px 40px; }
  .app-topbar { padding: 0 14px; }
}

@media (max-width: 720px) {
  .role-fields { grid-template-columns: 1fr; }
  .role-compact .compact-row { flex-direction: column; gap: 2px; }
  .role-compact .compact-label { flex: none; }
  .action-search-row { flex-direction: column; }
  .exec-fields { grid-template-columns: 1fr; }
  .drawer-sheet { width: 100%; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
