/* ═══════════════════════════════════════════════════════
   Surface Ops — Style System
   ═══════════════════════════════════════════════════════ */

/* ─── Safe area support for standalone web app mode ─── */
html {
  background: var(--sidebar-bg, #2A1419);
  /* The page-header (56px) is sticky, and the window is the scroll container, so in-page anchor
     links (e.g. the Settings sub-nav) would otherwise land their target tucked under it. Offset
     fragment-scroll targets to clear the header with a little breathing room. */
  scroll-padding-top: 70px;
}

/* ─── 1. Variables + Reset ─── */
:root {
  /* Surface Collective brand tokens — raw palette (source of truth) */
  --oxblood: #4C1F28;
  --parchment: #F6F2EA;
  --paper: #FBF9F4;
  --ink: #1C1A17;
  --pine: #2E4034;
  --stone: #6F6A60;
  --brass: #AD8A50;

  --bg: var(--parchment);
  --card: var(--paper);
  --card-shadow: 0 2px 12px rgba(76,31,40,0.06);
  --text: var(--ink);
  --muted: var(--stone);
  --line: rgba(28,26,23,0.14);
  --accent: var(--oxblood);
  --accent-secondary: #5E2833;
  --accent-gold: var(--brass);   /* accent only — never text */
  --danger: #A6362F;             /* essential error/overdue state (outside brand table by necessity) */
  --success: var(--pine);
  --warning: var(--brass);
  --input-bg: #F1ECE0;
  --subcard-bg: #F1ECE1;
  --topbar-bg: rgba(246,242,234,0.92);
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-serif: "EB Garamond", Georgia, serif;
  --font-display: "EB Garamond", Georgia, serif;
  --radius: 10px;
  --radius-lg: 13px;

  --sidebar-bg: #2A1419;
  --sidebar-text: #EDE7DA;
  --sidebar-muted: #A79E92;
  --sidebar-hover: rgba(246,242,234,0.08);
  --sidebar-active: var(--oxblood);
  --sidebar-active-text: var(--parchment);
  --sidebar-width: 230px;
  --panel-width: 480px;
  --panel-shadow: -4px 0 24px rgba(0,0,0,0.15);
  --info: var(--pine);
  --color-focus: var(--brass);
}

[data-theme="dark"] {
  --bg: #100C0D;
  --card: #1A1215;
  --card-shadow: 0 4px 16px rgba(0,0,0,0.3);
  --text: #EDE8DF;
  --muted: #A79E92;
  --line: #2E2229;
  --accent: #C9A765;            /* lighter brass for legibility on the dark ground */
  --accent-secondary: #D4B575;
  --accent-gold: #C9A765;
  --danger: #D4504A;
  --success: #6E9A82;           /* lightened pine for dark */
  --warning: #C9A765;
  --info: #6E9A82;
  --input-bg: #160F12;
  --subcard-bg: rgba(255,255,255,0.04);
  --topbar-bg: rgba(20,14,17,0.88);

  --sidebar-bg: #0E0A0B;
  --sidebar-hover: rgba(246,242,234,0.06);
  --sidebar-active: rgba(76,31,40,0.7);
  --panel-shadow: -4px 0 24px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

/* Skip link */
.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--accent); color: var(--bg);
  padding: 8px 16px; z-index: 100; font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 2px solid var(--card);
  outline-offset: -4px;
}

/* ─── 2. Layout (sidebar, main area, panel) ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 40;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
  height: 100vh;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
}

.main-area {
  flex: 1;
  width: calc(100vw - var(--sidebar-width));
  max-width: calc(100vw - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 30;
  height: 56px;
  min-height: 56px;
  gap: 18px;
}
.page-header__left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-header__breadcrumb { font-size: 13px; color: var(--muted); }
.page-header__breadcrumb a { color: var(--muted); }
.page-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header__timer-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subcard-bg);
}
.page-header__timer-name { font-weight: 600; }
.page-header__timer-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
/* Wrapper around the other-staff timer badges — its own SSE-refreshed region (live `clock`
   signal). Lays the badges out in the same row as before; collapses while it holds no badges
   so it never adds a stray header gap. */
.page-header__timers {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header__timers:empty { display: none; }

/* Compact clock-in quick-action in the top header (Phase 12 slice 4). */
.header-clock:empty { display: none; }
.header-clock__form { display: inline-flex; margin: 0; }
.header-clock__start {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.header-clock__icon { width: 11px; height: 11px; flex-shrink: 0; }

/* Top-bar active-timer widget (moved out of the sidebar). */
.header-timer { display: inline-flex; align-items: center; }
.header-timer.is-hidden { display: none; }
.header-timer__running {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subcard-bg);
}
.header-timer__project {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.header-timer__task {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.header-timer__task:hover { color: var(--text); text-decoration: underline; }
.header-timer__clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.header-timer__form { display: inline-flex; margin: 0; }
.header-timer__idle { display: inline-flex; align-items: center; gap: 8px; }
.header-timer__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
/* Keep the top bar compact on small screens — drop the state label, keep the button. */
@media (max-width: 640px) { .header-timer__label { display: none; } }

/* Audit & Logs tab links reuse the generic .tab component. */
a.tab { text-decoration: none; }

/* --- Global search (docs/search-spec.md) --- */
.page-header__search {
  position: relative;
  flex: 1 1 auto;
  max-width: 420px;
  margin-left: 12px;
  display: flex;
  align-items: center;
}
.page-header__search-icon {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.page-header .page-header__search .search-input {
  padding-left: 32px;
  min-height: 36px;
  background: var(--bg);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 6px;
}
.search-dropdown[hidden] { display: none; }
.search-dropdown__group { padding: 4px 0; }
.search-dropdown__group + .search-dropdown__group { border-top: 1px solid var(--line); }
.search-dropdown__heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 10px;
  font-weight: 600;
}
.search-dropdown__item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
}
.search-dropdown__item:hover,
.search-dropdown__item:focus {
  background: var(--bg);
  outline: none;
}
.search-dropdown__item-label { font-size: 14px; }
.search-dropdown__item-sub { font-size: 12px; color: var(--muted); }
.search-dropdown__seeall {
  display: block;
  text-align: center;
  padding: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.search-dropdown__seeall:hover { text-decoration: underline; }
.search-dropdown__empty {
  padding: 14px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Full results page (search_results.html) */
.search-page-form { display: flex; gap: 10px; margin-bottom: 18px; }
.search-input--page { flex: 1; }
.search-results__group { margin-top: 20px; }
.search-results__group:first-of-type { margin-top: 0; }
.search-results__heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 6px;
}
.search-results__list { list-style: none; margin: 0; padding: 0; }
.search-results__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 9px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
}
.search-results__item:hover { background: var(--bg); border-color: var(--line); }
.search-results__item-label { font-weight: 500; }
.search-results__item-sub { font-size: 13px; color: var(--muted); text-align: right; }

@media (max-width: 720px) {
  .page-header__search { max-width: none; margin-left: 8px; }
  .page-header__search-icon { display: none; }
  .page-header .page-header__search .search-input { padding-left: 12px; }
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text);
  line-height: 0;
}
.mobile-menu-toggle svg { width: 18px; height: 18px; display: block; }

.page-content {
  flex: 1;
  padding: 20px 24px;
  width: 100%;
}

/* ─── Slide-out panel ─── */
.panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 50;
}
.panel-overlay.open { display: block; }

.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--panel-width);
  background: var(--card);
  box-shadow: var(--panel-shadow);
  z-index: 51;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel.open { transform: translateX(0); }

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.panel__title { margin: 0; font-size: 16px; font-weight: 600; }
.panel__close {
  background: none; border: none;
  font-size: 20px; color: var(--muted);
  cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius);
}
.panel__close:hover { background: var(--line); color: var(--text); }
.panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ─── 3. Sidebar Navigation ─── */
.sidebar__brand {
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar__brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}
.sidebar__brand-link:hover { text-decoration: none; }
.sidebar__logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #4C1F28;
  color: #F6F2EA;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.03em;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}
img.sidebar__logo { background: none; display: block; object-fit: contain; }

/* Theme-aware brand logo (shared by the sidebar + portal header). An inline SVG logo uses
   currentColor, so it follows the theme via the color set here; a dark-mode override <img>
   is toggled in by [data-theme="dark"]. */
.brand-logo { display: inline-flex; align-items: center; }
.brand-logo__dark { display: none; }
[data-theme="dark"] .brand-logo__light { display: none; }
[data-theme="dark"] .brand-logo__dark { display: inline-flex; }
.brand-logo__svg { background: none !important; display: inline-flex; align-items: center; justify-content: center; }
.brand-logo__svg svg { width: 100%; height: 100%; display: block; }
.sidebar__logo.brand-logo__svg { color: var(--sidebar-active-text); }       /* sized 30×30 by .sidebar__logo */
.portal-logo.brand-logo__svg { color: var(--accent); width: 34px; height: 34px; }

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.sidebar__brand-name {
  color: var(--sidebar-active-text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.sidebar__brand-sub {
  color: var(--sidebar-muted);
  font-size: 10px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.sidebar__section { padding: 4px 0; }
.sidebar__section + .sidebar__section {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4px;
  padding-top: 8px;
}

.sidebar__heading {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sidebar-muted);
  padding: 8px 16px 4px;
}

/* Collapsible nav sections (Phase 12). The heading is a button toggling its body;
   state is persisted in localStorage by the inline script in base.html. */
button.sidebar__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: calc(100% - 16px);
  margin: 0 8px;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
button.sidebar__heading:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
button.sidebar__heading:focus-visible {
  outline: 2px solid rgba(246,242,234,0.4);
  outline-offset: -2px;
}
.sidebar__heading-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.15s ease;
}
.sidebar__section.is-collapsed .sidebar__heading-chevron { transform: rotate(-90deg); }
.sidebar__section.is-collapsed .sidebar__section-body { display: none; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 8px;
  margin: 1px 8px;
  transition: background 0.1s;
}
.sidebar__link:hover { background: var(--sidebar-hover); color: var(--sidebar-text); text-decoration: none; }
.sidebar__link:focus-visible {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  outline: 2px solid rgba(246,242,234,0.4);
  outline-offset: -2px;
  text-decoration: none;
}
.sidebar__link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.sidebar__icon { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.55; }

.sidebar__timer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(76,31,40,0.25);
}
.sidebar__timer-label { font-size: 11px; text-transform: uppercase; color: var(--sidebar-muted); letter-spacing: 0.04em; }
.sidebar__timer-project { font-size: 13px; font-weight: 600; color: #F6F2EA; margin: 2px 0; }
.sidebar__timer-clock {
  font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sidebar-text);
  margin: 4px 0 8px;
}

.sidebar__user {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.sidebar__user-name { color: var(--sidebar-text); font-weight: 600; }
.sidebar__logout { color: var(--sidebar-muted); font-size: 12px; text-decoration: none; }
.sidebar__logout:hover { color: var(--danger); text-decoration: none; }

.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 8px;
  line-height: 0;
  color: var(--sidebar-muted);
  transition: background 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}
/* The visible icon reflects the currently-selected mode (data-theme-mode on <html>):
   Light → sun, Dark → moon, System → monitor. With no preference set (or no JS) the
   System icon shows, matching the "follow OS" default. */
.theme-toggle__icon { width: 16px; height: 16px; display: none; }
.theme-toggle__icon--system { display: block; }
[data-theme-mode="light"] .theme-toggle__icon--system,
[data-theme-mode="dark"] .theme-toggle__icon--system { display: none; }
[data-theme-mode="light"] .theme-toggle__icon--sun { display: block; }
[data-theme-mode="dark"] .theme-toggle__icon--moon { display: block; }

/* Collapse-to-rail toggle (Phase 12). Hidden on mobile, which uses the off-canvas drawer. */
.sidebar__collapse {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 8px;
  line-height: 0;
  color: var(--sidebar-muted);
  transition: background 0.15s, border-color 0.15s;
}
.sidebar__collapse:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); }
.sidebar__collapse svg { width: 16px; height: 16px; display: block; transition: transform 0.15s ease; }
html[data-sidebar="collapsed"] .sidebar__collapse svg { transform: rotate(180deg); }
@media (max-width: 768px) { .sidebar__collapse { display: none; } }

/* Collapsed rail — desktop only (mobile keeps the full drawer). The narrow --sidebar-width
   override flows through .main-area automatically; here we hide text + center icons. */
@media (min-width: 769px) {
  html[data-sidebar="collapsed"] { --sidebar-width: 64px; }
  html[data-sidebar="collapsed"] .sidebar__brand { flex-direction: column; gap: 8px; padding: 12px 6px; }
  html[data-sidebar="collapsed"] .sidebar__brand-link { flex: 0; justify-content: center; }
  html[data-sidebar="collapsed"] .sidebar__brand-text,
  html[data-sidebar="collapsed"] .theme-toggle,
  html[data-sidebar="collapsed"] .sidebar__heading,
  html[data-sidebar="collapsed"] .sidebar__timer,
  html[data-sidebar="collapsed"] .sidebar__user-name,
  html[data-sidebar="collapsed"] .sidebar__link .pill { display: none; }
  /* Rail can't toggle a section (headings are hidden) — always show every section's icons.
     Must out-specify `.sidebar__section.is-collapsed .sidebar__section-body { display:none }`
     so a previously-collapsed section isn't stranded invisible with no way to expand. */
  html[data-sidebar="collapsed"] .sidebar__section.is-collapsed .sidebar__section-body,
  html[data-sidebar="collapsed"] .sidebar__section-body { display: block; }
  html[data-sidebar="collapsed"] .sidebar__link {
    justify-content: center;
    gap: 0;
    font-size: 0;
    padding: 9px 0;
    margin: 1px 6px;
  }
  html[data-sidebar="collapsed"] .sidebar__icon { width: 18px; height: 18px; opacity: 0.7; }
  html[data-sidebar="collapsed"] .sidebar__user { justify-content: center; padding: 12px 6px; }
}

/* ─── 4. Components (pills, buttons, forms, inputs) ─── */

/* Forms */
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.inline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.inline { display: inline-flex; align-items: center; gap: 6px; }
.small-label { font-size: 13px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
/* .help-text + .section-intro are defined once, in the Cards section below. */
.field-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  color: var(--muted);
  cursor: help;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.stacked-form {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.stacked-form .btn { width: 100%; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  font: inherit;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  min-height: 38px;
  line-height: 1.2;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea { resize: vertical; }

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

select[multiple] {
  background-image: none;
  padding-right: 12px;
  min-height: 100px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,31,40,0.12);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px; height: 16px; margin: 0;
  accent-color: var(--accent);
}

/* Buttons */
.btn {
  font: inherit;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #FBF9F4;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-secondary); border-color: var(--accent-secondary); color: #FBF9F4; text-decoration: none; }
.btn.danger { border-color: var(--danger); background: var(--danger); color: #FBF9F4; }
.btn.danger:hover { background: #8C2C26; border-color: #8C2C26; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); opacity: 0.9; }
.btn.ghost:hover { opacity: 1; background: var(--bg); }
.btn.ghost.danger { color: var(--danger); border-color: rgba(166,54,47,0.4); }
.btn.ghost.danger:hover { background: rgba(166,54,47,0.08); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.full-width { width: 100%; }

.btn-icon {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 20px; padding: 2px 4px;
  line-height: 1; border-radius: var(--radius);
}
.btn-icon:hover { color: var(--danger); background: rgba(166,54,47,0.08); }

/* Pills & tags */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: default;
}
.pill.running { border-color: var(--accent); color: var(--accent); background: rgba(76,31,40,0.08); }
.pill.overdue { color: var(--danger); border-color: rgba(166,54,47,0.5); background: rgba(166,54,47,0.08); font-weight: 600; }
.pill.idle { color: var(--muted); }
.pill.positive { color: var(--success); border-color: rgba(46,64,52,0.4); background: rgba(46,64,52,0.08); }
.pill.negative { color: var(--danger); border-color: rgba(166,54,47,0.4); background: rgba(166,54,47,0.08); }

.pill.tiny {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(76,31,40,0.05);
}

.tag-pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--subcard-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  margin: 0 2px;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tag-pill-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tag-pill-btn:hover {
  border-color: var(--accent-gold);
  color: var(--text);
}
.tag-pill-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #FBF9F4;
}

/* Status pills */
.pill.status.open { color: var(--success); border-color: rgba(46,64,52,0.4); background: rgba(46,64,52,0.08); }
.pill.status.closed, .pill.status.done { color: var(--muted); border-color: var(--line); background: var(--subcard-bg); }
.pill.status.on_hold { color: #6F6A60; border-color: rgba(122,124,134,0.4); background: rgba(122,124,134,0.08); }
.pill.status.not_started { color: var(--muted); border-color: var(--line); background: var(--bg); }
.pill.status.in_progress { color: #2E4034; border-color: rgba(46,64,52,0.4); background: rgba(46,64,52,0.08); }
.pill.status.in_review { color: #7E5F1C; border-color: rgba(173,138,80,0.5); background: rgba(173,138,80,0.12); }
.pill.status.approved, .pill.status.complete { color: var(--success); border-color: rgba(46,64,52,0.4); background: rgba(46,64,52,0.08); }
.pill.status.blocked { color: var(--danger); border-color: rgba(166,54,47,0.4); background: rgba(166,54,47,0.08); }

/* Inline quick-edit dropdowns (project status on the projects list; task status +
   priority on the task lists): a status/priority pill you change in place. Keeps the
   .pill.{status,priority}.{x} colours; the native select arrow signals it's editable. */
select.quick-status-select,
select.quick-billable-select,
select.quick-edit-select {
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
  max-width: 140px;
  vertical-align: middle;
}
select.quick-status-select:hover,
select.quick-billable-select:hover,
select.quick-edit-select:hover { filter: brightness(0.96); }
select.quick-status-select:focus-visible,
select.quick-billable-select:focus-visible,
select.quick-edit-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Health pills */
.pill.health.on_track  { color: var(--success); border-color: rgba(46,64,52,0.4);  background: rgba(46,64,52,0.08); }
.pill.health.at_risk   { color: #7E5F1C; border-color: rgba(173,138,80,0.5);  background: rgba(173,138,80,0.12);  }
.pill.health.off_track { color: var(--danger); border-color: rgba(166,54,47,0.4); background: rgba(166,54,47,0.08); }
.pill.health.not_set   { color: var(--muted); border-color: var(--line); background: var(--subcard-bg); }

/* Priority pills */
.pill.priority.urgent { background: #A6362F; color: #FBF9F4; border-color: #A6362F; }
.pill.priority.high   { background: #AD8A50; color: #231016; border-color: #AD8A50; }
.pill.priority.medium { background: #8A7C86; color: #FBF9F4; border-color: #8A7C86; }
.pill.priority.low    { background: #E5E2D9; color: #6F6A60; border-color: #E5E2D9; }

/* Job-type pills (phase 5) */
.pill.job-type.design     { color: #4C1F28; border-color: rgba(76,31,40,0.35); background: #EFE3E4; }
.pill.job-type.ad_hoc     { color: #7E5F1C; border-color: rgba(173,138,80,0.4); background: #F3EAD8; }
.pill.job-type.music      { color: #2E4034; border-color: rgba(46,64,52,0.3); background: #E3EAE4; }
.pill.job-type.internship { color: #1C5E48; border-color: rgba(28,94,72,0.3); background: #E2EBE8; }

/* Design pipeline stage tracker (phase 5) */
.design-pipeline__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.design-pipeline__head h2 { margin: 0; }
.stage-tracker {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
}
.stage-tracker .stage-step { flex: 1 1 0; min-width: 110px; margin: 0; }
.stage-tracker .stage-step form { margin: 0; }
.stage-step__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.15s ease;
}
.stage-step__btn:hover { border-color: var(--accent); color: var(--text); }
.stage-step__dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 11px;
  font-weight: 600;
}
.stage-step.done .stage-step__btn    { color: var(--success); border-color: rgba(46,64,52,0.4); background: rgba(46,64,52,0.06); }
.stage-step.current .stage-step__btn { color: var(--accent); border-color: var(--accent); background: rgba(76,31,40,0.08); font-weight: 600; }
.stage-step.done .stage-step__dot    { background: var(--success); color: #FBF9F4; border-color: var(--success); }
.stage-step.current .stage-step__dot { background: var(--accent); color: #FBF9F4; border-color: var(--accent); }

/* ─── 5. Task rows + task lists ─── */
.task-row {
  display: grid;
  grid-template-columns: 16px auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.task-row:hover { background: var(--subcard-bg); }
.task-row:last-child { border-bottom: none; }
.task-row--dependency { border-left: 3px solid var(--warning); }

.task-row__status { flex-shrink: 0; }
.task-row__title { min-width: 0; }
.task-row__title a { color: var(--text); text-decoration: none; }
.task-row__title a:hover { color: var(--accent); }
.task-row__project { display: block; font-size: 12px; }
.task-row__priority { flex-shrink: 0; }
.task-row__meta { flex-shrink: 0; font-size: 13px; text-align: right; }

.overdue { color: var(--danger); font-weight: 600; }

.dependency-badge {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.recurring-icon {
  color: var(--accent);
  font-size: 14px;
  margin-right: 2px;
  vertical-align: middle;
}

/* ─── 6. Cards + sections ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 16px 0;
  box-shadow: var(--card-shadow);
}

h1, h2 { margin: 0 0 8px 0; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.05rem; }
.lead { font-size: 1rem; }

.muted { color: var(--muted); }
.help-text {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.section-intro {
  margin: 0 0 12px;
  max-width: 72ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}
.info-tip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subcard-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}
.info-tip__icon:hover,
.info-tip__icon:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  outline: none;
}
.info-tip__content {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  max-width: min(300px, 80vw);
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--card-shadow);
  font-size: 12px;
  line-height: 1.4;
  z-index: 25;
}
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.form-inline { display: inline; }
.label-stacked { display: block; margin: .4rem 0; }
.tc { text-align: center; }
.text-sm { font-size: .85em; }
.btn-row { margin: .5rem 0; display: flex; gap: .5rem; flex-wrap: wrap; }
.form-block__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.text-xs { font-size: 12px; }
.col-cb { width: 34px; }
.ml-auto { margin-left: auto; }
.flash--brand { background: var(--accent); color: #FBF9F4; }
.link-white { color: #FBF9F4; text-decoration: underline; }
.inline-icon { width: 14px; height: 14px; vertical-align: -2px; display: inline-block; flex-shrink: 0; }

.dashboard-header { padding: 4px 0; }
.dashboard-header h1 { margin: 0; }

.subcard {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--subcard-bg);
}

/* Document version diff (Phase 16 slice 3) — colours for difflib.HtmlDiff output. */
.diff-wrap { overflow-x: auto; font-size: 12px; }
.diff-wrap table.diff { width: 100%; border-collapse: collapse; font-family: var(--mono, monospace); }
.diff-wrap td, .diff-wrap th { padding: 0 6px; white-space: pre-wrap; vertical-align: top; }
.diff-wrap .diff_header { color: var(--muted); text-align: right; }
.diff-wrap .diff_next { color: var(--muted); }
.diff-wrap .diff_add { background: rgba(46,64,52,0.18); }
.diff-wrap .diff_sub { background: rgba(166,54,47,0.18); }
.diff-wrap .diff_chg { background: rgba(173,138,80,0.22); }

/* Timesheets (Phase 15) — per-day groupings on the timesheet pages. */
.timesheet-day { margin-top: 14px; }
.timesheet-day__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 4px 2px; border-bottom: 1px solid var(--line); margin-bottom: 2px;
}

.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 768px) { .split { grid-template-columns: 1fr; } }

/* Grids */
.grid { display: grid; grid-template-columns: 1.4fr 1.2fr auto; gap: 10px; align-items: end; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: 1.2fr 1.6fr 1fr auto; }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid .full { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .grid, .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
}

/* Structured address entry (client billing + firm postal addresses). */
.address-block { display: grid; gap: 10px; }
.address-block__legend { font-size: 13px; font-weight: 600; color: var(--text); }
.address-csz { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 10px; }
@media (max-width: 720px) { .address-csz { grid-template-columns: 1fr; } }

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--subcard-bg);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 1.3rem; font-weight: 700; margin: 2px 0; }
.stat-meta { color: var(--muted); font-size: 12px; }

.project-dashboard-top { padding-bottom: 10px; }
.project-summary-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.project-summary-band > .section-intro {
  grid-column: 1 / -1;
}
.project-summary-band > div,
.project-summary-band > details {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--subcard-bg);
}
.project-summary-band > details > summary {
  display: grid;
  gap: 4px;
  list-style: none;
  cursor: pointer;
  padding: 0;
}
.project-summary-band > details > summary::-webkit-details-marker { display: none; }
.project-summary-band strong { font-size: 14px; }
.dashboard-summary-cards { margin-top: 14px; }
.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}
.dashboard-column { display: grid; gap: 14px; align-content: start; }
.dashboard-panel h2 { margin-bottom: 10px; }
.dashboard-list-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.dashboard-list-item:last-child { border-bottom: none; }
.dashboard-list-item--clickable { cursor: pointer; border-radius: var(--radius); padding: 8px 4px; margin: 0 -4px; }
.dashboard-list-item--clickable:hover { background: var(--subcard-bg); }
.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.dashboard-panel h3.muted {
  margin: 14px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.management-section {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.management-section > summary {
  font-weight: 600;
  font-size: 15px;
}

@media (max-width: 980px) {
  .dashboard-main-grid { grid-template-columns: 1fr; }
}

/* Filters */
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}
.filters .full { grid-column: 1 / -1; }
@media (max-width: 768px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .filters { grid-template-columns: 1fr; } }

/* ─── 7. Tables (compact) ─── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -18px;
  padding: 0 18px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.table th, .table td {
  border-top: 1px solid var(--line);
  padding: 9px 12px;
  vertical-align: top;
}
.table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6F6A60;
  background: var(--subcard-bg);
  white-space: nowrap;
  border-top: none;
  border-bottom: 1px solid var(--line);
}
.table tr.clickable-row { cursor: pointer; }
.table tr.clickable-row:hover td { background: var(--subcard-bg); }
.table tbody tr:hover td { background: var(--subcard-bg); }

/* ─── Greeting / editorial headings (EB Garamond) ─── */
.greeting {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--accent);
  letter-spacing: -0.01em;
  margin: 0;
}
.greeting-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ─── Shared page heading (eyebrow + serif title) ─── */
.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 18px;
}
.page-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.page-title {
  font-family: var(--font-serif); font-size: 30px; font-weight: 500;
  color: var(--accent); margin: 0; line-height: 1.05; letter-spacing: -0.01em;
}

/* ─── Shared pill tab filter bar ─── */
.pill-tabs { display: flex; gap: 2px; background: #EDEAE1; border-radius: 9px; padding: 3px; }
.pill-tab {
  border: none; background: none; color: var(--muted);
  font-size: 12.5px; font-weight: 600; padding: 6px 14px;
  border-radius: 7px; cursor: pointer; font-family: inherit;
  text-decoration: none; display: inline-block; transition: background 0.1s;
}
.pill-tab:hover { background: rgba(255,255,255,0.5); color: var(--text); }
.pill-tab--active { background: var(--card); color: var(--text); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
[data-theme="dark"] .pill-tabs { background: var(--subcard-bg); }
[data-theme="dark"] .pill-tab--active { background: var(--card); }
[data-theme="dark"] .pill-tab:hover { background: rgba(255,255,255,0.06); }

/* ─── Shared list section (like pl-section, used across multiple pages) ─── */
.so-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
.so-col-header {
  display: flex; align-items: center; gap: 14px; padding: 9px 16px;
  background: var(--subcard-bg); border-bottom: 1px solid var(--line);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: #6F6A60;
}
.so-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); color: var(--text);
  transition: background 0.1s; min-width: 0;
}
.so-row:last-child { border-bottom: none; }
.so-row:hover { background: var(--subcard-bg); }
.so-main { flex: 1; min-width: 0; }
.so-name { font-size: 13.5px; font-weight: 700; }
.so-name a { color: var(--text); text-decoration: none; }
.so-name a:hover { color: var(--accent); text-decoration: underline; }
.so-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Client list avatar */
.cl-avatar {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--accent); color: #F6F2EA;
}
.cl-billing { flex: 0 0 90px; font-size: 12px; color: var(--muted); }
.cl-contacts { flex: 0 0 70px; font-size: 12.5px; color: var(--muted); text-align: right; }
.cl-status { flex: 0 0 80px; }
.cl-actions { flex-shrink: 0; display: flex; gap: 4px; align-items: center; }

/* Invoice list */
.inv-num { flex: 0 0 90px; font-size: 13px; font-weight: 700; }
.inv-client { flex: 1; min-width: 0; font-size: 13px; }
.inv-date { flex: 0 0 80px; font-size: 12px; color: var(--muted); text-align: right; }
.inv-due  { flex: 0 0 76px; font-size: 12px; text-align: right; }
.inv-total { flex: 0 0 80px; font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.inv-status { flex: 0 0 120px; font-size: 12px; }
.inv-actions { flex-shrink: 0; display: flex; gap: 4px; }
@media (max-width: 900px) {
  .inv-date, .cl-contacts { display: none; }
}
@media (max-width: 640px) {
  .inv-due, .cl-billing, .cl-status { display: none; }
}

/* ─── 8. Tab bar ─── */
.tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  font-weight: 600;
}

/* ─── 9. Deliverables + sections ─── */
.deliverable-group { margin-bottom: 24px; }
.deliverable-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 2px solid var(--line);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.deliverable-header h3 { margin: 0; font-size: 15px; }
.deliverable-dates { font-size: 13px; color: var(--muted); }
.deliverable-stats { font-size: 13px; color: var(--muted); }

.deliverable-group > details > summary { cursor: pointer; list-style: none; }
.deliverable-group > details > summary::-webkit-details-marker { display: none; }
.deliverable-group > details > summary::before {
  content: "\25B8 ";
  font-size: 12px; color: var(--muted);
  transition: transform 0.15s ease;
  display: inline-block;
}
.deliverable-group > details[open] > summary::before { transform: rotate(90deg); }

.section-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-secondary, var(--accent));
  padding: 8px 0 4px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
}

.section-compact { padding: 12px 0; }
.section-compact__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.section-compact__title { font-size: 15px; font-weight: 600; }
.section-compact__meta { font-size: 13px; color: var(--muted); }

.deliverable-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.deliverable-manage-item:last-child { border-bottom: none; }
.section-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 20px;
  font-size: 13px;
}

.ungrouped-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 0 6px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 12px;
  margin-top: 24px;
}

/* ─── 10. Comments + checklists ─── */
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: none; }
.comment__meta { font-size: 12px; margin-bottom: 4px; }
.comment__body { white-space: pre-wrap; font-size: 14px; }

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item.done .checklist-item__title {
  text-decoration: line-through;
  color: var(--muted);
}
.checklist-item__title { flex: 1; font-size: 14px; }

.checklist-toggle {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  color: var(--text);
  line-height: 1;
}
.checklist-toggle:hover { color: var(--accent); }

.checklist-add-form {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}
.checklist-add-form input { flex: 1; }

.comment-add-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.checklist-delete { display: inline; }

/* Progress bar */
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}
.progress-bar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ─── 11. Panel task detail ─── */
.panel-task__status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-task__meta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 16px;
}
.panel-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.panel-meta-row:last-child { border-bottom: none; }

.panel-section {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.panel-section__heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.panel-section__body { font-size: 14px; }

.panel-entry-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 13px;
}

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

.dependency-card {
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(173,138,80,0.08);
}

/* ─── 12. Attention items ─── */
.attention-list { display: grid; gap: 8px; margin-top: 8px; }
.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-size: 14px;
}
.attention-item--danger {
  border-color: rgba(166,54,47,0.3);
  background: rgba(166,54,47,0.04);
}
.attention-count {
  font-size: 18px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* ─── 13. Inline edit, actions, misc ─── */
.inline-edit-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 44;
}
.inline-edit-overlay.open { display: block; }

.inline-edit { position: relative; }
.inline-edit__body {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  padding: 24px;
  min-width: 340px;
  max-width: 560px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

@media (min-width: 769px) {
  .inline-edit__body {
    width: 480px;
  }
}

@media (max-width: 768px) {
  .inline-edit__body {
    right: 8px; left: 8px;
    top: auto; bottom: 8px;
    transform: none;
    max-width: none; width: auto;
    max-height: 80vh;
  }
}

/* Wider variant for multi-column forms (e.g. the deliverable edit form). */
.inline-edit--wide .inline-edit__body { max-width: 760px; }
@media (min-width: 769px) {
  .inline-edit--wide .inline-edit__body { width: 720px; }
}

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.footer { padding-bottom: 28px; }
.padtop { margin-top: 10px; }

.editform {
  display: grid;
  gap: 10px;
  max-width: 520px;
}

/* Task cards (legacy, used on project detail clock-in) */
.task-list { display: grid; gap: 10px; }
.task-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  align-items: center;
}
.task-card .btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* Project cards */
.project-grid { display: grid; gap: 12px; }
.project-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--subcard-bg);
  display: grid;
  gap: 10px;
}
.project-card.overdue { border-color: rgba(166,54,47,0.5); box-shadow: 0 0 0 1px rgba(166,54,47,0.12); }
.project-card.due_soon { border-color: rgba(173,138,80,0.5); }
.project-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.project-card__title { font-weight: 700; }
.project-card__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

/* Due dates */
.due {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.due.overdue { color: var(--danger); border-color: rgba(166,54,47,0.4); background: rgba(166,54,47,0.07); }
.due.due_soon { color: #7E5F1C; border-color: rgba(173,138,80,0.5); background: rgba(173,138,80,0.1); }

/* Trend rows */
.trend-list { display: grid; gap: 14px; }
.trend-item { display: grid; gap: 4px; }
.trend-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.trend-row:first-of-type { border-top: none; }
.trend-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(76,31,40,0.1);
  overflow: hidden;
  position: relative;
}
.trend-bar > span {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-gold));
  border-radius: inherit;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

/* Date ranges */
.date-range { font-size: 13px; color: var(--muted); }
.date-range .separator { margin: 0 4px; }

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { margin: 0 4px; }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
}
.empty-state__icon {
  display: block;
  margin: 0 auto 12px;
  width: 40px;
  height: 40px;
  opacity: 0.35;
}
.empty-state p { margin: 0 0 16px; font-size: 14px; line-height: 1.5; }
.empty-guidance {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--subcard-bg);
  padding: 14px;
  display: grid;
  gap: 6px;
}
.empty-guidance__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.empty-guidance__body {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.empty-guidance__action {
  margin-top: 2px;
  font-size: 13px;
}

/* Flash messages */
.flash-container { padding: 0 24px; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}
.flash--success { background: rgba(46,64,52,0.08); border: 1px solid rgba(46,64,52,0.25); color: var(--success); }
.flash--error { background: rgba(166,54,47,0.08); border: 1px solid rgba(166,54,47,0.25); color: var(--danger); }
.flash--info { background: rgba(46,64,52,0.07); border: 1px solid rgba(46,64,52,0.18); color: #2E4034; }
.flash--warning { background: rgba(173,138,80,0.14); border: 1px solid rgba(173,138,80,0.35); color: #7E5F1C; }
.flash__close {
  background: none; border: none;
  color: inherit; font-size: 1.2rem;
  cursor: pointer; padding: 0 4px;
  opacity: 0.6; line-height: 1;
}
.flash__close:hover { opacity: 1; }

[data-theme="dark"] .flash--success { color: #6BB090; }
[data-theme="dark"] .flash--error { color: #E07070; }
[data-theme="dark"] .flash--info { color: #8899CC; }
[data-theme="dark"] .flash--warning { color: #C9A765; }

/* Dark-mode legibility: status pills / badges / due-labels that pin a dark text
   color (#7E5F1C gold, #2E4034 navy) over a faint rgba tint read as dark-on-dark
   in dark mode. Re-point those to the adaptive --warning/--info tokens. Rules with
   a SOLID light background (e.g. .pill.job-type.ad_hoc/.music) stay legible and are
   intentionally excluded. */
[data-theme="dark"] .pill.status.in_progress,
[data-theme="dark"] .badge--type-external { color: var(--info); }
[data-theme="dark"] .pill.status.in_review,
[data-theme="dark"] .pill.health.at_risk,
[data-theme="dark"] .due.due_soon,
[data-theme="dark"] .badge.warning,
[data-theme="dark"] .badge--type-leadership,
[data-theme="dark"] .portal-status--in_progress,
[data-theme="dark"] .portal-status--in_review,
[data-theme="dark"] .portal-invoice-status--partially-paid { color: var(--warning); }

/* Clock banner (legacy, kept for compat) */
.clock-banner {
  border-bottom: 1px solid var(--line);
  background: rgba(76,31,40,0.06);
  padding: 8px 24px;
}
.clock-banner__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.clock-banner__meta { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
.clock-banner__title { font-weight: 700; }
.clock-banner__detail { font-size: 13px; }
.clock-banner__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.clock-banner__timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.35);
  font-size: 13px;
}

/* Statements */
.statement-card { display: grid; gap: 14px; }
.statement-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.statement-contact { display: flex; gap: 6px; flex-wrap: wrap; }
.statement-period { text-align: right; min-width: 200px; }
.statement-period__range { font-size: 1.1rem; font-weight: 600; margin-top: 6px; }
.statement-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--subcard-bg);
}

/* Aging */
.aging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.aging-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg);
}

/* Ledger */
.ledger-table td .ledger-title { font-weight: 600; }
.ledger-table tfoot th { border-top: 2px solid var(--line); font-weight: 700; }

/* Wrap (legacy, used in some templates) */
.wrap { max-width: 1100px; margin: 0 auto; padding: 18px; }

/* Task create options */
.task-create-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

/* ─── 14. Login page ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 18px;
}
.login-card { padding: 32px 28px; }
.login-header { text-align: center; margin-bottom: 24px; }
.login-logo { border-radius: 12px; margin-bottom: 12px; }
.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.login-btn { width: 100%; margin-top: 4px; }

/* "or" divider between the password form and the Microsoft sign-in button. */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
/* Microsoft SSO button: keep the multi-color logo + label centered together. */
.login-ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.login-ms-btn svg { flex: 0 0 auto; }

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}
.password-field input {
  width: 100%;
  padding-right: 40px;
}
.password-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  line-height: 1;
}
.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── 15. Mobile responsive ─── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 60;
  }
  .sidebar.open {
    transform: translateX(0);
    padding-top: env(safe-area-inset-top);
  }
  .main-area {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }
  .panel {
    width: 100%;
    width: 100dvw;
  }
  .mobile-menu-toggle { display: block; }

  .page-content { padding: 12px; }
  .page-header { padding: 10px 12px; }

  .task-row {
    grid-template-columns: auto 1fr;
    gap: 4px;
  }
  .task-row__priority, .task-row__meta {
    grid-column: 2;
    font-size: 12px;
  }

  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  input, select, textarea {
    font-size: 16px !important;
  }
}

/* ─── 16. Utilities ─── */
.dep-icon { margin-right: 2px; }
.dependency-detail { display: grid; gap: 8px; }
.font-serif { font-family: var(--font-serif); }

/* ─── 17. Billable indicators ─── */
.pill.billable {
  background: var(--success);
  color: #FBF9F4;
}
.pill.non-billable {
  background: var(--line);
  color: var(--muted);
}

.billable-dot {
  color: var(--success);
  font-size: 10px;
}
.non-billable-dot {
  color: var(--muted);
  font-size: 10px;
}

.internal-banner {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--subcard-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

/* ─── 18. Task entry links ─── */
.task-entry-link {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.task-entry-link:hover {
  text-decoration: underline;
}
.entry-note {
  font-size: 13px;
  margin-top: 2px;
}

/* ─── 19. Quick clock-in (dashboard) ─── */
.quick-clock-in {
  padding: 12px 0;
}
.quick-clock-in .inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.quick-clock-in select,
.quick-clock-in input[type="text"] {
  flex: 1;
  min-width: 160px;
}
.clock-in-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.clock-in-form__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.clock-in-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.clock-in-field__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.clock-in-field select,
.clock-in-field input {
  width: 100%;
}
.clock-in-field--full {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .clock-in-form__fields {
    grid-template-columns: 1fr;
  }
}

/* ─── 20. Clock-in note field ─── */
.clock-in-note {
  font-size: 13px;
  padding: 4px 8px;
  max-width: 200px;
}

/* ─── 21. Sidebar timer task ─── */
.sidebar__timer-task {
  font-size: 12px;
  color: var(--sidebar-muted, #999);
  margin: 2px 0 4px;
}
.sidebar__timer-task a {
  color: var(--sidebar-muted, #999);
  text-decoration: none;
}
.sidebar__timer-task a:hover {
  color: var(--sidebar-text);
  text-decoration: underline;
}

/* ── Quick-edit controls ─────────────────────────────────────────────────── */

/* Panel metadata grid */
.panel-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.panel-meta__row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.panel-meta__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Pill-styled select (looks like a pill but is a dropdown) */
.pill-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 3px 24px 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A7C86' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}
.pill-select:hover { border-color: var(--accent-gold); }
.pill-select:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(173,138,80, 0.2);
}

/* Status-colored pill selects */
.pill-select.status.not_started { background-color: var(--line); color: var(--text); }
.pill-select.status.in_progress { background-color: #2E4034; color: #FBF9F4; border-color: #2E4034; }
.pill-select.status.in_review   { background-color: var(--accent-gold); color: #231016; border-color: var(--accent-gold); }
.pill-select.status.approved    { background-color: var(--success); color: #FBF9F4; border-color: var(--success); }
.pill-select.status.complete    { background-color: var(--muted); color: #FBF9F4; border-color: var(--muted); }
.pill-select.status.blocked     { background-color: var(--danger); color: #FBF9F4; border-color: var(--danger); }

/* Priority-colored pill selects */
.pill-select.priority.urgent { background-color: #A6362F; color: #FBF9F4; border-color: #A6362F; }
.pill-select.priority.high   { background-color: #AD8A50; color: #231016; border-color: #AD8A50; }
.pill-select.priority.medium { background-color: #8A7C86; color: #FBF9F4; border-color: #8A7C86; }
.pill-select.priority.low    { background-color: #E5E2D9; color: #6F6A60; }

/* White dropdown arrow on dark colored backgrounds, dark arrow on light colored */
.pill-select.status.in_progress,
.pill-select.status.approved,
.pill-select.status.complete,
.pill-select.status.blocked,
.pill-select.priority.urgent,
.pill-select.priority.medium {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
.pill-select.status.in_review,
.pill-select.priority.high {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23231016' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Quick select and date input (non-pill styled, for worker/date) */
.quick-select,
.quick-date {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  width: 100%;
}
.quick-select:hover,
.quick-date:hover { border-color: var(--accent-gold); }
.quick-select:focus,
.quick-date:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(173,138,80, 0.2);
}

/* Inline field form (no visible form chrome) */
.inline-field {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

/* Task meta bar (full page quick-edit) */
#task-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
#task-meta .panel-meta__row { display: flex; flex-direction: column; gap: 2px; }

/* ─── PWA / Mobile UX polish ─── */
body {
  overscroll-behavior-y: contain;
}

.sidebar__link, .sidebar__brand, .sidebar__timer, .tab, .btn, .pill-select {
  -webkit-user-select: none;
  user-select: none;
}

.sidebar__link, .btn, .task-row, .tab {
  -webkit-tap-highlight-color: rgba(76, 31, 40, 0.12);
}

/* ─── Bulk action bar ─── */
.bulk-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width, 230px);
  right: 0;
  background: var(--card);
  border-top: 2px solid var(--accent-gold);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 35;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}
.bulk-bar__count {
  font-weight: 600;
  font-size: 14px;
  min-width: 120px;
}
.bulk-bar__action {
  font-size: 14px;
  padding: 6px 10px;
  min-width: 200px;
}

@media (max-width: 768px) {
  .bulk-bar {
    left: 0;
    padding: 10px 16px;
    flex-wrap: wrap;
  }
  .bulk-bar__action {
    min-width: 0;
    flex: 1;
  }
}

/* Task checkbox in rows */
.task-checkbox {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-gold);
}

/* Section select-all */
.section-select-all {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  cursor: pointer;
  accent-color: var(--accent-gold);
}

/* Inline bulk bar (for deliverable/section management) */
.bulk-bar--inline {
  position: static;
  border-top: none;
  box-shadow: none;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--subcard-bg);
}

/* Deliverable/section manage item checkboxes */
.deliverable-checkbox,
.section-checkbox {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-gold);
}

/* Auto-computed status indicator */
.auto-indicator {
  font-size: 10px;
  margin-left: 3px;
  opacity: 0.6;
  vertical-align: middle;
}

/* Completion banner */
.completion-banner {
  background: rgba(46,64,52, 0.08);
  border: 1px solid rgba(46,64,52, 0.25);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* Panel danger zone */
.panel-danger-zone {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* Project workspace/support inline-edit popovers (e.g. a deliverable's
   "Add Task" form) intentionally use the shared .inline-edit__body modal
   styling defined above — fixed + centered, with max-height and
   overflow-y so the form scrolls and its submit button stays reachable,
   theme-aware, and bounded to the viewport.
   A previous override here positioned them as an absolute `right: 0`
   dropdown anchored to a narrow trigger button, with no max-height; that
   pushed the panel — and the "Add task"/Save button — off-screen, so it
   was removed in favor of the shared modal. */


/* Project detail workspace redesign */
.project-workspace-header {
  display: grid;
  gap: 14px;
}
.project-workspace-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.work-creation-strip {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.work-creation-strip details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--subcard-bg);
}
.workspace-main {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
.workspace-main__heading {
  margin-bottom: 4px;
}
.deliverable-card {
  border-left: 4px solid var(--accent);
}
.deliverable-card > details > summary {
  list-style: none;
  cursor: pointer;
}
.deliverable-card > details > summary::-webkit-details-marker { display: none; }
.deliverable-card__summary {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.deliverable-card__summary > div { flex: 1 1 auto; min-width: 0; }
.deliverable-card__summary strong {
  display: inline-block;
  overflow-wrap: anywhere;
}
.deliverable-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.deliverable-card__body {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.workspace-task-list {
  display: grid;
  gap: 8px;
}
.workspace-task-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: var(--card);
}
.workspace-task-row__main,
.workspace-task-row__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.workspace-task-row__title {
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}
.workspace-task-row__main { min-width: 0; }
.workspace-task-row__actions { justify-content: flex-end; }
.drag-handle {
  cursor: grab;
  color: var(--muted, #aaa);
  padding: 0 4px;
  user-select: none;
  flex-shrink: 0;
  font-size: 13px;
  letter-spacing: -2px;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.drag-handle:hover { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.deliverable-drag-handle { align-self: center; }
.sortable-ghost { opacity: 0.35; }
.sortable-chosen { box-shadow: 0 0 0 2px var(--accent); }
.support-workspace { margin-top: 18px; }
.support-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.support-tabs .active {
  border-color: var(--accent);
  color: var(--accent);
}
.support-pane { display: none; }
.support-pane.active { display: block; }

@media (max-width: 900px) {
  .workspace-task-row { grid-template-columns: 1fr; }
  .deliverable-card__summary { flex-direction: column; }
  .deliverable-card__actions { justify-content: flex-start; }
  .workspace-task-row__actions { justify-content: flex-start; }
}

/* ─── Sortable table headers ─── */
th[data-sort] {
  user-select: none;
  white-space: nowrap;
}
th[data-sort]:hover { background: var(--subcard-bg); }
th[data-sort]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.sort-chevron {
  display: inline-block;
  font-size: 11px;
  margin-left: 2px;
  color: var(--muted);
}
th[aria-sort="ascending"] .sort-chevron,
th[aria-sort="descending"] .sort-chevron { color: var(--accent); }

/* ─── Keyboard focus for table row actions ─── */
table a:focus-visible,
table button:focus-visible,
table summary:focus-visible,
.table-scroll a:focus-visible,
.table-scroll button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ─── Required field indicator ─── */
.required-indicator::after,
label.required::after,
label[data-required] > span:first-child::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
  margin-left: 2px;
}

/* ─── Screen-reader-only utility ─── */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Confirm dialog (replaces native confirm()) ─── */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.confirm-dialog {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  max-width: 440px;
  width: 100%;
  padding: 20px 22px;
  border: 1px solid var(--line);
}
.confirm-dialog__title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}
.confirm-dialog__message {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Badge component ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: var(--subcard-bg);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1.4;
}
.badge.success { background: rgba(46,64,52,0.1); border-color: rgba(46,64,52,0.3); color: var(--success); }
.badge.warning { background: rgba(173,138,80,0.14); border-color: rgba(173,138,80,0.4); color: #7E5F1C; }
.badge.danger  { background: rgba(166,54,47,0.08); border-color: rgba(166,54,47,0.3); color: var(--danger); }
.badge.muted   { background: transparent; border-color: var(--line); color: var(--muted); }
.badge.info    { background: rgba(46,64,52,0.07); border-color: rgba(46,64,52,0.2); color: var(--info); }

/* ─── Secondary button ─── */
.btn.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn.secondary:hover {
  background: var(--subcard-bg);
  border-color: var(--muted);
  color: var(--text);
}

/* ─── List component ─── */
.list {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 8px;
}
a.list-item,
div.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
}
.list > a.list-item:last-child,
.list > div.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--subcard-bg); text-decoration: none; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.list-item__meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 2px;
}
.list-item__aside {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.list-item__actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.list-item--block { flex-direction: column; align-items: flex-start; gap: 8px; }

/* ─── Form block ─── */
.form-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--subcard-bg);
  margin: 12px 0;
}
.form-block__title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

/* ─── Form grid ─── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
}

/* ─── Link list ─── */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: grid;
  gap: 4px;
  font-size: 14px;
}

/* ─── DL grid ─── */
.dl-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 14px;
  align-items: baseline;
  margin-bottom: 12px;
}
.dl-grid dt { color: var(--muted); font-size: 13px; }
.dl-grid dd { margin: 0; }

/* ─── Detail grid ─── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 16px;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* ─── Meta row ─── */
.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}

/* ─── Prose ─── */
.prose { font-size: 14px; line-height: 1.6; }

/* ─── Meetings page ─── */
.meeting-live-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0 4px;
  background: rgba(76,31,40,0.06);
  border: 1px solid rgba(76,31,40,0.18);
  border-radius: var(--radius);
  flex-wrap: wrap;
  font-size: 14px;
}
.meeting-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: meetingLivePulse 2s ease-in-out infinite;
}
@keyframes meetingLivePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(76,31,40,0.5); }
  60%       { opacity: 0.8; box-shadow: 0 0 0 5px rgba(76,31,40,0); }
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 16px 0 7px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.meeting-list { display: grid; }

.meeting-row {
  display: grid;
  grid-template-columns: 4px 80px 1fr auto;
  gap: 0 14px;
  align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
  border-radius: var(--radius);
  margin: 1px 0;
}
.meeting-row:last-child { border-bottom: none; }
.meeting-row:hover { background: var(--subcard-bg); text-decoration: none; }
.meeting-row--past { opacity: 0.78; }
.meeting-row--past:hover { opacity: 1; }

.meeting-row__bar {
  align-self: stretch;
  border-radius: 2px;
  min-height: 36px;
}
.meeting-row__bar--internal   { background: #9691A0; }
.meeting-row__bar--client     { background: var(--accent); }
.meeting-row__bar--leadership { background: var(--accent-gold); }
.meeting-row__bar--external   { background: #2E4034; }

.meeting-row__date { text-align: right; line-height: 1.4; }
.meeting-row__date-day  { font-weight: 700; font-size: 13px; }
.meeting-row__date-time { font-size: 12px; color: var(--muted); }

.meeting-row__body { min-width: 0; }
.meeting-row__title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.meeting-row__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.meeting-row__project-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  background: rgba(76,31,40,0.07);
  color: var(--accent);
  border: 1px solid rgba(76,31,40,0.15);
}

.meeting-row__aside {
  text-align: center;
  flex-shrink: 0;
  min-width: 52px;
}
.meeting-row__attendee-count { font-size: 18px; font-weight: 700; line-height: 1.1; }
.meeting-row__attendee-label { font-size: 11px; color: var(--muted); }

/* Per-type badge tint */
.badge--type-internal   { background: var(--subcard-bg); color: var(--muted); border-color: var(--line); }
.badge--type-client     { background: rgba(76,31,40,0.08); color: var(--accent); border-color: rgba(76,31,40,0.2); }
.badge--type-leadership { background: rgba(173,138,80,0.12); color: #7E5F1C; border-color: rgba(173,138,80,0.3); }
.badge--type-external   { background: rgba(46,64,52,0.07); color: #2E4034; border-color: rgba(46,64,52,0.18); }

@media (max-width: 640px) {
  .meeting-row { grid-template-columns: 4px 60px 1fr; }
  .meeting-row__aside { display: none; }
}

/* ─── Print styles ─── */
@media print {
  /* Hide navigation and UI chrome */
  .sidebar,
  .page-header,
  .panel-overlay,
  .panel,
  .inline-edit-overlay,
  .flash-container,
  .mobile-menu-toggle,
  .btn,
  .actions,
  .form-actions,
  details.inline-edit > summary,
  .filters,
  .bulk-bar,
  nav {
    display: none !important;
  }

  /* Full-width content */
  .app-layout { display: block; }
  .main-area {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .page-content { padding: 0; }

  /* Cards print without shadow */
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  /* Clean table borders */
  table { border-collapse: collapse; width: 100%; }
  th, td { border: 1px solid #ccc; padding: 6px 8px; }
  thead { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; }

  /* Don't break rows across pages */
  tr { page-break-inside: avoid; }

  /* Show full URLs on links */
  a[href]::after { content: " (" attr(href) ")"; font-size: 10px; color: #666; }
  a.btn::after, .actions a::after { content: none; }

  body { font-size: 11pt; color: #000; background: #FBF9F4; }
  h1 { font-size: 16pt; }
  h2 { font-size: 13pt; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Client Portal (Phase 7)
   Standalone, mobile-first surface for client contacts.
   ============================================================ */
.portal-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.portal-topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 32px;
  height: 66px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
}
.portal-logo { border-radius: 8px; }
.portal-brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #F6F2EA;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  flex-shrink: 0;
}
.portal-brand__name { line-height: 1; }
.portal-nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}
.portal-nav a {
  padding: 22px 0;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
}
.portal-nav a:hover { color: var(--text); }
.portal-nav a.is-active { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.portal-account {
  display: flex;
  align-items: center;
  gap: 12px;
}
.portal-account__text { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.portal-account__name { color: var(--text); font-size: 0.85rem; font-weight: 600; }
.portal-account__org { color: var(--muted); font-size: 0.72rem; }
.portal-account__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--info);
  color: #F6F2EA;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.portal-signout {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
  text-decoration: none;
}
.portal-signout:hover { color: var(--accent); text-decoration: underline; }
.portal-logout-form { margin: 0; }
.portal-main { flex: 1; width: 100%; }
.portal-content,
.portal-narrow {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  box-sizing: border-box;
}
.portal-narrow { max-width: 540px; }
.portal-content.portal-narrow { max-width: 640px; }
.portal-footer {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.portal-card { padding: 24px; margin-bottom: 20px; }
.portal-card--flush { padding: 0; overflow: hidden; }
.portal-h1 { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; color: var(--accent); font-size: 1.6rem; margin: 0 0 4px; }
.portal-h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.15rem; margin: 0 0 12px; }
.portal-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.portal-breadcrumb { margin: 0 0 8px; }
.portal-breadcrumb a { color: var(--muted); text-decoration: none; font-weight: 600; }
.portal-help { margin-top: 16px; font-size: 0.85rem; }
.portal-breakdown-link { margin: 14px 0 0; font-weight: 600; }
.portal-prewrap { white-space: pre-wrap; line-height: 1.55; }
.portal-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Deliverable files + option selection (was inline-styled with hardcoded colors) */
.portal-deliverable-files { margin-top: .75rem; display: flex; flex-direction: column; gap: .75rem; }
.portal-option { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; }
.portal-option--chosen { border-color: var(--success); }
.portal-file--image { margin: 0; }
.portal-file--image img {
  max-width: 100%;
  max-height: 340px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

/* Project cards */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.portal-project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.portal-project-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.portal-project-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.portal-card-cta { color: var(--accent); font-weight: 600; font-size: 0.9rem; margin-top: auto; }

/* Lists */
.portal-list { list-style: none; margin: 0; padding: 0; }
.portal-list__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.portal-list__item:last-child { border-bottom: none; }
.portal-list__item--block { flex-direction: column; }
.portal-list__main { min-width: 0; }
.portal-note-meta { margin-top: 6px; font-size: 0.8rem; }

/* Status pills */
.portal-status { text-transform: capitalize; }
.portal-status--complete,
.portal-status--approved,
.portal-status--closed { background: rgba(46,64,52,0.12); color: var(--success); }
.portal-status--in_progress { background: rgba(173,138,80,0.16); color: #7E5F1C; }
.portal-status--in_review { background: rgba(46,64,52,0.10); color: var(--info); }
.portal-status--open { background: rgba(46,64,52,0.08); color: var(--info); }
.portal-status--blocked,
.portal-status--on_hold { background: rgba(166,54,47,0.12); color: var(--danger); }
.portal-status--not_started { background: var(--subcard-bg); color: var(--muted); }

/* Invoices */
.portal-table { width: 100%; }
.portal-table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.portal-invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.portal-invoice-lines { margin-bottom: 20px; }
.portal-invoice-status--paid { background: rgba(46,64,52,0.12); color: var(--success); }
.portal-invoice-status--partially-paid { background: rgba(173,138,80,0.16); color: #7E5F1C; }
.portal-invoice-status--due { background: rgba(46,64,52,0.08); color: var(--info); }
.portal-invoice-totals {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-left: auto;
  max-width: 320px;
}
.portal-total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  color: var(--muted);
}
.portal-total-row--due {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 12px;
  color: var(--accent);
  font-weight: 800;
  font-size: 1.5rem;
}
[data-theme="dark"] .portal-total-row--due { color: var(--accent-gold); }
.portal-invoice-notes { margin-top: 24px; }

@media (max-width: 640px) {
  .portal-topbar { gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
  .portal-account__name { display: none; }
  .portal-content, .portal-narrow { padding: 16px 14px 40px; }
  .portal-card { padding: 18px; }
}

/* Portal payment button block */
.portal-pay-form { margin-top: 20px; }
.portal-pay-form .btn { font-size: 1.05rem; padding: 14px 26px; box-shadow: 0 6px 18px rgba(76,31,40,0.20); }

/* ── Portal design-system components (warm-editorial) ── */
/* Uppercase taupe field/section label */
.portal-eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9A8E80;
  font-weight: 700;
}
/* Hero heading scale (project / invoice / request heroes) */
.portal-h1--hero { font-size: 2.3rem; line-height: 1.05; }
.portal-hero-status { font-size: 0.98rem; color: var(--muted); margin: 6px 0 0; }
.portal-hero-status strong { color: var(--text); text-transform: capitalize; }

/* Reusable success / confirmation icon */
.portal-success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(46,64,52,0.14);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.portal-success-icon svg { width: 28px; height: 28px; }
.portal-centered { text-align: center; max-width: 460px; margin: 0 auto; }

/* Client-facing stage tracker (mirrors design_stage pipeline) */
.portal-stages {
  display: flex;
  align-items: flex-start;
  margin: 0;
  padding: 4px 6px 0;
}
.portal-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  gap: 8px;
  min-width: 0;
}
.portal-stage::before,
.portal-stage::after {
  content: "";
  position: absolute;
  top: 12px;
  height: 2px;
  background: var(--line);
  width: 50%;
  z-index: 0;
}
.portal-stage::before { left: 0; }
.portal-stage::after { right: 0; }
.portal-stage:first-child::before,
.portal-stage:last-child::after { display: none; }
.portal-stage__dot {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.portal-stage__label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.portal-stage--done .portal-stage__dot { background: var(--accent); border-color: var(--accent); color: #F6F2EA; }
.portal-stage--done::before,
.portal-stage--done::after { background: var(--accent); }
.portal-stage--current .portal-stage__dot { border-color: var(--accent); color: var(--accent); background: var(--card); }
.portal-stage--current::before { background: var(--accent); }
.portal-stage--current .portal-stage__label,
.portal-stage--done .portal-stage__label { color: var(--text); }

/* Per-deliverable cards with tinted action footer */
.portal-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 12px;
}
.portal-section-head .portal-h2 { margin: 0; }
.portal-deliverables { display: flex; flex-direction: column; gap: 14px; }
.portal-deliverable {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.portal-deliverable__body { padding: 16px 18px; }
.portal-deliverable__head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.portal-deliverable__title { font-weight: 700; font-size: 1rem; }
.portal-deliverable__note { color: var(--muted); margin: 6px 0 0; font-size: 0.9rem; }
.portal-deliverable__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--subcard-bg);
}
.portal-deliverable__footer--review { background: rgba(173,138,80,0.10); }
.portal-deliverable__footer--approved { background: rgba(46,64,52,0.10); }
.portal-deliverable__footer--changes { background: rgba(166,54,47,0.08); }
.portal-deliverable__shared { font-size: 0.8rem; color: var(--muted); margin-left: auto; }

/* Conversation chat bubbles */
.portal-chat { display: flex; flex-direction: column; gap: 14px; margin: 0 0 18px; }
.portal-msg { display: flex; gap: 10px; align-items: flex-end; max-width: 86%; }
.portal-msg--mine { flex-direction: row-reverse; margin-left: auto; }
.portal-msg__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #F6F2EA; flex-shrink: 0;
  background: var(--accent);
}
.portal-msg--mine .portal-msg__avatar { background: var(--info); }
.portal-msg__bubble {
  background: var(--subcard-bg);
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 9px 13px;
  min-width: 0;
}
.portal-msg--mine .portal-msg__bubble {
  background: rgba(76,31,40,0.06);
  border-radius: 14px 4px 14px 14px;
}
.portal-msg__meta { font-size: 0.72rem; color: var(--muted); margin: 0 0 3px; }
.portal-msg__body { margin: 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* Selectable choice pills (request work-type) */
.portal-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.portal-choice {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--subcard-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.portal-choice input { position: absolute; opacity: 0; pointer-events: none; }
.portal-choice:has(input:checked) {
  background: rgba(76,31,40,0.08);
  border-color: var(--accent);
  color: var(--accent);
}
.portal-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Invoice meta block (Billed to / Issued / Due) */
.portal-invoice-meta {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 18px 0 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.portal-invoice-meta__group { display: flex; flex-direction: column; gap: 3px; }
.portal-invoice-meta__group--right { text-align: right; }
.portal-invoice-meta__val { font-weight: 600; }
.portal-invoice-pay-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* Consolidated admin settings page */
.settings-jump { margin: 8px 0 20px; }
.settings-jump a { margin: 0 2px; }
.settings-section { margin: 0 0 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.settings-section > h2 { margin-top: 0; }
.settings-links { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 18px; }

/* ── Notifications: bell + in-app center (Phase 11) ───────────────────────── */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
}
.notif-bell:hover { background: rgba(76,31,40,0.07); }
.notif-bell.active { color: var(--accent); }
.notif-bell__icon { width: 19px; height: 19px; display: block; }
.notif-bell__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #FBF9F4;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

/* Presence — "who else is viewing now" (Phase 6 real-time, slice 4) */
.presence { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.presence__label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.presence__dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #2E4034; color: #FBF9F4; font-size: 9.5px; font-weight: 800;
  border: 1.5px solid var(--card); margin-left: -6px;
}
.presence__dot:first-of-type { margin-left: 0; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--line);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item--unread { background: rgba(76,31,40,0.04); }
.notif-item__icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--subcard-bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}
.notif-item__body { flex: 1 1 auto; min-width: 0; }
.notif-item__link-form { margin: 0; }
.notif-item__link {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.notif-item__link:hover { color: var(--accent); text-decoration: underline; }
.notif-item__snippet { margin: 2px 0 0; font-size: 13px; }
.notif-item__time { display: block; margin-top: 4px; font-size: 12px; }
.notif-item__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.notif-item__icon svg { width: 14px; height: 14px; display: block; }
.notif-item__dismiss {
  flex: 0 0 auto;
  background: none;
  border: 0;
  padding: 5px;
  cursor: pointer;
  color: var(--muted);
  opacity: 0;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  align-self: flex-start;
}
.notif-item:hover .notif-item__dismiss { opacity: 1; }
.notif-item__dismiss:hover { color: var(--danger); background: var(--subcard-bg); }
.notif-item__dismiss svg { width: 13px; height: 13px; display: block; }

/* Phase 10 — per-project quick-view (slide-out panel + full page) */
.quickview .qv-stage { display: flex; align-items: center; gap: .5rem; margin: 0 0 .25rem; }
.quickview .qv-h { margin: 0 0 .4rem; font-size: .95rem; }
.quickview .qv-list { list-style: none; margin: 0; padding: 0; }
.quickview .qv-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .25rem 0; border-bottom: 1px solid var(--line, #eee); }
.quickview .qv-list li:last-child { border-bottom: 0; }
.quickview .qv-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.quickview .qv-metric { font-size: 1.4rem; margin: .2rem 0 0; }
.quickview .qv-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.quickview .qv-snippet { font-size: .9em; white-space: pre-wrap; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; align-items: start; }
.dash-grid .dash-wide { grid-column: 1 / -1; }

/* ===== Time-entry modal — two-column create/edit dialog (entry_modal.js) ===== */
.entry-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.40); z-index: 60;
}
.entry-modal-overlay.open { display: block; }

.entry-modal {
  position: fixed; z-index: 61;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(0,0,0,0.30);
  display: none; flex-direction: column; overflow: hidden;
  opacity: 0; transition: opacity .15s ease, transform .15s ease;
}
.entry-modal.open { display: flex; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.entry-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.entry-modal__title { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 500; color: var(--accent); }
.entry-modal__close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: var(--radius); }
.entry-modal__close:hover { background: var(--line); color: var(--text); }
.entry-modal__body { flex: 1; min-height: 0; overflow-y: auto; }

/* The form (shared by the modal body + the standalone page card) */
.entry-modal-form { display: flex; flex-direction: column; }
.entry-modal__body .entry-modal-form { padding: 18px 20px 0; }

.em-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.em-col { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.em-field { display: flex; flex-direction: column; gap: 5px; }
.em-field--grow { flex: 1; }
.em-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.em-help { font-size: 11.5px; color: var(--muted); }
.em-help code { background: var(--input-bg); padding: 0 4px; border-radius: 4px; font-size: 11px; }

/* Total-time field + Start/Stop timer button */
.em-time-row { display: flex; gap: 8px; align-items: stretch; }
.em-time-input {
  flex: 1; min-width: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text);
}
.em-time-input:disabled { opacity: 1; color: var(--accent); -webkit-text-fill-color: var(--accent); }
.em-timer-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.em-timer-btn__icon { width: 14px; height: 14px; }

.em-date-input {
  width: 100%; font: inherit; padding: 8px 12px; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg);
}
.em-textarea {
  width: 100%; resize: vertical; min-height: 120px; font: inherit;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text);
}
.em-locked {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--subcard-bg); color: var(--muted);
}

.em-radio-row { display: flex; gap: 8px; }
.em-radio {
  display: inline-flex; align-items: center; gap: 6px; flex: 1; cursor: pointer;
  font-size: 13px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius);
}
.em-radio:has(input:checked) { border-color: var(--accent); background: rgba(76,31,40,0.06); font-weight: 600; }

.em-rate-row { display: flex; gap: 10px; align-items: center; }
.em-rate-override { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.em-rate-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 2px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg);
}
.em-rate-input-wrap.is-locked { opacity: 0.55; }
.em-rate-prefix, .em-rate-suffix { color: var(--muted); font-size: 13px; }
.em-rate-input { flex: 1; min-width: 0; border: none; background: transparent; padding: 8px 4px; font: inherit; color: var(--text); text-align: right; }
.em-rate-input:focus { outline: none; }

/* Combobox — upgrades a <select data-combobox> into a searchable input + dropdown */
.em-combo { position: relative; }
.em-combo__native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.em-combo__input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text); font: inherit;
}
.em-combo__list {
  position: absolute; z-index: 5; top: calc(100% + 2px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none; max-height: 230px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow);
}
.em-combo__opt { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.em-combo__opt:hover, .em-combo__opt[aria-selected="true"] { background: var(--bg); }

.em-footer {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--card);
}
.em-footer__left, .em-footer__right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Standalone (no-JS / direct hit) page reuses the form inside a card */
.entry-modal-card .entry-modal-form { padding: 0; }
.entry-modal-card .em-footer { position: static; background: transparent; }

/* Top-bar "+ Create" menu (one entry point for creating every top-level item). */
.create-menu { position: relative; display: inline-flex; }
.create-menu__toggle { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.create-menu__plus { width: 14px; height: 14px; flex: 0 0 auto; }
.create-menu__chevron { width: 11px; height: 11px; flex: 0 0 auto; opacity: 0.85; transition: transform 0.15s; }
.create-menu__toggle[aria-expanded="true"] .create-menu__chevron { transform: rotate(180deg); }
.create-menu__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  min-width: 212px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 6px;
}
.create-menu__list[hidden] { display: none; }
.create-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
.create-menu__item:hover,
.create-menu__item:focus {
  background: var(--bg);
  outline: none;
}
.create-menu__icon { width: 16px; height: 16px; flex: 0 0 auto; color: var(--muted); }
.create-menu__item:hover .create-menu__icon,
.create-menu__item:focus .create-menu__icon { color: var(--accent); }
.create-menu__sep { height: 1px; background: var(--line); margin: 6px 4px; }

@media (max-width: 720px) {
  .em-grid { grid-template-columns: 1fr; gap: 16px; }
  .create-menu__label { display: none; }
  .create-menu__toggle { padding-left: 8px; padding-right: 8px; }
}

/* Completed to-dos: strike through the title + dim. They also sort to the bottom of the list
   (server-side via task_sort_key; ajax.js moves a row there live on the Done checkbox toggle). */
.workspace-task-row.is-complete .workspace-task-row__title,
.task-row.is-complete .task-row__title a { text-decoration: line-through; }
.workspace-task-row.is-complete,
.task-row.is-complete { opacity: 0.55; }
.task-done-check { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent, #4C1F28); }
.task-done-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; }

/* Matter number — a subtle monospace tag shown wherever a project/matter is named, so the human-
   facing matter number (SURF-0042) is ubiquitous. Rendered by the matter_tag/matter_badge helpers
   (app_core) + the projects list. Kept understated so it never competes with the project name. */
.matter-no {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ── Client portal "dropbox" (browser → SharePoint uploads) ─────────────── */
.dropbox-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.6rem 1rem;
  margin: 0.5rem 0 0;
  border: 2px dashed rgba(127, 127, 127, 0.45);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropbox-drop:hover,
.dropbox-drop:focus-visible,
.dropbox-drop.is-dragover {
  border-color: var(--brand, #4c1f28);
  background: rgba(76, 31, 40, 0.05);
  outline: none;
}
.dropbox-drop__icon { font-size: 1.6rem; line-height: 1; }
.dropbox-active,
.dropbox-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.dropbox-active__item { padding: 0.55rem 0; border-top: 1px solid rgba(127, 127, 127, 0.18); }
.dropbox-active__item:first-child { border-top: 0; }
.dropbox-active__head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.92rem; }
.dropbox-active__name { font-weight: 600; word-break: break-word; }
.dropbox-active__bar {
  height: 6px; margin: 0.35rem 0; border-radius: 4px; overflow: hidden;
  background: rgba(127, 127, 127, 0.2);
}
.dropbox-active__fill { height: 100%; width: 0; border-radius: 4px; background: #2e4034; transition: width 0.2s ease; }
.dropbox-active__item.is-done .dropbox-active__fill { background: #2e7d32; }
.dropbox-active__item.is-error .dropbox-active__fill { background: #b3261e; }
.dropbox-active__status { font-size: 0.85rem; }
.dropbox-list .dropbox-item {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.5rem 0; border-top: 1px solid rgba(127, 127, 127, 0.18);
}
.dropbox-list .dropbox-item:first-child { border-top: 0; }
.dropbox-item__name { font-weight: 600; word-break: break-word; flex: 1 1 60%; }
.dropbox-item__meta { font-size: 0.85rem; flex: 0 0 auto; }
.dropbox-item--failed .dropbox-item__meta { color: #b3261e; }

/* ---- Page-level tabs (project + client detail pages) ---- */
.pw-page-tabs { margin: 2px 2px 16px; gap: 2px; padding: 0 6px; padding-bottom: 0; }
.pw-page-tabs .btn.ghost.small { border-radius: 0; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); background: none; margin-bottom: -1px; }
.pw-page-tabs .btn.ghost.small:hover { color: var(--text); background: none; }
.pw-page-tabs .btn.ghost.small.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; background: none; }
[data-theme="dark"] .pw-page-tabs .btn.ghost.small.active { color: #D4848E; border-bottom-color: #D4848E; }

/* ---- Timeline feed (partials/timeline_feed.html, project + client pages) ---- */
.tl-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 2px; }
.tl { list-style: none; margin: 12px 0 0; padding: 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-day { position: relative; margin: 16px 0 2px; padding-left: 26px; font-size: 11px; font-weight: 700;
          text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tl-item { position: relative; padding: 7px 0 7px 26px; }
.tl-item::before { content: ""; position: absolute; left: 3px; top: 13px; width: 10px; height: 10px;
                   border-radius: 50%; background: var(--card); border: 2px solid var(--muted); }
.tl-item--work::before { border-color: var(--accent); }
.tl-item--chat::before { border-color: var(--success); }
.tl-item--client::before { border-color: var(--warning); }
.tl-item--billing::before { border-color: var(--danger); }
.tl-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.tl-line a { color: inherit; }
.tl-chip { flex-shrink: 0; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
           background: var(--subcard-bg); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tl-time { font-size: 11px; color: var(--muted); white-space: nowrap; margin-left: auto; font-variant-numeric: tabular-nums; }
.tl-detail { font-size: 12px; color: var(--muted); margin-top: 2px; padding-right: 8px; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tl-actions > details[open] { flex-basis: 100%; }

/* ─── Mobile-only chrome ───
   The bottom tab bar, drawer close button, nav backdrop, and header search toggle exist solely
   for the rebuilt small-screen experience (static/mobile.css, loaded at ≤768px). They are hidden
   here so they can never appear at desktop widths — mobile.css re-displays them. */
.mobile-tabbar,
.mobile-search-toggle,
.sidebar__close,
.mobile-nav-backdrop { display: none; }
