/* =============================================================
   Malina — Schedule / Timetable
   Class names match schedule.js output exactly.
   ============================================================= */

/* ── Schedule-specific layout tokens ── */
:root {
  --time-col-w: 60px;
  --slot-15: 20px;    /* pixels per 15-minute slot (matches zoomLevel default) */
}

/* ============================================================
   SCHEDULE WRAPPER (scroll container)
   ============================================================ */
.schedule-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.schedule-wrapper::-webkit-scrollbar { width: 5px; height: 5px; }
.schedule-wrapper::-webkit-scrollbar-track { background: transparent; }
.schedule-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.schedule-wrapper::-webkit-scrollbar-thumb:hover { background: var(--accent-border); }

#scheduleInner {
  min-width: 900px;
  position: relative;
}

/* ============================================================
   STAFF HEADER ROW (sticky top) + SCHEDULE BODY — one shared
   grid template. The header row and the body MUST use the exact
   same column tracks or the staff headers drift out of alignment
   with the schedule columns below. --staff-count is set inline on
   #scheduleInner by schedule.js (day: visible staff, week: 7).
   ============================================================ */
.staff-header-row,
.schedule-body {
  display: grid;
  grid-template-columns:
    var(--time-col-w)
    repeat(var(--staff-count, 1), minmax(var(--staff-col-min, 160px), 1fr))
    var(--time-col-w);
}

.staff-header-row {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-elev-1);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 3px 16px rgba(26,23,20,0.10);
}

.time-gutter {
  /* Opaque so body content never shows through the sticky header */
  background: var(--bg-elev-1);
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.staff-col-header {
  padding: 10px 14px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(217,179,108,0.07) 0%, transparent 100%), var(--bg-elev-1);
  border-bottom: 2px solid var(--accent-border) !important;
  transition: background 0.2s;
}
.staff-col-header:hover {
  background: linear-gradient(180deg, rgba(217,179,108,0.12) 0%, transparent 100%), var(--bg-elev-1);
}

/* worker card inside header — generated by JS */
.worker {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-width: 0;
}
.worker .av {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
  border: 2px solid rgba(217,179,108,0.4);
  box-shadow: 0 0 12px rgba(217,179,108,0.18), 0 2px 6px rgba(26,23,20,0.18);
}
.worker .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.worker .name {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg);
}
.worker .role {
  font-size: 11px; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.worker .stat-dot { position: absolute; top: 12px; right: 12px; }

/* week nav gutters */
.week-nav-gutter {
  display: flex; align-items: center; justify-content: center;
}
.week-nav-arrow {
  width: 28px; height: 28px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border);
  color: var(--fg-muted); font-size: 11px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.week-nav-arrow:hover {
  background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent);
}

/* ============================================================
   SCHEDULE BODY (time col + staff cols) — column tracks come
   from the shared grid template above.
   ============================================================ */
.schedule-body {
  position: relative;
}

/* ── Time columns ── */
.time-col {
  border-right: 1px solid var(--border);
  position: relative;
}
.time-col-right {
  border-left: 1px solid var(--border);
  border-right: none;
  position: relative;
}
.time-col-right .time-row { justify-content: flex-start; padding-left: 4px; }
.time-col-right .time-row .time-num { padding-left: 6px; padding-right: 0; }
.time-col-right .time-row.half .time-num { padding-left: 6px; padding-right: 0; }

/* ── Time rows ── */
.time-row {
  height: var(--slot-15);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  padding-right: 4px;
}
.time-row.hour {
  border-top: 1px solid var(--grid-line);
}
.time-row.hour .time-num {
  font-size: 11px; font-weight: 700; color: var(--fg-muted);
  padding-right: 6px; line-height: 1;
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}
.time-row.hour .tick {
  position: absolute; right: 0; top: 50%;
  width: 12px; height: 2px;
  background: rgba(26,23,20,0.30);
  transform: translateY(-50%);
}
.time-row.half {
  border-top: 1px solid var(--grid-line-soft);
}
.time-row.half .tick {
  position: absolute; right: 0; top: 50%;
  width: 7px; height: 1px;
  background: rgba(26,23,20,0.18);
  transform: translateY(-50%);
}
.time-row.half .time-num {
  font-size: 9px; font-weight: 500; color: var(--fg-dim);
  padding-right: 6px; line-height: 1;
  font-family: var(--font-mono);
}
.time-row.quarter {
  border-top: 1px solid var(--grid-line-faint);
}
.time-row.quarter .tick {
  position: absolute; right: 0; top: 50%;
  width: 3px; height: 1px;
  background: rgba(26,23,20,0.08);
  transform: translateY(-50%);
}

/* ── Staff schedule columns ── */
.staff-schedule-col {
  border-right: 1px solid var(--border-soft);
  position: relative;
  overflow: visible;
}
.staff-schedule-col:last-child { border-right: none; }

/* ── Time slots (clickable cells) ── */
.slot {
  height: var(--slot-15);
  position: relative;
  cursor: pointer;
  transition: background 0.1s;
}
.slot.hour  { border-top: 1px solid var(--grid-line); }
.slot.half  { border-top: 1px solid var(--grid-line-soft); }
.slot.quarter { border-top: 1px solid var(--grid-line-faint); }
.slot:hover { background: rgba(217,179,108,0.05); }
.slot.hour:hover, .slot.half:hover { background: rgba(217,179,108,0.07); }
.slot.hour:hover::before, .slot.half:hover::before {
  content: '+ New Appointment';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px; font-weight: 500;
  color: var(--accent); opacity: 0.9; white-space: nowrap; pointer-events: none;
  background: rgba(255,255,255,0.85); padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--accent-border);
}

/* ============================================================
   APPOINTMENT BLOCKS
   ============================================================ */
.appt {
  position: absolute;
  left: 3px; right: 3px;
  min-height: 48px;   /* keep 15-min appointments clickable/readable (APPT_MIN_H in schedule.js) */
  border-radius: 8px;
  padding: 0;         /* spacing lives on .appt-content so the height tiers can tune it */
  overflow: hidden;
  cursor: pointer;
  z-index: 10;
  /* Near-solid light surface with a subtle (≤12%) status tint layered on top —
     the 4px left strip carries the saturated colour, text sits on a stable
     cream surface (--bg-elev-2). */
  background:
    linear-gradient(var(--a-bg, rgba(201,168,76,0.12)), var(--a-bg, rgba(201,168,76,0.12))),
    var(--bg-elev-2);
  border: 1px solid var(--a-border, rgba(201,168,76,0.45));
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: 0 2px 8px rgba(26,23,20,0.14), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
  container-type: size;      /* height tiers below track the RENDERED size */
  container-name: appt-card;
}
.appt:hover {
  filter: brightness(1.03);
  transform: translateX(2px) scale(1.01);
  box-shadow: 0 5px 18px rgba(26,23,20,0.20), inset 0 1px 0 rgba(255,255,255,0.4);
  background:
    linear-gradient(var(--a-bg-hover, rgba(201,168,76,0.20)), var(--a-bg-hover, rgba(201,168,76,0.20))),
    var(--bg-elev-2);
  z-index: 30;   /* min-height can make short blocks overhang the next one — lift on hover */
}
/* Side-by-side lanes: crisp 1px page-background outline separates neighbors */
.appt.appt-laned { outline: 1px solid var(--bg-base); }

.appt.break {
  min-height: 0;   /* breaks are inert background — stay true to the grid */
  border-left: 3px solid var(--fg-dim);
  padding: 4px 8px;   /* .appt no longer pads; break lines are direct children */
}
.appt.break {
  background: repeating-linear-gradient(135deg,
    rgba(26,23,20,0.02) 0, rgba(26,23,20,0.02) 6px,
    rgba(26,23,20,0.05) 6px, rgba(26,23,20,0.05) 12px) !important;
  border-color: rgba(26,23,20,0.10);
  border-left-color: var(--fg-dim);
  box-shadow: none;
  cursor: default;
}
.appt.break .a-name { color: var(--fg-muted); font-style: italic; font-weight: 500; }

/* Typographic hierarchy: name (14px bold, near-black ink) > service (12px
   medium, 80%) > time (11px, 66%). All three clear WCAG AA on the pale
   status-tinted surface. */
.a-name {
  font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: rgba(22,18,12,0.96);
  text-shadow: 0 1px 2px rgba(255,255,255,0.45);
  line-height: 1.3;
}
/* "New client" pill — rendered until the client books a 2nd appointment
   (is_new_client from /api/appointments). Brand gold so it never collides
   with the six status colours. Sits before the name inside .a-name. */
.appt-new-badge {
  display: inline-block;
  vertical-align: 1px;
  margin-right: 5px;
  padding: 1px 6px;
  font-size: 9px; font-weight: 800; line-height: 1.5;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  text-shadow: none;
}
/* Tooltip variant: chip trails the (wrapping) client name instead */
.wat-client .appt-new-badge { margin: 0 0 0 2px; vertical-align: 2px; }

.a-svc {
  font-size: 12px; font-weight: 500;
  color: rgba(22,18,12,0.80);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px; line-height: 1.25;
}
.a-time {
  font-size: 11px; font-weight: 600;
  color: rgba(22,18,12,0.66);
  white-space: nowrap;
  margin-top: 2px; line-height: 1.3;
  font-feature-settings: 'tnum' 1;
  letter-spacing: 0.02em;
}

/* ============================================================
   STATUS COLOURS — the card's tint, border and 4px left strip all
   come from the appointment's status (blue new / orange confirmed /
   green arrived / purple completed / grey cancelled / red no-show).
   --a-bg / --a-border / --status-color are set inline from
   schedule.js via appointment-status.js; data-status carries the key
   so per-status treatments can hang off it here.
   ============================================================ */
.appt-status-strip {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--status-color, var(--a-color, var(--accent)));
  pointer-events: none;
}

/* Worker identity moved off the card tint (status owns that now) onto a small
   corner pip, so you can still tell two workers' cards apart at a glance. */
.appt-worker-pip {
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--a-worker, var(--accent));
  box-shadow: 0 0 0 1px rgba(26,23,20,0.25);
  pointer-events: none;
}
/* (pip shrinks in the name-only height tier — see @container rules below) */

/* Cancelled / no-show read as "off the books": muted, struck through. */
.appt[data-status="cancelled"], .appt[data-status="not_arrived"] { opacity: 0.72; }
.appt[data-status="cancelled"] .a-name { text-decoration: line-through; text-decoration-thickness: 1px; }
.appt[data-status="cancelled"]:hover, .appt[data-status="not_arrived"]:hover { opacity: 1; }
/* Completed is settled history — flat, no lift shadow competing with today. */
.appt[data-status="completed"] { box-shadow: 0 1px 4px rgba(26,23,20,0.10), inset 0 1px 0 rgba(255,255,255,0.25); }

.appt-content {
  display: flex;
  flex-direction: column;
  justify-content: center;   /* short cards: content sits vertically centered */
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px 8px 14px;   /* 14px left = 10px + clearance for the 4px status strip */
}

/* ── Height-responsive content tiers ──────────────────────────────
   .appt is a size container, so these respond to the card's RENDERED
   height — zoom level and the min-height clamp included — not the raw
   duration. Thresholds are content-box px (the 1px borders eat 2px).
     ≥68px  name + service + time
    38–68px name + time (service moves to the hover tooltip)
     <38px  name only (tooltip carries service + time)
   Breaks have no .appt-content wrapper, so the line selectors stay
   unscoped to catch their direct .a-svc/.a-time children too. */
@container appt-card (height < 68px) {
  .appt-content { padding-block: 4px; }
  .a-svc { display: none; }
}
@container appt-card (height < 38px) {
  .a-time { display: none; }
  .appt-worker-pip { top: 3px; right: 3px; width: 5px; height: 5px; }
}

/* ============================================================
   NOW LINE
   ============================================================ */
.now-line {
  position: absolute; left: 0; right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 20;
  pointer-events: none;
  overflow: visible;
  box-shadow: 0 0 8px var(--danger), 0 0 20px rgba(216,117,117,0.35);
}
.now-line::before {
  content: '';
  position: absolute;
  left: 0; top: -5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

/* ============================================================
   WEEK VIEW — day header row
   ============================================================ */
.week-day-header {
  padding: 10px 12px; border-right: 1px solid var(--border);
  background: var(--bg-elev-1);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; transition: background 0.15s; border-radius: 6px;
}
.week-day-header:hover { background: var(--bg-elev-3); }
.week-day-name {
  font-size: 10px; font-weight: 800; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.week-day-num {
  font-size: 20px; font-weight: 800; color: var(--fg-muted); line-height: 1;
}
.week-day-num.today-col {
  color: var(--accent);
  text-shadow: 0 0 24px rgba(217,179,108,0.45);
}
.week-day-appt-count {
  font-size: 10px; font-weight: 700; color: var(--info); letter-spacing: 0.02em; min-height: 14px;
}

/* ============================================================
   WEEK APPOINTMENT TOOLTIP
   ============================================================ */
.week-appt-tooltip {
  position: fixed; z-index: 9999; display: none;
  background: var(--bg-elev-2); border: 1px solid var(--accent-border);
  border-radius: var(--radius-md); padding: 12px 14px;
  min-width: 210px; max-width: 280px;
  box-shadow: 0 8px 32px rgba(26,23,20,0.18), 0 0 0 1px rgba(217,179,108,0.1);
  pointer-events: none;
}
/* Full, non-truncated details — names/services wrap instead of ellipsizing */
.wat-client {
  font-size: 14px; font-weight: 700; color: var(--fg);
  margin-bottom: 3px; line-height: 1.35; overflow-wrap: break-word;
}
.wat-service {
  font-size: 12px; color: var(--fg-muted); line-height: 1.4;
  margin-bottom: 7px;
  overflow-wrap: break-word;
}
/* Status chip — always rendered, so it carries the divider under the header */
.wat-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--fg);
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--st) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--st) 42%, transparent);
}
.wat-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st); flex: 0 0 7px; }
.week-appt-tooltip .wat-status + .wat-row { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
.wat-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin-top: 4px;
}
.wat-lbl {
  font-size: 10px; font-weight: 700; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0;
}
.wat-val { font-size: 12px; font-weight: 600; color: var(--fg); text-align: right; }
.wat-num { font-feature-settings: 'tnum' 1; letter-spacing: 0.02em; }
.wat-price .wat-val { color: var(--accent); font-weight: 700; }

/* ============================================================
   CONTEXT MENU
   ============================================================ */
.ctx-menu {
  position: fixed; background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 6px; min-width: 170px;
  box-shadow: var(--shadow-lg); z-index: 2000; display: none;
}
.ctx-menu.open { display: block; }
.ctx-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 12px; cursor: pointer;
  color: var(--fg-muted); transition: all 0.15s;
}
.ctx-item:hover { background: var(--bg-elev-3); color: var(--fg); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ============================================================
   REVENUE DROPDOWN
   ============================================================ */
.rev-menu {
  position: fixed; z-index: 9999; background: var(--bg-elev-2);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 320px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
  max-height: min(480px, calc(100vh - 80px));
  max-height: min(480px, calc(100dvh - 80px));
}
.rev-menu.open { display: flex; }
.rev-menu-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.rev-hdr-date { font-size: 13px; font-weight: 600; color: var(--fg); }
.rev-hdr-clients { font-size: 12px; color: var(--fg-dim); }
.rev-metric-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.rev-metric-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 16px; transition: background 0.12s;
}
.rev-metric-label { font-size: 13px; color: var(--fg); }
.rev-metric-right { display: flex; align-items: center; gap: 7px; }
.rev-metric-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--fg-dim); flex-shrink: 0; pointer-events: none;
}
.rev-metric-dot.has-value { border-color: var(--info); background: var(--info); }
.rev-metric-val {
  font-size: 13px; font-weight: 600; color: var(--fg-muted);
  min-width: 52px; text-align: right;
}
.rev-menu-footer {
  border-top: 1px solid var(--border); padding: 8px 12px;
  display: flex; align-items: center; gap: 4px; flex-shrink: 0; flex-wrap: wrap;
}
.rev-footer-label { font-size: 10px; color: var(--fg-dim); font-weight: 600; margin-right: 4px; }
.rev-cur-btn {
  padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 700;
  border: 1px solid var(--border); background: var(--bg-elev-3);
  color: var(--fg-dim); cursor: pointer; transition: all 0.15s;
}
.rev-cur-btn:hover { background: var(--info-tint); border-color: var(--info); color: var(--info); }
.rev-cur-btn.active { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent); }
.rev-rate-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--info); flex-shrink: 0; margin-left: auto; }
.rev-rate-dot.loading { background: var(--accent); animation: pulse 1s infinite; }
.rev-rate-dot.error { background: var(--danger); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ============================================================
   SELL DROPDOWN
   ============================================================ */
.sell-wrap { position: relative; flex-shrink: 0; }
.sell-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--accent); color: var(--accent-ink); border: none;
  border-radius: var(--radius-sm); padding: 7px 10px 7px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.sell-btn:hover { background: var(--accent-hover); }
.sell-menu {
  position: fixed; background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 6px;
  min-width: 180px; box-shadow: var(--shadow-lg); z-index: 9999; display: none;
}
.sell-menu.open { display: block; }
.sell-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  color: var(--fg-muted); transition: all 0.15s;
}
.sell-menu-item:hover { background: var(--bg-elev-3); color: var(--fg); }

/* ============================================================
   POSITIONS FILTER DROPDOWN
   ============================================================ */
.pos-wrap { position: relative; flex-shrink: 1; }
.pos-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 11px; font-weight: 600;
  cursor: pointer; color: var(--fg-muted); transition: all 0.15s; white-space: nowrap;
}
.pos-btn:hover, .pos-btn.open { border-color: var(--accent-border); color: var(--accent); background: var(--accent-tint); }
.pos-drop {
  position: fixed; background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
  min-width: 300px; box-shadow: var(--shadow-lg); z-index: 9999; display: none;
}
.pos-drop.open { display: block; }
.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pos-sec-title {
  font-size: 10px; font-weight: 700; color: var(--fg-dim);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;
}
.pos-opt {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: var(--radius-sm); font-size: 12px; cursor: pointer;
  color: var(--fg-muted); transition: all 0.15s;
}
.pos-opt:hover { background: var(--bg-elev-3); color: var(--fg); }
.pos-opt.sel { color: var(--accent); }
.pos-radio {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--border); flex-shrink: 0; transition: all 0.15s;
}
.pos-opt.sel .pos-radio { background: var(--accent); border-color: var(--accent); }

/* ============================================================
   DURATION CHIPS
   ============================================================ */
.dur-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dur-chip {
  padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--fg-dim); cursor: pointer; transition: all 0.15s;
}
.dur-chip:hover { border-color: var(--accent-border); color: var(--accent); }
.dur-chip.active { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent); }

/* ============================================================
   TIME STEPPER (add appt modal)
   ============================================================ */
/* Time selection group wrapper */
.time-selection-group {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}

.time-stepper {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px;
  width: 100%;
}

.time-step-col {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex-shrink: 0;
}

.time-step-btn {
  width: 28px; height: 24px; background: var(--bg-elev-3);
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--fg-dim); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 10px;
  transition: all 0.15s; flex-shrink: 0;
}

.time-step-btn:hover {
  border-color: var(--accent-border); color: var(--accent); background: var(--accent-tint);
}

.time-step-btn:active { transform: scale(0.9); }

.time-input-field {
  font-size: 32px; font-weight: 700; color: var(--accent);
  font-family: var(--font-body); width: 56px; text-align: center;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  outline: none; line-height: 1; letter-spacing: 1px;
  cursor: ns-resize; transition: border-color 0.15s, color 0.15s;
  font-feature-settings: 'tnum' 1; padding: 4px 0;
}

.time-input-field:focus {
  border-bottom-color: var(--accent-border); cursor: text; color: var(--gold-200);
}

.time-step-colon {
  font-size: 28px; font-weight: 700; color: var(--fg-muted);
  line-height: 1; padding-bottom: 6px; flex-shrink: 0; margin: 0 2px;
}

.time-end-label {
  font-size: 11px; color: var(--fg-dim); text-align: center;
  padding: 6px 0; border-top: 1px solid var(--border);
}

.time-end-label span {
  color: var(--accent); font-weight: 600;
}

.time-step-period { display: flex; flex-direction: column; gap: 4px; margin-left: 6px; }

.time-step-ampm {
  padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--bg-elev-3); border: 1px solid var(--border);
  color: var(--fg-dim); cursor: pointer; transition: all 0.15s;
}

.time-step-ampm.active { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent); }

@media (max-width: 480px) {
  .time-stepper {
    padding: 10px 12px; gap: 8px;
  }
  .time-step-col { gap: 4px; }
  .time-step-btn { width: 26px; height: 22px; font-size: 9px; }
  .time-input-field { font-size: 28px; width: 48px; padding: 3px 0; }
  .time-step-colon { font-size: 24px; }
}

/* ============================================================
   TIME GRID (add staff modal)
   ============================================================ */
.time-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.t-chip {
  padding: 6px 4px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elev-2); color: var(--fg-dim); font-size: 11px;
  font-weight: 500; text-align: center; cursor: pointer; transition: all 0.15s; user-select: none;
}
.t-chip.sel { background: var(--accent-tint); border-color: var(--accent-border); color: var(--accent); }

/* ============================================================
   SHARED PAGE STATES
   ============================================================ */
.search-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.search-row .input { min-width: 280px; }
.search-row .found { font-size: 12.5px; color: var(--fg-muted); margin-left: 4px; }

/* ============================================================
   WEEK VIEW — legacy fallback (HTML-based week, not JS-rendered)
   ============================================================ */
.week {
  display: flex; flex-direction: column; min-height: 100%;
}
.week-head {
  display: grid; grid-template-columns: 60px repeat(7, 1fr) 60px;
  border-bottom: 1px solid var(--border); padding: 14px 0;
  position: sticky; top: 0; background: var(--bg-base); z-index: 2;
}
.week-head .arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-muted); cursor: pointer; transition: color var(--dur-fast) var(--ease-out);
}
.week-head .arrow:hover { color: var(--accent); }
.week-head .day { text-align: center; padding: 6px 8px; }
.week-head .day .dow {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em;
  color: var(--fg-muted); text-transform: uppercase;
}
.week-head .day .num {
  display: block; font-family: var(--font-display);
  font-size: 28px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--fg); margin-top: 2px; font-variant-numeric: tabular-nums;
}
.week-head .day.today .num { color: var(--accent); font-style: italic; }
.week-head .day .appts { display: block; font-size: 11px; color: var(--fg-muted); margin-top: 2px; }
.week-head .day.today .appts { color: var(--gold-200); }
.week-body {
  display: grid; grid-template-columns: 60px repeat(7, 1fr) 60px; flex: 1;
}
.week-col {
  border-right: 1px solid var(--border-soft); position: relative; min-height: 760px;
}
.week-col:last-child { border-right: none; }

/* ============================================================
   WEEK VIEW — JS-rendered week (week-chip agenda layout)
   ============================================================ */
/* Narrower minimum tracks — applies to header AND body via the
   shared grid template's --staff-col-min. */
#scheduleInner[data-view="week"] { --staff-col-min: 140px; }

/* Day-separator: stronger border between days in week view */
#scheduleInner[data-view="week"] .staff-schedule-col {
  border-right: 1px solid var(--border);
}
#scheduleInner[data-view="week"] .staff-schedule-col:last-child {
  border-right: none;
}

.week-col-agenda { position: relative; }
.week-agenda-list {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 4px 3px;
  display: flex; flex-direction: column; gap: 3px;
  pointer-events: none; scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.week-chip {
  pointer-events: auto; border-radius: 5px;
  border-left: 3px solid var(--accent); background: var(--bg-elev-2);
  padding: 4px 6px; cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
  min-height: 30px; display: flex; flex-direction: column;
  gap: 1px; flex-shrink: 0; overflow: hidden;
}
.week-chip:hover { filter: brightness(0.97); transform: translateX(2px); }
.wc-time {
  font-size: 9px; font-weight: 700; color: var(--fg-dim);
  font-feature-settings: 'tnum' 1; letter-spacing: 0.02em; white-space: nowrap;
}
.wc-client {
  font-size: 11px; font-weight: 700; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.wc-staff { font-size: 9px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-meta {
  font-size: 10px; font-weight: 600; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}
.week-chip.break-chip {
  background: rgba(120,120,130,0.18); border-left-color: var(--fg-dim); opacity: 0.7; min-height: 28px;
}
.week-chip.break-chip .wc-client { color: var(--fg-dim); font-size: 10px; }
.wag-time-hdr {
  font-size: 10px; font-weight: 800; color: var(--accent); opacity: 0.8;
  padding: 5px 4px 2px; margin-top: 5px;
  border-top: 1px solid rgba(217,179,108,0.18);
  letter-spacing: 0.04em; font-feature-settings: 'tnum' 1; flex-shrink: 0;
}

/* ============================================================
   MOBILE DAY AGENDA (≤768px) — schedule.js swaps the per-worker
   day grid for one chronological column (renderDayAgenda). Cards
   reuse .appt-status-strip and the .a-name/.a-svc hierarchy so
   the two layouts read as the same system.
   ============================================================ */
#scheduleInner[data-view="agenda"] { padding: 10px 12px 28px; }
.agenda-list { display: flex; flex-direction: column; gap: 8px; }
.agenda-empty {
  padding: 36px 16px; text-align: center;
  color: var(--fg-dim); font-size: 13px;
}
.agenda-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px;   /* 16px left clears the 4px status strip */
  border-radius: 8px;
  background:
    linear-gradient(var(--a-bg, rgba(201,168,76,0.12)), var(--a-bg, rgba(201,168,76,0.12))),
    var(--bg-elev-2);
  border: 1px solid var(--a-border, var(--border));
  cursor: pointer;
  overflow: hidden;
}
.agenda-card:active { filter: brightness(0.97); }
.agenda-time {
  display: flex; flex-direction: column; align-items: flex-end;
  flex: 0 0 44px;
  font-feature-settings: 'tnum' 1; white-space: nowrap;
}
.agenda-start { font-size: 13px; font-weight: 700; color: rgba(22,18,12,0.92); }
.agenda-end   { font-size: 11px; font-weight: 600; color: rgba(22,18,12,0.55); }
.agenda-main { flex: 1 1 auto; min-width: 0; }
.agenda-staff {
  display: flex; align-items: center; gap: 5px;
  margin-top: 3px; font-size: 11px; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agenda-staff-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px;
  background: var(--a-worker, var(--accent));
}
/* Same "off the books" treatment as the grid cards */
.agenda-card[data-status="cancelled"], .agenda-card[data-status="not_arrived"] { opacity: 0.72; }
.agenda-card[data-status="cancelled"] .a-name { text-decoration: line-through; text-decoration-thickness: 1px; }
.agenda-card.agenda-break {
  cursor: default;
  background: repeating-linear-gradient(135deg,
    rgba(26,23,20,0.02) 0, rgba(26,23,20,0.02) 6px,
    rgba(26,23,20,0.05) 6px, rgba(26,23,20,0.05) 12px), var(--bg-elev-1);
  border-color: rgba(26,23,20,0.10);
}
.agenda-break .a-name { color: var(--fg-muted); font-style: italic; font-weight: 500; }
.wag-time-hdr--first { margin-top: 0; border-top: none; padding-top: 2px; }
