/* Self-hosted Inter (latin, variable weight axis) — one file, works fully
   offline; the system stack below is the graceful fallback. OFL-licensed. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('assets/inter.woff2') format('woff2');
}

/* =====================================================================
   Design language v2 — canonical design tokens (Chunk 1 base restyle).
   ONE place for every color, space, radius, shadow, and type value.
   Hues are the existing Harmony palette (deep green #1b4332 + leaf
   #52b788) — refined and reorganized, not replaced. The "legacy aliases"
   block maps the old --forest-/--gold-/--ink-/etc. names onto these so
   existing rules keep working while they migrate onto the canonical
   tokens (Slice B); the alias block is removed once migration completes.
   ===================================================================== */
:root {
  /* Brand + leaf */
  --brand-strong: #0f2818;
  --brand-deep: #163d26;
  --brand: #1b4332;
  --brand-mid: #2d6a4f;
  --brand-bright: #40916c;
  --leaf: #52b788;
  --leaf-line: #cfe8da;
  --leaf-soft: #e7f3ec;
  --leaf-tint: #f5faf7;

  /* Neutrals + text emphasis levels. --bg is a crisp cool near-white:
     blue channel highest, red lowest, so there is zero warm/yellow cast;
     the faint mint keeps it on-brand without tinting beige. */
  --bg: #f4fafb;
  --surface: #ffffff;
  --surface-inset: #eff7f8;
  --border: #dfe9e2;
  --border-strong: #cbd8d0;
  --text: #16241c;
  --text-2: #3c4a42;
  --text-muted: #6b7b72;
  --text-faint: #a3b0a9;
  --on-brand: #ffffff;

  /* Amber accent (kiosk type / calendar selection / recur badges) —
     a brand accent, kept distinct from the semantic "warning". */
  --accent-gold: #b9822b;
  --accent-gold-ink: #8a5f14;
  --accent-gold-soft: #faedd6;

  /* Semantic set */
  --success: #2d8a5f;
  --success-soft: #e7f3ec;
  --warning: #b8620f;
  --warning-ink: #92400e;
  --warning-soft: #fdf0dd;
  --danger: #c0392b;
  --danger-ink: #9a2c1f;
  --danger-soft: #fbe2de;
  --info: #2b6ca3;
  --info-soft: #e6eff6;

  /* Overlay / scrim + on-brand translucents (white-on-green controls) */
  --scrim: rgba(15, 36, 24, 0.45);
  --on-brand-soft: rgba(255, 255, 255, 0.14);
  --on-brand-line: rgba(255, 255, 255, 0.35);
  --warning-line: #f0d9a8;
  --accent-gold-scrim: rgba(138, 95, 20, 0.12);
  --nav-shadow: 0 -2px 10px rgba(15, 40, 24, 0.06);

  /* Elevation (softer, premium) */
  --shadow-1: 0 1px 2px rgba(15, 40, 24, 0.06), 0 1px 1px rgba(15, 40, 24, 0.04);
  --shadow-mid: 0 4px 14px rgba(15, 40, 24, 0.10);
  --shadow-2: 0 6px 22px rgba(15, 40, 24, 0.08);
  --shadow-3: 0 12px 32px rgba(15, 40, 24, 0.18);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Spacing scale — 4px base, multiples only */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-section: 26px; /* reconciled onto the scale in Slice B */

  /* Typography scale (applied in Slice B) */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fs-display: 27px;
  --fs-title: 19px;
  --fs-section: 15px;
  --fs-body: 15px;
  --fs-meta: 13px;
  --fs-caption: 11.5px;
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-body: 1.5;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

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

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand-deep);
  color: var(--on-brand);
  padding: calc(env(safe-area-inset-top, 0px) + var(--space-4)) var(--space-5) var(--space-4);
  box-shadow: var(--shadow-mid);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-title);
  letter-spacing: -0.01em;
}

.brand svg { flex: none; }

.screen-title {
  font-size: var(--fs-meta);
  font-weight: var(--fw-regular);
  color: var(--leaf-line);
  opacity: 0.9;
  margin-top: 2px;
}

/* ---------- Notice banner (persistent, dismissible — not a toast) ---------- */
.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--warning-soft);
  border-bottom: 1px solid var(--warning-line);
  color: var(--warning-ink);
  font-size: var(--fs-meta);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  padding: var(--space-3) var(--space-4);
}
.notice-banner-text { flex: 1; }
.notice-dismiss {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--accent-gold-scrim);
  color: var(--accent-gold-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ---------- Main content ---------- */
.content {
  flex: 1;
  padding: 14px 14px 90px;
  overflow-x: hidden;
}

.section-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: var(--space-5) var(--space-1) var(--space-2);
}
.section-label:first-child { margin-top: var(--space-1); }

/* ---------- Month calendar ---------- */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 12px;
}
.month-nav-btn {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.month-nav-btn:active { transform: scale(0.94); }
.month-nav-label {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}

.month-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}
.month-dow {
  text-align: center;
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.month-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 7px;
  cursor: pointer;
  position: relative;
}
.month-cell:active { transform: scale(0.93); }
.month-cell .num {
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: 1;
}
.month-cell.outside { opacity: 0.32; }
.month-cell.is-today .num { color: var(--brand); font-weight: var(--fw-semibold); }
.month-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent-gold); }
.month-cell .dots {
  display: flex;
  gap: 2px;
  height: 6px;
  margin-top: 5px;
  align-items: center;
}
.month-cell .dot { width: 5px; height: 5px; border-radius: 50%; }
.dot-event { background: var(--brand-bright); }
.dot-kiosk { background: var(--accent-gold); }
.dot-warn { background: var(--danger); }

.month-cell.avail { background: var(--leaf-soft); border-color: var(--leaf-line); }
.month-cell.scheduled { background: var(--brand-mid); border-color: var(--brand-mid); }
.month-cell.scheduled .num { color: var(--on-brand); }

/* ---------- Availability legend ---------- */
.legend-row {
  display: flex;
  gap: 18px;
  margin: 2px 4px 16px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: none;
}
.legend-swatch.avail { background: var(--leaf-soft); border: 1px solid var(--leaf-line); }
.legend-swatch.scheduled { background: var(--brand-mid); }

/* ---------- Filter chips ---------- */
.filter-row {
  display: flex;
  gap: var(--space-2);
  margin: var(--space-1) var(--space-1);
}
.filter-row.wrap { flex-wrap: wrap; }
.filter-chip {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease;
}
.filter-chip:active { transform: scale(0.95); }
.filter-chip.is-active {
  background: var(--leaf-soft);
  border-color: var(--leaf);
  color: var(--brand);
}
/* Spacing modifiers (replace inline one-offs in app.js templates) */
.filter-row.flush { margin: 0; }
.filter-row.below { margin: 0 0 var(--space-4); }
.form-field.attached { margin-top: -10px; }

/* ---------- Day header ---------- */
.day-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 20px 4px 8px;
  scroll-margin-top: 96px;
}
.day-header .day-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.day-header .day-badge {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--brand-mid);
  background: var(--leaf-soft);
  padding: 1px 8px;
  border-radius: 999px;
}
.day-header.is-today .day-title { color: var(--brand); }

.day-empty {
  font-size: var(--fs-meta);
  color: var(--text-faint);
  margin: 0 4px 4px;
  font-style: italic;
}

/* ---------- Cards ---------- */
/* v2: borderless soft-shadow card (matches Home's .tile-card language).
   The old 4px left accent stripe is retired — event/kiosk type now reads
   from the .type-badge. A hairline top edge keeps definition on white. */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:active { transform: scale(0.985); }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: 1.3;
}

.type-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  background: var(--leaf-soft);
  color: var(--brand);
  white-space: nowrap;
}
.type-badge.type-kiosk {
  background: var(--accent-gold-soft);
  color: var(--accent-gold-ink);
}

.recur-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}

.territory-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}

.tag-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 14px;
}
.tag-badge {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--leaf-tint);
  border: 1px solid var(--leaf-line);
  color: var(--brand);
}


/* ---------- Chats tab: chat list ---------- */
.chat-list { padding-top: 4px; }
.chat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.chat-row:last-child { border-bottom: none; }
.chat-row { transition: background 0.14s ease; }
.chat-row:active { background: var(--leaf-tint); }
.chat-row > svg { flex: none; color: var(--text-muted); }
.chat-row-main { min-width: 0; flex: 1; }
.chat-row-name { font-weight: var(--fw-semibold); font-size: var(--fs-body); color: var(--text); }
.chat-row.is-unread .chat-row-name { color: var(--brand); }
.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-mid);
  color: var(--on-brand);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  line-height: 1;
  vertical-align: middle;
}
.chat-row-preview {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-row.is-unread .chat-row-preview { color: var(--text); font-weight: var(--fw-semibold); }
.chat-row-time { flex: none; font-size: var(--fs-caption); color: var(--text-faint); }

/* ---------- Conversation sheet ---------- */
/* Reclaims the outer .sheet's own padding/scroll (via :has, supported in
   all evergreen browsers Harmony targets) so THIS sheet's header and
   composer can stay pinned while only the message list scrolls, instead
   of fighting the outer sheet's own overflow:auto. */
.sheet:has(.chat-sheet) {
  padding: 0;
  overflow: hidden;
  display: flex;
}
.chat-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 88vh;
}
.chat-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.chat-sheet-title { font-size: var(--fs-title); font-weight: var(--fw-semibold); color: var(--text); flex: 1; }

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg-row { max-width: 82%; }
.msg-row.msg-mine { align-self: flex-end; text-align: right; }
.msg-divider {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-mid);
  margin: 2px 0;
}
.msg-divider::before, .msg-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--leaf-line);
}
.msg-meta { font-size: var(--fs-caption); color: var(--text-faint); margin-bottom: 3px; }
.msg-bubble {
  display: inline-block;
  padding: 9px 13px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.4;
  text-align: left;
  word-break: break-word;
}
.msg-mine .msg-bubble { background: var(--brand-mid); border-color: var(--brand-mid); color: var(--on-brand); }
.msg-bubble.msg-deleted { background: transparent; border-style: dashed; color: var(--text-faint); font-style: italic; }

.msg-reply-quote {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  border-left: 2px solid var(--leaf);
  padding-left: 8px;
  margin-bottom: 4px;
}
.msg-mine .msg-reply-quote { border-left: none; border-right: 2px solid var(--leaf-line); padding-left: 0; padding-right: 8px; }

.msg-reactions { margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }
.msg-mine .msg-reactions { justify-content: flex-end; }
.reaction-pill {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.reaction-pill.is-mine { background: var(--leaf-soft); border-color: var(--leaf-line); color: var(--brand); }

.msg-actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.msg-mine .msg-actions { justify-content: flex-end; }
.msg-actions button {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--leaf-tint);
  color: var(--brand);
  cursor: pointer;
}
.msg-emoji-picker { display: inline-flex; gap: 2px; }
.msg-emoji-picker button { font-size: 16px; padding: 3px 5px; border: none; background: none; cursor: pointer; }

.composer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 18px;
  background: var(--leaf-tint);
  border-top: 1px solid var(--border);
  font-size: var(--fs-meta);
  color: var(--text-2);
  flex: none;
}
.composer-strip button { flex: none; border: none; background: none; color: var(--text-muted); cursor: pointer; }

.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid var(--border);
  flex: none;
}
.composer-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: var(--fs-body);
  font-family: inherit;
  background: var(--leaf-tint);
  color: var(--text);
}
.composer-input:focus { outline: none; border-color: var(--brand-bright); background: var(--surface); }
.composer-send {
  flex: none;
  border: none;
  background: var(--brand-mid);
  color: var(--on-brand);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}
.composer-send:active { background: var(--brand); }

/* ---------- Chat membership rows (create/manage chat sheets) ---------- */
.chat-member-list { margin-bottom: 8px; }
.chat-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
  cursor: pointer;
}
.chat-member-row.is-selected { background: var(--leaf-soft); border-color: var(--leaf-line); color: var(--brand); }
/* .remove-btn is a full-width block button everywhere else it's used
   (e.g. "Delete chat" at the bottom of Manage chat) — shrunk back down
   to an inline pill only when nested inside a member row. */
.chat-member-row .remove-btn { width: auto; margin-top: 0; padding: 5px 10px; font-size: var(--fs-caption); cursor: pointer; }


.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 7px;
  font-size: var(--fs-caption);
  color: var(--text-muted);
}
.card-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-meta svg { flex: none; opacity: 0.7; }

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  gap: 8px;
}

.staffing-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--leaf-soft);
  color: var(--brand);
}
.staffing-pill.understaffed {
  background: var(--warning-soft);
  color: var(--warning-ink);
}

.traffic-tag {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 10px; opacity: 0.5; }
.empty-state .headline { font-weight: var(--fw-semibold); color: var(--text-2); margin-bottom: 4px; }
.empty-state .sub { font-size: var(--fs-meta); }

/* ---------- Rep dropdown (My Schedule placeholder auth) ---------- */
.rep-select-wrap {
  margin: 4px 4px 4px;
}
.rep-select-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--leaf-soft);
  opacity: 0.85;
  margin-bottom: 4px;
}
.rep-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--on-brand-soft);
  border: 1px solid var(--on-brand-line);
  color: var(--on-brand);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  padding: 10px 34px 10px 12px;
  border-radius: var(--radius-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.rep-select option { color: var(--text); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
  box-shadow: var(--nav-shadow);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 7px 0 5px;
  color: var(--text-muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  border-radius: 12px;
  transition: transform 0.12s ease, color 0.14s ease;
}
.nav-btn:active { transform: scale(0.94); }
.nav-btn.is-active { color: var(--brand); }
.nav-btn.is-active svg { color: var(--brand); }
.nav-btn svg { color: var(--text-muted); }
.nav-icon-wrap { position: relative; display: inline-block; }
.nav-badge {
  position: absolute;
  top: -6px;
  right: -9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--brand-mid);
  color: var(--on-brand);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1;
  border: 2px solid var(--surface);
}

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: calc(50% - 240px + 18px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 78px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  box-shadow: var(--shadow-3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease;
}
@media (max-width: 480px) {
  .fab { right: 18px; }
}
.fab:active { transform: scale(0.94); background: var(--brand-deep); }

/* ---------- Sheet / modal ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: scrim-in 0.22s ease-out;
}
@keyframes scrim-in {
  from { background: transparent; }
  to { background: var(--scrim); }
}
.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  padding: var(--space-2) var(--space-5) calc(env(safe-area-inset-bottom, 0px) + var(--space-6));
  box-shadow: var(--shadow-3);
  animation: sheet-up 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sheet-up {
  from { transform: translateY(28px) scale(0.985); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
/* Exit animation: closeSheet() flags UI.sheetClosing, render() stamps
   .is-closing, then a timer clears UI.sheet. Terminal state is identical
   to an instant close, so a dropped frame never strands the sheet open. */
.sheet-backdrop.is-closing { animation: scrim-out 0.18s ease-in forwards; }
.sheet-backdrop.is-closing .sheet { animation: sheet-down 0.18s cubic-bezier(0.4, 0, 1, 1) forwards; }
@keyframes scrim-out {
  from { background: var(--scrim); }
  to { background: transparent; }
}
@keyframes sheet-down {
  from { transform: translateY(0) scale(1); opacity: 1; }
  to { transform: translateY(20px) scale(0.985); opacity: 0; }
}
.sheet-grabber {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  margin: var(--space-2) auto var(--space-3);
}
.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}
.sheet-title {
  font-size: var(--fs-title);
  font-weight: var(--fw-semibold);
  color: var(--text);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}
.sheet-close {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--leaf-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.sheet-close:active { transform: scale(0.9); background: var(--leaf-line); }

.detail-type-badge { margin: var(--space-2) 0 var(--space-4); }

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-of-type { border-bottom: none; }
.detail-row .icon-wrap {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--leaf-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-row .detail-text { flex: 1; min-width: 0; }
.detail-row .detail-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}
.detail-row .detail-value {
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  color: var(--text);
  line-height: var(--lh-snug);
  word-break: break-word;
}
.detail-row a.detail-value {
  color: var(--brand-mid);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-decoration-color: var(--leaf-line);
  text-underline-offset: 3px;
}
.detail-row a.detail-value:active { color: var(--brand-bright); }

.shift-list { margin-top: var(--space-2); }
.shift-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  background: var(--surface-inset);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.shift-row:active { transform: scale(0.985); }
.shift-row.unfilled {
  background: var(--warning-soft);
  border-color: var(--warning-line);
}
.shift-row .shift-time {
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.shift-row .shift-label {
  font-size: var(--fs-caption);
  color: var(--text-muted);
  font-weight: var(--fw-regular);
}
.shift-row .shift-rep {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rep-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--brand);
}
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-mid);
  color: var(--on-brand);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.unfilled-tag {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--warning-ink);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* rep-picker inside sheet */
.rep-picker-list { margin-top: 6px; }
.rep-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.rep-picker-row:last-child { border-bottom: none; }
.rep-picker-row:active { background: var(--leaf-tint); }
.rep-picker-row .name { flex: 1; font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--text); }
.rep-picker-row .check { color: var(--brand-mid); flex: none; }
.rep-picker-row.is-selected .name { color: var(--brand); }
.remove-btn {
  width: 100%;
  text-align: center;
  padding: var(--space-3);
  margin-top: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.remove-btn:active { transform: scale(0.985); }

/* ---------- Form ---------- */
.form-field { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-3);
  font-size: var(--fs-body);
  font-family: inherit;
  font-weight: var(--fw-regular);
  background: var(--surface-inset);
  color: var(--text);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-faint); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px var(--leaf-soft);
  background: var(--surface);
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.type-toggle {
  display: flex;
  gap: var(--space-2);
}
.type-toggle-btn {
  flex: 1;
  padding: var(--space-3) 0;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-inset);
  color: var(--text-2);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-meta);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, background 0.14s ease, border-color 0.14s ease;
}
.type-toggle-btn:active { transform: scale(0.97); }
.type-toggle-btn.is-active {
  border-color: var(--brand-mid);
  background: var(--leaf-soft);
  color: var(--brand);
}
.type-toggle-btn.is-active.kiosk {
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
  color: var(--accent-gold-ink);
}

.btn-primary {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: none;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  cursor: pointer;
  margin-top: var(--space-2);
  transition: transform 0.12s ease, background 0.14s ease;
}
.btn-primary:active { background: var(--brand-deep); transform: scale(0.985); }

.btn-secondary {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface-inset);
  color: var(--brand);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  cursor: pointer;
  margin-top: var(--space-3);
  transition: transform 0.12s ease, background 0.14s ease;
}
.btn-secondary:active { background: var(--leaf-soft); transform: scale(0.985); }

.field-error {
  font-size: var(--fs-caption);
  color: var(--danger);
  margin-top: var(--space-2);
  text-align: center;
}

.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-inset);
  color: var(--brand);
  font-size: 18px;
  font-weight: var(--fw-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease;
}
.stepper-btn:active { transform: scale(0.92); background: var(--leaf-soft); }
.stepper-val {
  font-size: var(--fs-title);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--on-brand);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-3);
  z-index: 60;
  white-space: nowrap;
  animation: toast-in 0.15s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.reset-link {
  text-align: center;
  margin: 26px 0 6px;
  font-size: var(--fs-caption);
  color: var(--text-faint);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Push notifications enable card (Chats tab) ---------- */
.push-card {
  position: relative;
  background: var(--leaf-soft);
  border: 1px solid var(--leaf-line);
  border-radius: var(--radius-md);
  padding: 14px 34px 14px 14px;
  margin: 8px 0 14px;
}
.push-card-text {
  font-size: var(--fs-meta);
  color: var(--text-2);
  margin-bottom: 4px;
}
.push-card .btn-primary { margin-top: 10px; }
.push-card-dismiss {
  position: absolute;
  top: 6px;
  right: 8px;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

/* ---------- Design language v2 (Home pilot; app-wide rollout planned) ---------- */
.greeting {
  font-size: var(--fs-display);
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  margin: var(--space-2) 0 var(--space-1);
}
.greeting-sub {
  font-size: var(--fs-body);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
}
.hero-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  padding: var(--space-5);
  margin-bottom: var(--space-section);
  transition: transform 0.12s ease, box-shadow 0.14s ease;
}
.hero-card:active { transform: scale(0.99); }
.hero-kicker {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-bright);
  margin-bottom: var(--space-2);
}
.hero-title {
  font-size: var(--fs-title);
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-1);
}
.hero-meta {
  font-size: var(--fs-body);
  color: var(--text-2);
  margin-bottom: 2px;
}
.hero-countdown {
  display: inline-block;
  margin: var(--space-3) 0 var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--leaf-soft);
  color: var(--brand);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
}
.hero-reminder {
  margin-top: var(--space-2);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--warning-ink);
}
.hero-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.hero-actions .btn-primary { margin-top: 0; }
.section-lg { margin-top: var(--space-section); }
.section-title-lg {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--fs-title);
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}
.section-manage-link {
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  color: var(--brand-mid);
  cursor: pointer;
  text-decoration: none;
}
.tile-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: transform 0.12s ease, box-shadow 0.14s ease;
}
.tile-card:active { transform: scale(0.99); }
.tile-title {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.tile-sub {
  font-size: var(--fs-meta);
  color: var(--text-2);
  margin-top: 3px;
}
.tile-date-chip {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--leaf-soft);
  color: var(--brand);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  margin-left: var(--space-2);
  white-space: nowrap;
}
.tile-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.btn-mini {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: none;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-meta);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: transform 0.12s ease, background 0.14s ease;
}
.btn-mini:active { transform: scale(0.97); background: var(--brand-deep); }
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
@media (max-width: 360px) {
  .tile-grid { grid-template-columns: 1fr; }
}
.tile-grid a.tile-card {
  display: block;
  text-decoration: none;
  margin-bottom: 0;
}
.empty-line {
  font-size: var(--fs-meta);
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-1) 2px;
}
.staffing-row-warn .tile-title { color: var(--danger); }

/* Compact contact rows: name + role left, icon buttons right. Replaces the
   old full-width Call/Email buttons so many contacts stack cleanly. */
.contact-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.contact-main { flex: 1; min-width: 0; }
.contact-actions { display: flex; gap: var(--space-2); flex: none; }
.contact-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--leaf-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease;
}
.contact-btn:active { transform: scale(0.92); background: var(--leaf-line); }

/* Import button (Manage): icon + label secondary action */
.btn-import {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin: var(--space-1) 0 var(--space-4);
}

/* Quick-link tiles with auto favicon (Home). Selector qualified to beat
   the earlier `.tile-grid a.tile-card { display:block }` (same specificity,
   later in source). */
.tile-grid a.ql-tile {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 0;
}
.ql-thumb {
  position: relative;
  width: 24px;
  height: 24px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.ql-favicon {
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--surface);
}
.ql-label {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

/* ---------- Skeleton loaders (replace the bare "Loading…" text) ---------- */
.skeleton-screen { padding: var(--space-2) 2px; }
.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
}
.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: skel-shimmer 1.25s ease-in-out infinite;
}
@keyframes skel-shimmer { to { transform: translateX(100%); } }
.skel-line { height: 12px; margin-bottom: var(--space-2); }
.skel-line.lg { height: 20px; width: 55%; margin-bottom: var(--space-3); }
.skel-line.sm { width: 40%; }
.skel-card {
  height: 76px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  margin-bottom: var(--space-3);
  overflow: hidden;
}

/* ---------- Reduced motion: keep meaning, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card:active, .tile-card:active, .hero-card:active, .btn-primary:active,
  .btn-secondary:active, .btn-mini:active, .fab:active, .nav-btn:active,
  .filter-chip:active, .month-cell:active, .stepper-btn:active,
  .sheet-close:active, .type-toggle-btn:active { transform: none; }
  .skel::after { animation: none; display: none; }
}
