@import './tokens.css';

/* ─── Cross-page navigation (MPA View Transitions) ──────────────────────────
   This is a multi-page app: every nav link is a full document reload, which
   otherwise flashes the whole shell (and topbar) on each page flip. Opting in
   to cross-document view transitions lets the browser snapshot the old page,
   load the new one, and animate between them so navigation reads as seamless.
   Progressive enhancement — browsers without support just navigate normally. */
@view-transition {
  navigation: auto;
}

/* Keep the content crossfade quick so it feels like a flip, not a slow fade. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 140ms;
}

/* The topbar is captured as its own snapshot (view-transition-name: topbar) so
   it morphs in place. But its live style is a translucent bar over a
   backdrop-blur: the snapshot bakes in that blur against the *old* page and
   keeps 15% transparency, so as the root crossfades underneath you get a blur
   mismatch and the page showing through the header — a header flash. Paint the
   snapshots on a solid bar so the header stays rock-steady through the morph.
   The live topbar keeps its frosted-glass look while scrolling. */
::view-transition-old(topbar),
::view-transition-new(topbar) {
  background: var(--c-bg);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  /* The cross-document view transition captures the `html` element as the
     `root` snapshot and paints the overlay above the live page. If only `body`
     carried the background, the transparent seams of the crossfade (and any
     area uncovered when two pages differ in height) would expose the white
     browser canvas — a flash on every navigation. Keep the dark colour on the
     root so the canvas behind the transition is always solid. */
  background: var(--c-bg);
}
body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--c-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Hide scrollbars (subtle, non-overlapping) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--c-border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--c-border-strong);
  border-radius: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ─── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
  height: var(--topbar-h);
  /* A stable name marks the topbar as one persistent element across pages, so
     the browser morphs it in place instead of crossfading it with the rest. */
  view-transition-name: topbar;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-logo {
  display: block;
  height: 64px;
  width: auto;
}
/* Flexible filler that pushes following items to the end of a flex row. */
.spacer {
  flex: 1;
}
/* Right-aligned button cluster inside a .panel-head (Refresh/Clear, etc.). */
.head-actions {
  display: flex;
  gap: var(--s-2);
  margin-left: auto;
}
/* Inline "this is a deduction" emphasis — fees/expenses that leave the business. */
.text-err {
  color: var(--c-err);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.user-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-6) var(--s-5);
}

/* ─── Top nav ──────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  gap: var(--s-1);
  margin-left: var(--s-4);
}
.nav-link {
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text-muted);
}
.nav-link:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
  text-decoration: none;
}
.nav-link.active {
  color: var(--c-accent);
  background: var(--c-accent-soft);
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface-2);
  color: var(--c-text);
  font: inherit;
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: var(--c-surface);
  border-color: var(--c-accent);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--c-text-muted);
}
/* Caution action (e.g. closing live inventory): amber, not destructive-red. */
.btn-warn {
  background: color-mix(in oklab, var(--c-warn) 18%, var(--c-surface-2));
  border-color: var(--c-warn);
  color: var(--c-text);
}
.btn-warn:hover {
  background: color-mix(in oklab, var(--c-warn) 28%, var(--c-surface));
  border-color: var(--c-warn);
}

/* ─── Search ──────────────────────────────────────────────────────────────
   Shares the input/control family (height, border, radius, font) with .seg and
   .btn so the Products toolbar reads as one cohesive row — the accent
   "+ New product" button is the only intentional standout. */
.search {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font: inherit;
  font-size: var(--fs-sm);
}
.search:focus {
  outline: none;
  border-color: var(--c-accent);
}

/* ─── Overview grid ───────────────────────────────────────────────────── */
.page-head {
  margin-bottom: var(--s-5);
}
.page-head h1 {
  font-size: var(--fs-2xl);
  margin: 0 0 var(--s-1);
  letter-spacing: -0.02em;
}
.page-head p {
  margin: 0;
  color: var(--c-text-muted);
}
.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

/* ─── Grouped-table section header (drill: group → categories) ─────────── */
tr.row-section > th {
  background: var(--c-surface-2);
  color: var(--c-text);
  font-size: var(--fs-sm);
  border-top: 1px solid var(--c-border-strong);
  padding-top: var(--s-3);
}

/* ─── Drill-down affordance ────────────────────────────────────────────── */
.clickable {
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.stat-card.clickable:hover {
  background: var(--c-surface-2);
  transform: translateY(-1px);
}
tr.clickable:hover > * {
  background: var(--c-surface-2);
}
.bar-row.clickable:hover {
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
}
.clickable:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ─── FAQ dialog ───────────────────────────────────────────────────────── */
.faq {
  max-width: 640px;
  width: calc(100% - 2rem);
  max-height: 85vh;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-text);
  padding: var(--s-5);
}
.faq::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.faq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.faq-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
}
.faq-close {
  padding: var(--s-1) var(--s-3);
}
.faq-intro {
  margin: 0 0 var(--s-3);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.faq details {
  border-top: 1px solid var(--c-border);
  padding: var(--s-3) 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq details > *:not(summary) {
  margin-top: var(--s-2);
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
.faq ul {
  margin: var(--s-2) 0 0;
  padding-left: var(--s-5);
}
.faq li {
  margin-bottom: var(--s-2);
}
.faq strong {
  color: var(--c-text);
}
.faq-red {
  color: var(--c-err);
  font-weight: 600;
}

/* ─── Page toolbar — the filters/actions strip above every page's content ──
   One component for every page. The default aligns items to the bottom so a
   stacked .field-inline (label over control) lines up on its control; the
   .center modifier vertically centers single-row controls (search, segmented
   toggles, a lone button). */
.page-toolbar {
  display: flex;
  align-items: flex-end;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.page-toolbar.center {
  align-items: center;
}
.page-toolbar .search {
  flex: 1 1 auto;
}
.page-toolbar .seg {
  flex: 0 0 auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}

/* ─── Overview list ───────────────────────────────────────────────────── */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.list {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.list-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  color: inherit;
  transition: background 0.12s;
}
.list-row:last-child {
  border-bottom: none;
}
.list-row:hover {
  background: var(--c-surface-2);
  text-decoration: none;
}
.list-row:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}
.list-row .row-main {
  flex: 1 1 auto;
  min-width: 0;
}
.list-row .row-name {
  font-weight: 600;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-group-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
}
.list-group-count {
  font-weight: 600;
  color: var(--c-text-faint);
}
.list-row .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  flex: 0 0 auto;
}
.list-row .meta.sources {
  min-width: 168px;
  justify-content: flex-end;
}
@media (max-width: 720px) {
  .list-row {
    flex-wrap: wrap;
  }
  .list-row .row-main {
    flex-basis: 100%;
  }
  .list-row .meta.sources {
    justify-content: flex-start;
  }
}
.card {
  display: block;
  padding: var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  color: inherit;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.card:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.card h3 {
  margin: 0 0 var(--s-1);
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}
.card .region {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  margin-bottom: var(--s-3);
}
.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}

/* ─── Badges / chips ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 2px var(--s-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid var(--c-border-strong);
  color: var(--c-text-muted);
  background: var(--c-surface-2);
}
.badge.accent {
  color: var(--c-accent);
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}
.chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-text-faint);
}
.chip.on {
  color: var(--c-text-muted);
}
.chip.on .dot {
  background: var(--c-ok);
}
/* "Related views" chip bar — contextual cross-tab links near a page header. */
.related-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin: var(--s-3) 0;
}
.related-label {
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Accent pills so the cross-links read clearly as interactive entry points.
   Overrides the base .btn/.btn-ghost they're built on (defined later → wins). */
.related-chip {
  padding: var(--s-1) var(--s-3);
  border-radius: 999px;
  border: 1px solid var(--c-accent);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.related-chip::before {
  content: '↗';
  font-weight: 400;
  opacity: 0.7;
}
.related-chip:hover {
  background: var(--c-accent);
  color: var(--c-bg); /* dark ground on accent fill — AA (white is only 3.74:1) */
  border-color: var(--c-accent);
  text-decoration: none;
}
.price {
  font-weight: 700;
  color: var(--c-text);
}

/* ─── Detail page ─────────────────────────────────────────────────────── */
.detail-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.detail-head h1 {
  margin: 0;
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
}
.detail-head .region {
  color: var(--c-text-muted);
}
/* Sub-section header (Financials / Source data) on the product detail page —
   reuses .detail-head's flex row but sits between panels rather than at the top. */
.detail-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
}
.detail-head.subsection {
  margin: var(--s-6) 0 var(--s-2);
}

.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--c-border);
}
.panel-head h2 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
}
.panel-head .status {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 600;
}
/* Co-developer sub-section head: the (read-only) quarter this period closes. */
.codev-quarter-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text-muted);
}

/* Finance — section group headers (Bookings revenue / Accounting) */
.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin: var(--s-5, 1.5rem) 0 var(--s-3);
  padding-bottom: var(--s-2, 0.5rem);
  border-bottom: 2px solid var(--c-border);
}
.section-title {
  margin: 0;
  /* One step above .panel-head h2 (fs-md/700) so the group header (Bookings
     revenue / Accounting) clearly outranks the panel titles beneath it.
     Ladder: page h1 (2xl) › section-title (lg) › panel h2 (md) › h3 (sm). */
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.section-sub {
  color: var(--c-text-faint);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* Finance — collapsible "Stripe reconciliation detail" drill-down */
.reconcile-summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface-2);
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.reconcile-summary::-webkit-details-marker {
  display: none;
}
/* Shared disclosure marker — the FAQ <summary> and the Stripe reconcile summary
   collapse/expand with the same triangle so the affordance reads identically. */
.faq summary::before,
.reconcile-summary::before {
  content: '▸';
  margin-right: var(--s-1);
  color: var(--c-text-faint);
}
.faq details[open] summary::before,
details.reconcile[open] .reconcile-summary::before {
  content: '▾';
}
.reconcile-summary .status {
  margin-left: auto;
}
.reconcile-title {
  font-size: var(--fs-md);
}
.reconcile-body {
  padding: var(--s-4);
  display: grid;
  gap: var(--s-4);
}
.reconcile-body .panel-head {
  border: 0;
  background: transparent;
  padding: 0 0 var(--s-2, 0.5rem);
}
.reconcile-body h3 {
  margin: 0;
  font-size: var(--fs-sm, 0.95rem);
  font-weight: 700;
}
.status-ok {
  color: var(--c-ok);
}
.status-missing {
  color: var(--c-text-faint);
}
.status-error {
  color: var(--c-err);
}
.panel-body {
  padding: var(--s-4);
}
.panel-body.empty {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

/* Field readout */
.field {
  margin-bottom: var(--s-4);
}
.field-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-faint);
  margin-bottom: 2px;
}
.field-value {
  white-space: pre-wrap;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s-2) var(--s-4);
  font-size: var(--fs-sm);
  margin: 0 0 var(--s-4);
}
/* Left-aligned inline editor row (label/input + Save) inside a .comm-edit panel. */
.editor-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-top: var(--s-3);
}
.kv dt {
  color: var(--c-text-faint);
}
.kv dd {
  margin: 0;
}

ul.clean {
  margin: 0;
  padding-left: var(--s-5);
}
ul.clean li {
  margin-bottom: var(--s-1);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.data th,
table.data td {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-border);
}
table.data th {
  color: var(--c-text-faint);
  font-weight: 600;
}
/* Click-to-sort headers (see js/sortable.js). Only header cells the script marks
   as `.sortable` get the affordance; section/headerless tables are left alone. */
table.data thead th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  white-space: nowrap;
}
table.data thead th.sortable:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
}
/* Direction arrow on the active column. Right-aligned numeric headers keep the
   arrow snug after the value; left-aligned ones get a trailing arrow. */
table.data thead th.sortable[aria-sort]::after {
  content: '▲';
  font-size: 0.7em;
  margin-left: 0.4em;
  opacity: 0.85;
}
table.data thead th.sortable[aria-sort='descending']::after {
  content: '▾';
}

.sku-cards {
  display: grid;
  gap: var(--s-3);
}
.sku-card {
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface-2);
}
.sku-card .sku-top {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.ota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-3);
}
.ota-tile {
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-sm);
  padding: var(--s-4);
  text-align: center;
  color: var(--c-text-faint);
}
.ota-tile.on {
  border-style: solid;
  color: var(--c-text);
}

.health {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-xs);
  padding: 2px var(--s-2);
  border-radius: 999px;
}
.health.ok {
  color: var(--c-ok);
  background: #4ade8016;
}
.health.bad {
  color: var(--c-err);
  background: #f8717116;
}

/* ─── Skeletons / states ──────────────────────────────────────────────── */
/* The sweep animates a pseudo-element's `transform` rather than the base
   element's `background-position`. background-position can't be composited, so
   the old shimmer repainted on the main thread every frame (DevTools flagged it
   as the CLS culprit: UNSUPPORTED_CSS_PROPERTY / non-composited). transform runs
   on the compositor, so the sweep is smooth and never blocks layout. */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--c-surface);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--c-surface-2) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: shimmer 1.4s ease infinite;
  will-change: transform;
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}
/* Refresh button: spin only the glyph (not the button box) while a manual
   re-fetch is in flight. The icon is its own inline-block so the rotation pivots
   on the glyph's center, leaving the button border/focus ring steady. */
#refresh-btn {
  padding: var(--s-1) var(--s-2);
  line-height: 1;
}
.refresh-icon {
  display: inline-block;
}
#refresh-btn.spinning .refresh-icon {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #refresh-btn.spinning .refresh-icon {
    animation: none;
  }
}
/* Bank-sync cooldown affordance: a radial "sweep" over the refresh button that
   depletes as the cooldown elapses (like an ability cooldown). The angle is an
   animatable registered custom property so the sweep is smooth; JS sets the total
   duration (--cd-total) and a negative delay (--cd-delay) so it can start partway
   through when the page loads mid-cooldown. While cooling the button still works —
   it just refreshes the view and won't re-hit the bank until the sweep completes. */
@property --refresh-cd {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
#refresh-btn.cooling {
  position: relative;
  cursor: progress;
}
#refresh-btn.cooling::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(var(--c-accent) var(--refresh-cd), transparent 0);
  opacity: 0.28;
  animation: refresh-cooldown var(--cd-total, 900s) linear var(--cd-delay, 0s) forwards;
}
@keyframes refresh-cooldown {
  from {
    --refresh-cd: 360deg;
  }
  to {
    --refresh-cd: 0deg;
  }
}
@media (prefers-reduced-motion: reduce) {
  /* No sweep animation — show a static dimmed ring so the cooldown is still evident. */
  #refresh-btn.cooling::after {
    animation: none;
    background: var(--c-accent);
    opacity: 0.18;
  }
}
/* Small deep-link to the Actual Budget server in the Finance toolbar. */
.actual-link {
  align-self: center;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.actual-link[hidden] {
  display: none;
}
.sk-line {
  height: 12px;
  margin-bottom: var(--s-2);
}
/* Fills a .chart container's reserved height with a shimmer while it loads. */
.sk-chart {
  width: 100%;
  height: 100%;
  border-radius: var(--r-md);
}
.banner {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  font-size: var(--fs-sm);
}
.banner.error {
  background: #f8717118;
  border: 1px solid var(--c-err);
  color: var(--c-err);
}
.banner.ok {
  background: #4ade8016;
  border: 1px solid var(--c-ok);
  color: var(--c-ok);
}
.empty-state {
  text-align: center;
  color: var(--c-text-muted);
  padding: var(--s-8) var(--s-4);
}
/* Failure variant — visually distinct from a neutral "no data" empty so a broken
   fetch can never be mistaken for a legitimate zero. Red-accented box, with the
   technical detail demoted to faint small-print and a Retry affordance. */
.empty-state.is-error {
  color: var(--c-err);
  background: #f8717110;
  border: 1px solid color-mix(in srgb, var(--c-err) 35%, transparent);
  border-radius: var(--r-md);
  padding: var(--s-5) var(--s-4);
}
.empty-state .es-lead {
  margin: 0;
  font-weight: 600;
}
.empty-state.is-error small {
  display: block;
  margin-top: var(--s-2);
  color: var(--c-text-faint);
}
.empty-state .es-actions {
  margin-top: var(--s-3);
}
/* Lighter inline empty — a left-aligned muted note for in-table / in-panel
   "no X yet" messages, distinct from the big centered .empty-state used for whole
   sections. Works as <div>, <td>, or <span> (no forced display). */
.empty-inline {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

/* ─── Login ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-5);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: var(--s-7) var(--s-6);
  text-align: center;
}
.login-card .brand {
  justify-content: center;
  font-size: var(--fs-xl);
  margin-bottom: var(--s-2);
}
.login-card .brand-logo {
  height: 138px;
}
.login-card p {
  color: var(--c-text-muted);
  margin: 0 0 var(--s-6);
  font-size: var(--fs-sm);
}
.btn-google {
  width: 100%;
  justify-content: center;
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-md);
  background: #fff;
  color: #1f1f1f;
  border: none;
  font-weight: 600;
}
.btn-google:hover {
  background: #f1f1f1;
  border: none;
}
/* Secondary, deliberately understated — it's a dev/testing affordance, not the
   primary path. Only rendered in non-prod (see login.js). */
.btn-demo {
  width: 100%;
  justify-content: center;
  margin-top: var(--s-3);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.login-error {
  margin-top: var(--s-4);
  font-size: var(--fs-sm);
  color: var(--c-err);
}
.login-foot {
  margin-top: var(--s-5);
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}

/* ─── Payroll ──────────────────────────────────────────────────────────── */
.field-inline {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.select,
.input,
.input-sm {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font: inherit;
  font-size: var(--fs-sm);
  padding: var(--s-2) var(--s-3);
}
.select:focus,
.input:focus,
.input-sm:focus {
  outline: none;
  border-color: var(--c-accent);
}
/* Pay-period picker option weighting: past periods read lighter; the next pay
   period and upcoming periods are regular weight. */
.opt-past {
  color: var(--c-text-faint);
}
.opt-next {
  font-weight: 400;
}
.opt-upcoming {
  font-weight: 400;
}
/* Subtle "Past" / "Upcoming" group labels — faint, light weight, smaller. */
#period optgroup {
  color: var(--c-text-faint);
  font-weight: 400;
  font-size: var(--fs-xs);
}
.input-sm {
  width: 78px;
  padding: var(--s-1) var(--s-2);
}

/* Generic two-column panel grid (named for its first use; now also Finance's
   trend/expenses row and the product detail page). Collapses to one column when narrow. */
.payroll-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--s-4);
  align-items: start;
}
@media (max-width: 860px) {
  .payroll-layout {
    grid-template-columns: 1fr;
  }
}

/* Pay-period preview + stranded share a top row so the Departures board can run
   full width. Preview holds a base width; stranded (only rendered when something's
   actually stranded) takes the rest. When nothing's stranded its slot collapses and
   the preview spans the row. */
.payroll-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: start;
  margin-bottom: var(--s-4);
}
.payroll-top > .preview-panel {
  flex: 1 1 340px;
}
.payroll-top > #stranded {
  flex: 2 1 460px;
}
.payroll-top > #stranded:empty {
  display: none;
}

/* A secondary section inside a panel — e.g. co-developer commissions under the
   pay-period preview. Separated from the panel body by a top rule, with a smaller
   h3 header row (title + quarter picker + queue button) that mirrors a panel-head. */
.panel-subsection {
  border-top: 1px solid var(--c-border);
  padding: var(--s-4);
}
.panel-subsection .subsection-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.panel-subsection .subsection-head h3 {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
}
.panel-subsection .subsection-head .status {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* Fixed column widths so the columns can't reflow: expanding a co-developer
   breakdown only grows its row downward and never shifts the Name/Total columns or
   any other row. Widths pin the checkbox, name, and total; Breakdown takes the rest. */
.receipt {
  table-layout: fixed;
}
.receipt thead th:nth-child(2) {
  width: 17rem;
}
.receipt th.col-pay {
  width: 7rem;
}
.receipt td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pay-period preview receipt: the middle "Breakdown" cell holds itemized lines
   (tours / adjustments / co-developer commission), each a label on the left and an
   amount on the right; the per-person total in the last cell is bold. */
.receipt .pay-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
}
.receipt .pay-item + .pay-item {
  margin-top: 2px;
}
.receipt .pay-amt {
  color: var(--c-text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Restaurant-menu dot leaders: the label grows and a faint dotted line fills the gap
   from the end of the label to the amount on the right. Applies to top-level pay-items
   and the co-developer summary row (both = .pay-label + .pay-amt in a flex row). */
.receipt .pay-item > .pay-label,
.receipt .codev-details > summary > .pay-label {
  display: flex;
  align-items: baseline;
  flex: 1 1 auto;
  min-width: 0;
}
.receipt .pay-item > .pay-label::after,
.receipt .codev-details > summary > .pay-label::after {
  content: '';
  flex: 1 1 auto;
  align-self: flex-end;
  height: 0.45em;
  margin: 0 0.6em 0.16em;
  /* Dotted leader as a repeating radial-gradient so the dot pitch (background-size
     width) and transparency (color-mix alpha) are both controllable. */
  background-image: radial-gradient(circle, color-mix(in oklab, var(--c-text-faint) 32%, transparent) 1px, transparent 1.5px);
  background-size: 9px 100%;
  background-position: left bottom;
  background-repeat: repeat-x;
}
.receipt .pay-item.muted .pay-label,
.receipt .pay-item.muted .pay-amt {
  color: var(--c-text-faint);
}
/* The co-developer Mercury badge after a guide's name in the receipt. */
.receipt .name-badge {
  margin-left: var(--s-2);
}
/* Queue action row directly under the receipt (replaces the old toolbar button).
   Right/bottom padding matches the panel body so the button lines up with the
   receipt's right edge and has breathing room below. */
.receipt-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 var(--s-4) var(--s-4);
  margin-top: var(--s-2);
}
/* Collapsed-by-default co-developer derivation: the summary reads like a pay-item
   row (label + amount) with a disclosure caret; the body lists each product's
   net-revenue × rate = commission BELOW it. Override .pay-item's flex so the
   summary and the expanded body stack vertically instead of sitting side by side. */
.receipt .codev-details {
  display: block;
}
.receipt .codev-details > summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
  cursor: pointer;
  list-style: none;
}
.receipt .codev-details > summary::-webkit-details-marker {
  display: none;
}
.receipt .codev-details > summary .pay-label::before {
  content: '▸';
  display: inline-block;
  width: 1em;
  margin-right: 2px;
  color: var(--c-text-faint);
}
.receipt .codev-details[open] > summary .pay-label::before {
  content: '▾';
}
.receipt .codev-prods {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: var(--s-1) 0 var(--s-2) var(--s-4);
}
.receipt .codev-prod {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--fs-xs);
}
.receipt .codev-prod-name {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--c-text-muted);
}
.receipt .codev-prod-calc {
  flex: 1 1 auto;
  color: var(--c-text-faint);
}
.receipt .codev-prod .pay-amt {
  flex: 0 0 auto;
}
/* Per-person payout selection (piecemeal). The leading checkbox column is narrow;
   a fully-queued row greys out and shows a "queued" chip instead of a checkbox. */
.receipt th.pay-select,
.receipt td.pay-select {
  width: 2.5rem; /* fixed-layout: fits the checkbox / ✓ paid mark, padding trimmed */
  padding-left: var(--s-2);
  padding-right: var(--s-2);
  white-space: nowrap;
  text-align: center;
}
.receipt tr.is-paid td:not(.pay-select) {
  opacity: 0.5;
}
/* Compact "already queued" mark in the narrow select column (the row is also greyed). */
.receipt .queued-mark {
  color: var(--c-ok);
  font-weight: 700;
}
.receipt .queued-chip {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-ok);
  white-space: nowrap;
}
/* Already-queued / remaining summary rows under the grand total. */
.receipt tfoot tr.receipt-sub th,
.receipt tfoot tr.receipt-sub td {
  font-weight: 400;
  color: var(--c-text-muted);
  border-top: 0;
}
.receipt tfoot tr.receipt-sub th:last-child {
  font-weight: 700;
  color: var(--c-text);
}

/* ─── Departures board (calendar list–style) ──────────────────────────────────
   Each departure is one fixed-height flex row, so every row is the exact same
   height and the right-hand columns (guide / guests / pay) line up across every
   day. The title column flexes; the tour name and meta ellipsise before the flags
   and editable inputs, which stay pinned and visible. */
.board-list {
  display: flex;
  flex-direction: column;
}
.day-group + .day-group {
  margin-top: var(--s-2);
}
/* Day group header sticks below the topbar while its rows scroll past. */
.day-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
  position: sticky;
  top: var(--topbar-h);
  z-index: 2;
}
.day-head-date {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--c-text-muted);
}
.day-head-side {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}

.board-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: 52px;
  padding: 0 var(--s-3);
  border-bottom: 1px solid var(--c-border);
  cursor: pointer; /* whole row opens the departure detail drawer */
}
/* A subtle lift on hover — deliberately lighter than the day-header chip (which is
   --c-surface-2) so a hovered row never reads as a date row. Emphasis ladder:
   base < hover < day header < open-in-drawer. */
.board-row:hover {
  background: color-mix(in oklab, var(--c-surface), var(--c-surface-2));
}
/* The departure whose detail drawer is open. Deliberately NOT the accent blue — that
   hue owns bulk checkbox selection — so this uses a neutral emphasis (lighter surface
   + a muted bar) to read as "open here" without colliding with the selection state. */
.board-row.is-active {
  background: color-mix(in oklab, var(--c-surface-2) 86%, var(--c-text));
  box-shadow: inset 3px 0 0 var(--c-text-muted);
}

/* ─── Guide filter (pay-period preview → Departures board) ───────────────────
   The tour count in the preview is a button that filters the board to that guide.
   Styled like a link so it reads as clickable next to the guide-name link. */
.board-filter-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--c-accent);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.board-filter-btn:hover { text-decoration: underline; }
.board-filter-btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 3px;
}
/* The active guide's preview row — same neutral is-active treatment as the board
   rows (applied to cells since a <tr> can't carry the inset bar reliably). */
#report tr.is-active > td {
  background: color-mix(in oklab, var(--c-surface-2) 86%, var(--c-text));
}
#report tr.is-active > td:first-child {
  box-shadow: inset 3px 0 0 var(--c-text-muted);
}
/* The "Showing only X's tours ✕" chip in the Departures panel head. */
.board-filter { display: inline-flex; align-items: center; }
.board-filter-chip {
  display: inline-block; /* plain inline text — flex would trim the inter-word spaces */
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.board-filter-chip strong { color: var(--c-text); }
.board-filter-clear {
  border: 0;
  background: none;
  padding: 0;
  margin-left: var(--s-2);
  color: var(--c-text-muted);
  line-height: 1;
  cursor: pointer;
}
.board-filter-clear:hover { color: var(--c-text); }

.li-time {
  flex: none;
  width: 72px;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.li-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  overflow: hidden;
}
.li-name {
  flex: 0 1 auto;
  min-width: 40px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li-sub {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--c-text-faint);
  font-size: var(--fs-xs);
}
.li-flags {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  white-space: nowrap;
}
/* Deferral badges: a monthly-cadence departure whose pay lands in a different pay
   period. `out` = paid later (this period only shows it); `in` = pulled into the
   end-of-month run from the first half. Neutral/info hues — not the warn red. */
.defer-chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px var(--s-2);
  border-radius: 999px;
  white-space: nowrap;
}
.defer-chip.out {
  color: var(--c-text-muted);
  background: color-mix(in oklab, var(--c-text-muted) 16%, transparent);
}
.defer-chip.in {
  color: var(--c-info);
  background: color-mix(in oklab, var(--c-info) 14%, transparent);
}
/* A row whose pay is deferred out of this period reads as informational, not active. */
.board-row.is-deferred .li-name,
.board-row.is-deferred .li-pay {
  opacity: 0.6;
}
.li-custom {
  flex: none;
  display: inline-flex;
  gap: var(--s-2);
}
.li-guide-col {
  flex: none;
  width: 184px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.li-guide-col .select {
  width: 100%;
}
.li-guests {
  flex: none;
  width: 84px;
  text-align: right;
  white-space: nowrap;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.li-guests-lbl {
  color: var(--c-text-faint);
}
.li-pay {
  flex: none;
  width: 88px;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .li-guests-lbl {
    display: none;
  }
  .li-guide-col {
    width: 150px;
  }
}

/* Retained: .dep-sub + .data .col-pay still used by the report + stranded tables. */
.dep-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-2);
  margin-top: 2px;
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}
.data .col-pay {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── Bulk-action bar (shared: calendar list view + payroll board) ────────────
   Visual styles for the floating multi-select bar and its custom checkboxes. The
   calendar pins its bar as a flex child of .cal-page; payroll docks it (below). */
.bulk-bar {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  box-shadow: 0 -6px 16px -8px rgba(0, 0, 0, 0.45);
}
.bulk-bar[hidden] {
  display: none;
}
.bulk-group {
  display: inline-flex;
  align-items: flex-end;
  gap: var(--s-3);
}
.bulk-group[hidden] {
  display: none;
}
#bulk-count {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  align-self: center;
}
/* Custom-styled to match the dashboard's inputs/switch: surface-2 box, strong
   border, accent fill when checked, accent focus ring; sized a touch larger than the
   native control for easier targeting in the list. */
.bulk-check {
  flex: none;
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  display: inline-grid;
  place-content: center;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.bulk-check::after {
  content: '';
  width: 5px;
  height: 9px;
  margin-bottom: 2px; /* optical centering of the rotated check */
  border: solid var(--c-bg); /* dark ground on the accent fill — matches our AA rule */
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.12s ease;
}
.bulk-check:hover {
  border-color: var(--c-accent);
}
.bulk-check:checked {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.bulk-check:checked::after {
  transform: rotate(45deg) scale(1);
}
/* Indeterminate (day box with only some bookings selected): a dash, not a check. */
.bulk-check:indeterminate {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.bulk-check:indeterminate::after {
  width: 9px;
  height: 2px;
  margin: 0;
  border: 0;
  background: var(--c-bg);
  transform: none;
}
.bulk-check:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* Payroll: dock the bar so it floats at the bottom of the viewport while the long
   departures list scrolls (sticky, centered). It's the last child of <main>, so once
   the page is scrolled to the end it settles in place. */
.bulk-dock {
  position: sticky;
  bottom: var(--s-5);
  z-index: 20;
  display: flex;
  justify-content: center;
  margin-top: var(--s-4);
  pointer-events: none; /* let clicks fall through the empty dock to the page */
}
.bulk-dock .bulk-bar {
  pointer-events: auto;
}

/* ─── Slide-in detail drawer (shared: calendar events + payroll departures) ───
   Base overlay: fixed to the viewport, slides in from the right over a backdrop.
   The calendar additionally docks this as an inline column at ≥1280px — those
   layout-specific overrides stay in calendar.css. */
.cal-drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 380px;
  max-width: 92vw;
  height: calc(100vh - var(--topbar-h));
  margin: 0;
  border: 1px solid var(--c-border);
  border-radius: 0;
  box-shadow: var(--shadow-2);
  overflow: auto;
  z-index: 60;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.22s ease, visibility 0.22s ease;
}
.cal-drawer.open {
  transform: translateX(0);
  visibility: visible;
}
.cal-backdrop {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 55;
}
.cal-detail .panel-head #detail-close {
  margin-left: auto;
  padding: var(--s-1) var(--s-2);
  line-height: 1;
}
.cal-detail .panel-body { font-size: var(--fs-sm); }
.cal-detail .detail-empty { color: var(--c-text-faint); }
.cal-detail dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-2) var(--s-3);
  margin: 0 0 var(--s-3);
}
.cal-detail dt { color: var(--c-text-faint); }
.cal-detail dd { margin: 0; color: var(--c-text); }
.cal-detail .detail-title {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0 0 var(--s-3);
}
.cal-detail .detail-section {
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-3);
  margin-top: var(--s-3);
}
.cal-detail .note {
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}
.cal-detail a.cf-link {
  color: var(--c-info);
  word-break: break-all;
}

/* ─── Wide screens (≥1280px): dock the drawer as an inline column ─────────────
   Shared docked appearance for the slide-in drawer. Below 1280px it stays the
   fixed overlay above; at ≥1280px each page lays out a right-hand column and the
   drawer fills it in place (no transform, no backdrop). The calendar supplies its
   own grid (calendar.css); the payroll grid lives below. The calendar also re-
   declares this appearance in calendar.css — identical values, so it's a no-op
   there — plus its drag-resize handle, which payroll doesn't use. */
@media (min-width: 1280px) {
  .cal-drawer.open {
    position: relative;
    display: flex;
    flex-direction: column;
    inset: auto;
    margin: 0;
    width: auto;
    max-width: none;
    height: auto;
    min-height: 0;
    transform: none;
    visibility: visible;
    transition: none;
    box-shadow: none;
    border-radius: var(--r-md);
    overflow: visible;
  }
  .cal-drawer.open .panel-head { flex: none; }
  .cal-drawer.open .panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
  /* Closing collapses the column in place rather than sliding the fixed overlay
     off-screen. */
  .cal-drawer:not(.open) { display: none; }
  /* No dark backdrop for the docked column. */
  .cal-backdrop { display: none; }

  /* Payroll dock: .payroll-col (all page content) fills column 1; the open drawer
     fills column 2 on the right. A single grid row, so the content defines the row
     height and the header sits flush at the top — no gap. The drawer is sticky so
     it tracks the scroll of the long board. When closed the column collapses and the
     page reclaims full width. */
  .payroll-page:has(.cal-drawer.open) {
    display: grid;
    grid-template-columns: 1fr var(--cal-drawer-w, 380px);
    column-gap: var(--s-3);
    align-items: start;
    max-width: calc(var(--maxw) + var(--cal-drawer-w, 380px) + var(--s-3));
  }
  .payroll-page:has(.cal-drawer.open) > #detail-panel {
    grid-column: 2;
    align-self: start;
    position: sticky;
    top: calc(var(--topbar-h) + var(--s-3));
    max-height: calc(100vh - var(--topbar-h) - 2 * var(--s-3));
  }
}
/* Finance period controls ride in the floating dock. Unlike the bulk bar (whose
   form fields baseline-align at flex-end), these are equal-height seg/nav controls,
   so center the row; the trailing status + refresh sit centered against them. */
.period-bar {
  align-items: center;
}
.period-bar .actual-link,
.period-bar #synced {
  align-self: center;
}

/* Channel mix bar */
.channel-mix {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin-bottom: var(--s-4);
}
.channel-mix:empty {
  display: none;
}
.mix-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-faint);
}
.mix-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.mix-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-text-faint);
}
.mix-direct .dot {
  background: var(--c-ok);
}
.mix-viator .dot {
  background: var(--c-info);
}
.mix-getyourguide .dot {
  background: var(--c-accent);
}
.mix-airbnb .dot {
  background: #f472b6;
}
.mix-eventbrite .dot {
  background: var(--c-warn);
}
.mix-total {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--c-text);
}
.assign {
  width: 100%;
}

table.data tfoot th {
  border-top: 1px solid var(--c-border-strong);
  border-bottom: 1px solid var(--c-border);
  padding-top: var(--s-3);
  font-size: var(--fs-md);
}

.callout {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}
.callout.warn {
  background: #fbbf2416;
  border: 1px solid var(--c-warn);
  color: var(--c-warn);
}
.callout.info {
  background: color-mix(in oklab, var(--c-info) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--c-info) 45%, transparent);
  color: var(--c-info);
}

.add-guide {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.add-guide .input {
  flex: 1;
  min-width: 140px;
}

/* ─── Finance ──────────────────────────────────────────────────────────── */
.seg {
  display: inline-flex;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.seg-btn {
  padding: var(--s-2) var(--s-4);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border: none;
  border-right: 1px solid var(--c-border-strong);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.seg-btn:last-child {
  border-right: none;
}
.seg-btn:hover {
  color: var(--c-text);
}
.seg-btn.active {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

/* Period navigator (arrows + dropdown) — pairs with the .seg granularity control. */
.period-nav {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.period-arrow {
  padding: var(--s-2) var(--s-3);
  background: var(--c-surface-2);
  color: var(--c-text-muted);
  border: none;
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1;
  cursor: pointer;
}
.period-arrow:hover:not(:disabled) {
  color: var(--c-text);
}
.period-arrow:disabled {
  opacity: 0.4;
  cursor: default;
}
.period-select {
  background: var(--c-surface-2);
  color: var(--c-text);
  border: none;
  border-left: 1px solid var(--c-border-strong);
  border-right: 1px solid var(--c-border-strong);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.stat-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-faint);
  margin-bottom: var(--s-1);
}
.stat-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat-value.sm {
  font-size: var(--fs-lg);
}
.stat-value.pos {
  color: var(--c-ok);
}
.stat-value.neg {
  color: var(--c-err);
}

.chart {
  width: 100%;
  height: 360px;
  /* Let an ECharts canvas shrink with its grid/flex track instead of inflating
     it (which would push a sibling table out and clip it). */
  min-width: 0;
}
#trend.chart {
  height: 300px;
}
/* The money-flow sankey has many nodes (sources → fees → net → expenses → profit),
   so it gets extra height to keep the labels legible. */
#sankey.chart {
  height: 560px;
}

/* Revenue-by-channel: donut flexes (min 0), table keeps its full content width
   (never squeezed/clipped); stacks on narrower screens. */
.channel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, max-content);
  gap: var(--s-4);
  align-items: center;
}
@media (max-width: 980px) {
  .channel-layout {
    grid-template-columns: 1fr;
  }
}

/* ─── Comparison matrix ────────────────────────────────────────────────── */
.detail-head .cmp-seg {
  margin-left: auto;
}
.cmp-seg {
  display: inline-flex;
  gap: var(--s-1);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 2px;
}
.cmp-seg .btn {
  font-size: var(--fs-sm);
  padding: var(--s-1) var(--s-3);
}
.cmp-seg .btn.active {
  color: var(--c-accent);
  background: var(--c-accent-soft);
}
.cmp-seg .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Break the comparison view out of the centered container to span the page. */
#view-compare {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 var(--s-5);
}

/* Sticky column headers need no scroll-container between them and the window:
   neutralize the panel's corner-clip and the scroll wrapper on wide screens. */
#view-compare .panel {
  overflow: visible;
}
#view-compare .panel-head {
  border-radius: var(--r-md) var(--r-md) 0 0; /* keep rounded top without the clip */
}
.cmp-scroll {
  overflow: visible;
}
@media (max-width: 820px) {
  .cmp-scroll {
    overflow-x: auto; /* narrow screens scroll horizontally (header sticky trades off) */
  }
}
.cmp-table {
  min-width: 640px;
  /* Fixed layout so the attribute column is set and every source column is
     equal — the unset source columns divide the remaining width evenly. */
  table-layout: fixed;
}
.cmp-table th,
.cmp-table td {
  vertical-align: top;
  overflow-wrap: anywhere; /* keep long values inside their equal column */
}
.cmp-table thead th {
  position: sticky;
  top: var(--topbar-h, 63px); /* stick just below the sticky topbar */
  z-index: 2;
  white-space: nowrap;
  background: var(--c-surface-2);
}
.cmp-attr {
  position: sticky;
  left: 0;
  z-index: 1; /* sticky-left column above normal body cells */
  width: 180px;
  background: var(--c-surface);
  font-weight: 600;
  color: var(--c-text-muted);
}
.cmp-table thead th.cmp-attr {
  z-index: 3; /* corner: above both the header row and the sticky-left column */
}
.cmp-table tbody tr:hover .cmp-attr {
  background: var(--c-surface-2);
}
.cmp-empty {
  color: var(--c-text-faint);
}
.cmp-row-diff {
  box-shadow: inset 3px 0 0 var(--c-warn);
}
.cmp-cell-diff {
  background: #fbbf2416;
  color: var(--c-warn);
}
.cmp-flag {
  color: var(--c-warn);
  font-size: 0.7em;
  vertical-align: middle;
}
.cmp-okmark {
  color: var(--c-ok);
  font-size: var(--fs-xs);
}

.cmp-summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.cmp-expand {
  font-size: var(--fs-xs);
  padding: 0 var(--s-2);
}
.cmp-detail {
  margin-top: var(--s-3);
}
.cmp-clamp {
  max-height: 4.6em;
  overflow: hidden;
}
.cmp-clamp.cmp-open {
  max-height: none;
}
.cmp-more {
  margin-top: var(--s-1);
  background: none;
  border: none;
  padding: 0;
  color: var(--c-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.cmp-extras {
  margin-top: var(--s-4);
}
.cmp-extras summary {
  cursor: pointer;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-faint);
  margin-bottom: var(--s-3);
}

/* Commission-rate override disclosure — styled as an explicit toggle button. */
.comm-edit {
  margin: var(--s-4) 0;
}
.comm-edit > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  width: fit-content;
  cursor: pointer;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-size: var(--fs-sm);
  font-weight: 500;
  list-style: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.comm-edit > summary::-webkit-details-marker {
  display: none;
}
.comm-edit > summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  opacity: 0.7;
}
.comm-edit[open] > summary::before {
  transform: rotate(45deg);
}
.comm-edit > summary:hover,
.comm-edit[open] > summary {
  border-color: var(--c-accent);
  color: var(--c-accent);
}
@media (max-width: 860px) {
  .cmp-attr {
    min-width: 110px;
  }
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 80px;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
  font-size: var(--fs-sm);
}
.bar-label {
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  background: var(--c-surface-2);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--c-accent);
  border-radius: 999px;
}
.bar-val {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ─── Settings ─────────────────────────────────────────────────────────── */
.btn.primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  /* Dark cool ground as the label so it reads against the light azure fill
     (token-driven, was a hardcoded warm brown from the old ember accent). */
  color: var(--c-bg);
  font-weight: 600;
}
.btn.primary:hover {
  background: color-mix(in oklab, var(--c-accent) 82%, white);
  border-color: color-mix(in oklab, var(--c-accent) 82%, white);
}
.help {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
  margin: 0 0 var(--s-4);
  max-width: 70ch;
}
.help code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--c-text);
  background: var(--c-surface-2);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}
.fees-table .input-sm {
  width: 96px;
  text-align: right;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-4);
  margin-top: var(--s-4);
}

/* ─── Photo library ───────────────────────────────────────────────────── */
#log-panel {
  margin-top: var(--s-6);
}
.photo-dropzone {
  border: 1.5px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  padding: var(--s-5);
  text-align: center;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.photo-dropzone:hover,
.photo-dropzone:focus-visible {
  border-color: var(--c-accent);
  outline: none;
}
.photo-dropzone.dragover {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}
.photo-dropzone .dz-inner {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  pointer-events: none;
}
.photo-dropzone .dz-inner .dz-browse {
  pointer-events: auto;
  padding: 0 var(--s-1);
  color: var(--c-accent);
}
.photo-dropzone small {
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}

.photo-status {
  margin: var(--s-3) 0 0;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.photo-status.ok {
  color: var(--c-ok);
}
.photo-status.warn {
  color: var(--c-warn);
}

.photo-grid {
  margin-top: var(--s-4);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-4);
}
.photo-tile {
  margin: 0;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.photo-tile.dragging {
  opacity: 0.4;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--c-bg);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-badge {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  padding: 2px var(--s-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent);
  backdrop-filter: blur(4px);
}
.photo-actions {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  display: flex;
  gap: var(--s-1);
  opacity: 0;
  transition: opacity 0.15s;
}
.photo-tile:hover .photo-actions,
.photo-tile:focus-within .photo-actions {
  opacity: 1;
}
.photo-actions .btn {
  padding: var(--s-1) var(--s-2);
  background: rgba(0, 0, 0, 0.55);
  border-color: transparent;
  color: var(--c-text);
}
.photo-actions .btn:hover {
  border-color: var(--c-accent);
}
.photo-actions .photo-primary:disabled {
  color: var(--c-accent);
  opacity: 1;
  cursor: default;
}
.photo-tile figcaption {
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.photo-tile figcaption input {
  width: 100%;
  padding: var(--s-1) var(--s-2);
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: var(--fs-xs);
}
.photo-tile figcaption input:focus {
  border-color: var(--c-accent);
  outline: none;
}
.photo-meta {
  color: var(--c-text-faint);
  font-size: var(--fs-xs);
}

.log-view {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--c-text-muted);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── Guides ───────────────────────────────────────────────────────────── */
/* Removable chips (availability windows, trained tours). */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.chip-x {
  border: 0;
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 2px;
}
.chip-x:hover {
  color: var(--c-err);
}
.back-link {
  display: inline-block;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  margin-bottom: var(--s-2);
}

/* Status badges (reuse .badge base) */
.badge.status-active {
  color: var(--c-ok);
  border-color: color-mix(in srgb, var(--c-ok) 40%, transparent);
}
.badge.status-onboarding {
  color: var(--c-info);
  border-color: color-mix(in srgb, var(--c-info) 40%, transparent);
}
.badge.status-inactive {
  color: var(--c-text-faint);
}
.badge.status-warn {
  color: var(--c-warn);
  border-color: color-mix(in srgb, var(--c-warn) 40%, transparent);
}
.badge.status-err {
  color: var(--c-err);
  border-color: color-mix(in srgb, var(--c-err) 45%, transparent);
}
.badge.doc-signed {
  color: var(--c-ok);
}
.badge.doc-awaiting_signature {
  color: var(--c-warn);
}
.badge.doc-issued {
  color: var(--c-info);
}

.banner.warn {
  background: color-mix(in srgb, var(--c-warn) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-warn) 40%, transparent);
  color: var(--c-warn);
}

/* Detail tabs */
.guide-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  border-bottom: 1px solid var(--c-border);
  margin: var(--s-4) 0 var(--s-5);
}
.guide-tab {
  padding: var(--s-2) var(--s-4);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.guide-tab:hover {
  color: var(--c-text);
}
.guide-tab.active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

/* ─── Guide schedule (assigned + open-trained list, calendar-style) ─────────── */
.sched-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sched-day {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  margin-top: var(--s-2);
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.sched-day:first-child {
  margin-top: 0;
}
.sched-day-side {
  margin-left: auto;
  font-weight: 500;
  color: var(--c-text-muted);
}
.sched-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-border);
}
.sched-row.sched-assigned {
  background: var(--c-accent-soft);
}
.sched-time {
  flex: none;
  width: 84px;
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}
.sched-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.sched-meta {
  flex: none;
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  white-space: nowrap;
}
.sched-guests {
  width: 84px;
  text-align: right;
}
.sched-pay {
  width: 84px;
  text-align: right;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.sched-coguide {
  font-style: italic;
}
.sched-assign {
  flex: none;
  padding: var(--s-1) var(--s-3);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-4);
}
.field-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
textarea.input {
  resize: vertical;
  font-family: inherit;
}

.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-2);
}
.check-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
}

/* Co-dev / doc form rows */
.doc-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-4);
}
.doc-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
}
.data tr.row-warn td {
  background: color-mix(in srgb, var(--c-warn) 8%, transparent);
}

/* ─── Sensitive tax data (blur-by-default) ────────────────────────────── */
.redact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.panel.redacted .panel-body {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
  transition: filter 0.15s ease;
}
.tin-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 38px;
}
.tin-mask {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
.tin-mask.tin-revealed {
  color: var(--c-accent);
}

/* ─── Toggle switch (reusable boolean control) ──────────────────────────────
   <label class="switch">
     <input type="checkbox" /><span class="switch-track"><span class="switch-thumb"></span></span>
     <span class="switch-label">Label</span>
   </label> */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-strong);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-text-muted);
  transition: transform 0.15s ease, background 0.15s ease;
}
.switch input:checked + .switch-track {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
  background: #fff;
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.switch-label {
  font-size: var(--fs-sm);
}

/* ─── Modal dialog (native <dialog>) ─────────────────────────────────────── */
.modal {
  width: min(560px, calc(100vw - 2 * var(--s-5)));
  padding: 0;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-text);
}
.modal::backdrop {
  background: rgb(0 0 0 / 0.55);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-border);
}
.modal-head h2 {
  margin: 0;
  font-size: var(--fs-lg);
}
.modal-body {
  padding: var(--s-5);
}
.modal-body .input {
  width: 100%;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--c-border);
}

/* SKU picker inside the create-product modal */
.sku-picker {
  margin-top: var(--s-2);
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.sku-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  font-size: var(--fs-sm);
}
.sku-row:last-child {
  border-bottom: none;
}
.sku-row:hover {
  background: var(--c-surface-2);
}
.sku-row.is-claimed {
  opacity: 0.5;
  cursor: not-allowed;
}
.sku-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sku-note {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
  font-style: italic;
}

/* ─── Guide Staffing (ranked trained-guide list on the product page) ───────── */
.staffing-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.staffing-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--c-surface);
}
.staffing-rank {
  flex: none;
  width: 1.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.staffing-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.staffing-actions {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}
.staffing-actions .btn {
  padding: 2px 8px;
  line-height: 1.2;
}
.staffing-codev {
  margin-top: var(--s-4);
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-2);
}
.staffing-codev > summary {
  cursor: pointer;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  user-select: none;
}

/* ─── Calendar feeds page ───────────────────────────────────────────────────── */
.btn-sm {
  padding: var(--s-1) var(--s-2);
  font-size: var(--fs-sm);
}
.feed-link-cell {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.feed-url {
  flex: 1;
  min-width: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.feed-actions {
  display: flex;
  gap: var(--s-2);
  white-space: nowrap;
}
