/* ============================================================
   Brand fonts — Focal (sans) and Grenette Pro (serif italic)
   ============================================================ */
@font-face {
  font-family: 'Focal';
  src: url('/fonts/Focal-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Focal';
  src: url('/fonts/Focal-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Manrope falls back to Focal's two weights — alias the in-between weights
   to Bold so older Manrope rules (500, 600) still render in Focal Bold. */
@font-face {
  font-family: 'Focal';
  src: url('/fonts/Focal-Bold.woff2') format('woff2');
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'GrenettePro';
  src: url('/fonts/GrenettePro-Light.woff2') format('woff2');
  font-weight: 300 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'GrenettePro';
  src: url('/fonts/GrenettePro-LightItalic.woff2') format('woff2');
  font-weight: 300 400;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Wobble Hifi brand palette
     FLIPBACK #1C441F · ADAPTER #D7DB71 · DEMO #F6E8D2
     OBI #C27543 · WARP #C0A9B3 · plus burgundy/mustard/orange/peach

     Page canvas is cream; surfaces (cards, sidebar, topbar, modals, the
     grid) are FLIPBACK green. The text/border variables below describe
     the *page-level* values; surface scopes redefine them lower down. */
  --bg: #f6e8d2;             /* DEMO cream — the page canvas */
  --surface: #1c441f;        /* FLIPBACK */
  --surface-2: #234e25;
  --surface-3: #2d5e30;
  --border: #d6c5a3;         /* warm tan divider on cream bg */
  --text: #1c441f;           /* FLIPBACK green text on cream */
  --text-dim: #5d6f5e;       /* muted green-grey */
  --text-faint: #8c9e8c;     /* faint green-grey */
  --accent: #d7db71;         /* ADAPTER chartreuse */
  --accent-2: #b8c050;       /* darker chartreuse for gradients */
  --accent-glow: rgba(215, 219, 113, 0.30);
  --accent-fg: #1c441f;      /* dark text for use ON accent backgrounds */
  --violet: #c0a9b3;         /* WARP mauve — repurposed for "open" status */
  --violet-glow: rgba(192, 169, 179, 0.30);
  --violet-fg: #3a1f29;
  --amber: #e2b53f;          /* mustard — repurposed for "draft/warning" */
  --amber-fg: #2a1f08;
  --green: #d7db71;
  --red: #c27543;            /* OBI terracotta — danger/conflict */
  --red-fg: #2a1208;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: 'Focal', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --serif: 'GrenettePro', 'Source Serif 4', Georgia, 'Times New Roman', serif;
  /* Reference breakpoints. CSS custom properties can't be used directly
     inside @media queries (spec limitation), but naming them here keeps the
     two values findable and consistent across the file.
       --bp-phone  : 480px — phone-only polish (compact KPIs, tight inv rows)
       --bp-tablet : 800px — tablet/mobile (drawer nav, stacked fields, etc.) */
  --bp-phone: 480px;
  --bp-tablet: 800px;
}

/* Inside any surface, the canvas-text variables flip to cream-on-green so
   nested elements (which mostly use var(--text) etc.) look correct without
   needing to be touched individually. Buttons are listed here too — their
   background is always the green surface-2, so they always want cream text
   regardless of the canvas they sit on. */
.topbar, .sidebar, .card, .stat, .shift, .modal, .toast,
.login-card, .welcome, .sched-grid, .sched-shift,
.avail-day, .pos-chip, .pos-legend-item, .week-nav,
.role-pill, .btn {
  --text: #f6e8d2;
  --text-dim: #c2b497;
  --text-faint: #8a7a5e;
  --border: #2d5e30;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 15% 0%, rgba(215, 219, 113, 0.07), transparent 40%),
    radial-gradient(circle at 85% 100%, rgba(192, 169, 179, 0.06), transparent 40%);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  /* Input background is always the dark-green surface-2, so text must
     always be cream — regardless of whether the input sits at page level
     (where --text would otherwise be dark green) or inside a card. */
  color: #f6e8d2;
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: #c2b497; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
/* Search-input clear button is dark by default — flip it for contrast on
   the green input background. */
input[type="search"]::-webkit-search-cancel-button {
  filter: invert(0.85);
  cursor: pointer;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Boot screen */
.boot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 14px;
}
.boot-logo {
  width: 56px; height: 56px;
  background: url('/assets/logo.png') center/contain no-repeat;
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-text { color: var(--text-dim); font-family: var(--serif); font-style: italic; font-size: 13px; }
@keyframes pulse { 0%,100% { opacity: 0.6 } 50% { opacity: 1 } }

/* Top bar */
.topbar {
  /* Total height = 56px content row + safe-area-inset-top (Dynamic Island /
     notch) so the content never gets squished behind the status bar. */
  height: calc(56px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Hamburger button — always visible; toggles sidebar drawer on mobile,
   collapses the sidebar panel on desktop. */
.menu-toggle {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 40px; height: 40px;
  margin-right: 8px;
  background: transparent; border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle .ic { width: 22px; height: 22px; }
.btn .ic { width: 18px; height: 18px; flex-shrink: 0; }

/* Scrim shown behind the mobile drawer. Display toggling happens in the
   mobile media query — desktop never sees this element rendered. */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 45;
  background: rgba(5, 8, 12, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-logo {
  width: 32px; height: 32px;
  background: url('/assets/logo.png') center/contain no-repeat;
}
.brand-name { font-family: var(--sans); font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.brand-name .dim { color: var(--text-dim); font-weight: 400; }
.topbar-spacer { flex: 1; }
.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim); font-family: var(--sans); font-weight: 500;
}
.role-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); }
.role-pill.admin .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.role-pill.lead  .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.role-pill.employee .dot { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.user-chip { color: var(--text); font-family: var(--sans); margin-left: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-weight: 500;
  transition: all 0.12s;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-faint); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--accent-fg); border-color: var(--accent);
  font-weight: 600; box-shadow: 0 0 0 1px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-violet {
  background: linear-gradient(180deg, var(--violet), #a08894);
  color: var(--violet-fg); border-color: var(--violet); font-weight: 600;
}
.btn-violet:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: inherit; }
.btn-ghost:hover { color: var(--text); }
/* Inside dark surfaces the inherited color is already cream, but pin it
   explicitly so Safari doesn't resolve the chain incorrectly. */
.topbar .btn-ghost { color: var(--text); }
.btn-warning { background: linear-gradient(180deg, #c8913a, #b07c2e); color: #fff; border-color: #b07c2e; font-weight: 600; }
.btn-warning:hover { filter: brightness(1.08); border-color: #c8913a; }
.btn-danger { color: var(--red); border-color: rgba(194, 117, 67, 0.4); }
.btn-danger:hover { background: rgba(194, 117, 67, 0.10); border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 6px; }

/* Layout */
.layout {
  display: grid;
  /* First column is auto-sized by the sidebar's width so it collapses
     smoothly when the sidebar animates to width:0. minmax(0,1fr) prevents
     the content column from expanding beyond its share of the viewport. */
  grid-template-columns: auto minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}
.layout > * { min-width: 0; }
.sidebar {
  width: 240px;
  overflow: hidden;
  /* Animate collapse: fade out content quickly, then width shrinks to 0. */
  transition: width 0.22s ease, opacity 0.15s ease,
              padding-left 0.22s ease, padding-right 0.22s ease;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
/* Desktop-only collapsed state. Mobile drawer uses sidebar-open instead. */
@media (min-width: 801px) {
  body.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right: none;
    opacity: 0;
  }
}
.sidebar-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint); padding: 10px 10px 6px;
  font-family: var(--sans); font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-dim); width: 100%; text-align: left;
  font-size: 13px; font-weight: 500; transition: all 0.1s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface-2); color: var(--accent);
  border-color: var(--border);
}
.nav-item.section-active { color: var(--text); }
.nav-item.nav-parent { justify-content: flex-start; }
.nav-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  opacity: 0.5;
  transition: transform 0.15s;
  line-height: 1;
}
.nav-item.nav-child {
  margin-left: 18px;
  padding-left: 10px;
  font-size: 12px;
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0;
}
.nav-item.nav-child:hover { border-left-color: var(--text-faint); }
.nav-item.nav-child.active {
  border-left-color: var(--accent);
  border-left-width: 2px;
  padding-left: 9px;
}
.nav-item .ic { width: 16px; height: 16px; opacity: 0.8; }
.sidebar-foot {
  margin-top: auto; padding: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  border-top: 1px solid var(--border);
}

.content {
  padding: 24px 28px;
  max-width: 1200px;
  width: 100%;
  /* Exposed to full-bleed children (e.g. sched-grid-wrap) so they can
     negate exactly the right amount of padding without hard-coding it. */
  --pad-x: 28px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-title {
  margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.015em;
  font-family: var(--sans);
}
.page-sub {
  color: var(--text-dim); font-size: 14px; margin-top: 4px;
  font-family: var(--serif); font-style: italic; font-weight: 400;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-title { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.card-body { padding: 16px; }

/* Stats */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px 16px; position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-faint); font-family: var(--sans); font-weight: 600;
}
.stat-value {
  font-family: var(--sans); font-size: 30px; font-weight: 700;
  margin-top: 4px; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 13px; color: var(--text-dim); margin-left: 4px; }

/* Day group */
.day-group { margin-bottom: 22px; }
.day-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; margin-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.day-name {
  font-family: var(--sans); font-size: 12px; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.10em; font-weight: 700;
}
.day-date { color: var(--text); font-weight: 700; font-size: 15px; font-family: var(--sans); letter-spacing: -0.01em; }
.day-empty {
  color: var(--text-dim); font-size: 13px; margin-left: auto;
  font-family: var(--serif); font-style: italic;
}
.day-today {
  background: var(--accent); color: var(--accent-fg); font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 3px; letter-spacing: 0.04em;
}
.shift-list { display: flex; flex-direction: column; gap: 8px; }

.shift {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 14px;
  padding: 12px 14px;
  transition: background 0.12s, border-color 0.12s;
}
.shift:hover { background: var(--surface-2); }
.shift.open {
  border-left-color: var(--violet);
  /* Keep the dark surface underneath so cream text stays readable;
     layer a faint violet glow on top to mark it as an open shift. */
  background:
    linear-gradient(90deg, var(--violet-glow), transparent 30%),
    var(--surface);
}
.shift.mine { border-left-color: var(--accent); }
.shift.others { border-left-color: var(--surface-3); opacity: 0.85; }
.shift-time {
  font-family: var(--mono); font-size: 13px; color: var(--text); text-align: center; min-width: 110px;
}
.shift-time .duration {
  display: block; font-size: 10px; color: var(--text-faint);
  margin-top: 2px; letter-spacing: 0.04em;
}
.shift-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shift-employee {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--text); font-size: 14px;
}
.shift-position { color: var(--text-dim); font-size: 12px; font-family: var(--sans); font-weight: 500; }
.shift-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #0a0e14; flex-shrink: 0;
}

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em;
  padding: 3px 8px; border-radius: 8px;
  background: var(--surface-3); color: var(--text-dim);
}
.badge.violet { background: var(--violet-glow); color: var(--violet); }
.badge.accent { background: var(--accent-glow); color: var(--accent); }
.badge.amber { background: rgba(226, 181, 63, 0.14); color: var(--amber); }

/* Empty */
.empty { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-title { color: var(--text); font-size: 16px; font-weight: 700; margin-bottom: 8px; font-family: var(--sans); }
.empty-hint {
  font-size: 14px; color: var(--text-dim);
  font-family: var(--serif); font-style: italic; font-weight: 300;
  line-height: 1.5; max-width: 480px; margin: 0 auto;
}
.empty.no-results .empty-title { color: var(--text-dim); font-weight: 500; }

/* Modal — flex layout so head + scrolling body + foot stay inside the
   viewport. The body grows to fill available space and scrolls; foot
   never overlaps content even on tall forms in short windows. */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 8, 12, 0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  width: 100%; max-width: min(480px, calc(100vw - 40px));
  /* Use dvh (dynamic viewport) so mobile browsers' shrinking URL bar
     doesn't intermittently clip the modal foot. Falls back to vh. */
  max-height: 92vh;
  max-height: 92dvh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px var(--accent-glow);
  overflow: hidden;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex: 0 0 auto;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body {
  padding: 20px;
  flex: 1 1 auto;
  min-height: 0;           /* lets the inner scroll work in a flex parent */
  overflow-y: auto;
}
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; color: var(--text-dim);
  margin-bottom: 5px; font-weight: 500; letter-spacing: 0.02em;
}
.field input, .field select, .field textarea { width: 100%; }
.field textarea { min-height: 60px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint {
  font-size: 12px; color: var(--text-dim); margin-top: 4px;
  font-family: var(--serif); font-style: italic; font-weight: 300;
  line-height: 1.45;
}
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--red) !important; }
.field-error-msg { font-size: 12px; color: var(--red); margin-top: 4px; font-weight: 500; }
.field-required { color: var(--red); margin-left: 2px; font-weight: 700; }
.page-loading {
  color: var(--text-dim); font-size: 14px; padding: 24px;
  font-family: var(--serif); font-style: italic; text-align: center;
}

/* Toast */
.toast-wrap {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 12px;
  padding: 10px 14px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease-out; min-width: 240px;
}
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }

/* Login screen */
.login-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; padding: 20px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; width: 100%; max-width: 420px; text-align: center;
  box-shadow: 0 0 0 1px var(--accent-glow), 0 24px 48px rgba(0,0,0,0.4);
}
.login-card h1 {
  font-family: var(--sans); font-weight: 700;
  font-size: 26px; letter-spacing: -0.02em; margin: 0 0 8px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-card p {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  color: var(--text-dim); margin: 0 0 22px; font-size: 15px;
}

/* Week nav */
.week-nav {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px;
}
.week-nav button {
  background: transparent; border: none; color: var(--text-dim);
  padding: 6px 10px; border-radius: 8px; font-size: 12px; font-family: var(--mono);
}
.week-nav button:hover { background: var(--surface-2); color: var(--text); }
.week-nav .week-label {
  padding: 6px 14px; color: var(--text); font-family: var(--mono); font-size: 12px;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.week-nav .week-today-btn {
  border-left: 1px solid var(--border);
  color: var(--accent); font-weight: 600;
  padding-left: 12px;
}
.week-nav .week-today-btn:hover { color: var(--text); }

/* Sticky schedule page header — sticks just below the topbar while scrolling */
.sched-sticky-head {
  position: sticky;
  top: calc(56px + env(safe-area-inset-top, 0px));
  z-index: 20;
  background: var(--bg);
  /* pull the element flush with the content edges using the same --pad-x
     variable used by sched-grid-wrap, so both always align. */
  margin-top: -24px;
  padding-top: 16px;
  padding-bottom: 14px;
  margin-left: calc(-1 * var(--pad-x, 28px));
  margin-right: calc(-1 * var(--pad-x, 28px));
  padding-left: var(--pad-x, 28px);
  padding-right: var(--pad-x, 28px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

/* Pull-to-refresh indicator.
   Centered via margin-left so JS can animate only translateY without
   fighting translateX(-50%). The loading animation bakes in the final Y. */
.ptr-indicator {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: 50%;
  margin-left: -17px;     /* half of 34px — centering without translateX */
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  opacity: 0;
  z-index: 40;
  pointer-events: none;
  will-change: transform, opacity;
}
.ptr-indicator.ptr-loading {
  opacity: 1 !important;
  animation: ptr-spin 0.55s linear infinite;
}
@keyframes ptr-spin {
  from { transform: translateY(44px) rotate(0deg); }
  to   { transform: translateY(44px) rotate(360deg); }
}

/* Tables */
.row-grid {
  display: grid; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.row-grid:last-child { border-bottom: none; }
.row-head {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-faint); padding-bottom: 8px;
}

/* Role select */
select.role-select {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--mono); font-size: 12px;
  padding: 4px 8px; border-radius: 4px;
}

.row { display: flex; align-items: center; gap: 8px; }
.gap-12 { gap: 12px; }

/* ============================================================
   Schedule grid (admin / lead view)
   ============================================================ */

.sched-grid-wrap {
  overflow-x: auto;
  /* 70vh keeps the grid tall enough to show ~8+ employees before scrolling,
     while still acting as the vertical scroll container so position:sticky
     works for the day-header row. dvh adjusts for mobile browser chrome. */
  max-height: 70vh;
  max-height: 70dvh;
  /* Bleed to the exact edge of .content's padding so no cream shows
     on either side. --pad-x is set on .content (28px desktop, 16px mobile)
     and inherited here. */
  margin-left: calc(-1 * var(--pad-x, 28px));
  margin-right: calc(-1 * var(--pad-x, 28px));
  padding-left: var(--pad-x, 28px);
  padding-right: var(--pad-x, 28px);
  padding-bottom: 8px;
  /* The rounded corners live here, not on .sched-grid, so the inner grid
     can let cells use position:sticky without being clipped. */
  border-radius: 16px;
  /* max-width: content box + both paddings = content border-box width,
     so the wrap never exceeds its container and causes page scroll. */
  max-width: calc(100% + 2 * var(--pad-x, 28px));
  box-sizing: border-box;
  /* Solid dark surface as a backdrop so any sub-pixel gap, rounded
     corner, or overflow edge blends into the grid instead of revealing
     the cream page background. */
  background: #1c441f;
}
.sched-grid {
  display: grid;
  grid-template-columns: 200px repeat(7, minmax(110px, 1fr));
  /* Column gap uses the background trick (reliable for vertical dividers).
     Row gap is 0 — we use explicit border-bottom on cells instead, because
     Safari/WebKit on mobile doesn't always paint the gap background in the
     last column, causing row dividers to visually cut short there. */
  column-gap: 1px;
  row-gap: 0;
  background: #2d5e30;
  /* No border-bottom — the last row's cell border-bottom forms the edge. */
  border-top: 1px solid #2d5e30;
  border-left: 1px solid #2d5e30;
  border-right: 1px solid #2d5e30;
  min-width: 880px;
}
.sched-grid > * {
  background: var(--surface);
  padding: 8px 10px;
  min-height: 72px;
  /* Explicit border provides the row separator — consistent across all
     columns including the last one (Sunday). */
  border-bottom: 1px solid #2d5e30;
}

.sched-corner {
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  display: flex; align-items: center;
}

/* Pin the employee name column (and the top-left corner cell) so they
   stay visible while horizontally scrolling the grid on narrow screens.
   Box-shadow on the right gives a soft "edge" cue during scroll.
   Higher-specificity selector + min-width:0 to win against the grid
   defaults that can break sticky in CSS Grid. */
.sched-grid > .sched-corner,
.sched-grid > .sched-emp {
  position: sticky !important;
  left: 0;
  z-index: 3;
  min-width: 0;
  /* Solid background so cells scrolling past don't bleed through.
     The grid-item default background (var(--surface-2)) is opaque, but
     the open-row / unassigned-row variants use translucent gradients;
     overrides below restore opacity for those. */
  background-color: var(--surface-2);
  box-shadow: 4px 0 6px -4px rgba(0, 0, 0, 0.45);
}
/* Day header row — sticky to the top of the scroll container so it's
   always visible while scrolling down through many employees.
   z-index 4 sits above the emp column (3); corner gets 5 so it covers
   both the scrolling emp column and the scrolling day headers. */
.sched-grid > .sched-day-head {
  position: sticky;
  top: 0;
  z-index: 4;
}
.sched-grid > .sched-corner {
  top: 0;
  z-index: 5;
}
/* Open/unassigned rows had translucent gradients — that's fine when not
   sticky, but during scroll the transparent parts would expose underlying
   cells. Layer the gradient on top of the solid surface. */
.sched-grid > .sched-emp.open-row {
  background:
    linear-gradient(90deg, var(--violet-glow), transparent 80%),
    var(--surface-2);
}
.sched-grid > .sched-emp.unassigned-row {
  background:
    linear-gradient(90deg, rgba(226, 181, 63, 0.14), transparent 80%),
    var(--surface-2);
}

.sched-day-head {
  background: var(--surface-2);
  font-family: var(--mono);
  display: flex; flex-direction: column;
  gap: 2px; align-items: center; justify-content: center;
  text-align: center;
}
.sched-day-head.today { background: var(--accent-glow); }
.sched-day-name {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-dim);
}
.sched-day-head.today .sched-day-name { color: var(--accent); }
.sched-day-date {
  font-family: var(--sans); font-size: 14px; font-weight: 700;
  color: var(--text); letter-spacing: -0.01em;
}
.sched-day-head.today .sched-day-date { color: var(--accent); }

.sched-emp {
  background: var(--surface-2);
  display: flex; flex-direction: column;
  gap: 4px; justify-content: center;
}
.sched-emp-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px; color: var(--text);
  overflow: hidden;
}
.sched-emp-name > span {
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.sched-emp-hours {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  letter-spacing: 0.04em;
}
.sched-emp-hours.overtime { color: var(--amber); font-weight: 700; }
.sched-emp.open-row {
  background: linear-gradient(90deg, var(--violet-glow), var(--surface-2) 80%);
}
.sched-emp.open-row .sched-emp-name { color: var(--violet); }

.sched-emp.unassigned-row {
  background: linear-gradient(90deg, rgba(226, 181, 63, 0.14), var(--surface-2) 80%);
}
.sched-emp.unassigned-row .sched-emp-name { color: var(--amber); }
.sched-cell.unassigned-cell {
  background: rgba(226, 181, 63, 0.05);
}
.sched-cell.unassigned-cell .sched-shift {
  background: linear-gradient(180deg, var(--amber), #c69a30);
  color: var(--amber-fg);
  border-left-color: #8a6e1c;
}

.sched-cell {
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  transition: background 0.1s;
}
.sched-cell.today-col { background: rgba(215, 219, 113, 0.05); }
.sched-cell.unavailable {
  background: rgba(194, 117, 67, 0.10);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent, transparent 6px,
    rgba(194, 117, 67, 0.05) 6px, rgba(194, 117, 67, 0.05) 12px
  );
}
.sched-cell.open-cell { background: rgba(192, 169, 179, 0.06); }
.sched-cell.empty-clickable { cursor: pointer; }
.sched-cell.empty-clickable:hover {
  background: var(--surface-2);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
.sched-cell-add {
  font-size: 18px; color: var(--text-faint); text-align: center;
  opacity: 0; transition: opacity 0.12s; align-self: center;
  flex: 1; display: flex; align-items: center; justify-content: center;
  width: 100%;
}
.sched-cell.empty-clickable:hover .sched-cell-add { opacity: 1; }
.sched-unavail-badge {
  font-size: 10px; color: var(--red); font-family: var(--mono);
  text-align: center; padding: 6px 0;
  letter-spacing: 0.08em; text-transform: uppercase;
}

.sched-shift {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--accent-fg);
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  border-left: 3px solid #8a9430;
  transition: filter 0.12s, transform 0.12s;
  line-height: 1.3;
}
.sched-shift:hover { filter: brightness(1.08); transform: translateY(-1px); }
.sched-shift.open {
  background: linear-gradient(180deg, var(--violet), #a08894);
  color: var(--violet-fg);
  border-left-color: #6e4145;
}
/* Offered-up: still owned by the employee, but up for grabs. Keep the
   position color (set inline by JS), tone it down with reduced saturation
   and a dashed mauve left border; the "OFFERED UP" pill underneath does
   the heavy lifting for state communication. */
.sched-shift.offered {
  position: relative;
  filter: saturate(0.6) brightness(0.92);
  border-left: 3px dashed var(--violet);
}
.sched-shift.offered:hover { filter: saturate(0.8) brightness(1.02); }
.sched-shift-offered-label {
  margin-top: 2px;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--violet-fg);
  background: rgba(192, 169, 179, 0.85);   /* WARP mauve */
  border-radius: 999px;
  padding: 1px 6px;
  display: inline-block;
  line-height: 1.4;
}
.sched-shift.conflict {
  outline: 2px solid var(--red);
  outline-offset: -2px;
  box-shadow: 0 0 0 2px rgba(194, 117, 67, 0.30);
}
.sched-conflict-icon { color: var(--red); }
.sched-shift-time {
  font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em;
}
.sched-shift-pos {
  font-size: 10px; opacity: 0.78; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Drag-and-drop shift reordering (build view only) */
.sched-shift[draggable="true"] { cursor: grab; }
.sched-shift[draggable="true"]:active { cursor: grabbing; }
.sched-shift.dragging {
  opacity: 0.35;
  transform: none;
  filter: none;
}
.sched-cell.drag-over {
  background: rgba(215, 219, 113, 0.12);
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
}
.sched-cell.drag-over.drag-copy {
  background: rgba(192, 169, 179, 0.14);
  outline-color: var(--violet);
}

/* ============================================================
   Availability — manager grid variant
   ============================================================ */
.sched-cell.avail-cell {
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  min-height: 56px;
}
.sched-cell.avail-cell:hover { background: var(--surface-2); }
.sched-cell.avail-cell.unavailable {
  color: var(--red); font-weight: 700;
}

/* ============================================================
   Availability — employee weekly strip
   ============================================================ */
.avail-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.avail-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.12s;
  display: flex; flex-direction: column; gap: 6px;
  font-family: inherit;
  color: var(--text);
}
.avail-day:hover {
  border-color: var(--text-faint);
  transform: translateY(-1px);
  background: var(--surface-2);
}
.avail-day.off {
  background: rgba(194, 117, 67, 0.12);
  border-color: rgba(194, 117, 67, 0.45);
}
.avail-day.off:hover { filter: brightness(1.1); }
.avail-day.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.avail-day-name {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.10em;
}
.avail-day-date {
  font-family: var(--sans); font-size: 20px; font-weight: 700;
  letter-spacing: -0.02em;
}
.avail-day-status {
  font-family: var(--sans); font-weight: 700;
  font-size: 10px; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.10em;
}
.avail-day.off .avail-day-status { color: var(--red); font-weight: 700; }
.avail-day.today .avail-day-name { color: var(--accent); }

/* ============================================================
   Home page — landing card + tile grid
   ============================================================ */

.home-greeting {
  font-size: 32px !important;
  letter-spacing: -0.02em !important;
}

.home-shift-card {
  margin-bottom: 28px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-left: 4px solid var(--accent);
  border-radius: 18px;
}
.home-shift-card .card-body { padding: 24px 26px; }
.home-shift-label {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 8px;
}
.home-shift-headline {
  font-family: var(--sans); font-weight: 700;
  font-size: 32px; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 8px;
  line-height: 1.1;
}
.home-shift-time {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px;
  margin-top: 10px;
}
.home-shift-time-range {
  font-family: var(--mono);
  font-size: 20px; font-weight: 700;
  color: var(--text);
}
.home-shift-position {
  font-family: var(--sans); font-weight: 500;
  font-size: 14px; color: var(--text-dim);
  padding: 4px 10px; background: var(--surface-3);
  border-radius: 999px;
}
.home-shift-sub {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 14px; color: var(--text-dim); margin-top: 10px;
  line-height: 1.5;
}

.home-section-title {
  font-family: var(--sans); font-weight: 700;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint); margin: 8px 0 14px;
}

.home-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.home-tile {
  --text: #f6e8d2;
  --text-dim: #c2b497;
  --text-faint: #8a7a5e;
  --border: #2d5e30;
  color: var(--text);
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 22px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.home-tile::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  opacity: 0.7;
}
.home-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  text-decoration: none;
}
.home-tile:hover::before { opacity: 1; }
.home-tile-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-glow);
  border-radius: 12px;
  color: var(--accent);
  margin-bottom: 6px;
}
.home-tile-icon svg { width: 22px; height: 22px; }
.home-tile-title {
  font-family: var(--sans); font-weight: 700;
  font-size: 18px; letter-spacing: -0.01em;
  color: var(--text);
}
.home-tile-desc {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 14px; color: var(--text-dim);
  line-height: 1.45;
}
.home-tile-hint {
  margin-top: 6px;
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--amber);
}
.home-tile-unset {
  border-style: dashed;
  opacity: 0.85;
}
.home-tile-unset .home-tile-icon {
  background: rgba(226, 181, 63, 0.16);
  color: var(--amber);
}

/* ============================================================
   Tile editor rows (Settings)
   ============================================================ */
.tile-edit-row {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.tile-edit-row:last-of-type { border-bottom: none; }
.tile-edit-cols {
  display: flex; gap: 6px; align-items: center;
}
.tile-edit-cols .btn { white-space: nowrap; }
.tile-edit-cols input,
.tile-edit-cols select { padding: 6px 8px; font-size: 13px; }
.tile-edit-cols > input:first-child { flex: 1; }
.tile-edit-cols > select { flex: 0 0 100px; }
.tile-edit-row > div:not(:first-child) input {
  width: 100%; padding: 6px 8px; font-size: 12px;
}

/* ============================================================
   Upcoming events list on /home (DJ + Event Google Calendars)
   ============================================================ */
.home-events-mount { margin-top: 24px; }
.event-list {
  display: flex; flex-direction: column; gap: 18px;
}
.event-day-head {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.event-day {
  display: flex; flex-direction: column; gap: 6px;
}
.event-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: 8px;
  /* Forest-green surface needs cream text — the rest of the cream-canvas
     theme inverts colors per-surface via this same trick (.card, .shift…). */
  --text: #f6e8d2;
  --text-dim: #c2b497;
  --text-faint: #8a7a5e;
  --border: #2d5e30;
  color: var(--text);
}
.event-row.event-cal-dj     { border-left-color: var(--accent, #d7db71); }   /* chartreuse */
.event-row.event-cal-events { border-left-color: #c27543; }                  /* OBI terracotta */
.event-time {
  flex: 0 0 70px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  padding-top: 2px;
}
.event-body { flex: 1; min-width: 0; }
.event-title-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.event-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.event-chip-dj     { background: rgba(215, 219, 113, 0.18); color: #d7db71; }
.event-chip-events { background: rgba(194, 117, 67, 0.18);  color: #e9a172; }
.event-title {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--text);
  flex: 1;
  word-break: break-word;
}
.event-loc {
  margin-top: 2px;
  font-family: var(--sans); font-size: 12px; color: var(--text-dim);
}

/* ============================================================
   Inventory module
   ============================================================ */
.inv-filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 16px;
}
.inv-search { flex: 1; min-width: 220px; }
.inv-filter-toggle { display: none; }
.inv-chips-wrap { display: contents; }
.inv-cat-head {
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-dim);
  margin: 22px 0 8px;
}
.inv-grid {
  display: grid; gap: 8px;
}
.inv-row {
  display: grid;
  grid-template-columns: 1fr 130px auto;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  --text: #f6e8d2;
  --text-dim: #c2b497;
  color: var(--text);
}
.inv-row.low { border-left-color: var(--amber); }
.inv-row-name { font-family: var(--sans); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inv-low-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  background: rgba(226,181,63,0.15); color: var(--amber);
  border: 1px solid rgba(226,181,63,0.3);
  border-radius: 4px; padding: 1px 5px; flex-shrink: 0;
}
.inv-row-sub  { font-family: var(--sans); font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.inv-row-qty { text-align: right; }
.inv-row-qty-now { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text); }
.inv-row-qty-par { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.inv-row-qty-par.low { color: var(--amber); }
.inv-row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Invoice line-review table */
.inv-lines-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.inv-line-row {
  display: grid;
  grid-template-columns: 2fr 70px 2fr 80px 1fr auto;
  gap: 6px; align-items: center; min-width: 0;
}
.inv-line-head {
  font-family: var(--sans); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim);
}
.inv-line-row input,
.inv-line-row select { padding: 6px 8px; font-size: 13px; min-width: 0; }


/* ============================================================
   Sales reports page
   ============================================================ */
.rpt-date-bar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  --text: #f6e8d2; --text-dim: #c2b497;
  color: var(--text);
}
.rpt-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.rpt-preset {
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.rpt-preset:hover { border-color: var(--accent); }
.rpt-preset.active {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
.rpt-custom {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.rpt-custom input { padding: 6px 8px; font-size: 13px; }

.rpt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.rpt-kpi {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  --text: #f6e8d2; --text-dim: #c2b497;
  color: var(--text);
}
.rpt-kpi .stat-label {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim);
}
.rpt-kpi .stat-value {
  font-family: var(--sans); font-size: 24px; font-weight: 800;
  margin-top: 4px;
}
.rpt-kpi .stat-delta {
  font-family: var(--mono); font-size: 11px;
  margin-top: 2px;
  color: var(--text-dim);
}
.rpt-kpi .stat-delta.up   { color: var(--accent); }
.rpt-kpi .stat-delta.down { color: var(--red); }
.rpt-kpi .stat-hint {
  font-family: var(--sans); font-size: 11px; color: var(--text-dim); margin-top: 4px;
}

.rpt-split {
  display: grid; gap: 14px; margin-top: 18px;
  grid-template-columns: 1fr 1fr;
}

.rpt-table {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.rpt-row {
  display: grid;
  grid-template-columns: 40px 2fr 1fr 80px 110px;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  font-family: var(--sans); font-size: 13px;
}
/* Generic breakdown tables: 1 + 1-2 numeric columns */
.card-body > .rpt-table .rpt-row:not(:first-of-type ~ .rpt-row),
.rpt-split .rpt-table .rpt-row {
  grid-template-columns: 1.6fr repeat(auto-fit, minmax(80px, 1fr));
}
.rpt-row.rpt-head {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim);
}
.rpt-num { text-align: right; font-family: var(--mono); }
.rpt-strong { font-weight: 600; }
.rpt-clickable { cursor: pointer; transition: background 0.08s; }
.rpt-clickable:hover { background: rgba(215, 219, 113, 0.08); }

/* Sub-link chooser shown when an admin clicks a "group" tile on /home */
.tile-child-list {
  display: flex; flex-direction: column; gap: 6px;
}
.tile-child {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--sans); font-size: 14px;
  transition: background 0.12s ease, transform 0.06s ease;
}
.tile-child:hover {
  background: rgba(215, 219, 113, 0.08);  /* faint chartreuse */
  border-color: rgba(215, 219, 113, 0.4);
}
.tile-child:active { transform: translateY(1px); }
.tile-child-title { font-weight: 500; }
.tile-child-arrow {
  color: var(--text-dim);
  display: flex; align-items: center;
}

/* ============================================================
   Position color legend (above the schedule grid)
   ============================================================ */
.pos-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.pos-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; color: var(--text);
  font-family: var(--sans); font-weight: 500;
}
.pos-legend-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.2);
  flex-shrink: 0;
}

/* ============================================================
   Per-role rate editor rows (inside the employee modal)
   ============================================================ */
.rate-row {
  display: flex; gap: 6px; align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.rate-row:last-of-type { border-bottom: none; }
.rate-row input { padding: 6px 8px; font-size: 12px; }

/* ============================================================
   Recipes module
   ============================================================ */

.recipe-filter-bar {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 22px;
}
.recipe-search {
  width: 100%; max-width: 480px;
  padding: 12px 16px;
  font-size: 14px;
  border-radius: 999px;
}
.recipe-chip-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.recipe-chip-row-sub { opacity: 0.85; }
.recipe-chip {
  --text: var(--surface);
  --text-dim: var(--surface);
  color: var(--surface);
  background: transparent;
  border: 1px solid var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: var(--sans); font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.recipe-chip:hover {
  background: var(--surface);
  color: var(--text);
}
.recipe-chip.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--surface);
}
.recipe-chip-tag {
  font-family: var(--mono); font-weight: 500;
  text-transform: lowercase;
  font-size: 11px;
}

/* Tag dropdown (replaces chip row) */
.recipe-tag-wrap {
  display: inline-flex; align-items: center;
}
.recipe-tag-select {
  font-family: var(--mono); font-size: 12px;
  padding: 6px 28px 6px 12px;
  border-radius: 999px;
  /* Hardcode both values so they're immune to --surface context flipping and
     so native appearance overrides (Safari) don't bleed through. */
  background: #1c441f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23f6e8d2' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid #1c441f;
  color: #f6e8d2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.recipe-tag-select option {
  background: #1c441f;
  color: #f6e8d2;
}

/* Selection mode (bulk-archive on active page, restore on archived page) */
.recipe-card.selectable {
  padding-left: 50px;
}
.recipe-card-check {
  position: absolute;
  top: 18px; left: 16px;
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-dim);
  background: var(--surface-2);
  transition: all 0.12s;
}
.recipe-card-check.on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 4px var(--surface);
}
.recipe-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.recipe-card.archived {
  opacity: 0.85;
  border-style: dashed;
}
.recipe-card.archived::before { opacity: 0.25; }
.recipe-card.archived .recipe-card-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.recipe-card {
  --text: #f6e8d2;
  --text-dim: #c2b497;
  --text-faint: #8a7a5e;
  --border: #2d5e30;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 16px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  display: flex; flex-direction: column; gap: 10px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.recipe-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  opacity: 0.55;
  transition: opacity 0.12s;
}
.recipe-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);
}
.recipe-card:hover::before { opacity: 1; }
.recipe-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.recipe-card-title {
  font-family: var(--sans); font-weight: 700;
  font-size: 17px; line-height: 1.2; letter-spacing: -0.01em;
  color: var(--text);
}
.recipe-card-cat {
  font-family: var(--sans); font-weight: 700;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.10em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-glow); color: var(--accent);
  flex-shrink: 0;
}
.recipe-card-desc {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 14px; color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.recipe-card-ing-teaser {
  font-family: var(--mono); font-style: normal;
  font-size: 12px; color: var(--text-faint);
}
.recipe-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 2px;
}
.recipe-meta-pill {
  font-family: var(--sans); font-weight: 500;
  font-size: 11px;
  padding: 3px 9px;
  background: var(--surface-3);
  color: var(--text-dim);
  border-radius: 999px;
}
.recipe-meta-pill.primary {
  background: var(--accent-glow); color: var(--accent); font-weight: 700;
}
.recipe-meta-tag {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim);
  padding: 2px 4px;
}

/* ----- Recipe detail (inside modal) ----- */
.recipe-detail { font-family: var(--sans); }
.recipe-detail-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.recipe-detail-desc {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 15px; color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 18px;
}
.recipe-detail-h {
  font-family: var(--sans); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent);
  margin: 18px 0 8px;
}
.recipe-detail-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.recipe-detail-list li {
  font-family: var(--mono); font-size: 13px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--text);
}
.recipe-detail-instructions,
.recipe-detail-notes {
  font-family: var(--serif); font-weight: 300;
  font-size: 14px; color: var(--text); line-height: 1.6;
  white-space: pre-wrap;
}
.recipe-detail-notes { font-style: italic; color: var(--text-dim); }

/* ============================================================
   Position chips (Settings page)
   ============================================================ */
.pos-chip-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 28px;
}
.pos-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 4px 4px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; font-size: 12px; color: var(--text);
}
.pos-chip-x {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: none;
  background: transparent; color: var(--text-faint);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.pos-chip-x:hover { background: rgba(194, 117, 67, 0.18); color: var(--red); }

/* ============================================================
   Template list summary cards
   ============================================================ */
.tpl-summary {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.tpl-summary-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 60px;
}
.tpl-summary-day {
  font-family: var(--sans); font-weight: 700;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--text-dim); margin-bottom: 2px;
}
.tpl-summary-empty {
  color: var(--text-faint); font-size: 11px;
}
.tpl-summary-slot {
  font-family: var(--mono); font-size: 11px;
  background: var(--accent-glow); color: var(--accent);
  padding: 3px 6px; border-radius: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================
   Template editor row
   ============================================================ */
.tpl-slot-row {
  display: flex; gap: 6px; align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.tpl-slot-row:last-of-type { border-bottom: none; }
.tpl-slot-row select,
.tpl-slot-row input { padding: 6px 8px; font-size: 12px; }

/* ============================================================
   Tablet / mobile (≤ --bp-tablet = 800px): sidebar → slide-in drawer,
   single-column layout, form fields bumped to 16px so iOS Safari stops
   auto-zooming on focus, touch targets enlarged, page actions stacked.
   Also absorbs the former 900px rule (.rpt-split single-column).
   ============================================================ */
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }

  /* Hide the desktop-only "X modules loaded" footer, show the backdrop scrim. */
  .sidebar-backdrop { display: block; }

  /* Sidebar becomes a fixed drawer that slides in from the left. We anchor
     it just below the topbar so the topbar (hamburger included) stays
     accessible even while the drawer is open. */
  .sidebar {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top)); left: 0; bottom: 0;
    width: min(280px, 84vw);
    padding: 14px 12px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-105%);
    transition: transform 0.20s ease;
    z-index: 60;          /* above .sidebar-backdrop (45), under modals (100) */
    overflow-y: auto;
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.30);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-label { display: block; }   /* keep the "Workspace" header in drawer */
  .sidebar-foot { display: none; }
  .nav-item { font-size: 14px; padding: 11px 12px; }   /* taller tap targets */

  /* Content gets typical mobile padding + safe-area insets. */
  .content {
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    --pad-x: 16px;
  }

  /* Adjust sticky schedule header top offset for mobile (shorter top padding). */
  .sched-sticky-head {
    margin-top: -16px;
    padding-top: 12px;
    padding-bottom: 12px;
    /* margin/padding left/right now handled via --pad-x: 16px on .content */
  }

  /* Brand text gets crowded next to the hamburger + role pill — drop the
     "/ dashboard" tagline at small widths but keep the logo + name. */
  .brand-name .dim { display: none; }

  /* Topbar space is tight on mobile — hide the user's name from the role
     pill (keep the role badge) and hide "Sign out" text (keep the icon). */
  .user-chip { display: none; }
  .signout-label { display: none; }

  /* iOS Safari zooms into any focused input under 16px font-size. Bumping
     all form fields fixes that across the whole app in one rule. */
  input, select, textarea, .field input, .field select, .field textarea,
  .inv-search, .recipe-search { font-size: 16px; }

  /* Paired inputs (Invoice date + Invoice #, From + To, etc.) get squeezed
     to ~120px each on a 390px phone. Stack them. */
  .field-row { grid-template-columns: 1fr; }

  /* Action button rows — wrap into rows of 2 instead of stacking full-width.
     Each button self-sizes so a page with 2 buttons gets a natural row and
     a page with 5 buttons wraps to 2–3 rows rather than a tall column. */
  .page-head { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .page-actions { flex-wrap: wrap; gap: 8px; }
  .page-actions > .btn { flex: 1 1 calc(50% - 4px); min-width: min-content; justify-content: center; }

  /* Inventory chip filters — show toggle button, hide chips until open. */
  .inv-filter-toggle { display: flex; }
  .inv-chips-wrap { display: none; width: 100%; }
  .inv-chips-wrap.open { display: block; }

  /* Compact schedule grid column widths so today fits with less scrolling. */
  .sched-grid {
    grid-template-columns: 150px repeat(7, minmax(90px, 1fr));
    min-width: 780px;
  }

  /* Slightly chunkier touch targets on the small buttons that show up in
     inventory rows, recipe cards, etc. */
  .btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }

  /* Existing rules: keep schedule/template grids horizontally scrollable. */
  .shift { grid-template-columns: auto 1fr; }
  .shift-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .avail-week { grid-template-columns: repeat(7, minmax(60px, 1fr)); overflow-x: auto; }
  .avail-day { padding: 12px 6px; }
  .avail-day-date { font-size: 14px; }
  .tpl-summary { grid-template-columns: repeat(7, minmax(80px, 1fr)); overflow-x: auto; }
  .tpl-slot-row { flex-wrap: wrap; }
  /* Inventory — invoice line rows stack to single column on mobile so
     the 6-column desktop grid doesn't overflow. Item rows also collapse. */
  .inv-line-row { grid-template-columns: 1fr; row-gap: 4px; }
  .inv-lines-wrap { overflow-x: hidden; }
  .inv-line-head { display: none; }
  .inv-row { grid-template-columns: 1fr; }
  .inv-row-qty { text-align: left; }
  .inv-row-actions { justify-content: flex-start; }
  /* Sales report 2-column split collapses to single column on tablet/mobile
     (was a separate 900px block — absorbed here to keep breakpoints to two). */
  .rpt-split { grid-template-columns: 1fr; }
  /* Schedule grid shift cards need a minimum tap-target height on touch
     screens; the default 5px/8px padding makes them hard to press. */
  .sched-shift { min-height: 36px; padding: 6px 8px; }
}

/* ============================================================
   Phone (≤ --bp-phone = 480px): tighter polish — smaller KPIs, single-
   column report tables, compact inventory rows.
   ============================================================ */
@media (max-width: 480px) {
  .rpt-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  .rpt-kpi .stat-value { font-size: 20px; }
  /* The 5-column report row (rank/name/share/qty/revenue) doesn't fit on
     a phone — drop the rank chip and let columns flow narrower. */
  .rpt-row { grid-template-columns: 1.4fr 0.7fr 0.7fr 0.9fr !important; gap: 6px; font-size: 12px; padding: 8px 10px; }
  .rpt-row > div:first-child { display: none; }       /* rank column */
  .page-title { font-size: 20px; }

  /* Home tiles: at full desktop size each tile is ~140px tall, which on
     phone means scrolling to see 3rd / 4th tile. Compact the padding +
     icon + title so 3 fit comfortably on a normal phone height. */
  .home-tile-grid { grid-template-columns: 1fr; gap: 10px; }
  .home-tile { padding: 14px 16px 16px; gap: 4px; }
  .home-tile-icon { width: 36px; height: 36px; margin-bottom: 2px; }
  .home-tile-icon svg { width: 18px; height: 18px; }
  .home-tile-title { font-size: 16px; }
  .home-tile-desc { font-size: 13px; line-height: 1.35; }
  .home-tile-hint { font-size: 10px; margin-top: 2px; }
  /* Inventory item rows: on phone keep name + qty on the same line (1fr auto)
     with the action buttons spanning below — much denser than the 800px
     full single-column stack, and name/qty are more readable side-by-side.
     Overrides the 800px text-align:left on qty back to right-aligned. */
  .inv-row { grid-template-columns: 1fr auto; gap: 8px 10px; padding: 8px 10px; }
  .inv-row-qty { text-align: right; }
  .inv-row-actions { grid-column: 1 / -1; }
  .inv-cat-head { margin: 14px 0 6px; }
}

/* ============================================================
   Finance module — Accounts Payable
   ============================================================ */

.fin-summary-bar {
  display: flex;
  gap: 14px;
  margin: 16px 0 4px;
  flex-wrap: wrap;
}

.fin-summary-card {
  background: var(--surface);
  color: var(--surface-text, #f6e8d2);
  border-radius: var(--radius);
  padding: 14px 20px 12px;
  min-width: 140px;
  flex: 1;
}

.fin-summary-card.fin-card-danger .fin-summary-val {
  color: var(--red);
}

.fin-summary-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.fin-summary-lbl {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}

/* Payables table — CSS grid for alignment without a <table> */
.fin-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 12px;
}

.fin-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr 1fr 1.4fr;
  gap: 0 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

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

.fin-row-head {
  background: var(--surface);
  color: var(--surface-text, #f6e8d2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
}

.fin-row:not(.fin-row-head):hover { background: rgba(0,0,0,0.025); }

.fin-col-amt  { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fin-col-action { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

.fin-vendor-name { font-weight: 600; }

/* Due-date status badges */
.fin-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.fin-status-overdue { background: #fde8e0; color: #a83a1a; }
.fin-status-today   { background: #fff3cd; color: #7a5200; }
.fin-status-soon    { background: #fef3c7; color: #7a5200; }
.fin-status-ok      { background: #e6f4ea; color: #1a6b35; }
.fin-status-none    { background: #f0f0f0; color: #666; }

.fin-due-date {
  font-size: 13px;
  display: block;
  margin-bottom: 2px;
}

.fin-pay-method { font-size: 12px; opacity: 0.7; }
.fin-pay-ref    { font-size: 12px; font-family: monospace; opacity: 0.65; }

.fin-paid-toggle {
  margin-top: 28px;
  font-size: 14px;
}

.fin-undo-btn { opacity: 0.6; }
.fin-undo-btn:hover { opacity: 1; }

/* Finance responsive — collapse to fewer columns on tablet/mobile */
@media (max-width: 800px) {
  .fin-row {
    grid-template-columns: 1fr 1fr;
    row-gap: 4px;
  }
  .fin-row-head { display: none; }
  .fin-col-vendor  { grid-column: 1 / 2; }
  .fin-col-inv     { grid-column: 2 / 3; text-align: right; font-size: 12px; opacity: 0.7; }
  .fin-col-date    { font-size: 12px; opacity: 0.7; }
  .fin-col-due     { grid-column: 2 / 3; text-align: right; }
  .fin-col-amt     { font-size: 15px; }
  .fin-col-action  { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ============================================================
   Receipt line-item grid (simpler than invoice lines — no item mapping)
   ============================================================ */

.fin-receipt-lines {
  margin-top: 4px;
}

.fin-rline-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr auto;
  gap: 0 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

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

.fin-rline-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  opacity: 0.55;
  padding-bottom: 4px;
}

.fin-rline-cat {
  font-size: 13px;
  color: var(--text);
  opacity: 0.75;
}

/* Tag memory — highlight on GL selects that were pre-filled from
   learned history. A subtle green-tinted border + visible badge. */
.fin-memory-badge { font-size: 10px; padding: 2px 6px; vertical-align: middle; cursor: default; }
.fin-from-memory {
  border-color: #4a8c4f !important;
  background-color: rgba(74, 140, 79, 0.06) !important;
}

/* Banner shown when tag memory pre-tagged one or more lines. */
.fin-memory-banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(215, 219, 113, 0.08);
  border: 1px solid rgba(215, 219, 113, 0.25);
  font-size: 13px;
  color: var(--text);  /* cream inside the dark-green invoice card */
}

@media (max-width: 800px) {
  .fin-rline-row {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
  }
  .fin-rline-head { display: none; }
  .fin-rline-row > *:nth-child(2) { text-align: right; }
  .fin-rline-row > *:nth-child(3) { grid-column: 1 / -1; }
  .fin-rline-row > *:nth-child(4) { display: none; }
}

/* ============================================================
   Finance — Expenses
   ============================================================ */

.fin-month-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0 4px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #888);
  border-bottom: 1px solid var(--border, #e0d6c8);
  margin: 18px 0 4px;
}
.fin-month-total {
  font-weight: 700;
  font-size: 14px;
  color: var(--text, inherit);
}

/* Week divider used in the payables table */
.fin-week-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0 6px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #888);
  border-bottom: 1px solid var(--border, #e0d6c8);
  margin: 22px 0 0;
}
.fin-week-head:first-child { margin-top: 4px; }
.fin-week-total {
  font-weight: 700;
  font-size: 14px;
  color: var(--text, inherit);
  text-transform: none;
  letter-spacing: 0;
}

.fin-exp-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.fin-exp-row {
  display: grid;
  grid-template-columns: 90px 1fr 120px 140px 90px 32px;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border, #e0d6c8);
}
.fin-exp-row:hover { background: rgba(0,0,0,.03); }
.fin-exp-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #888);
  font-weight: 600;
  padding: 4px 6px;
}
.fin-exp-date   { font-size: 13px; color: var(--text-muted, #888); white-space: nowrap; }
.fin-exp-desc   { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.fin-exp-note   { font-size: 11px; color: var(--text-muted, #888); }
.fin-exp-vendor { font-size: 13px; color: var(--text-muted, #888); }
.fin-exp-amt    { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }

/* Category badge — tinted by type */
.fin-cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,0,0,.06);
  color: inherit;
}
.fin-cat-rent      { background: rgba(120,80,200,.12); color: #5a3a9a; }
.fin-cat-utilities { background: rgba(30,120,180,.12); color: #1a5a8a; }
.fin-cat-wages     { background: rgba(200,100,30,.12); color: #9a4a10; }
.fin-cat-insurance { background: rgba(30,160,100,.12); color: #0a6a40; }
.fin-cat-marketing { background: rgba(200,50,150,.12); color: #8a1060; }
.fin-cat-legal     { background: rgba(80,80,80,.12);   color: #404040; }
.fin-cat-repairs   { background: rgba(180,140,20,.12); color: #7a5a00; }
.fin-cat-licenses  { background: rgba(20,160,160,.12); color: #006060; }
.fin-cat-office    { background: rgba(80,140,220,.12); color: #2050a0; }
.fin-cat-other     { background: rgba(0,0,0,.08);      color: var(--text-muted, #666); }

/* Wave import preview table */
.fin-wave-table {
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--border, #e0d6c8);
  border-radius: 6px;
}
.fin-wave-row {
  display: grid;
  grid-template-columns: 120px 1fr 160px 100px 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border, #e0d6c8);
}
.fin-wave-row:last-child { border-bottom: none; }
.fin-wave-head {
  background: var(--surface-hover, #f0e8d6);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted, #888);
  position: sticky;
  top: 0;
  z-index: 1;
}
.form-input-sm {
  padding: 4px 7px;
  font-size: 13px;
  border: 1px solid var(--border, #d0c8b8);
  border-radius: 5px;
  background: var(--bg, #fff);
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 800px) {
  .fin-exp-row {
    grid-template-columns: 1fr auto;
    row-gap: 3px;
  }
  .fin-exp-head { display: none; }
  .fin-exp-date   { grid-column: 1 / -1; font-size: 11px; }
  .fin-exp-vendor { display: none; }
  .fin-wave-row {
    grid-template-columns: 90px 1fr 110px 80px 28px;
  }
}

/* ============================================================
   Finance — P&L report
   ============================================================ */

.fin-pnl-body {
  font-size: 14px;
  max-width: 680px;
}
.fin-pnl-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
}
.fin-pnl-section {
  margin: 18px 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted, #888);
  border-top: 1px solid var(--border, #e0d6c8);
  padding-top: 12px;
}
.fin-pnl-line,
.fin-pnl-subtotal {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
}
.fin-pnl-subtotal {
  border-top: 1px solid var(--border, #e0d6c8);
  font-weight: 600;
  margin-top: 4px;
  padding-top: 6px;
}
.fin-pnl-gross,
.fin-pnl-net {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  margin-top: 6px;
  font-weight: 700;
  font-size: 16px;
  border-top: 2px solid var(--text, currentColor);
  border-bottom: 2px solid var(--text, currentColor);
  font-variant-numeric: tabular-nums;
}
.fin-pnl-negative { color: #b03030; }
.fin-card-danger .fin-summary-val { color: #b03030; }

/* ============================================================
   Finance — bank reconciliation
   ============================================================ */

.fin-recon-acct-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.fin-acct-chip { border-radius: 20px; }
.fin-acct-chip.active {
  background: var(--surface, #1c441f);
  color: var(--accent, #d7db71);
  border-color: transparent;
}
.fin-recon-all-matched {
  padding: 16px;
  border-radius: 8px;
  background: rgba(74,140,79,.1);
  border: 1px solid rgba(74,140,79,.3);
  color: #2d6b32;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
}

/* Transaction table */
.fin-txn-table { display: flex; flex-direction: column; margin-bottom: 12px; }
.fin-txn-row {
  display: grid;
  grid-template-columns: 90px 1fr 90px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border, #e0d6c8);
}
.fin-txn-row:hover { background: rgba(0,0,0,.03); }
.fin-txn-head {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted, #888);
  padding: 4px 6px;
}
.fin-txn-desc    { font-size: 14px; }
.fin-txn-actions { flex-wrap: wrap; }
.fin-match-label  { font-size: 12px; font-weight: 600; color: #2d6b32; }
.fin-ignore-label { font-size: 12px; color: var(--text-muted, #888); }

/* Match modal list */
.fin-match-list { display: flex; flex-direction: column; gap: 2px; }
.fin-match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
}
.fin-match-item:hover { background: rgba(0,0,0,.04); }
.fin-match-item.selected {
  border-color: var(--surface, #1c441f);
  background: rgba(28,68,31,.06);
}

@media (max-width: 800px) {
  .fin-txn-row {
    grid-template-columns: 80px 1fr auto;
    row-gap: 4px;
  }
  .fin-txn-head { display: none; }
  .fin-txn-actions { grid-column: 1 / -1; }
}

/* ============================================================
   Finance — recurring expense templates
   ============================================================ */

.fin-rec-table { display: flex; flex-direction: column; }

.fin-rec-row {
  display: grid;
  grid-template-columns: 1fr 140px 90px 110px 90px 130px;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border, #e0d6c8);
}
.fin-rec-row:hover { background: rgba(0,0,0,.03); }
.fin-rec-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #888);
  padding: 4px 6px;
}
.fin-rec-inactive { opacity: .5; }
.fin-rec-desc { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.fin-rec-day  { font-size: 13px; color: var(--text-muted, #888); }

.fin-rec-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.fin-rec-posted   { background: rgba(74,140,79,.15); color: #2d6b32; }
.fin-rec-due      { background: rgba(180,60,20,.12);  color: #8a2a00; }
.fin-rec-upcoming { background: rgba(0,0,0,.07);      color: var(--text-muted, #666); }
.fin-rec-paused   { background: rgba(0,0,0,.07);      color: var(--text-muted, #666); }

/* Source badges on expense rows */
.fin-source-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
}
.fin-source-recurring { background: rgba(74,140,79,.12); color: #2d6b32; }
.fin-source-wave      { background: rgba(60,100,200,.12); color: #1a3a80; }

@media (max-width: 800px) {
  .fin-rec-row {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
  }
  .fin-rec-head { display: none; }
  .fin-rec-day  { display: none; }
}

/* ============================================================
   Finance — batch GL categorize banner + modal table
   ============================================================ */

.fin-batch-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 7px;
  background: rgba(180, 120, 20, 0.1);
  border: 1px solid rgba(180, 120, 20, 0.35);
  font-size: 13px;
  flex-wrap: wrap;
}
.fin-batch-banner-text { flex: 1; }

.fin-batch-table {
  display: flex;
  flex-direction: column;
}
.fin-batch-row {
  display: grid;
  grid-template-columns: 1fr 130px 160px;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border, #e0d6c8);
}
.fin-batch-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted, #888);
  padding: 4px;
  position: sticky;
  top: 0;
  background: var(--bg, #fff);
  z-index: 1;
}
.fin-batch-desc   { font-size: 13px; }
.fin-batch-vendor { font-size: 12px; color: var(--text-muted, #888); }

/* ============================================================
   Print styles — /finance/pnl "Print / PDF" button
   Hides everything except the P&L and Schedule C cards.
   ============================================================ */
@media print {
  /* Hide nav, sidebar, header buttons, export buttons, and date picker */
  nav, aside, .sidebar, .topbar, .page-head, .fin-summary-bar,
  .fin-print-btn, .btn, .card:not(.fin-print-card),
  .field-row, .page-sub { display: none !important; }

  /* Show only the report cards */
  .fin-print-card { display: block !important; }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    margin-bottom: 24pt;
    page-break-inside: avoid;
  }
  .fin-pnl-body {
    max-width: 100% !important;
  }
  .fin-pnl-title {
    font-size: 14pt;
  }
  .fin-pnl-gross,
  .fin-pnl-net {
    font-size: 13pt;
  }
  /* Force page break before Schedule C */
  .card + .card { page-break-before: always; }
}

/* ---- Sales Tax Report ---- */
.fin-tax-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.fin-tax-biz   { font-size: 1.1rem; font-weight: 600; color: var(--text-dim); }
.fin-tax-title { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 4px 0; }
.fin-tax-period { font-size: 0.9rem; color: var(--text-dim); }

.fin-tax-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 640px) {
  .fin-tax-summary-row { grid-template-columns: repeat(2, 1fr); }
}
.fin-tax-summary-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}
.fin-tax-summary-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.fin-tax-summary-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.fin-tax-co-note {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.83rem;
  color: #78350f;
  line-height: 1.5;
}

.fin-tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.fin-tax-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
}
.fin-tax-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.fin-tax-row td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.fin-tax-row:hover td { background: var(--surface-2); }
.fin-tax-highlight { color: var(--accent) !important; font-weight: 600; }
.fin-tax-total-row td {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  border-top: 2px solid var(--border);
  background: var(--surface-2);
}

@media print {
  .fin-tax-co-note { border-color: #999; background: #fff9e6; }
  .fin-tax-summary-box { background: #f8f8f8; border-color: #ccc; }
  .fin-tax-highlight { color: #1a56db !important; }
}

/* ---- Tip Pool Calculator ---- */
.tip-job-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tip-job-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.tip-job-row:hover { background: var(--surface-2); }
.tip-job-row.on-bar {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.tip-job-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.tip-job-label { font-size: 0.9rem; cursor: pointer; flex: 1; }

.tip-calc-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.tip-calc-title  { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.tip-calc-period { font-size: 0.85rem; color: var(--text-dim); margin-top: 2px; }

.tip-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 500px) {
  .tip-summary-row { grid-template-columns: 1fr 1fr; }
}
.tip-summary-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}
.tip-summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}
.tip-summary-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.tip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.tip-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
}
.tip-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.tip-row td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.tip-row:hover td { background: var(--surface-2); }
.tip-highlight { color: var(--accent) !important; font-weight: 600; }
.tip-total-row td {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  border-top: 2px solid var(--border);
  background: var(--surface-2);
}

@media print {
  .tip-print-btn, .btn, .card:not(.tip-print-card),
  .field-row, .page-sub { display: none !important; }
  .tip-print-card { display: block !important; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ---- Tip pool: collapsible job section ---- */
.tip-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.tip-toggle-arrow {
  font-size: 0.7rem;
  color: var(--text-dim);
  width: 14px;
  display: inline-block;
}
.tip-section-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: 4px;
}
.tip-summary-highlight {
  border-color: var(--accent) !important;
  background: color-mix(in srgb, var(--accent) 8%, transparent) !important;
}
.tip-summary-highlight .tip-summary-value { color: var(--accent); }

.tip-hours-wrap { display: inline-flex; align-items: center; gap: 4px; }
.tip-hours-value { cursor: pointer; border-bottom: 1px dashed var(--text-dim); }
.tip-hours-value:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tip-hours-override .tip-hours-value { color: var(--accent); border-bottom-style: solid; }
.tip-override-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 0.8rem; padding: 0 2px; line-height: 1;
}
.tip-override-clear:hover { color: var(--text); }
.tip-hours-input { width: 80px; padding: 2px 6px; font-size: 0.9rem; text-align: right; }
