/* ATHESIS STUDIO OS - Application Stylesheet
   Every class below is consumed by index.html, chrome.js, or main.js.
   Classes for components that do not exist yet arrive with those components.
 */

/* ===== Base ===== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ===== Application layout (moved from index.html per 4.1) ===== */

#app {
  display: flex;
  height: 100vh;   /* fallback for browsers without dvh support */
  height: 100dvh;  /* tracks the visible viewport, not the layout one, so
                      the on-screen keyboard doesn't leave dead space or
                      clip the chrome (task 11) */
  overflow: hidden;
}

#nav-rail {
  width: var(--rail-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

#nav-mount {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

#topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-16);
  flex-shrink: 0;
}

#screen-mount {
  flex: 1;
  overflow: auto;
}

#footbar {
  height: var(--footbar-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-16);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ===== Rail ===== */

.rail {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-16) var(--space-12);
  gap: var(--space-12);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
}

.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.85;
}

.brand-wordmark {
  height: 28px;
  width: auto;
  object-fit: contain;
  /* Invert the dark wordmark so it reads on the dark rail background */
  filter: invert(1) brightness(0.85);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  height: 36px;                 /* 6.3 */
  padding: 0 var(--space-12);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background var(--duration-standard) var(--easing-standard),
              color var(--duration-standard) var(--easing-standard);
  white-space: nowrap;
}

.nav-item:hover { background: var(--bg-raised); }

.nav-item.active {
  background: var(--gold-wash);
  color: var(--gold);
}

.rail-spacer { flex: 1; }

/* ===== Media player ===== */

.player {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-12);
}

/* Track name + load button side by side */
.player-track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  margin-top: var(--space-4);
}

.player-track {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Load audio file button — sits flush next to track name */
.player-load-btn {
  flex-shrink: 0;
  padding: 3px;
  opacity: 0.45;
  transition: opacity var(--duration-standard), color var(--duration-standard);
  color: var(--text-secondary);
}
.player-load-btn:hover {
  opacity: 1;
  color: var(--gold);
}

.player-elapsed {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

.player-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-top: var(--space-8);
}

.player-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  transition: color var(--duration-standard);
}

.player-btn:hover { color: var(--text-primary); }

.player-btn.engaged { color: var(--gold); }

.player-toggle {
  width: 32px;
  height: 32px;
  border: 2px solid var(--gold);
  border-radius: var(--radius-full);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.player-toggle:hover { color: var(--gold-hover); border-color: var(--gold-hover); }

/* ===== Top bar ===== */

.topbar-context .context-title {
  font-size: 15px;
  font-weight: 600;
}

.topbar-context .context-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

/* Sync status dot — 8 px circle left of the bell */
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
  transition: background 0.3s;
}
.sync-dot[data-status="saved"]   { background: var(--color-success, #4caf50); }
.sync-dot[data-status="saving"]  { background: var(--gold); animation: sync-pulse 1s ease-in-out infinite; }
.sync-dot[data-status="error"]   { background: var(--color-danger, #f44336); }
.sync-dot[data-status="offline"] { background: var(--text-tertiary); }
/* Queued locally but not yet written to the server — steady, not alarming. */
.sync-dot[data-status="pending"]  { background: var(--gold); opacity: 0.55; }
/* Conflict requires an explicit resolution from the user. */
.sync-dot[data-status="conflict"] {
  background: var(--color-warning, #ff9800);
  box-shadow: 0 0 0 2px rgba(255, 152, 0, 0.28);
  animation: sync-pulse 1.8s ease-in-out infinite;
}

@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

.bell-wrap { position: relative; }

.bell-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background var(--duration-standard);
}

.bell-btn:hover { background: var(--bg-raised); }

.badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  background: var(--status-busy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.popover {
  position: absolute;
  top: calc(100% + var(--space-8));
  right: 0;
  width: min(280px, 90vw);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
  z-index: 100;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  animation: popover-in var(--duration-enter) var(--easing-standard);
}

.popover-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-8);
}

.popover-empty {
  font-size: 12px;
  color: var(--text-secondary);
  padding: var(--space-8) 0;
}

.popover-item {
  font-size: 12px;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.popover-item.read { color: var(--text-tertiary); }

@keyframes popover-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.user-block {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #000;
  flex-shrink: 0;
}

.user-name { font-size: 12px; font-weight: 500; }

.user-role { font-size: 11px; color: var(--text-tertiary); }

/* ===== Footer ===== */

.foot-gold { color: var(--gold); }

/* Wordmark image in the footer — kept small so it sits in the bar */
.foot-wordmark {
  height: 18px;
  width: auto;
  display: block;
  opacity: 0.75;
  transition: opacity var(--duration-standard);
  filter: brightness(1.1);
}
.foot-wordmark:hover { opacity: 1; }

.foot-center { color: var(--text-secondary); }

/* ===== Screens ===== */

.screen-stub { padding: var(--space-32); }

.screen-stub h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-12);
}

.screen-stub p {
  color: var(--text-secondary);
  margin: 0;
}

.not-found-screen .card-eyebrow { margin-bottom: var(--space-12); }

.not-found-screen h1 { margin-bottom: var(--space-8); }

.not-found-screen p { margin-bottom: var(--space-24); }

.not-found-link {
  display: inline-block;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.not-found-link:hover { text-decoration: underline; }

/* ===== Buttons (consumed by the notification popover today,
   by everything else from Stage 4) ===== */

.btn {
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  transition: background var(--duration-standard), border-color var(--duration-standard);
}

.btn:hover { background: var(--bg-raised); }

.btn:active { opacity: 0.85; }

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
  font-weight: 600;
}

.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }

.btn-small {
  padding: var(--space-4) var(--space-8);
  font-size: 12px;
  margin-top: var(--space-8);
}

/* ===== Eyebrow label (6.2): used by the player, then everywhere ===== */

.card-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ===== Tasks screen (Stage 2 slice) ===== */

.tasks-screen, .projects-screen {
  padding: var(--space-24) var(--space-32);
  max-width: 760px;
}

.tasks-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-16);
  flex-wrap: wrap;
}

.tasks-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: var(--space-4) 0 0;
}

.tasks-progress { min-width: 180px; }

.tasks-progress-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  text-align: right;
}

.prog {
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width var(--duration-standard) var(--easing-standard);
}

.filter-row {
  display: flex;
  gap: var(--space-8);
  margin: var(--space-16) 0 var(--space-12);
}

.filter-chip {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-full);
  transition: all var(--duration-standard) var(--easing-standard);
}

.filter-chip:hover { background: var(--bg-raised); color: var(--text-primary); }

.filter-chip.on {
  background: var(--gold-wash);
  border-color: var(--gold-dim);
  color: var(--gold);
}

.task-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
}

.task-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-standard);
}

.task-row:last-child { border-bottom: none; }

.task-row:hover { background: var(--bg-raised); }

.task-row.done .task-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.task-check {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: transparent;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration-standard) var(--easing-standard);
}

.task-check:hover { border-color: var(--gold); }

.task-check.checked {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
}

.task-body { flex: 1; min-width: 0; }

.task-title {
  font-size: 13px;
  font-weight: 500;
  transition: color var(--duration-standard);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-top: 2px;
}

.chip-tone {
  font-size: 11px;
  font-weight: 500;
  padding: 1px var(--space-8);
  border-radius: var(--radius-full);
}

.tone-pre     { color: var(--phase-pre);     background: var(--phase-pre-soft); }
.tone-prod    { color: var(--phase-prod);    background: var(--phase-prod-soft); }
.tone-post    { color: var(--phase-post);    background: var(--phase-post-soft); }
.tone-release { color: var(--phase-release); background: var(--phase-release-soft); }

.prio-high { font-size: 11px; color: var(--status-busy); font-weight: 600; }
.prio-low  { font-size: 11px; color: var(--text-tertiary); }

.task-right {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.task-due {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.task-due.overdue { color: var(--status-busy); font-weight: 600; }

.avatar-sm { width: 24px; height: 24px; font-size: 10px; }

.task-empty {
  padding: var(--space-24);
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}

.tasks-hint {
  margin-top: var(--space-12);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ===== Projects screen (Stage 2 slice) ===== */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-12);
  margin-top: var(--space-16);
}

.project-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  transition: border-color var(--duration-standard);
}

.project-card:hover { border-color: var(--border-strong); }

.project-name { font-size: 15px; font-weight: 600; }

.project-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 2px 0 var(--space-12);
}

.admin-project-context {
  margin-top: 3px;
  font-size: 10px;
  color: var(--phase-release);
}

.project-progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.project-pct {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.project-counts { font-size: 11px; color: var(--text-tertiary); }

.projects-note {
  margin-top: var(--space-16);
  font-size: 11px;
  color: var(--text-tertiary);
}

.context-menu {
  position: fixed;
  z-index: 1002;
  min-width: 180px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  padding: var(--space-4, 4px) 0;
  display: flex;
  flex-direction: column;
}

.context-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary, #f5f5f5);
  font-size: 13px;
  padding: var(--space-8) var(--space-12);
  cursor: pointer;
}

.context-menu-item:hover:not(:disabled),
.context-menu-item:focus-visible {
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
  outline: none;
}

.context-menu-item:disabled { opacity: 0.4; cursor: not-allowed; }
.context-menu-item.destructive { color: var(--status-busy, #e5484d); }

/* ---- Row actions button -------------------------------------------------
   The visible door to the context menu (action-menu.js). A right-click
   does not exist under a finger, so this is the ONLY way these actions
   are reachable on a phone -- which is exactly why it is a full 44px
   target here rather than only under the mobile breakpoint. */

.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 8px);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.row-action-btn:hover { background: var(--bg-raised); color: var(--text-primary); }
.row-action-btn:focus-visible { outline: none; border-color: var(--gold); color: var(--text-primary); }
.row-action-btn[aria-expanded="true"] { background: var(--bg-raised); color: var(--text-primary); }

/* Inside a week column the row is already tight; keep the target but
   drop the padding that would push the chip text out of the column. */
.calendar-chip-row .row-action-btn { min-width: 32px; }

.toast-stack {
  position: fixed;
  bottom: calc(var(--space-16) + env(safe-area-inset-bottom, 0px));
  right: calc(var(--space-16) + env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  z-index: 1001;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-16);
  max-width: 320px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  animation: toast-in var(--duration-enter) var(--easing-standard);
  font-size: 13px;
}

.toast.leaving { opacity: 0; transition: opacity 150ms; }

.toast-action {
  background: none;
  border: none;
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
  padding: 0;
}

.toast-action:hover { color: var(--gold-hover); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.devtests { padding: var(--space-24) var(--space-32); max-width: 640px; }

.devtests-sub { font-size: 12px; color: var(--text-tertiary); margin: 4px 0 var(--space-16); }

.devtests-summary {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-4) var(--space-12);
  border-radius: var(--radius-md);
  margin-right: var(--space-12);
}

.devtests-summary.all-pass { color: var(--status-ok); background: rgba(74,222,128,0.1); }
.devtests-summary.has-fail { color: var(--status-busy); background: rgba(248,113,113,0.1); }

.devtests-list { margin-top: var(--space-16); border-top: 1px solid var(--border-subtle); }

.devtests-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  flex-wrap: wrap;
}

.devtests-icon { width: 14px; font-weight: 700; }
.devtests-row.pass .devtests-icon { color: var(--status-ok); }
.devtests-row.fail .devtests-icon { color: var(--status-busy); }
.devtests-name { flex: 1; color: var(--text-primary); }
.devtests-ms { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 11px; }
.devtests-error { width: 100%; color: var(--status-busy); font-family: var(--font-mono); font-size: 11px; padding-left: 22px; }

/* ===== Project scope selector (Tasks screen) ===== */

.project-scope-row { margin: var(--space-12) 0 0; }

.project-scope-select {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  transition: border-color var(--duration-standard);
}

.card:hover { border-color: var(--border-strong); }

.card-footer-link {
  display: block;
  margin-top: var(--space-12);
  font-size: 11px;
  color: var(--gold);
  font-weight: 500;
}

.card-footer-link:hover { color: var(--gold-hover); }

.dashboard { padding: var(--space-24) var(--space-32) var(--space-32); }

.dash-grid {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  gap: var(--space-12);
  align-items: start;
}

.dash-col { display: flex; flex-direction: column; gap: var(--space-12); min-width: 0; }

.dash-card { display: flex; flex-direction: column; }

/* ---- Hero (9.3, 6.6) ---- */

.dash-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-32) 0;
  text-align: center;
  position: relative;
}

.dash-hero-mark {
  width: 56px;
  height: 56px;
  color: var(--text-tertiary);
  opacity: 0.08;
  margin-bottom: var(--space-8);
}

.dash-hero-wordmark {
  max-width: 260px;
  width: 100%;
  height: auto;
  display: block;
  /* Slight brightness boost so it reads on dark bg */
  filter: brightness(1.05);
}

/* Legacy fallback — hidden when the img loads */
.dash-hero-word {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  display: none;
}

.dash-hero-rule {
  width: 200px;
  height: 1px;
  background: var(--gold);
  margin: var(--space-12) 0;
}

.dash-hero-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.36em;
  color: var(--text-tertiary);
}

.dash-hero.animate-in .dash-hero-mark     { animation: hero-mark 600ms var(--easing-standard) both; }
.dash-hero.animate-in .dash-hero-wordmark { animation: hero-word 400ms var(--easing-standard) 200ms both; }
.dash-hero.animate-in .dash-hero-word     { animation: hero-word 400ms var(--easing-standard) 200ms both; }
.dash-hero.animate-in .dash-hero-rule     { animation: hero-rule 300ms var(--easing-standard) 500ms both; }
.dash-hero.animate-in .dash-hero-sub      { animation: hero-sub  300ms var(--easing-standard) 700ms both; }

@keyframes hero-mark { from { opacity: 0; } to { opacity: 0.08; } }
@keyframes hero-word { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hero-rule { from { width: 0; } to { width: 200px; } }
@keyframes hero-sub { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .dash-hero.animate-in .dash-hero-mark,
  .dash-hero.animate-in .dash-hero-word,
  .dash-hero.animate-in .dash-hero-rule,
  .dash-hero.animate-in .dash-hero-sub { animation: none; }
}

/* ---- Metric row (9.4) ---- */

.dash-metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-12);
}

.metric-card { min-height: 180px; }

.donut-wrap { display: flex; align-items: center; gap: var(--space-16); margin: var(--space-8) 0; }

.donut-track { fill: none; stroke: var(--bg-raised); stroke-width: 7; }
.donut-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 7;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 600ms var(--easing-standard);
}

.donut-label { display: flex; flex-direction: column; }
.donut-pct { font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.donut-caption { font-size: 11px; color: var(--text-tertiary); }

.budget-figures { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-8); }
.figure-row { display: flex; justify-content: space-between; font-size: 12px; }
.figure-label { color: var(--text-tertiary); }
.figure-value { font-family: var(--font-mono); color: var(--text-primary); }

.job-list { display: flex; flex-direction: column; gap: var(--space-12); margin-top: var(--space-4); }
.job-row { font-size: 12px; }
.job-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.job-filename { font-family: var(--font-mono); font-size: 11px; color: var(--text-primary); }
.job-pct { color: var(--text-tertiary); font-family: var(--font-mono); font-size: 11px; }
.job-check { color: var(--status-ok); font-weight: 700; }
.job-status { color: var(--text-tertiary); font-size: 11px; }

/* ---- Bottom row (9.5) ---- */

.dash-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-12);
}

.wide-card { min-height: 220px; }

.activity-list { display: flex; flex-direction: column; margin-top: var(--space-4); }
.activity-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}
.activity-row:last-child { border-bottom: none; }
.activity-text { color: var(--text-primary); }
.activity-time { color: var(--text-tertiary); white-space: nowrap; font-size: 11px; }
.activity-empty { color: var(--text-tertiary); font-size: 12px; padding: var(--space-8) 0; }

.assistant-header { display: flex; justify-content: space-between; align-items: center; }
.assistant-spark { color: var(--gold); font-size: 14px; }
.assistant-greeting { font-size: 12px; color: var(--text-primary); margin: var(--space-8) 0; }
.assistant-bullets { margin: 0 0 var(--space-8); padding-left: 18px; font-size: 12px; color: var(--text-secondary); }
.assistant-bullets li { margin-bottom: 4px; }

.assistant-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-height: 90px;
  overflow-y: auto;
  margin-bottom: var(--space-8);
}
.assistant-msg { font-size: 11px; padding: var(--space-4) var(--space-8); border-radius: var(--radius-md); max-width: 88%; }
.assistant-msg-user { align-self: flex-end; background: var(--gold-wash); color: var(--gold); }
.assistant-msg-assistant { align-self: flex-start; background: var(--bg-raised); color: var(--text-primary); }
.assistant-typing { opacity: 0.6; }

.assistant-input-row { display: flex; gap: var(--space-4); margin-top: auto; }
.assistant-input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-md);
  font-size: 12px;
}
.assistant-send {
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  width: 28px;
  font-weight: 700;
}

.quick-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); margin-top: var(--space-4); }
.quick-action-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: var(--space-8);
  border-radius: var(--radius-md);
  text-align: left;
  transition: border-color var(--duration-standard);
}
.quick-action-btn:hover { border-color: var(--gold-dim); }

/* ---- Column 1: priorities, project status ---- */

.priority-list { display: flex; flex-direction: column; margin-top: var(--space-4); }
.priority-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.priority-row:last-child { border-bottom: none; }
.priority-row.done .priority-title { color: var(--text-tertiary); text-decoration: line-through; }
.priority-body { flex: 1; min-width: 0; }
.priority-title { font-size: 12px; font-weight: 500; }
.priority-sub { font-size: 11px; color: var(--text-tertiary); }
.priority-time { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

.status-list { display: flex; flex-direction: column; margin-top: var(--space-4); }
.status-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.status-row:last-child { border-bottom: none; }
.status-thumb {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg-raised); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-secondary); flex-shrink: 0;
}
.status-body { flex: 1; min-width: 0; }
.status-name { font-size: 12px; font-weight: 500; }
.status-sub { font-size: 11px; color: var(--text-tertiary); margin-bottom: 2px; }
.status-pct { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.live-chip {
  font-size: 10px; font-weight: 700; color: var(--status-busy);
  background: rgba(248,113,113,0.12); padding: 2px 6px; border-radius: var(--radius-full);
  animation: pulse 1.5s infinite;
}

/* ---- Column 3: events, availability, weather ---- */

.event-list { display: flex; flex-direction: column; margin-top: var(--space-4); }
.event-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.event-row:last-child { border-bottom: none; }
.event-icon { font-size: 14px; }
.event-body { flex: 1; min-width: 0; }
.event-title { font-size: 12px; font-weight: 500; }
.event-sub { font-size: 11px; color: var(--text-tertiary); }
.event-date { text-align: right; }
.event-month { font-size: 9px; font-weight: 700; color: var(--gold); letter-spacing: 0.05em; }
.event-day { font-size: 14px; font-weight: 600; }

.avail-list { display: flex; flex-direction: column; margin-top: var(--space-4); }
.avail-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.avail-row:last-child { border-bottom: none; }
.avail-body { flex: 1; min-width: 0; }
.avail-name { font-size: 12px; font-weight: 500; }
.avail-role { font-size: 11px; color: var(--text-tertiary); }
.avail-status { font-size: 11px; color: var(--text-secondary); display: flex; align-items: center; white-space: nowrap; }

.weather-skeleton { color: var(--text-tertiary); font-size: 12px; padding: var(--space-16) 0; }
.weather-error { font-size: 12px; color: var(--status-busy); display: flex; flex-direction: column; gap: var(--space-8); align-items: flex-start; }
.weather-headline { display: flex; align-items: baseline; gap: var(--space-8); margin: var(--space-4) 0 var(--space-12); }
.weather-temp { font-family: var(--font-mono); font-size: 28px; font-weight: 600; }
.weather-condition { font-size: 12px; color: var(--text-secondary); }
.weather-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); }
.weather-cell-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; }
.weather-cell-value { font-size: 12px; color: var(--text-primary); font-family: var(--font-mono); }

@media (max-width: 1280px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-metric-row, .dash-bottom-row { grid-template-columns: 1fr; }
}

.teams-screen { padding: var(--space-24) var(--space-32); max-width: 980px; }

.teams-layout {
  display: flex;
  gap: var(--space-16);
  align-items: flex-start;
}

.teams-dept-list {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.teams-dept-row {
  text-align: left;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-12);
  color: var(--text-primary);
  transition: background var(--duration-standard), border-color var(--duration-standard);
}

.teams-dept-row:hover { background: var(--bg-raised); }

.teams-dept-row.on {
  background: var(--gold-wash);
  border-color: var(--gold-dim);
}

.teams-dept-name { font-size: 13px; font-weight: 500; }

.teams-dept-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.teams-main { flex: 1; min-width: 0; }

.teams-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.teams-member-strip { display: flex; gap: var(--space-4); }

.teams-tabs {
  display: flex;
  gap: var(--space-4);
  margin: var(--space-16) 0 var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
}

.teams-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: var(--space-8) var(--space-4);
  margin-right: var(--space-16);
  transition: color var(--duration-standard);
}

.teams-tab:hover { color: var(--text-primary); }

.teams-tab.on { color: var(--gold); border-bottom-color: var(--gold); }

.teams-tab-content { padding-top: var(--space-8); }

/* Chat */

.chat-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  height: 420px;
}

.chat-messages { flex: 1; overflow-y: auto; padding: var(--space-12) var(--space-16); }

.chat-row { display: flex; gap: var(--space-8); padding: var(--space-8) 0; align-items: flex-start; }

.chat-body { flex: 1; min-width: 0; }

.chat-meta { display: flex; align-items: baseline; gap: var(--space-8); }

.chat-author { font-size: 12px; font-weight: 600; color: var(--text-primary); }

.chat-time { font-size: 11px; color: var(--text-tertiary); }

.chat-text { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.chat-delete {
  background: none; border: none; color: var(--text-tertiary);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px;
}

.chat-delete:hover { color: var(--status-busy); }

.chat-composer {
  display: flex;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-16);
  border-top: 1px solid var(--border-subtle);
}

.chat-input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 13px;
}

/* Files */

.files-upload-row { margin-bottom: var(--space-12); }

.files-native-input {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.files-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
}

.files-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
}

.files-row:last-child { border-bottom: none; }

.files-name { font-size: 13px; font-weight: 500; }

.files-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.files-status-col { min-width: 140px; text-align: right; }

.files-status { font-size: 11px; color: var(--text-tertiary); margin-bottom: var(--space-4); }

.files-ocr-text {
  margin-top: var(--space-8);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  padding: var(--space-8);
  max-width: 320px;
  text-align: left;
}

/* Meetings */

.meetings-panel { display: flex; flex-direction: column; gap: var(--space-8); }

.meeting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.meeting-info { display: flex; align-items: center; gap: var(--space-12); }

.meeting-title { font-size: 13px; font-weight: 500; }

.meeting-actions { display: flex; align-items: center; gap: var(--space-8); }

/* Activity (Teams) */

.activity-panel { display: flex; flex-direction: column; gap: 0; }

.activity-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
}

.activity-text { flex: 1; color: var(--text-secondary); }

.avatar-service { background: var(--bg-raised); color: var(--text-tertiary); }

/* ===== Settings screen ===== */

.settings-screen { padding: var(--space-24) var(--space-32); max-width: 640px; }

.settings-intro { font-size: 12px; color: var(--text-tertiary); margin: 4px 0 var(--space-24); }

.settings-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: var(--space-16);
  margin-bottom: var(--space-16);
}

.settings-field { margin-top: var(--space-16); }

.settings-field:first-of-type { margin-top: var(--space-12); }

.settings-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-8);
}

.settings-help { font-size: 11px; color: var(--text-tertiary); margin-top: var(--space-4); }

.settings-text-input {
  width: 100%;
  max-width: 320px;
}

.settings-slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.settings-slider-row input[type="range"] {
  flex: 1;
  max-width: 320px;
  accent-color: var(--gold);
}

.settings-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

.settings-actions-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.settings-native-file-input {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.pd-screen { padding: var(--space-24) var(--space-32); max-width: 1080px; }

.pd-header { margin-bottom: var(--space-4); }

.pd-breadcrumb { display: flex; align-items: center; gap: var(--space-8); }

.pd-breadcrumb-link { color: var(--text-secondary); font-size: 13px; }

.pd-breadcrumb-link:hover { color: var(--text-primary); }

.pd-breadcrumb-sep { color: var(--text-tertiary); }

.pd-breadcrumb-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }

.pd-star {
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); font-size: 18px; line-height: 1; padding: 0 4px;
}

.pd-star.on { color: var(--gold); }

.pd-subtitle { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.pd-tab-content { padding-top: var(--space-16); }

/* Overview — Development Toolkit */

.pd-toolkit { margin-bottom: var(--space-24); }

.pd-toolkit-eyebrow { margin-bottom: var(--space-12); }

.pd-toolkit-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-10);
}

.pd-toolkit-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  text-decoration: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-14);
  transition: border-color var(--duration-standard), background var(--duration-standard);
  cursor: pointer;
}

.pd-toolkit-card:hover {
  border-color: var(--gold);
  background: var(--bg-raised);
}

.pd-toolkit-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.pd-toolkit-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}

.pd-toolkit-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.pd-toolkit-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
}

.pd-toolkit-desc {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-secondary);
  flex: 1;
}

.pd-toolkit-cta {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-top: auto;
}

/* Overview — Phase Toolkit accordion */

.pd-phase-section {
  margin-bottom: var(--space-10);
}

.pd-phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-10) var(--space-14);
  cursor: pointer;
  color: var(--text-primary);
  transition: border-color var(--duration-standard), background var(--duration-standard);
  min-height: 44px; /* comfortable touch target */
}

.pd-phase-header:hover {
  border-color: var(--gold);
  background: var(--bg-surface);
}

.pd-phase-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.pd-phase-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.pd-phase-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.pd-phase-chevron {
  font-size: 18px;
  color: var(--text-tertiary);
  line-height: 1;
  transition: transform var(--duration-standard);
  user-select: none;
}

.pd-phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-10);
  margin-top: var(--space-10);
}

.pd-phase-grid.collapsed {
  display: none;
}

@media (max-width: 640px) {
  .pd-phase-grid {
    grid-template-columns: 1fr;
  }
}

/* Overview — Story Bible */

.pd-bible {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16) var(--space-18);
  margin-bottom: var(--space-24);
}

.pd-bible-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-12);
  margin-bottom: var(--space-10);
}

.pd-bible-open {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
}

.pd-bible-open:hover { text-decoration: underline; }

.pd-bible-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.pd-bible-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: var(--space-4);
}

.pd-bible-logline {
  font-size: 13px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-8);
}

.pd-bible-premise {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: var(--space-12);
}

.pd-bible-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.pd-bible-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px 8px;
  font-size: 10px;
}

.pd-bible-chip-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
}

.pd-bible-chip-value { color: var(--text-primary); }

/* Overview — Stats */

.pd-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-12);
}

.pd-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
}

.pd-stat-figure {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: var(--space-4);
}

.pd-stat-figure-sm {
  font-size: 14px;
  font-weight: 600;
  margin-top: var(--space-4);
  color: var(--text-primary);
}

.pd-stat-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* Timeline / Gantt */

.pd-timeline-wrap { overflow: hidden; }

.pd-gantt-layout { display: flex; gap: var(--space-16); align-items: flex-start; }

.pd-gantt-scroll {
  flex: 1;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-sunken);
  max-height: 480px;
  overflow-y: auto;
}

.pd-gantt-canvas { position: relative; min-height: 200px; }

.pd-gantt-gridline {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}

.pd-gantt-gridlabel {
  position: absolute;
  top: 4px;
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  transform: translateX(4px);
  white-space: nowrap;
}

.pd-gantt-today {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--gold);
  z-index: 2;
}

.pd-gantt-today-chip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  background: var(--gold);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  z-index: 3;
}

.pd-gantt-phase-row {
  position: absolute;
  left: 0; right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding-left: var(--space-8);
  background: var(--bg-raised);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.pd-phase-toggle {
  background: none; border: none; color: var(--text-tertiary);
  cursor: pointer; font-size: 10px; padding: 0 4px;
}

.pd-phase-label { white-space: nowrap; }

.pd-gantt-bar {
  position: absolute;
  height: 22px;
  margin-top: 5px;
  border-radius: var(--radius-sm);
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  overflow: hidden;
  border: 1px solid transparent;
  user-select: none;
}

.pd-gantt-bar:active { cursor: grabbing; }

.pd-gantt-bar.tone-pre     { background: var(--phase-pre-soft);     border-color: var(--phase-pre); }
.pd-gantt-bar.tone-prod    { background: var(--phase-prod-soft);    border-color: var(--phase-prod); }
.pd-gantt-bar.tone-post    { background: var(--phase-post-soft);    border-color: var(--phase-post); }
.pd-gantt-bar.tone-release { background: var(--phase-release-soft); border-color: var(--phase-release); }

.pd-gantt-bar.complete {
  opacity: 0.55;
  cursor: default;
}
.pd-gantt-bar.complete .pd-gantt-bar-label { text-decoration: line-through; }
.pd-gantt-bar.orphan { opacity: 0.55; cursor: default; }

.pd-gantt-bar.selected { outline: 2px solid var(--gold); outline-offset: 1px; }

.pd-gantt-bar.violated { border-color: var(--status-busy); border-width: 2px; }

.pd-gantt-bar-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Detail panel */

.pd-detail-panel {
  width: 280px;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-height: 480px;
  overflow-y: auto;
}

.pd-detail-title { font-size: 15px; font-weight: 600; }

.pd-detail-phase { font-size: 11px; color: var(--text-tertiary); }

.pd-detail-dates { font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono); }

.pd-detail-assignee { display: flex; align-items: center; gap: var(--space-8); font-size: 13px; }

.pd-detail-description { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.pd-subtask-list { display: flex; flex-direction: column; gap: var(--space-4); }

.pd-subtask-row { display: flex; align-items: center; gap: var(--space-8); font-size: 12px; }

.pd-subtask-done { color: var(--text-tertiary); text-decoration: line-through; }

.pd-attach-list { display: flex; flex-direction: column; gap: var(--space-4); }

.pd-attach-row { font-size: 12px; color: var(--text-secondary); font-family: var(--font-mono); }

/* Budget tab */

.pd-budget-summary { margin-bottom: var(--space-16); }

.pd-line-items {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.pd-line-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.pd-line-row:last-child { border-bottom: none; }

.pd-line-name { color: var(--text-primary); }

.pd-line-figures { color: var(--text-secondary); font-family: var(--font-mono); font-size: 12px; }

/* ===== Finance screen ===== */

.finance-screen { padding: var(--space-24) var(--space-32); max-width: 900px; }

.finance-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-12);
  margin: var(--space-16) 0 var(--space-24);
}

.finance-summary-stat {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: var(--space-12) var(--space-16);
}

.finance-table th { cursor: pointer; user-select: none; white-space: nowrap; }

.finance-table th:hover { color: var(--gold); }

.finance-row { cursor: pointer; }

.finance-project-link { color: var(--gold); font-weight: 500; }

.finance-project-link:hover { color: var(--gold-hover); }

.finance-no-budget { color: var(--text-tertiary); font-style: italic; }

.finance-detail-row td {
  background: var(--bg-sunken);
  padding: var(--space-12) var(--space-16);
}

.finance-line-items { display: flex; flex-direction: column; gap: var(--space-4); }

.finance-line-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: var(--space-4) 0;
}

.finance-line-name { color: var(--text-secondary); }

.finance-line-figures { font-family: var(--font-mono); color: var(--text-primary); }

.finance-hint { font-size: 11px; color: var(--text-tertiary); margin-top: var(--space-12); }

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
  z-index: 2000;
  animation: dialog-scrim-in var(--duration-enter) var(--easing-standard);
}

@keyframes dialog-scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dialog-frame {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  padding: var(--space-24);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: dialog-frame-in var(--duration-enter) var(--easing-standard);
}

@keyframes dialog-frame-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-16);
}

.dialog-body { display: flex; flex-direction: column; gap: var(--space-12); }

.dialog-field { display: flex; flex-direction: column; gap: var(--space-4); }

.dialog-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.dialog-field input,
.dialog-field select,
.dialog-field textarea {
  width: 100%;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-8);
}

.dialog-error {
  font-size: 12px;
  color: var(--status-busy);
}

/* ===== Tasks header addition: New Task button + progress grouped ===== */

.tasks-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

/* ── Dashboard help link row ── */
.dash-help-row {
  display: flex;
  justify-content: flex-end;
  padding: 0 var(--space-4) var(--space-8);
}

/* ── Per-screen help link (? icon + "Help" label, top-right of header) ── */
.screen-help-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
  white-space: nowrap;
}
.screen-help-link:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-raised);
}
.screen-help-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.gallery-page { padding: var(--space-24) var(--space-32); max-width: 900px; }

.gallery-intro { font-size: 12px; color: var(--text-tertiary); margin: 4px 0 var(--space-24); }

.gallery-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: var(--space-16);
  margin-bottom: var(--space-16);
}

.gallery-heading { font-size: 14px; font-weight: 600; margin: 0 0 var(--space-4); }

.gallery-note { font-size: 11px; color: var(--text-tertiary); margin: 0 0 var(--space-12); }

.gallery-subnote { font-size: 11px; color: var(--text-tertiary); margin: var(--space-12) 0 var(--space-4); }

.gallery-row { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }

.gallery-progress-stack { display: flex; flex-direction: column; gap: var(--space-8); max-width: 320px; }

.gallery-progress-item { display: flex; align-items: center; gap: var(--space-12); }

.gallery-progress-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); width: 36px; }

.gallery-progress-item .prog { flex: 1; }

.pd-resize-handle {
  position: absolute;
  top: 0;
  left: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 1;
}

.pd-resize-handle:hover,
.pd-resize-handle:active {
  background: var(--gold-wash);
}

.user-wrap { position: relative; }

.user-block {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  background: none;
  border: none;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-standard);
}

.user-block:hover { background: var(--bg-raised); }

.user-menu { top: calc(100% + var(--space-8)); right: 0; width: min(220px, 90vw); }

.user-menu-role {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  padding: var(--space-8);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.user-menu-role:hover { background: var(--bg-raised); }

.user-menu-role.on { color: var(--gold); font-weight: 600; }

.user-menu .popover-empty {
  font-size: 11px;
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-8);
  padding-top: var(--space-8);
}

.topbar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 360px;
  flex: 1;
  margin: 0 var(--space-24);
}

.topbar-search {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: var(--space-8) 56px var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
}

.topbar-search:hover { border-color: var(--gold-dim); }

.topbar-search-kbd {
  position: absolute;
  right: var(--space-8);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  pointer-events: none;
}

.palette-body { gap: 0 !important; }

.dialog-frame:has(.palette-body) {
  max-width: 600px;
  padding: 0;
}

.palette-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  padding: var(--space-16);
  font-family: var(--font-ui);
}

.palette-input:focus { outline: none; }

.palette-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-8);
}

.palette-group + .palette-group { margin-top: var(--space-8); }

.palette-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: var(--space-4) var(--space-8);
}

.palette-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.palette-row.on { background: var(--gold-wash); }

.palette-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  flex-shrink: 0;
  min-width: 56px;
  text-align: center;
}

.palette-badge-command { color: var(--gold); border-color: var(--gold-dim); }
.palette-badge-help { color: var(--accent); border-color: var(--accent-dim, var(--accent)); opacity: 0.85; }

.palette-label { font-size: 13px; color: var(--text-primary); }

.palette-match {
  background: var(--gold-wash);
  color: var(--gold);
  border-radius: 2px;
  font-style: normal;
}

.palette-loading,
.palette-empty {
  padding: var(--space-16);
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ===== Status dot (used by Dashboard's Team Availability since Session
   5, and by People & Crew) — genuinely missing until now; the JS applied
   this class with no CSS behind it, so it rendered invisibly. ===== */

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-idle);
  flex-shrink: 0;
}

.status-dot.ok { background: var(--status-ok); }
.status-dot.warn { background: var(--status-warn); }
.status-dot.busy { background: var(--status-busy); }
.status-dot.idle { background: var(--status-idle); }

/* ===== People & Crew screen ===== */

.people-screen { padding: var(--space-24) var(--space-32); max-width: 900px; }

.people-search-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin: var(--space-16) 0;
}

.people-search-row .settings-text-input { max-width: 320px; }

.people-count { font-size: 11px; color: var(--text-tertiary); }

.people-layout {
  display: flex;
  gap: var(--space-16);
  align-items: flex-start;
}

.people-list {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-height: 520px;
  overflow-y: auto;
}

.people-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  cursor: pointer;
  transition: background var(--duration-standard), border-color var(--duration-standard);
}

.people-row:hover { background: var(--bg-raised); }

.people-row.on { border-color: var(--gold-dim); background: var(--gold-wash); }

.people-row-info { flex: 1; min-width: 0; }

.people-row-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }

.people-row-role { font-size: 11px; color: var(--text-tertiary); }

.people-detail {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.people-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.people-detail-status {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: 12px;
  color: var(--text-secondary);
}

.people-dept-chips { display: flex; gap: var(--space-8); flex-wrap: wrap; }

.people-task-list { display: flex; flex-direction: column; gap: var(--space-4); }

.people-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  font-size: 12px;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.people-task-project { color: var(--text-tertiary); font-size: 11px; }

/* ===== Assets screen ===== */

.assets-screen { padding: var(--space-24) var(--space-32); max-width: 960px; }

.assets-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  margin: var(--space-16) 0;
}

.assets-toolbar .settings-text-input { max-width: 320px; }

.drive-delivery-panel {
  margin: var(--space-16) 0;
  padding: var(--space-16);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.drive-delivery-title .card-eyebrow,
.drive-delivery-panel > .card-eyebrow { margin: 0 0 var(--space-4); }

.drive-delivery-title .settings-intro { margin: 0; }

.drive-delivery-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.drive-delivery-controls .settings-text-input { min-width: min(100%, 320px); }

.assets-view-toggle { display: flex; gap: var(--space-4); }

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-12);
}

.assets-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-8);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--duration-standard), background var(--duration-standard);
}

.assets-card:hover { background: var(--bg-raised); }

.assets-card.on { border-color: var(--gold-dim); background: var(--gold-wash); }

.assets-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.assets-card-size { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }

.assets-table th { cursor: pointer; user-select: none; }

.assets-table th:hover { color: var(--gold); }

.assets-drawer {
  margin-top: var(--space-16);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: var(--space-16);
}

.assets-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
}

.assets-drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-16);
}

/* ===== Calendar screen ===== */

.calendar-screen { padding: var(--space-24) var(--space-32); max-width: 980px; }

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-16) 0;
  flex-wrap: wrap;
  gap: var(--space-12);
}

.calendar-nav { display: flex; align-items: center; gap: var(--space-8); }

.calendar-label { font-size: 14px; font-weight: 600; margin-left: var(--space-8); min-width: 180px; }

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-dow {
  background: var(--bg-raised);
  padding: var(--space-8);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: center;
}

.calendar-cell {
  background: var(--bg-surface);
  min-height: 90px;
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.calendar-cell.dim { background: var(--bg-sunken); }

.calendar-cell.dim .calendar-cell-num { color: var(--text-tertiary); }

.calendar-cell.today { background: var(--gold-wash); }

.calendar-cell-num { font-family: var(--font-mono); font-size: 12px; color: var(--text-primary); }

.calendar-cell-items { display: flex; flex-direction: column; gap: 2px; }

/* A chip is a <button> so it can be tapped and focused (calendar.js);
   the resets below keep it looking exactly like the label it replaced. */
.calendar-chip {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 10px;
  text-align: left;
  padding: 2px 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.calendar-chip:hover { background: var(--bg-hover, var(--bg-raised)); color: var(--text-primary); }
.calendar-chip:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }

.calendar-chip-event { border-left: 2px solid var(--phase-release); }

.calendar-chip-task { border-left: 2px solid var(--phase-prod); }

.calendar-more { font-size: 10px; color: var(--text-tertiary); }

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--space-8);
}

.calendar-week-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.calendar-week-col.today { border-color: var(--gold-dim); background: var(--gold-wash); }

.calendar-week-head { font-size: 11px; font-weight: 600; color: var(--text-tertiary); margin-bottom: var(--space-4); }

.calendar-chip-subtitle { font-size: 9px; color: var(--text-tertiary); margin-top: -2px; margin-bottom: var(--space-4); }

.calendar-empty { font-size: 11px; color: var(--text-tertiary); }

.calendar-day { display: flex; flex-direction: column; gap: var(--space-8); }

.calendar-day-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-12);
}

.calendar-day-row-body { flex: 1; min-width: 0; }

/* ---- Agenda view --------------------------------------------------------
   The phone default (see calendar.js). A flat forward-running list, so it
   needs no horizontal scroll and no fixed column widths. */

.calendar-agenda { display: flex; flex-direction: column; gap: var(--space-16); }

.calendar-agenda-group { display: flex; flex-direction: column; gap: var(--space-8); }

.calendar-agenda-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-4);
}

.calendar-agenda-group.today .calendar-agenda-date { color: var(--gold); border-bottom-color: var(--gold-dim); }
.calendar-agenda-group.overdue .calendar-agenda-date { color: var(--status-busy); border-bottom-color: var(--status-busy); }
.calendar-agenda-group.overdue .calendar-day-row { border-left: 3px solid var(--status-busy); }

.calendar-agenda-add { min-width: 32px; }

/* A chip and its actions button, so the button sits beside the chip
   rather than stretching to the column width. */
.calendar-chip-row { display: flex; align-items: center; gap: var(--space-4); }
.calendar-chip-row .calendar-chip { flex: 1; min-width: 0; }

/* ===== Reports & Analytics screen ===== */

.reports-screen { padding: var(--space-24) var(--space-32); max-width: 900px; }

.reports-screen .card-eyebrow { margin: var(--space-24) 0 var(--space-8); }

.reports-busiest-list { display: flex; flex-direction: column; gap: 2px; }

.report-delivery-panel { margin-top: 0; }

/* ===== Production screen ===== */

.production-screen { padding: var(--space-24) var(--space-32); max-width: 960px; }

.production-screen .card-eyebrow { margin: var(--space-24) 0 var(--space-12); }

.production-screen .project-grid { margin-top: 0; }

/* ===== Marketing & Distribution screen ===== */

.marketing-project-block {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  padding: var(--space-16);
  margin-bottom: var(--space-16);
}

.marketing-project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}

.marketing-project-block .task-list { margin-top: var(--space-12); }

/* ===== Studio & Inventory screen ===== */

.inventory-screen { padding: var(--space-24) var(--space-32); max-width: 900px; }

.inventory-screen .card-eyebrow { margin: var(--space-24) 0 var(--space-8); }

.inventory-category { margin-bottom: var(--space-16); }

.inventory-category > .people-row-role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-8);
}

.inventory-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
}

.inventory-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
}

.inventory-row:last-child { border-bottom: none; }

.inventory-info { flex: 1; min-width: 0; }

/* ===== Locations & Rentals screen ===== */

.locations-screen { padding: var(--space-24) var(--space-32); max-width: 960px; }

.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-12);
  margin-top: var(--space-16);
}

.locations-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.locations-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
}

.locations-kind { font-size: 11px; color: var(--text-tertiary); }

.locations-booking { margin-top: var(--space-4); font-size: 12px; }

.locations-notes {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  padding: var(--space-8);
  margin-top: var(--space-4);
}

/* ===== Shots & Storyboards screen ===== */

.shots-screen { padding: var(--space-24) var(--space-32); max-width: 960px; }

.shots-screen .card-eyebrow { margin: var(--space-24) 0 var(--space-12); }

.shots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-12);
  margin-bottom: var(--space-8);
}

.shots-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* The panel frame: a nod to the reference tool's canvas area, in
   ATHESIS's own dark palette rather than its plain #222/#444. */
.shots-frame {
  aspect-ratio: 16 / 9;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
}

.shots-frame-number {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.shots-frame-movement {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.shots-card .task-title { padding: var(--space-12) var(--space-12) 0; font-size: 12px; }

.shots-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-12) var(--space-12);
}

/* ===== Scripts screen (the 16th and final route) ===== */

.scripts-screen { padding: var(--space-24) var(--space-32); max-width: 960px; }

/* ── Reel Viewer screen ──────────────────────────────────────────────────── */
.rv-screen { padding: var(--space-24) var(--space-32) var(--space-32); max-width: 1200px; }

.rv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-32);
  flex-wrap: wrap;
  gap: var(--space-12);
}

.rv-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.rv-controls { display: flex; align-items: center; gap: var(--space-10); }
.rv-proj-label { font-size: 12px; color: var(--text-secondary); }
.rv-proj-select { min-width: 180px; }

/* Section */
.rv-section { margin-bottom: var(--space-32); }

.rv-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-16);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.rv-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: var(--space-16) 0;
}

/* Scene group */
.rv-scene-group { margin-bottom: var(--space-24); }

.rv-scene-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-10);
  margin-bottom: var(--space-8);
}

.rv-scene-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.rv-scene-proj {
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-raised);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.rv-scene-count {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* Filmstrip */
.rv-filmstrip {
  background: #111;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

/* Perforation strip */
.rv-perfs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #0a0a0a;
  overflow: hidden;
  height: 14px;
}

.rv-perf {
  width: 10px;
  height: 7px;
  background: #2a2a2a;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Frame row */
.rv-frames {
  display: flex;
  gap: 8px;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.rv-frame {
  display: flex;
  flex-direction: column;
  width: 130px;
  min-width: 130px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--duration-standard), background var(--duration-standard);
  position: relative;
  overflow: hidden;
}

.rv-frame:hover {
  border-color: var(--gold-dim);
  background: #222;
}

.rv-frame-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  font-family: var(--font-mono);
  padding: 4px 6px 2px;
  letter-spacing: .05em;
}

.rv-frame-body {
  flex: 1;
  padding: 0 6px 6px;
  min-height: 52px;
}

.rv-frame-move {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.rv-frame-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv-frame-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  bottom: 5px;
  right: 5px;
}

.rv-status-shot        { background: var(--status-ok); }
.rv-status-storyboarded{ background: #60a5fa; }
.rv-status-planned     { background: var(--text-tertiary); }
.rv-status-approved    { background: var(--gold); }

/* Shot detail dialog rows */
.rv-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.rv-detail-label { color: var(--text-tertiary); }
.rv-detail-value { color: var(--text-primary); font-weight: 500; }
.rv-detail-desc  {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: var(--space-12);
}

/* Video assets grid */
.rv-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-10);
}

.rv-asset-card {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-14);
}

.rv-asset-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.rv-icon-video   { background: rgba(96,165,250,0.13); color: #60a5fa; }
.rv-icon-footage { background: rgba(74,222,128,0.12); color: var(--status-ok); }
.rv-icon-vfx     { background: rgba(167,139,250,0.13); color: #a78bfa; }

.rv-asset-info { flex: 1; min-width: 0; }

.rv-asset-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.rv-asset-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: center;
}

.rv-asset-kind {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}
.rv-kind-video   { background: rgba(96,165,250,0.13); color: #60a5fa; }
.rv-kind-footage { background: rgba(74,222,128,0.12); color: var(--status-ok); }
.rv-kind-vfx     { background: rgba(167,139,250,0.13); color: #a78bfa; }

.rv-asset-size { font-size: 11px; color: var(--text-tertiary); }
.rv-asset-proj { font-size: 11px; color: var(--text-tertiary); font-style: italic; }

/* Render queue */
.rv-job-list { display: flex; flex-direction: column; gap: var(--space-8); }

.rv-job-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-12);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-14);
}

.rv-job-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.rv-job-proj { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

.rv-job-right { display: flex; align-items: center; gap: var(--space-8); }

.rv-job-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.rv-job-status-active { background: rgba(212,168,72,0.14); color: var(--gold); }
.rv-job-status-done   { background: rgba(74,222,128,0.12); color: var(--status-ok); }
.rv-job-status-queued { background: var(--bg-sunken);      color: var(--text-tertiary); }

.rv-job-bar-wrap {
  width: 120px;
  height: 4px;
  background: var(--bg-sunken);
  border-radius: 2px;
  overflow: hidden;
}

.rv-job-bar {
  height: 100%;
  background: var(--border-strong);
  border-radius: 2px;
  transition: width .4s ease;
}
.rv-bar-active { background: var(--gold); }
.rv-bar-done   { background: var(--status-ok); }

.rv-job-pct {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  min-width: 32px;
  text-align: right;
}

/* Apps tools section */
.apps-tools-note {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 0 var(--space-12);
  line-height: 1.5;
}

.apps-card-tool-link {
  display: inline-block;
  margin-top: var(--space-8);
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
}

.apps-card:hover .apps-card-tool-link { color: var(--gold-hover); }

.apps-card-type-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--bg-raised);
  color: var(--text-tertiary);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

@media (max-width: 640px) {
  .rv-screen { padding: var(--space-16); }
  .rv-asset-grid { grid-template-columns: 1fr; }
  .rv-job-bar-wrap { width: 70px; }
  .rv-job-row { grid-template-columns: 1fr auto; }
  .rv-job-bar-wrap { display: none; }
}

/* ── Apps directory screen ───────────────────────────────────────────────── */
.apps-screen {
  padding: var(--space-24) var(--space-32) var(--space-32);
  max-width: 1100px;
}

.apps-header { margin-bottom: var(--space-32); }

.apps-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-6);
}

.apps-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.apps-group { margin-bottom: var(--space-32); }

.apps-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--space-12);
}

/* Card */
.apps-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-14);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--duration-standard), background var(--duration-standard), transform var(--duration-standard);
  position: relative;
}

.apps-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-raised);
  transform: translateY(-1px);
}

.apps-card:active { transform: translateY(0); }

/* Icon badge */
.apps-icon-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.apps-icon-badge .icon { display: block; }

/* Accent colour variants — icon badge background + icon colour */
.apps-badge-gold     { background: rgba(212,168,72,0.14); color: var(--gold); }
.apps-badge-blue     { background: rgba(96,165,250,0.13); color: #60a5fa; }
.apps-badge-green    { background: rgba(74,222,128,0.13); color: var(--status-ok); }
.apps-badge-amber    { background: rgba(251,191,36,0.13); color: #f59e0b; }
.apps-badge-purple   { background: rgba(167,139,250,0.13); color: #a78bfa; }
.apps-badge-neutral  { background: var(--bg-sunken);       color: var(--text-secondary); }

/* Card text */
.apps-card-body { flex: 1; min-width: 0; }

.apps-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apps-card-desc {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Arrow */
.apps-card-arrow {
  font-size: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-top: 2px;
  transition: color var(--duration-standard), transform var(--duration-standard);
}

.apps-card:hover .apps-card-arrow {
  color: var(--gold);
  transform: translateX(3px);
}

@media (max-width: 640px) {
  .apps-screen  { padding: var(--space-16); }
  .apps-grid    { grid-template-columns: 1fr; }
  .apps-card    { padding: var(--space-14); }
}

/* ── Film School screen ──────────────────────────────────────────────────── */
.film-school-screen { }

.film-school-stats {
  display: flex;
  gap: var(--space-24);
  flex-wrap: wrap;
  margin-top: var(--space-16);
}

.film-school-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.film-school-stat strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display, var(--font-mono));
  letter-spacing: -0.02em;
}

.film-school-stat span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.film-school-category { }

.film-school-category-heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.film-school-category-heading .apps-group-label {
  /* cancel the bottom-border the standalone class adds — heading owns it */
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.film-school-category-count {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

/* AI-powered pill on Film School cards */
.apps-card-ai-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(212, 168, 72, 0.10);
  border: 1px solid rgba(212, 168, 72, 0.22);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

/* Inline group-level link (used on the Apps screen Film School row) */
.apps-group-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  cursor: pointer;
}

.apps-group-link:hover { color: var(--gold-hover, var(--gold)); text-decoration: underline; }

@media (max-width: 640px) {
  .film-school-stats { gap: var(--space-16); }
  .film-school-stat strong { font-size: 18px; }
}

.scripts-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
  margin-top: var(--space-16);
}

.scripts-row {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
}

.scripts-row:last-child { border-bottom: none; }

.scripts-info { flex: 1; min-width: 0; }

.scripts-meta {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  flex-wrap: wrap;
  margin-top: 2px;
}

.shortcut-list { display: flex; flex-direction: column; gap: var(--space-8); }

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  padding: var(--space-4) 0;
}

.shortcut-keys {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  white-space: nowrap;
}

.shortcut-desc { font-size: 12px; color: var(--text-secondary); text-align: right; }

/* =========================================================================

   desktop-only v1 posture explicitly. Everything below is additive and
   gated behind max-width media queries, so nothing above 900px changes.

   Breakpoints:
     900px  -- chrome collapses (rail -> drawer, bottom nav appears)
     640px  -- content grids drop to their most compact column count
     420px  -- last-resort single column / tightened spacing
   ========================================================================= */

/* ---- Tap targets, all breakpoints (task 8) -----------------------------
   44px is the Apple HIG minimum; these controls are 32px today. Bumping
   them unconditionally (not just under the mobile breakpoint) costs
   nothing on desktop and is simply more correct. */

/* ---- Mobile-only controls: hidden by default, shown only under the
   900px breakpoint below. Without this, these elements (present in the
   DOM at every width so there's no layout shift when crossing the
   breakpoint) would render at their default display on desktop too. */

.hamburger-btn,
.topbar-search-icon-btn,
.bottom-nav,
#nav-backdrop {
  display: none;
}

.bell-btn,
.player-toggle,
.player-btn,
.hamburger-btn,
.topbar-search-icon-btn {
  min-width: 44px;
  min-height: 44px;
}

.avatar { min-width: 32px; min-height: 32px; } /* identity glyph, not itself the tap target -- .user-block is */

.user-block { min-height: 44px; }

@media (max-width: 900px) {

  /* ---- Left rail -> collapsible drawer (task 2) ------------------------ */

  #nav-rail {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(var(--rail-width), 82vw);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform var(--duration-enter) var(--easing-standard);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }

  #nav-rail.drawer-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }

  #nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-enter) var(--easing-standard);
  }

  #nav-backdrop.visible { opacity: 1; pointer-events: auto; }

  body.drawer-locked { overflow: hidden; }

  /* ---- Top bar (task 3) ------------------------------------------------ */

  .hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    border-radius: var(--radius-md);
  }

  .hamburger-btn:hover { background: var(--bg-raised); }

  .topbar-left-group { display: flex; align-items: center; gap: var(--space-8); min-width: 0; }

  /* Breadcrumb subtitle is the first thing to go -- the title alone still
     orients the user, and it's the long line most likely to wrap/clip. */
  .topbar-context .context-sub { display: none; }
  .topbar-context .context-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

  #topbar { padding: 0 var(--space-8); gap: var(--space-8); }

  .topbar-center-group { display: flex; align-items: center; }

  /* Full search input hides in favour of the tap-to-expand icon trigger
     (same openPalette() call either way -- see chrome.js). */
  .topbar-search-wrap { display: none; }

  .topbar-search-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
  }

  .topbar-search-icon-btn:hover { color: var(--text-primary); background: var(--bg-raised); }

  /* Role switcher / identity text collapses to just the avatar; the menu
     it opens is unchanged and still reachable by tapping it. */
  .user-info { display: none; }
  .topbar-right { gap: var(--space-8); }

  /* ---- Bottom tab bar (task 9) ------------------------------------------ */

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    z-index: 900;
  }

  .bottom-nav-item {
    flex: 1;
    min-width: 0;              /* six tabs on a 320px screen: let labels ellipsis */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
    color: var(--text-secondary);
    background: none;
    border: none;
    font-size: 10px;
    font-weight: 500;
  }

  .bottom-nav-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 2px;
  }

  .bottom-nav-item.active,
  .bottom-nav-item.active .icon { color: var(--gold); }

  /* Waiting-work cue: unread messages, follow-ups due. Absolutely
     positioned off the icon so a count appearing or changing width never
     nudges the tab labels. */
  .bottom-nav-icon { position: relative; display: inline-flex; }

  .bottom-nav-cue {
    position: absolute;
    top: -4px;
    left: 60%;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--status-busy, #e5484d);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
  }

  .bottom-nav-cue[hidden] { display: none; }

  /* The footer chrome (version string etc.) is desktop-only decoration;
     the bottom nav takes its place and its screen real estate. */
  #footbar { display: none; }

  #screen-mount {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* ---- Dashboard (task 4) ----------------------------------------------- */

  .dashboard { padding: var(--space-16); }
  .dash-hero { padding: var(--space-24) 0; }
  .dash-hero-word { font-size: 26px; }

  /* ---- Fixed-count grids (task 5) --------------------------------------- */

  .pd-stat-grid,
  .finance-summary,
  .assets-drawer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* A calendar's 7 columns are Sunday-through-Saturday: collapsing the
     column count would break the thing a calendar is. It scrolls
     horizontally instead, the same pattern already used for the Gantt
     (task 6), rather than reflowing into something that isn't a calendar
     anymore. */
  .calendar-month-grid,
  .calendar-week {
    grid-template-columns: repeat(7, minmax(92px, 1fr));
    overflow-x: auto;
  }

  /* ---- Calendar on a phone ----------------------------------------------
     The scrolling grid above is still available on request, but the
     screen now opens on the agenda (calendar.js), which needs the toolbar
     to wrap instead of squeezing the view toggle off the edge. */

  .calendar-screen { padding: var(--space-16) var(--space-12); }
  .calendar-toolbar { flex-wrap: wrap; gap: var(--space-8); }
  .calendar-nav { flex: 1 1 100%; }
  .calendar-label { min-width: 0; flex: 1; }
  .calendar-day-row { padding: var(--space-8) var(--space-12); }

  /* ---- Project Detail: Gantt + task details panel (task 7) -------------- */

  .pd-gantt-layout { flex-direction: column; }
  .pd-detail-panel { width: 100%; }

  /* ---- Panels / containers that assumed desktop width (task 7) --------- */

  .teams-layout { flex-direction: column; }
  .teams-dept-list { width: 100%; }

  /* ---- Project Detail: Overview mobile layout --------------------------- */

  /* Tighter screen padding on narrow phones */
  .pd-screen { padding: var(--space-16) var(--space-12); }

  /* Tab bar: allow horizontal scroll so all 6 tabs stay reachable without
     wrapping — same pattern used by the top-level nav. */
  .pd-screen .teams-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    flex-wrap: nowrap;
    gap: 0;
    margin: var(--space-12) 0 var(--space-8);
  }
  .pd-screen .teams-tabs::-webkit-scrollbar { display: none; }
  .pd-screen .teams-tab { flex-shrink: 0; margin-right: var(--space-12); }

  /* Toolkit: two compact columns instead of one long single-file list —
     eight full-width cards was most of what made the old page a
     scroll-forever wall on a phone. */
  .pd-toolkit-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }

  .pd-toolkit-card {
    padding: var(--space-10) var(--space-12);
    gap: var(--space-4);
  }

  .pd-toolkit-icon { width: 24px; height: 24px; }

  .pd-toolkit-name-row { margin-top: var(--space-2, 2px); }

  .pd-toolkit-name { font-size: 12px; }

  .pd-toolkit-desc {
    font-size: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Bible panel: reduce internal padding on mobile */
  .pd-bible {
    padding: var(--space-12) var(--space-14);
  }

  .pd-bible-title { font-size: 16px; }

  /* Stats: 2 columns on mobile, labels stay readable */
  .pd-stat-figure { font-size: 18px; }
  .pd-stat-card { padding: var(--space-12); }
}

@media (max-width: 640px) {
  .quick-actions-grid,
  .weather-grid,
  .dash-metric-row,
  .dash-bottom-row {
    grid-template-columns: 1fr;
  }

  .pd-stat-grid,
  .finance-summary,
  .assets-drawer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .pd-stat-grid,
  .finance-summary,
  .assets-drawer-grid {
    grid-template-columns: 1fr;
  }

  .dashboard { padding: var(--space-12); }
}

/* ── Admin panel ──────────────────────────────────────────────────────────── */

.admin-screen { padding: var(--space-24) var(--space-32); max-width: 900px; }

.admin-tabs { margin-bottom: var(--space-16); }

.admin-tab-content { padding-top: var(--space-8); }

.admin-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-16);
}

.admin-tab-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-invite-btn, .admin-send-btn {
  background: var(--gold);
  color: var(--bg-base);
  border-color: var(--gold);
}

.admin-invite-btn:hover, .admin-send-btn:hover {
  background: var(--gold-hover);
  border-color: var(--gold-hover);
}

.admin-loading {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: var(--space-24) 0;
}

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

.admin-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table td {
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-raised); }

.admin-row-self td { color: var(--gold); }
.admin-you   { color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }

.admin-member-name    { margin-left: var(--space-8); color: var(--text-primary); }
.admin-member-email   { color: var(--text-tertiary); }
.admin-member-last-emailed {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.75;
}
.admin-member-actions { white-space: nowrap; }
.admin-member-actions .btn + .btn { margin-left: var(--space-8); }

/* Pending chip — shown next to names of members who have never signed in */
.admin-member-pending {
  display: inline-block;
  margin-left: var(--space-8);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-wash);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  vertical-align: middle;
}

/* Resend invite button — gold-tinted when the member is still pending */
.admin-resend-pending {
  background: var(--gold-wash);
  border-color: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}
.admin-resend-pending:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #000;
}

.admin-role-select {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px var(--space-8);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
}
.admin-role-select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.admin-empty { color: var(--text-tertiary); font-size: 13px; padding: var(--space-24) 0; }
.admin-error { color: var(--status-busy);   font-size: 13px; padding: var(--space-24) 0; }

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.admin-error-box {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-24) 0;
}

.admin-error-msg {
  color: var(--status-busy);
  font-size: 13px;
}
.admin-help  { color: var(--text-tertiary); font-size: 12px; line-height: 1.6; margin: var(--space-12) 0 0; }

.admin-project-link { color: var(--text-primary); text-decoration: none; }
.admin-project-link:hover { color: var(--gold); }

.admin-role-name { font-weight: 600; color: var(--text-primary); }
.admin-role-note { color: var(--text-tertiary); font-size: 12px; }

.admin-cap-pill {
  display: inline-block;
  padding: 2px var(--space-8);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.admin-cap-yes { background: rgba(74,222,128,0.12); color: var(--status-ok); }
.admin-cap-no  { background: var(--bg-raised);      color: var(--text-tertiary); }

.admin-delete-warn {
  font-size: 12px;
  color: var(--status-busy);
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
}

.admin-invite-role-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

/* ── Onboard-existing-account dialog ─────────────────────────────────────── */
.onboard-result-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-16);
}

.onboard-user-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12);
}

.onboard-user-info { flex: 1; min-width: 0; }

.onboard-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.onboard-user-email {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.onboard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.onboard-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}
.onboard-badge-ok      { background: rgba(74,222,128,0.12); color: var(--status-ok); }
.onboard-badge-warn    { background: rgba(248,113,113,0.10); color: var(--status-busy); }
.onboard-badge-neutral { background: var(--bg-sunken); color: var(--text-tertiary); }

.onboard-not-found {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: var(--space-8) 0;
}

/* ── Admin action cell (edit + delete side by side) ─────────────────────── */
/* ── Admin tab bar — scrollable when 7+ tabs ────────────────────────────── */
.admin-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.admin-tabs::-webkit-scrollbar { display: none; }

/* ── Admin action cell (edit + delete side by side) ─────────────────────── */
.admin-action-cell { display: flex; gap: 6px; white-space: nowrap; }

/* ── Section header inside a tab (inline title + add button) ────────────── */
.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-20) 0 var(--space-12);
}
.admin-section-header:first-child { margin-top: 0; }
.admin-section-inline-title {
  margin: 0 !important; /* override admin-section-title margin when inline */
}

/* ── Divider between entity sections within one tab ─────────────────────── */
.admin-entity-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-24) 0 0;
}

/* ── Admin form (create / edit project dialogs) ──────────────────────────── */
.admin-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.admin-form-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}
.admin-form-col { display: flex; flex-direction: column; }

/* ── Studio tab — section headings ──────────────────────────────────────── */
.admin-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-tertiary);
  margin: var(--space-24) 0 var(--space-12);
}
.admin-section-title:first-child { margin-top: 0; }

/* ── Studio stats grid ──────────────────────────────────────────────────── */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-16);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.admin-stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Studio tab — action cards (Export / Import) ────────────────────────── */
.admin-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.admin-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-16) var(--space-20);
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.admin-action-card:hover {
  border-color: var(--gold-dim);
  background: var(--bg-hover);
}
.admin-action-icon {
  font-size: 20px;
  margin-bottom: 4px;
  color: var(--gold);
}
.admin-action-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.admin-action-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ── Studio tab — danger zone ───────────────────────────────────────────── */
.admin-danger-title { color: #F87171; }

.admin-danger-zone {
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-md);
  background: rgba(248,113,113,0.04);
  overflow: hidden;
}
.admin-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
  padding: var(--space-16) var(--space-20);
}
.admin-danger-row + .admin-danger-row {
  border-top: 1px solid rgba(248,113,113,0.15);
}
.admin-danger-info { flex: 1; min-width: 0; }
.admin-danger-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.admin-danger-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.admin-roles-table td:nth-child(2),
.admin-roles-table td:nth-child(3),
.admin-roles-table td:nth-child(4) { text-align: center; }

.btn-danger {
  background: rgba(248,113,113,0.15);
  color: #F87171;
  border: 1px solid rgba(248,113,113,0.3);
}
.btn-danger:hover { background: rgba(248,113,113,0.25); }

/* Admin nav item gets a subtle gold accent so it stands out */
/* Chat unread badge on the Messages nav item */
.nav-chat-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--bg-base);
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 1px 6px;
  line-height: 1.5;
  flex-shrink: 0;
}

.nav-item-admin { border-top: 1px solid var(--border-subtle); }
.nav-item-admin svg { color: var(--gold-dim); }
.nav-item-admin:hover svg,
.nav-item-admin.active svg { color: var(--gold); }

.nav-item-help { margin-top: var(--space-8); border-top: 1px solid var(--border-subtle); }
.nav-item-help svg { color: var(--text-secondary); }
.nav-item-help:hover svg { color: var(--text-primary); }

/* ── QR Code overlay (inventory + admin) ─────────────────────────────────── */

.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16);
}

.qr-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-24) var(--space-32);
  max-width: 380px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.qr-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.qr-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.qr-img {
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 8px;
}

.qr-url {
  font-size: 10px;
  color: var(--text-tertiary, var(--text-secondary));
  word-break: break-all;
  font-family: var(--font-mono, monospace);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.qr-btn-row {
  display: flex;
  gap: var(--space-8);
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Location booking dialog extras ──────────────────────────────────────── */

.loc-book-box { text-align: left; max-width: 420px; }

.loc-book-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.loc-book-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.loc-book-select,
.loc-book-input {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  padding: 8px 10px;
  width: 100%;
}

.loc-book-dates {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.loc-book-dates .loc-book-input { width: auto; flex: 1; }

/* ── Locations screen — action row ──────────────────────────────────────── */

.locations-actions {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-subtle);
}

/* ── Shots screen — summary + advance button ─────────────────────────────── */

.shots-summary {
  display: flex;
  gap: var(--space-16);
  margin-bottom: var(--space-20);
  flex-wrap: wrap;
}

.shots-stat {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.shots-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.shots-advance-btn {
  margin-top: var(--space-8);
  width: 100%;
}

.shots-card--done {
  opacity: 0.6;
}

.shots-card--done .shots-frame {
  background: var(--bg-raised);
}

/* ── Inventory QR button ─────────────────────────────────────────────────── */

.inventory-qr-btn {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--gold);
  border-color: var(--gold-dim);
}

.inventory-qr-btn:hover {
  background: rgba(229, 180, 81, 0.12);
}

/* ── Equipment Scan screen (#/scan/equipment/:id) ────────────────────────── */

.scan-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-32) var(--space-24) var(--space-48);
  gap: var(--space-24);
  max-width: 480px;
  margin: 0 auto;
}

.scan-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  text-align: center;
}

.scan-item-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--space-4);
}

.scan-item-name {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
  text-align: center;
}

.scan-item-sub {
  font-size: 14px;
  color: var(--text-secondary);
}

.scan-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-16);
  width: 100%;
}

/* Big thumb-friendly primary action button */
.scan-action-btn {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 18px 24px;
  font-size: 18px;
  font-weight: 700;
  background: var(--gold);
  color: #0A0A0B;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-standard),
              transform  var(--duration-fast) var(--easing-standard);
  text-align: center;
}

.scan-action-btn:hover  { background: #F0C55A; }
.scan-action-btn:active { transform: scale(0.97); }

.scan-action-btn--admin {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 14px;
  padding: 12px 20px;
}

.scan-action-btn--admin:hover { background: var(--bg-hover); color: var(--text-primary); }

.scan-who {
  font-size: 15px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-wrap: wrap;
  justify-content: center;
}

.scan-who-label { color: var(--text-primary); font-weight: 600; }
.scan-who-project { color: var(--text-secondary); }
.scan-who--maint { font-style: italic; }

.scan-back-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
  margin-top: auto;
}

.scan-back-btn:hover { color: var(--text-primary); background: var(--bg-raised); }

.scan-notfound {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-12);
  text-align: center;
  padding: var(--space-48) 0;
}

/* ── Bottom nav: QR scan shortcut ────────────────────────────────────────── */

@media (max-width: 900px) {
  .scan-screen {
    padding-top: var(--space-48);
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}
/* ── Admin email-delivery warning banner (P0-1) ── */
.admin-email-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12, 12px);
  background: rgba(255,178,36,0.08);
  border: 1px solid rgba(255,178,36,0.30);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-12, 12px) var(--space-16, 16px);
  font-size: 13px;
  line-height: 1.6;
  color: #d4a030;
  margin-bottom: var(--space-16, 16px);
}
.admin-email-warning > span { flex: 1; }
.admin-email-warning strong { color: #e8b84b; }
.admin-email-warning code {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  padding: 1px 5px;
}
.admin-banner-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #d4a030;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.admin-banner-dismiss:hover { opacity: 1; }

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--text-tertiary);
}

.quick-create {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-16);
  margin-top: var(--space-8);
}

.quick-create-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: none;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-create-btn:hover { background: var(--bg-raised); color: var(--gold); border-color: var(--gold-dim); }

/* ===== Media player ===== */

.history-popover { width: min(320px, 90vw); }

.history-actions {
  display: flex;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.history-actions .btn { flex: 1; }

.history-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.history-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.history-row:last-child { border-bottom: none; }

.history-type {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
}

.history-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

@keyframes popover-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.teams-dept-name-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); }

.teams-unread-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--gold);
  color: var(--bg-base);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.pd-gantt-connectors {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.pd-gantt-connector {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 1.5;
}

.pd-gantt-connector.violated { stroke: var(--status-busy, #e5484d); stroke-dasharray: 4 3; }

.pd-gantt-connector-arrow { fill: var(--text-tertiary); }
.pd-gantt-connector-arrow.violated { fill: var(--status-busy, #e5484d); }

.finance-line-right { display: flex; align-items: center; gap: var(--space-4); }

.dialog-note {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-sunken);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-12);
  margin-bottom: var(--space-8);
}

/* ===== Tasks header addition: New Task button + progress grouped ===== */

.people-show-offboarded {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  cursor: pointer;
}

.people-detail-actions { display: flex; gap: var(--space-8); }

.sw-screen { display: flex; flex-direction: column; gap: var(--space-16); padding: var(--space-24) var(--space-32); max-width: 1280px; }

/* Write tab */

.sw-write-layout {
  display: flex;
  gap: var(--space-16);
  align-items: stretch;
  min-height: 480px;
}

.sw-editor-col { flex: 1; display: flex; }

.sw-editor-textarea {
  flex: 1;
  min-height: 480px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}

.sw-editor-textarea:focus { outline: none; border-color: var(--gold-dim); }

.sw-sidebar {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  overflow-y: auto;
}

.sw-stats { padding-bottom: var(--space-8); border-bottom: 1px solid var(--border-subtle); }

.sw-scene-list { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-8); }

.sw-scene-row {
  display: flex;
  gap: var(--space-8);
  padding: var(--space-8);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.sw-scene-number {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  min-width: 18px;
}

/* Breakdown tab */

.sw-breakdown-table { display: flex; flex-direction: column; overflow-x: auto; }

.sw-breakdown-row {
  display: grid;
  grid-template-columns: 220px repeat(11, minmax(58px, 1fr));
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.sw-breakdown-header {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sw-breakdown-cell { font-size: 12px; text-align: center; }

.sw-breakdown-scene-cell { text-align: left; }

.sw-breakdown-tag-btn {
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  padding: var(--space-4);
  cursor: pointer;
}

.sw-breakdown-tag-btn:hover { border-color: var(--gold-dim); color: var(--text-primary); }

.sw-breakdown-tag-btn.filled { background: var(--gold-wash); color: var(--gold); border-color: var(--gold-dim); font-weight: 600; }

.sw-breakdown-tag-btn.hinted { color: var(--text-secondary); border-style: dashed; }

/* Suggestion strip under a breakdown row: auto-detected items awaiting confirmation */
.sw-breakdown-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0 var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
}

.sw-sugg-label {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: var(--space-4);
}

.sw-sugg-chip {
  background: var(--bg-sunken);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px var(--space-8);
  cursor: pointer;
}

.sw-sugg-chip:hover { border-color: var(--gold-dim); color: var(--gold); border-style: solid; }

/* Index tab */

.sw-index { display: flex; flex-direction: column; gap: var(--space-8); }

.sw-index-intro { margin-bottom: var(--space-8); }

.sw-index-section { margin-bottom: var(--space-16); }

.sw-index-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-8) var(--space-12);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  margin-bottom: var(--space-4);
}

.sw-index-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sw-index-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.sw-index-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: flex-end;
  max-width: 260px;
}

.sw-index-chip {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  font-size: 10.5px;
  padding: 1px var(--space-8);
  cursor: pointer;
  color: var(--text-secondary);
}

.sw-index-chip:hover { border-color: var(--gold-dim); color: var(--gold); }

.sw-chip-cast { color: var(--gold); }
.sw-chip-loc  { color: var(--text-secondary); }
.sw-chip-prop { color: var(--text-secondary); }

.sw-index-overflow { font-size: 10.5px; color: var(--text-tertiary); align-self: center; }

/* Schedule tab */

.sw-ppd-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.sw-ppd-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sw-ppd-input {
  width: 52px;
  padding: 3px 6px;
  font-size: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input, var(--bg-surface));
  color: var(--text-primary);
}

.sw-day-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  margin-bottom: var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.sw-day-scene-row, .sw-unscheduled-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  font-size: 13px;
  padding: var(--space-4) 0;
}

@media (max-width: 900px) {
  .sw-screen { padding: var(--space-16); }
  .sw-write-layout { flex-direction: column; }
  .sw-sidebar { width: 100%; }
  .sw-breakdown-row { grid-template-columns: 160px repeat(11, minmax(44px, 1fr)); font-size: 11px; }
}

/* ===== Theme Picker ===== */

/* Topbar button */
.theme-picker-wrap {
  position: relative;
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: color var(--duration-standard), background var(--duration-standard);
}
.theme-btn:hover { background: var(--bg-raised); color: var(--text-primary); }

/* Quick-picker popover swatch grid */
.theme-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 220px;
  z-index: 900;
}

.theme-swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-8);
  padding: var(--space-8);
}

.theme-swatch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 6px 4px;
  cursor: pointer;
  transition: border-color var(--duration-standard), background var(--duration-standard);
  color: var(--text-tertiary);
}
.theme-swatch-btn:hover {
  background: var(--bg-raised);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}
.theme-swatch-btn.active {
  border-color: var(--gold);
  color: var(--text-primary);
}

.theme-swatch-preview {
  display: flex;
  width: 36px;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.theme-swatch-dot {
  flex: 1;
  height: 100%;
}

.theme-swatch-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
  text-align: center;
}

/* User menu full-list theme rows */
.user-menu-theme-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  padding: 7px var(--space-12);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  color: var(--text-secondary);
  transition: background var(--duration-standard), color var(--duration-standard);
}
.user-menu-theme-row:hover { background: var(--bg-raised); color: var(--text-primary); }
.user-menu-theme-row.on   { color: var(--text-primary); }

.user-menu-theme-preview {
  display: flex;
  width: 30px;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}
.user-menu-theme-dot {
  flex: 1;
  height: 100%;
}

.user-menu-theme-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-menu-theme-name {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.user-menu-theme-desc {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1;
}
.user-menu-theme-check {
  font-size: 12px;
  color: var(--gold);
  flex-shrink: 0;
}

.user-menu-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-8) var(--space-12);
}

/* Wider user menu to fit theme rows */
.user-menu {
  min-width: 220px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Messages screen
═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout ── */
.msg-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* ── Sidebar ── */
.msg-sidebar {
  width: 280px;
  min-width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msg-sidebar-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.msg-sidebar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.msg-search {
  display: block;
  margin: var(--space-8) var(--space-12);
  padding: 7px var(--space-12);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  outline: none;
  flex-shrink: 0;
}
.msg-search:focus { border-color: var(--gold); }
.msg-search::placeholder { color: var(--text-tertiary); }

.msg-conv-list-mount {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0 var(--space-8);
}

.msg-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: var(--space-8) var(--space-16) 2px;
}

.msg-conv-row {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: 8px var(--space-12);
  cursor: pointer;
  border-radius: var(--radius-md);
  margin: 1px var(--space-8);
  transition: background var(--duration-standard);
  position: relative;
}
.msg-conv-row:hover  { background: var(--bg-raised); }
.msg-conv-row.active { background: var(--gold-wash); }

.msg-conv-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--bg-base);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
.msg-conv-avatar.group {
  background: var(--phase-pre, #7c5cbf);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 400;
}
.msg-conv-avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.msg-conv-info { flex: 1; min-width: 0; }

.msg-conv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.msg-conv-name {
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-conv-time {
  font-size: 10px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  white-space: nowrap;
}
.msg-conv-preview {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

.msg-unread-badge {
  background: var(--gold);
  color: var(--bg-base);
  font-size: 10px; font-weight: 700;
  border-radius: var(--radius-full);
  padding: 1px 6px;
  flex-shrink: 0;
}

.msg-conv-empty {
  padding: var(--space-24) var(--space-16);
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* ── Thread pane ── */
.msg-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
  min-width: 0;
}

.msg-empty-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  color: var(--text-tertiary);
  text-align: center;
}
.msg-empty-icon  { font-size: 40px; line-height: 1; }
.msg-empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.msg-empty-sub   { font-size: 13px; }

.msg-thread-hdr {
  height: var(--topbar-height, 52px);
  padding: 0 var(--space-16);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  background: var(--bg-surface);
}
.msg-thread-hdr-left    { display: flex; align-items: center; gap: var(--space-10); }
.msg-thread-hdr-info    { display: flex; flex-direction: column; }
.msg-thread-hdr-name    { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.msg-thread-hdr-members { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.msg-msg-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-16);
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-behavior: smooth;
}

.msg-load-more {
  align-self: center;
  margin-bottom: var(--space-16);
}

.msg-msg-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  justify-content: flex-end;
}

.msg-date-sep {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin: var(--space-12) 0;
  color: var(--text-tertiary);
  font-size: 11px;
}
.msg-date-sep::before,
.msg-date-sep::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border-subtle);
}

/* Message rows */
.msg-msg-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-8);
  margin-top: var(--space-8);
}
.msg-msg-row.mine        { flex-direction: row-reverse; }
.msg-msg-row.continuation { margin-top: 2px; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
.msg-avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.msg-avatar-spacer { width: 32px; flex-shrink: 0; }

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 68%;
}
.msg-msg-row.mine .msg-bubble-wrap { align-items: flex-end; }

.msg-sender-name {
  font-size: 11px; font-weight: 600;
  color: var(--gold);
  padding: 0 2px;
}

.msg-bubble {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 16px 16px 16px 4px;
  padding: 8px var(--space-12);
  font-size: 13px; line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-msg-row.mine .msg-bubble {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg-base);
  border-radius: 16px 16px 4px 16px;
}

.msg-timestamp {
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 0 2px;
  display: block;
}

/* ── Message input ── */
.msg-input-area {
  padding: var(--space-12) var(--space-16);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.msg-input-wrap {
  display: flex;
  gap: var(--space-8);
  align-items: flex-end;
}
.msg-input {
  flex: 1;
  padding: 9px var(--space-12);
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px; line-height: 1.5;
  resize: none;
  outline: none;
  overflow-y: auto;
  max-height: 120px;
}
.msg-input:focus      { border-color: var(--gold); }
.msg-input::placeholder { color: var(--text-tertiary); }

.msg-send-btn {
  padding: 9px var(--space-16);
  background: var(--gold);
  border: none;
  border-radius: var(--radius-lg);
  color: var(--bg-base);
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: opacity var(--duration-standard);
  flex-shrink: 0;
  line-height: 1.5;
}
.msg-send-btn:hover   { opacity: 0.88; }
.msg-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Mobile: single-pane layout ── */
@media (max-width: 640px) {
  .msg-layout {
    position: relative;
    overflow: hidden;
  }

  /* Sidebar takes full width; pane is hidden off-screen to the right */
  .msg-sidebar {
    width: 100%;
    min-width: 0;
    flex-shrink: 0;
    border-right: none;
    transition: transform 0.22s ease;
    transform: translateX(0);
  }

  .msg-pane {
    position: absolute;
    inset: 0;
    width: 100%;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    z-index: 2;
  }

  /* When a thread is open, slide sidebar out left and pane in */
  .msg-layout--thread .msg-sidebar {
    transform: translateX(-100%);
  }
  .msg-layout--thread .msg-pane {
    transform: translateX(0);
  }

  /* Back button visible only on mobile */
  .msg-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    transition: background var(--duration-standard);
  }
  .msg-back-btn:hover { background: var(--bg-raised); }

  /* Give the bubble wrap more room on narrow screens */
  .msg-bubble-wrap { max-width: 82%; }
}

/* Back button hidden on desktop */
@media (min-width: 641px) {
  .msg-back-btn { display: none; }
}

/* ── New chat dialog ── */
.msg-dialog-type {
  display: flex;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}
.msg-type-btn {
  flex: 1;
  padding: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration-standard);
}
.msg-type-btn:hover  { border-color: var(--gold); color: var(--text-primary); }
.msg-type-btn.active { border-color: var(--gold); color: var(--gold); background: var(--gold-wash); }

.msg-dialog-section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-8);
}
.msg-dialog-name-field { margin-bottom: var(--space-12); }

.msg-dialog-member-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-8);
}
.msg-dialog-member-row {
  display: flex; align-items: center; gap: var(--space-10);
  padding: 9px var(--space-12);
  cursor: pointer;
  transition: background var(--duration-standard);
  border-bottom: 1px solid var(--border-subtle);
}
.msg-dialog-member-row:last-child { border-bottom: none; }
.msg-dialog-member-row:hover      { background: var(--bg-raised); }
.msg-dialog-member-row.selected   { background: var(--gold-wash); }
.msg-dialog-member-info { flex: 1; min-width: 0; }
.msg-dialog-member-name  { font-size: 12px; font-weight: 500; color: var(--text-primary); display: block; }
.msg-dialog-member-email { font-size: 11px; color: var(--text-tertiary); display: block; }
.msg-dialog-check { color: var(--gold); font-weight: 700; flex-shrink: 0; font-size: 14px; }

/* ── Message search results ── */
.msg-search-result-row {
  padding: var(--space-8) var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.msg-search-result-row:hover  { background: var(--bg-raised); }
.msg-search-result-row.active { background: var(--gold-wash); }

.msg-search-result-conv {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  overflow: hidden;
}
.msg-search-result-type-icon {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.msg-search-result-conv-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-search-result-meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-6);
  overflow: hidden;
}
.msg-search-result-sender {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.msg-search-result-date {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}
.msg-search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.msg-search-result-snippet mark {
  background: rgba(229,180,81,0.25);
  color: var(--gold-pale);
  border-radius: 2px;
  padding: 0 2px;
  font-style: normal;
}
.msg-search-more-btn {
  display: block;
  width: calc(100% - var(--space-24));
  margin: var(--space-8) var(--space-12);
}

/* ── Message action button ("…") on own bubbles ── */
.msg-action-btn {
  opacity: 0;
  transition: opacity 0.15s;
  align-self: flex-end;
  flex-shrink: 0;
  /* Override row-action-btn sizing for the compact bubble context */
  min-width: 28px;
  height: 28px;
  font-size: 14px;
}
.msg-msg-row:hover .msg-action-btn,
.msg-msg-row:focus-within .msg-action-btn {
  opacity: 1;
}
/* Always show on touch devices */
@media (pointer: coarse) {
  .msg-action-btn { opacity: 1; }
}

/* ── Inline edit form ── */
.msg-edit-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 100%;
}
.msg-edit-textarea {
  width: 100%;
  padding: 8px var(--space-12);
  background: var(--bg-raised);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.msg-edit-actions {
  display: flex;
  gap: var(--space-8);
  justify-content: flex-end;
}

/* ── Edited label ── */
.msg-edited-label {
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 0 2px;
  font-style: italic;
}

/* ── Message highlight (search jump target) ── */
.msg-msg-row.msg-highlight .msg-bubble {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  animation: msg-highlight-fade 2.5s ease-out forwards;
}
@keyframes msg-highlight-fade {
  0%   { outline-color: var(--gold); }
  100% { outline-color: transparent; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Welcome Packet dialog
═══════════════════════════════════════════════════════════════════════════ */

.welcome-packet-member {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-16);
  margin-bottom: var(--space-16);
}
.welcome-packet-member-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.welcome-packet-member-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.welcome-packet-status {
  font-size: 12px;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Avatar — profile photo support
═══════════════════════════════════════════════════════════════════════════ */

/* When a photo is loaded the initials text is replaced by an <img> */
.avatar.has-photo {
  overflow: hidden;
  background: var(--bg-raised);
  padding: 0;
}
.avatar.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Settings — profile picture section
═══════════════════════════════════════════════════════════════════════════ */

.profile-pic-content {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

/* Larger avatar for the settings preview */
.profile-pic-circle {
  width: 64px !important;
  height: 64px !important;
  min-width: 64px !important;
  min-height: 64px !important;
  font-size: 22px !important;
  font-weight: 700;
  flex-shrink: 0;
  cursor: default;
}

.profile-pic-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.profile-pic-btns {
  display: flex;
  gap: var(--space-8);
  align-items: center;
  flex-wrap: wrap;
}

.profile-pic-status {
  min-height: 18px;
  color: var(--status-active);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Apps tab — admin source download button
═══════════════════════════════════════════════════════════════════════════ */

.apps-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--gold);
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.22);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.apps-dl-btn:hover:not(:disabled) {
  background: rgba(212,175,55,0.18);
  border-color: rgba(212,175,55,0.4);
}
.apps-dl-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Playlist manager — admin dialog
═══════════════════════════════════════════════════════════════════════════ */

/* Manage-playlist button in the player strip */
.player-manage-btn {
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0;
}

/* Dialog body gets extra padding reset so sections line up */
.playlist-dialog-body {
  padding: 0 !important;
}
.playlist-section {
  padding: 16px 20px;
}
.playlist-divider {
  border-top: 1px solid var(--border-subtle);
}
.playlist-section-heading {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

/* Track rows */
.playlist-track-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}
.playlist-track-row:hover { background: var(--bg-raised); }
.playlist-track-row.playlist-track-active { background: rgba(212,175,55,0.08); }

.playlist-play-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.playlist-play-btn:hover { background: rgba(212,175,55,0.18); color: var(--gold); }

.playlist-track-info { flex: 1; min-width: 0; }
.playlist-track-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

/* Type badges */
.playlist-type-badge {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid;
}
.playlist-badge-demo   { color: var(--text-tertiary); border-color: var(--border-subtle); background: transparent; }
.playlist-badge-url    { color: var(--status-active);  border-color: rgba(72,199,142,0.3); background: rgba(72,199,142,0.08); }
.playlist-badge-yt     { color: #f00;                  border-color: rgba(255,0,0,0.25);   background: rgba(255,0,0,0.06); }
.playlist-badge-upload { color: var(--gold);            border-color: rgba(212,175,55,0.3); background: rgba(212,175,55,0.08); }

.playlist-remove-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.playlist-remove-btn:hover { background: rgba(var(--status-busy-rgb, 255,90,90),0.12); color: var(--status-busy); }

.playlist-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
  padding: 8px 0;
}

/* Tab bar */
.playlist-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.playlist-tab {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.playlist-tab:hover { background: var(--bg-raised); }
.playlist-tab.playlist-tab-active {
  background: rgba(212,175,55,0.12);
  border-color: rgba(212,175,55,0.35);
  color: var(--gold);
}

.playlist-panel { }
.playlist-help {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 0 10px 0;
  line-height: 1.5;
}
.playlist-status {
  font-size: 12px;
  min-height: 18px;
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Bookings & Outreach screen ─────────────────────────────────────────── */
.bookings-screen { max-width: 980px; }
.bookings-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.bookings-stat {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 10px; padding: 10px 16px; min-width: 96px;
}
.bookings-stat.hot { border-color: var(--status-warn); }
.bookings-stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.bookings-stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.bookings-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--border-subtle); }
.bookings-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 14px; cursor: pointer;
}
.bookings-tab:hover { color: var(--text-primary); }
.bookings-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.bookings-filter-bar { display: flex; flex-direction: column; gap: 10px; margin: 0 0 16px; }
.bookings-search {
  width: 100%; max-width: 420px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-primary);
  font: inherit; font-size: 13.5px;
}
.bookings-search:focus { outline: none; border-color: var(--gold); }
.bookings-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.bookings-chip {
  border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary);
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.bookings-chip:hover { color: var(--text-primary); }
.bookings-chip.active { background: var(--gold); border-color: var(--gold); color: #0A0A0B; }
.bookings-section { margin-bottom: 20px; }
.bookings-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); margin: 0 0 8px; }
.bookings-list { display: flex; flex-direction: column; gap: 6px; }
.bookings-row {
  display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 10px; padding: 10px 14px;
  gap: 0;
}
.bookings-row.overdue { border-left: 3px solid var(--status-busy); }
.bookings-row-main { display: flex; align-items: center; gap: 10px; }
.bookings-row-info { flex: 1; min-width: 0; }
.bookings-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
@media (max-width: 700px) {
  .bookings-row-main { flex-wrap: wrap; }
  .bookings-stat { min-width: 72px; padding: 8px 12px; }
}

/* ---- Venue emergency contacts panel ------------------------------------ */
.venue-ec-toggle-row { display: flex; margin-top: 8px; }
.venue-ec-toggle {
  background: none; border: none; padding: 0;
  font-size: 11px; color: var(--text-secondary);
  cursor: pointer; letter-spacing: .01em;
}
.venue-ec-toggle:hover { color: var(--text-primary); }
.venue-ec-panel {
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px; padding-top: 10px;
}
.venue-ec-match-note {
  font-size: 11px; color: var(--text-secondary); font-style: italic;
  margin-bottom: 8px;
}
.venue-ec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px; margin-bottom: 8px;
}
.venue-ec-card {
  background: var(--bg-raised); border-radius: 6px; padding: 8px 10px;
}
.venue-ec-card-type {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary); margin-bottom: 3px;
}
.venue-ec-card-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  line-height: 1.3; margin-bottom: 2px;
}
.venue-ec-card-phone {
  display: block; font-size: 12px; color: var(--gold);
  text-decoration: none; margin-bottom: 2px;
}
.venue-ec-card-phone:hover { text-decoration: underline; }
.venue-ec-card-phone--verify { color: var(--text-secondary); }
.venue-ec-card-address { font-size: 11px; color: var(--text-secondary); line-height: 1.3; }
.venue-ec-training-title {
  font-size: 11px; font-weight: 700; color: var(--text-primary);
  margin: 12px 0 6px; letter-spacing: .02em;
}
.venue-ec-training-card { border: 1px solid var(--border-subtle); }
.venue-ec-911 {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px;
}
.venue-ec-source {
  font-size: 10px; color: var(--text-secondary); opacity: .7;
  line-height: 1.4;
}

@media (max-width: 900px) {
  /* Edit is one tap away in the row's actions menu. Three buttons across
     a 390px row would each fall under the 44px target, which is the
     failure this whole pass exists to fix. */
  .bookings-row-edit { display: none; }
  .bookings-row-actions { margin-left: auto; }
}

/* ---- Today (daily workspace) -------------------------------------------
   Built phone-first: one column of full-width rows, a 44px tap target on
   every control, and no horizontal scroll at 320px. The desktop rules at
   the bottom widen the rows rather than changing their shape, so the
   screen a producer learns on a phone is the same screen on a monitor. */

.daily-screen { display: flex; flex-direction: column; gap: var(--space-16, 16px); }

/* Offline / sync status bar — sits between the header and the counts strip.
   Only visible when the app is not in a clean saved state; hidden otherwise
   so it doesn't clutter normal use. Updated in-place via JS without a full
   screen re-render. */
.daily-sync-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-2, #1a1a1a);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle, #333);
}
.daily-sync-bar[data-status="offline"] {
  border-color: #555;
  color: var(--text-primary);
}
.daily-sync-bar[data-status="offline"]::before {
  content: ''; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: #555; flex-shrink: 0;
}
.daily-sync-bar[data-status="pending"],
.daily-sync-bar[data-status="saving"] {
  border-color: var(--gold-dim, var(--border-subtle));
  color: var(--gold);
}
.daily-sync-bar[data-status="pending"]::before,
.daily-sync-bar[data-status="saving"]::before {
  content: ''; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); opacity: 0.7; flex-shrink: 0;
}
.daily-sync-bar[data-status="error"] {
  border-color: #f44336;
  color: #f44336;
}
.daily-sync-bar[data-status="error"]::before {
  content: ''; display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: #f44336; flex-shrink: 0;
}

.daily-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.daily-summary-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 56px; padding: 8px 4px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 10px; color: var(--text-primary); font: inherit; cursor: pointer;
}
.daily-summary-chip:hover { border-color: var(--gold-dim, var(--border-subtle)); }
.daily-summary-chip:focus-visible { outline: none; border-color: var(--gold); }
.daily-summary-count { font-size: 20px; font-weight: 700; line-height: 1; }
.daily-summary-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary);
}
.daily-summary-chip.urgent { border-color: var(--status-busy); }
.daily-summary-chip.urgent .daily-summary-count { color: var(--status-busy); }
.daily-summary-chip.quiet .daily-summary-count { color: var(--text-secondary); }

.daily-section { display: flex; flex-direction: column; gap: 8px; }
.daily-section:focus { outline: none; }
.daily-section:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; border-radius: 8px; }
.daily-section-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px;
}
.daily-section-title {
  margin: 0; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--text-primary);
}
.daily-section-late .daily-section-title { color: var(--status-busy); }
.daily-section-hint { font-size: 12px; color: var(--text-secondary); }
.daily-section-more {
  align-self: flex-start; font-size: 12px; color: var(--text-secondary);
  text-decoration: none; padding: 6px 0;
}
.daily-section-more:hover { color: var(--gold); }

.daily-list { display: flex; flex-direction: column; gap: 6px; }

.daily-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 10px; padding: 8px 10px;
}
.daily-row.late { border-left: 3px solid var(--status-busy); }

/* The row body is itself the button: on a phone the whole line should be
   the tap target, not a 14px link inside it. */
.daily-row-open {
  flex: 1; min-width: 0; min-height: 44px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.daily-row-open:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.daily-row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.daily-row-kind {
  flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-secondary);
  border: 1px solid var(--border-subtle); border-radius: 4px; padding: 1px 5px;
}
.daily-row-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.daily-row-sub {
  font-size: 12px; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.daily-row .task-check { flex-shrink: 0; }
.daily-action-btn { flex-shrink: 0; }

@media (min-width: 900px) {
  .daily-summary { grid-template-columns: repeat(4, minmax(0, 160px)); }
  .daily-row-title { font-size: 15px; }
}

/* ---- Marketing campaign timeline --------------------------------------- */

/* Marketing readiness (GO / NO-GO) view */
.mkt-readiness { display: flex; flex-direction: column; gap: 16px; }
.mkt-verdict {
  font-family: var(--font-mono, monospace); font-size: 13px; font-weight: 700;
  letter-spacing: .06em; padding: 3px 12px; border-radius: 5px; border: 1px solid;
}
.mkt-verdict-go      { color: var(--status-ok, #3dd68c);   border-color: color-mix(in srgb, var(--status-ok, #3dd68c) 45%, transparent);   background: color-mix(in srgb, var(--status-ok, #3dd68c) 10%, transparent); }
.mkt-verdict-caution { color: var(--status-warn, #f0a500); border-color: color-mix(in srgb, var(--status-warn, #f0a500) 45%, transparent); background: color-mix(in srgb, var(--status-warn, #f0a500) 10%, transparent); }
.mkt-verdict-nogo    { color: var(--status-busy, #e5484d); border-color: color-mix(in srgb, var(--status-busy, #e5484d) 45%, transparent); background: color-mix(in srgb, var(--status-busy, #e5484d) 10%, transparent); }
.mkt-readiness-summary { font-size: 12.5px; color: var(--text-secondary); margin: 6px 0 10px; }
.mkt-check-list { display: flex; flex-direction: column; gap: 6px; }
.mkt-check-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--surface-raised, rgba(127,127,127,.05));
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
.mkt-check-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}
.mkt-check-dot.ok   { color: var(--status-ok, #3dd68c);   background: color-mix(in srgb, var(--status-ok, #3dd68c) 14%, transparent); }
.mkt-check-dot.warn { color: var(--status-warn, #f0a500); background: color-mix(in srgb, var(--status-warn, #f0a500) 14%, transparent); }
.mkt-check-label { flex: 1; }
.mkt-check-value { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-muted, #888); }
.mkt-readiness-note { font-family: var(--font-mono, monospace); font-size: 10px; color: var(--text-muted, #888); line-height: 1.6; }

/* View toggle (List / Timeline) */
.mktl-view-toggle {
  display: flex; gap: 0; border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden; margin-right: 8px;
}
.mktl-view-btn {
  background: transparent; border: none; color: var(--text-secondary);
  font-size: 12px; font-weight: 500; padding: 6px 12px; cursor: pointer;
  transition: background .12s, color .12s;
}
.mktl-view-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.mktl-view-btn.on { background: var(--gold); color: #000; font-weight: 600; }

/* Release date field (appears in each project block header) */
.mktl-release-field {
  display: flex; align-items: center; gap: 6px; margin-left: 12px;
}
.mktl-release-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-tertiary);
}
.mktl-release-input {
  font-size: 12px; background: var(--surface-2); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 7px;
  cursor: pointer;
}
.mktl-release-input:focus { outline: 2px solid var(--gold); border-color: transparent; }

/* Project block header — holds name, count, and release field */
.mktl-block-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* Timeline view wrapper */
.mktl-view-wrap { display: flex; flex-direction: column; gap: 0; }

/* Per-project canvas container */
.mktl-project-canvas-wrap { margin-top: 10px; }

/* Scrollable container for the date canvas */
.mktl-scroll {
  overflow-x: auto; overflow-y: hidden;
  border: 1px solid var(--border-subtle); border-radius: 6px;
  background: var(--bg-surface);
}

/* The absolute-positioned canvas */
.mktl-canvas { position: relative; min-height: 60px; }

/* Week gridlines */
.mktl-gridline {
  position: absolute; top: 0; width: 1px;
  background: var(--border-subtle); pointer-events: none;
}
.mktl-gridlabel {
  position: absolute; top: 4px;
  font-size: 10px; color: var(--text-tertiary);
  white-space: nowrap; pointer-events: none;
  padding-left: 3px;
}

/* TODAY marker */
.mktl-today-line {
  position: absolute; top: 0; width: 1px;
  background: var(--text-secondary); pointer-events: none; z-index: 1;
}
.mktl-today-chip {
  position: absolute; top: 4px;
  font-size: 9px; font-weight: 700; color: var(--text-secondary);
  letter-spacing: .06em; white-space: nowrap;
  padding: 1px 4px; border-radius: 3px;
  background: var(--surface-2); z-index: 2;
}

/* RELEASE marker */
.mktl-release-line {
  position: absolute; top: 0; width: 2px;
  background: var(--gold, #f0a500); pointer-events: none; z-index: 1;
  opacity: .85;
}
.mktl-release-chip {
  position: absolute; top: 4px;
  font-size: 9px; font-weight: 700; color: var(--gold, #f0a500);
  letter-spacing: .06em; white-space: nowrap;
  padding: 1px 4px; border-radius: 3px;
  background: var(--surface-2); z-index: 2;
}

/* Task bars / chips on the timeline */
.mktl-bar {
  position: absolute;
  display: flex; align-items: center; gap: 5px;
  height: 26px; max-width: 180px;
  padding: 0 8px 0 4px; border-radius: 5px;
  background: var(--phase-release-soft); border: 1px solid var(--phase-release);
  font-size: 11px; color: var(--text-primary);
  cursor: grab; user-select: none; white-space: nowrap; overflow: hidden;
  z-index: 3;
}
.mktl-bar:active { cursor: grabbing; }
.mktl-bar.done { opacity: 0.5; cursor: default; }
.mktl-bar.overdue { border-color: var(--status-busy); }
.mktl-dot {
  flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%;
  background: var(--phase-release); display: inline-block;
}
.mktl-bar.overdue .mktl-dot { background: var(--status-busy); }
.mktl-bar-label { overflow: hidden; text-overflow: ellipsis; }

/* Undated tasks shown as a plain text row below the canvas */
.mktl-undated-row {
  margin-top: 6px; font-size: 11px; color: var(--text-tertiary);
  display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline;
}
.mktl-undated-label { font-weight: 600; }

/* Staging area — undated task chips that can be dragged onto the canvas */
.mktl-staging-area {
  margin-top: 8px; padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--surface-1);
}
.mktl-staging-hint {
  display: block; font-size: 11px; color: var(--text-tertiary);
  margin-bottom: 6px; font-style: italic;
}
.mktl-staging-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.mktl-staging-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 11px; color: var(--text-primary);
  cursor: grab; user-select: none;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.mktl-staging-chip:hover { box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.mktl-staging-chip.dragging { opacity: 0.45; cursor: grabbing; }
/* Inert chip: completed or orphaned undated task — visible but not draggable */
.mktl-staging-chip.mktl-chip-inert {
  opacity: 0.55; cursor: default;
}
.mktl-staging-chip.mktl-chip-inert:hover { box-shadow: none; }
.mktl-staging-chip.done .mktl-bar-label { text-decoration: line-through; }
/* Canvas highlight while a chip is being dragged over it */
.mktl-canvas.mktl-canvas-drop-target {
  outline: 2px dashed var(--gold);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--gold) 6%, transparent);
}

/* Combined timeline layout -------------------------------------------- */

/* Outer flex wrapper: fixed label column + scrollable canvas */
.mktl-combined-outer {
  display: flex; align-items: stretch;
  border: 1px solid var(--border-subtle); border-radius: 6px;
  overflow: hidden;
  margin-top: 10px;
}

/* Fixed-width left panel showing project names */
.mktl-combined-labels {
  flex-shrink: 0; width: 130px;
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

/* One label cell per project band */
.mktl-combined-label {
  display: flex; align-items: flex-start;
  padding: 4px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  box-sizing: border-box;
}
.mktl-combined-label:last-child { border-bottom: none; }
.mktl-combined-label-text {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding-left: 6px; padding-top: 4px;
}

/* The combined scroll container fills the remaining width */
.mktl-combined-scroll {
  flex: 1; border: none; border-radius: 0;
  min-width: 0;
}

/* Horizontal band separator inside the combined canvas */
.mktl-band-sep {
  position: absolute; left: 0; height: 1px;
  background: var(--border-subtle); pointer-events: none; z-index: 0;
}

/* Task bars in combined mode override the default phase colour */
.mktl-bar.mktl-bar-project {
  background: transparent; /* overridden inline */
}

/* Full wrap including staging area below */
.mktl-combined-full-wrap { display: flex; flex-direction: column; gap: 0; }

/* Staging area below the combined canvas gets a small top margin */
.mktl-combined-staging { margin-top: 8px; }

/* Legend strip — coloured dot + project name, one entry per visible project.
   Sits above .mktl-combined-outer and shares its border so they read as one
   connected panel. The outer's own top margin is suppressed when preceded by
   the legend via the adjacent sibling selector below. */
.mktl-combined-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  padding: 8px 10px 6px;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  background: var(--bg-surface);
  border-radius: 6px 6px 0 0;
}

/* When legend immediately precedes the outer canvas, remove the outer's
   top margin and square off its top corners so the two elements merge. */
.mktl-combined-legend + .mktl-combined-outer {
  margin-top: 0;
  border-radius: 0 0 6px 6px;
}

.mktl-combined-legend-entry {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0;
}

.mktl-combined-legend-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.mktl-combined-legend-name {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
  text-decoration: none;
}
a.mktl-combined-legend-name:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Sub-toggle for Per campaign / Combined — sits right of the List/Timeline toggle */
.mktl-layout-toggle { margin-right: 0; }

@media (max-width: 700px) {
  .mktl-view-toggle { display: none; }
}

/* ---- Marketing campaign board ------------------------------------------ */

.marketing-tools-strip {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.marketing-tool-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; text-decoration: none; color: var(--text-secondary);
  padding: 6px 12px; border: 1px solid var(--border-color);
  border-radius: 6px; background: var(--bg-secondary);
  transition: border-color .12s, color .12s;
}
.marketing-tool-link:hover { border-color: var(--accent); color: var(--accent); }

.marketing-filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
}
.marketing-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.marketing-filter-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary);
}
.marketing-filter-field .project-scope-select { min-height: 40px; }
.marketing-filter-clear { align-self: flex-end; min-height: 40px; }

.marketing-task-row { gap: 10px; }
.marketing-task-row.overdue { border-left: 3px solid var(--status-busy); }
.marketing-task-row .task-right { display: flex; align-items: center; gap: 8px; }
.task-meta-line { font-size: 12px; color: var(--text-secondary); }

@media (max-width: 700px) {
  .marketing-filter-bar { flex-direction: column; align-items: stretch; }
  .marketing-filter-field .project-scope-select { width: 100%; }
  .marketing-task-row { flex-wrap: wrap; }
  .marketing-task-row .task-right { margin-left: auto; }
}

/* ── App Manager Panel (Marketing → App Manager tab) ──────────────────────
   All tokens come from the OS design system — no new colour primitives.
   ─────────────────────────────────────────────────────────────────────── */

.acm-screen {
  padding: var(--space-24) var(--space-32) var(--space-32);
  max-width: 900px;
}

/* ── Header ── */
.acm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-16);
  flex-wrap: wrap;
  margin-bottom: var(--space-24);
  padding-bottom: var(--space-20);
  border-bottom: 1px solid var(--border-subtle);
}

.acm-header-left { flex: 1; min-width: 0; }

.acm-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.acm-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 480px;
}

.acm-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-shrink: 0;
}

.acm-reset-btn {
  color: var(--text-tertiary);
  border-color: var(--border-subtle);
}
.acm-reset-btn:hover {
  color: var(--status-busy);
  border-color: var(--status-busy);
  background: rgba(248,113,113,0.06);
}

.acm-publish-btn {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}
.acm-publish-btn:hover:not(:disabled) {
  background: rgba(229,180,81,0.1);
}
.acm-publish-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.acm-studio-reset-btn {
  color: var(--text-tertiary);
  border-color: var(--border-subtle);
}
.acm-studio-reset-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  background: rgba(99,179,237,0.06);
}

/* ── Sections ── */
.acm-section {
  margin-bottom: var(--space-28);
}

.acm-section-head {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  margin-bottom: var(--space-6);
}

.acm-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.acm-section-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-raised);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.acm-section-note {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 0 0 var(--space-10);
  line-height: 1.5;
}

/* ── List ── */
.acm-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
}

.acm-empty-hint {
  padding: var(--space-20) var(--space-16);
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

/* ── Row ── */
.acm-row {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-10) var(--space-14);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-standard);
  min-height: 48px;
}
.acm-row:last-child { border-bottom: none; }
.acm-row:hover { background: var(--bg-raised); }

.acm-row-hidden {
  opacity: 0.45;
}
.acm-row-hidden:hover { opacity: 0.75; }

.acm-row-dragging {
  opacity: 0.4;
  background: var(--bg-raised);
}

.acm-row-drag-over {
  background: var(--gold-wash);
  border-top: 2px solid var(--gold);
}

/* ── Drag handle ── */
.acm-drag-handle {
  cursor: grab;
  font-size: 14px;
  color: var(--text-tertiary);
  user-select: none;
  flex-shrink: 0;
  opacity: 0.45;
  width: 16px;
  text-align: center;
}
.acm-row-draggable:hover .acm-drag-handle { opacity: 1; color: var(--text-secondary); }
.acm-drag-handle:active { cursor: grabbing; }
.acm-drag-handle-absent { visibility: hidden; }

/* ── Eye toggle ── */
.acm-eye-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--duration-standard);
  line-height: 1;
}
.acm-eye-btn:hover { opacity: 1; background: var(--bg-raised); }
.acm-eye-off { opacity: 0.3; }
.acm-eye-off:hover { opacity: 0.7; }

/* ── Entry body ── */
.acm-entry-body {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  flex: 1;
  min-width: 0;
}

/* Accent dot */
.acm-accent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.acm-dot-gold    { background: var(--gold); }
.acm-dot-blue    { background: #60a5fa; }
.acm-dot-green   { background: var(--status-ok); }
.acm-dot-amber   { background: #f59e0b; }
.acm-dot-purple  { background: #a78bfa; }
.acm-dot-neutral { background: var(--text-tertiary); }

/* Entry name + meta */
.acm-entry-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.acm-entry-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acm-category {
  font-size: 11px;
  color: var(--text-tertiary);
}

.acm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.acm-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  color: var(--text-tertiary);
}

.acm-pill-ai {
  background: rgba(245,166,35,0.10);
  color: #f5a623;
}

.acm-pill-custom {
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
}

/* ── Row actions ── */
.acm-actions {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-shrink: 0;
}

.acm-edit-btn {
  opacity: 0;
  transition: opacity var(--duration-standard);
}
.acm-row:hover .acm-edit-btn { opacity: 1; }

.acm-remove-btn {
  color: var(--status-busy);
  border-color: rgba(248,113,113,0.3);
  background: rgba(248,113,113,0.06);
  opacity: 0;
  transition: opacity var(--duration-standard);
}
.acm-remove-btn:hover {
  background: rgba(248,113,113,0.12);
  border-color: var(--status-busy);
}
.acm-row:hover .acm-remove-btn { opacity: 1; }

.acm-lock {
  font-size: 11px;
  opacity: 0.3;
  cursor: default;
  padding: 0 var(--space-4);
}

/* ── Edit / Add modal ── */
.acm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popover-in 0.15s ease;
}

.acm-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(520px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.acm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-16) var(--space-20);
  border-bottom: 1px solid var(--border-subtle);
}

.acm-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.acm-modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--duration-standard), background var(--duration-standard);
}
.acm-modal-close:hover { color: var(--text-primary); background: var(--bg-raised); }

.acm-form {
  padding: var(--space-20);
  display: flex;
  flex-direction: column;
  gap: var(--space-14);
}

.acm-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
}

.acm-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.acm-form-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.acm-form-input,
.acm-form-textarea,
.acm-form-select {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: var(--space-8) var(--space-10);
  width: 100%;
  transition: border-color var(--duration-standard);
}
.acm-form-input:focus,
.acm-form-textarea:focus,
.acm-form-select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-color: var(--gold-dim);
}

.acm-form-textarea { resize: vertical; min-height: 68px; }

/* ── Icon picker ── */
.acm-icon-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.acm-icon-picker-top {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.acm-icon-preview {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gold);
}

.acm-icon-preview .icon-image {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.acm-icon-upload-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: 28px;
}

.acm-icon-upload-btn {
  position: relative;
  overflow: hidden;
}

.acm-icon-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.acm-icon-upload-status {
  color: var(--text-tertiary);
  font-size: 11px;
}

.acm-save-error {
  flex: 1;
  color: var(--danger, #e5534b);
  font-size: 12px;
  align-self: center;
}

.acm-save-error:empty {
  display: none;
}

.acm-icon-search {
  flex: 1;
}

.acm-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: var(--space-4);
  max-height: 150px;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-8);
}

.acm-icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background var(--duration-standard), color var(--duration-standard), border-color var(--duration-standard);
  cursor: pointer;
  padding: 0;
}

.acm-icon-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.acm-icon-btn-selected {
  background: var(--gold-wash);
  color: var(--gold);
  border-color: var(--gold-dim);
}

.acm-icon-btn-selected:hover {
  background: var(--gold-wash);
  color: var(--gold);
}

.acm-icon-empty {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-tertiary);
  padding: var(--space-8);
  text-align: center;
}

.acm-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
  padding: var(--space-14) var(--space-20);
  border-top: 1px solid var(--border-subtle);
}

/* ── Mobile tweaks ── */
@media (max-width: 640px) {
  .acm-screen { padding: var(--space-16); }
  .acm-form-row { grid-template-columns: 1fr; }
  .acm-header { flex-direction: column; }
  .acm-edit-btn, .acm-remove-btn { opacity: 1; }
  .acm-entry-name { font-size: 12px; }
}

/* ─── Funding Roadmap screen (#/funding) ─────────────────────────── */
.funding-filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.funding-search {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 7px 10px;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  background: var(--surface, transparent);
  color: inherit;
}
.funding-filter-select,
.funding-inline-select {
  padding: 6px 8px;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  background: var(--surface, transparent);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
}
.funding-row { cursor: pointer; }
.funding-program { font-weight: 600; max-width: 340px; }
.funding-assignee-input {
  width: 110px;
  padding: 5px 8px;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  background: var(--surface, transparent);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
}
.funding-detail { padding: 10px 14px 14px; }
.funding-notes { margin: 4px 0 10px; line-height: 1.5; max-width: 72ch; }
.funding-meta { opacity: 0.75; font-size: 0.85rem; margin: 0 0 10px; }
.funding-due-wrap { display: flex; align-items: center; gap: 8px; }
.funding-due-input {
  padding: 5px 8px;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  background: var(--surface, transparent);
  color: inherit;
  font: inherit;
}
.funding-empty { opacity: 0.7; margin: 18px 4px; }
.funding-status-approved { border-color: #2e7d32; }
.funding-status-declined, .funding-status-not-eligible { opacity: 0.6; }

/* ── Production Office ─────────────────────────────────────────────────────── */

.po-screen { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* Top bar */
.po-topbar {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px;
  background: var(--panel, #1a1f2b); border-bottom: 1px solid var(--border, #2c3444);
  flex-shrink: 0;
}
.po-topbar-title { font-weight: 700; font-size: 16px; letter-spacing: .04em; }
.po-topbar-sub { font-size: 11px; color: var(--text-secondary, #888); margin-top: 1px; }
.po-topbar-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

/* Body: left rail + main content */
.po-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* Left tab rail */
.po-rail {
  width: 190px; flex-shrink: 0;
  background: var(--surface, #141922);
  border-right: 1px solid var(--border, #2c3444);
  overflow-y: auto; padding: 8px;
}
.po-rail-item {
  display: flex; align-items: center; padding: 7px 10px; border-radius: 4px;
  color: var(--text-secondary, #888); text-decoration: none; font-weight: 500;
  font-size: 12.5px; margin-bottom: 1px; border: 1px solid transparent;
  gap: 6px;
}
.po-rail-item:hover { background: var(--hover, #1a2030); color: var(--text, #eceae3); }
.po-rail-item.on { background: var(--selected, #1e2632); color: var(--text, #eceae3); border-color: #2c3646; }
.po-rail-count { margin-left: auto; font-family: monospace; font-size: 10.5px; color: var(--text-tertiary, #555); }

/* Main content */
.po-main { flex: 1; overflow-y: auto; padding: 16px 20px 60px; min-width: 0; }
.po-tab-hdr { margin-bottom: 12px; }
.po-tab-title { font-size: 20px; font-weight: 700; letter-spacing: .04em; margin: 0 0 2px; }
.po-tab-sub { font-size: 11.5px; color: var(--text-secondary, #888); margin-bottom: 10px; }
.po-tab-content { min-height: 200px; }

/* Script picker */
.po-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 12px; }
.po-picker-card { background: var(--panel, #1a1f2b); border: 1px solid var(--border, #2c3444); border-radius: 6px; padding: 14px; }
.po-picker-card.has-po { border-color: var(--accent, #d8a24c); }
.po-picker-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.po-picker-sub { font-size: 11.5px; color: var(--text-secondary, #888); margin-bottom: 12px; }

/* Cards */
.po-card { background: var(--panel, #1a1f2b); border: 1px solid var(--border, #2c3444); border-radius: 4px; margin-bottom: 12px; }
.po-card-hdr { padding: 8px 12px; border-bottom: 1px solid var(--border, #2c3444); font-family: var(--display, sans-serif); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary, #888); display: flex; align-items: center; cursor: default; }
.po-card--collapsible .po-card-hdr { cursor: pointer; user-select: none; }
.po-card--collapsible.closed .po-card-body { display: none; }
.po-card-body { padding: 12px; }
.po-crew-body { padding: 0; }
.po-crew-count { margin-left: auto; font-family: monospace; font-size: 10px; color: var(--text-tertiary, #555); text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Vitals */
.po-vitals { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
.po-vital { background: var(--panel, #1a1f2b); border: 1px solid var(--border, #2c3444); border-radius: 4px; padding: 10px 12px; }
.po-vital-n { font-family: monospace; font-weight: 600; font-size: 22px; letter-spacing: -.02em; }
.po-vital-l { font-size: 10.5px; color: var(--text-secondary, #888); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.po-vital-s { font-size: 10.5px; color: var(--text-secondary, #888); margin-top: 3px; }

/* Ribbon (stripboard overview) */
.po-ribbon { display: flex; gap: 4px; align-items: flex-end; height: 74px; padding: 6px 2px; }
.po-rb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.po-rb-bar { width: 100%; border-radius: 2px 2px 0 0; background: linear-gradient(180deg, var(--accent, #d8a24c), #b5813a); min-height: 2px; }
.po-rb-dl { font-family: monospace; font-size: 9px; color: var(--text-tertiary, #555); }
.po-rb-pl { font-family: monospace; font-size: 9px; color: var(--text-secondary, #888); }

/* Attention / warnings */
.po-warn-row { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--border, #2c3444); background: var(--surface, #141922); margin-bottom: 6px; }
.po-warn-badge { font-family: monospace; font-size: 10px; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; text-transform: uppercase; }
.po-warn-badge--need { background: var(--danger-bg, #331d1b); color: #e8a89e; }
.po-warn-badge--heavy { background: var(--warn-bg, #332714); color: #e6bd6f; }
.po-warn-badge--info { background: #182430; color: #9fc2dd; }
.po-dim { color: var(--text-tertiary, #555); font-size: 11px; }
.po-muted { color: var(--text-secondary, #888); }
.po-bold { font-weight: 600; }

/* Table */
.po-table-wrap { overflow: auto; border: 1px solid var(--border, #2c3444); border-radius: 4px; background: var(--panel, #1a1f2b); margin-bottom: 12px; }
.po-table-wrap table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.po-table-wrap thead th { position: sticky; top: 0; z-index: 3; background: #12161e; font-family: var(--display, sans-serif); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5px; color: var(--text-secondary, #888); border-bottom: 1px solid var(--border, #2c3444); padding: 6px 9px; text-align: left; white-space: nowrap; }
.po-table-wrap td { padding: 5px 9px; border-bottom: 1px solid #1e252e; white-space: nowrap; text-align: left; vertical-align: middle; color: var(--text, #eceae3); }
.po-table-wrap tbody tr:hover td { background: #161c26; }
.po-table-wrap td.num, .po-table-wrap th.num { text-align: right; }
.po-table-wrap .mono, .po-table-wrap td.mono { font-family: monospace; }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text, #eceae3); }
.rowsel { cursor: pointer; }
.po-scene-heading { font-weight: 600; }

/* Tags */
.po-tags { display: flex; gap: 3px; flex-wrap: wrap; white-space: normal; }
.po-tag { font-size: 10.5px; padding: 1px 6px; border-radius: 10px; background: #1d2532; border: 1px solid #2b3542; color: var(--text-secondary, #888); white-space: nowrap; }
.po-tag--cast { background: #1a2430; border-color: #2c3a4a; color: #bcd0e0; }
.po-tag--warn { background: #2a2311; border-color: #6f5623; color: #e6bd6f; }

/* Dept flags */
.po-flags { display: flex; gap: 3px; flex-wrap: wrap; }
.po-flag { font-family: monospace; font-size: 9.5px; padding: 1px 4px; border-radius: 3px; background: #1c2230; border: 1px solid #2b3340; color: var(--text-tertiary, #555); }
.po-flag.on { color: #20160a; background: var(--accent, #d8a24c); border-color: var(--accent, #d8a24c); }
.po-flag-note { font-size: 10.5px; padding: 1px 6px; border-radius: 10px; background: #2a1a18; border: 1px solid #7a4038; color: #e8a89e; }

/* Status pills */
.po-st { font-family: monospace; font-size: 10px; padding: 2px 7px; border-radius: 20px; font-weight: 600; display: inline-block; white-space: nowrap; }
.po-st--confirmed, .po-st--shot { color: #bff0d0; background: var(--success-bg, #183226); border: 1px solid #2c6b48; }
.po-st--needs, .po-st--unresolved { color: #f0c7c0; background: var(--danger-bg, #331d1b); border: 1px solid #7a4038; }
.po-st--offer-out { color: #f2d79c; background: var(--warn-bg, #332714); border: 1px solid #6f5623; }
.po-st--hold { color: #f0cf9a; background: #2e2413; border: 1px solid #6b4f20; }
.po-st--pass { color: var(--text-secondary, #888); background: #20242e; border: 1px solid #333b48; }

/* Mini selects and inputs */
.po-mini-select { background: var(--surface, #141922); border: 1px solid #2b3340; border-radius: 3px; color: var(--text, #eceae3); padding: 2px 6px; font-size: 12px; font-family: inherit; }
.po-inp { background: var(--surface, #141922); border: 1px solid #2b3340; border-radius: 3px; color: var(--text, #eceae3); padding: 3px 6px; font-size: 12px; font-family: inherit; min-width: 80px; }
.po-search { background: var(--surface, #141922); border: 1px solid var(--border, #2c3444); border-radius: 3px; color: var(--text, #eceae3); padding: 4px 8px; font-size: 12px; font-family: inherit; min-width: 190px; }

/* Toolbar */
.po-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.po-field { display: flex; align-items: center; gap: 6px; background: var(--surface, #141922); border: 1px solid var(--border, #2c3444); border-radius: 3px; padding: 4px 8px; }
.po-field-label { color: var(--text-secondary, #888); font-size: 11px; white-space: nowrap; }

/* Legend */
.po-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: var(--text-secondary, #888); margin-bottom: 10px; }
.po-legend-item { display: flex; align-items: center; }

/* Stripboard */
.po-board { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.po-day-col { flex: 0 0 176px; background: var(--panel, #1a1f2b); border: 1px solid var(--border, #2c3444); border-radius: 4px; min-height: 120px; }
.po-day-col.unsched { border-style: dashed; border-color: #4a4030; }
.po-day-hdr { padding: 7px 9px; border-bottom: 1px solid var(--border, #2c3444); }
.po-day-r1 { display: flex; align-items: center; justify-content: space-between; }
.po-day-r2 { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.po-day-num { font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.po-day-pg { font-family: monospace; font-size: 11px; color: var(--accent, #d8a24c); }
.po-day-dn { font-family: monospace; font-size: 9.5px; color: var(--text-tertiary, #555); }
.po-date-input { background: #121722; border: 1px solid #2b3340; border-radius: 3px; color: var(--text-secondary, #888); padding: 2px 4px; font-size: 10.5px; color-scheme: dark; width: 112px; }
.po-strips { padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.po-strip { border-left: 4px solid var(--text-tertiary, #555); background: #161c26; border-radius: 2px; padding: 5px 7px; font-size: 11px; }
.po-strip-r1 { display: flex; justify-content: space-between; gap: 6px; }
.po-strip-sc { font-family: monospace; color: var(--text-secondary, #888); }
.po-strip-pg { font-family: monospace; color: var(--text-tertiary, #555); }
.po-strip-set { color: var(--text, #eceae3); font-weight: 500; white-space: normal; }
.po-strip-cast { color: var(--text-tertiary, #555); font-size: 10px; white-space: normal; margin-top: 2px; }
/* Strip colours */
.po-strip.ext-day    { border-left-color: #c39b5a; }
.po-strip.ext-night  { border-left-color: #2f7a6f; }
.po-strip.ext-dusk   { border-left-color: #b06a86; }
.po-strip.int-day    { border-left-color: #4d6fa8; }
.po-strip.int-night  { border-left-color: #5d55a6; }
.po-strip.int-dusk   { border-left-color: #8a5f94; }
.po-strip.misc       { border-left-color: var(--text-tertiary, #555); }

/* Days In-Out grid */
.po-dood { overflow: auto; border: 1px solid var(--border, #2c3444); border-radius: 4px; max-height: 70vh; }
.po-dg { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
.po-dg th, .po-dg td { border-right: 1px solid #1e2530; padding: 5px 7px; white-space: nowrap; }
.po-dg thead th { position: sticky; top: 0; z-index: 5; background: #12161e; font-family: var(--display, sans-serif); font-weight: 600; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary, #888); border-bottom: 1px solid var(--border, #2c3444); text-align: center; }
.po-dg-role { position: sticky; left: 0; z-index: 4; background: #141a23; font-weight: 600; min-width: 150px; text-align: left !important; }
thead .po-dg-role { z-index: 6; }
.po-dg-tot { font-family: monospace; text-align: center; color: var(--text-secondary, #888); background: #131922; position: sticky; z-index: 2; }
thead .po-dg-tot { z-index: 6; }
.po-dg-cell { font-family: monospace; font-weight: 600; font-size: 10.5px; text-align: center; cursor: default; }
.po-dg-click { cursor: pointer; }
.po-dg-click:hover { outline: 1px solid var(--accent, #d8a24c); }
.c-SW, .c-W, .c-WF, .c-SWF { background: var(--success-bg, #183226); color: #bdeccd; }
.c-SW, .c-SWF { box-shadow: inset 2px 0 0 var(--success, #4fae72); }
.c-WF, .c-SWF { box-shadow: inset -2px 0 0 var(--success, #4fae72); }
.c-SWF { box-shadow: inset 2px 0 0 var(--success, #4fae72), inset -2px 0 0 var(--success, #4fae72); }
.c-H { background: #2e2413; color: #e2b878; }

/* Summary */
.po-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.po-matrix td, .po-matrix th { text-align: center; }
.po-matrix .rh { text-align: left; font-weight: 600; }

/* Info box */
.po-info-box { padding: 12px; background: var(--surface, #141922); border: 1px solid var(--border, #2c3444); border-radius: 4px; font-size: 12px; color: var(--text-secondary, #888); line-height: 1.5; }

/* Empty state */
.po-empty { padding: 26px; text-align: center; color: var(--text-secondary, #888); border: 1px dashed var(--border, #2c3444); border-radius: 4px; }
.po-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; gap: 12px; padding: 40px; text-align: center; }
.po-empty-icon { font-size: 48px; margin-bottom: 8px; }
.po-empty-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.po-clickable { cursor: pointer; }
.po-clickable:hover { text-decoration: underline; }

/* Drawer */
.po-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; opacity: 0; transition: opacity .18s ease; }
.po-scrim.on { opacity: 1; }
.po-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw; background: var(--panel2, #1b2130); border-left: 1px solid var(--border, #2c3444); transform: translateX(100%); transition: transform .18s ease; z-index: 50; display: flex; flex-direction: column; }
.po-drawer.on { transform: none; }
.po-drawer-hdr { padding: 12px 14px; border-bottom: 1px solid var(--border, #2c3444); display: flex; align-items: center; gap: 10px; }
.po-drawer-title { font-weight: 700; font-size: 16px; letter-spacing: .04em; margin: 0; flex: 1; }
.po-drawer-close { background: transparent; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary, #888); padding: 0 4px; line-height: 1; }
.po-drawer-body { padding: 14px; overflow-y: auto; flex: 1; }
.po-drawer-content { display: flex; flex-direction: column; gap: 8px; }
.po-drawer-sec { font-family: var(--display, sans-serif); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; color: var(--accent, #d8a24c); margin-top: 10px; }
.po-kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; font-size: 12px; }
.po-kv-k { color: var(--text-secondary, #888); }
.po-kv-v { color: var(--text, #eceae3); word-break: break-word; }
.po-cell-scene { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--border, #2c3444); background: var(--surface, #141922); margin-bottom: 6px; cursor: pointer; }
.po-k { font-family: monospace; font-size: 10px; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; }
.po-k--info { background: #182430; color: #9fc2dd; }

/* Import wizard */
.po-import-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 60; display: flex; align-items: center; justify-content: center; }
.po-import-dialog { background: var(--panel2, #1b2130); border: 1px solid var(--border, #2c3444); border-radius: 8px; max-width: 820px; width: 95vw; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; }
.po-import-hdr { padding: 16px 20px; border-bottom: 1px solid var(--border, #2c3444); }
.po-import-hdr h2 { font-size: 16px; font-weight: 700; margin: 0; }
.po-import-sub { font-size: 11.5px; color: var(--text-secondary, #888); }
.po-import-body { overflow-y: auto; padding: 16px 20px; flex: 1; }
.po-import-errors, .po-import-warnings, .po-import-info { padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; font-size: 12px; line-height: 1.6; }
.po-import-error { color: #e8a89e; }
.po-import-errors { background: #331d1b; border: 1px solid #7a4038; }
.po-import-warning { color: #e6bd6f; }
.po-import-warnings { background: #332714; border: 1px solid #6f5623; }
.po-import-info { background: #182430; border: 1px solid #2a4060; color: #9fc2dd; }
.po-import-more { text-align: center; color: var(--text-secondary, #888); font-style: italic; padding: 8px; }
.po-import-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.po-import-table th { background: #12161e; color: var(--text-secondary, #888); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border, #2c3444); }
.po-import-table td { padding: 5px 8px; border-bottom: 1px solid #1e252e; }
.po-import-footer { padding: 12px 20px; border-top: 1px solid var(--border, #2c3444); display: flex; justify-content: flex-end; gap: 10px; }

/* Responsive */
@media (max-width: 900px) {
  .po-vitals { grid-template-columns: repeat(3, 1fr); }
  .po-rail { width: 160px; }
  .po-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  /* Top bar: stack info above actions */
  .po-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
  }
  .po-topbar-info { min-width: 0; width: 100%; }
  .po-topbar-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .po-topbar-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
  .po-topbar-actions .btn { font-size: 11px; padding: 5px 6px; text-align: center; }
  /* Change script spans full width */
  .po-topbar-actions .btn:last-child { grid-column: 1 / -1; }

  /* Body: column layout — rail becomes horizontal scrolling chip row */
  .po-body { flex-direction: column; }
  .po-rail {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border, #2c3444);
    padding: 6px 10px;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    flex-shrink: 0;
  }
  .po-rail-item {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    margin-bottom: 0;
    white-space: nowrap;
  }
  .po-rail-count { margin-left: 4px; }

  /* Main content: account for bottom app nav (~56px) */
  .po-main { padding: 12px 12px 72px; }

  /* Vitals: 2-col, tighter */
  .po-vitals { grid-template-columns: repeat(2, 1fr); gap: 7px; margin-bottom: 10px; }
  .po-vital { padding: 8px 10px; }
  .po-vital-n { font-size: 19px; }

  /* Tab header */
  .po-tab-title { font-size: 17px; }

  /* Tables: allow horizontal scroll */
  .po-table-wrap { -webkit-overflow-scrolling: touch; }

  /* Two-col summary → single */
  .po-two-col { grid-template-columns: 1fr; }

  /* Stripboard: narrower columns */
  .po-day-col { flex: 0 0 148px; }

  /* Import dialog: full-screen on mobile */
  .po-import-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}
