/* TYPE SCALE: 12px (labels, captions, small buttons) / 14px (body) / 16px (inputs, titles) / 20px (page title)
   + 10px for micro labels (uppercase captions)
   / 28px (logo) / 48px (balance number). No other font sizes.
   SPACING RULE: all paddings, margins and gaps sit on a 4px grid (prefer 8px steps: 8/16/24/32).
   Tailwind: p-1/2/3/4/6/8, gap-1/2/3/4... never the half steps (0.5, 1.5, 2.5, 3.5). */
html { background: #f8fafc; }
html.dark { background: #0F172A; }
html, body { scrollbar-gutter: stable; overscroll-behavior-y: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

body { -webkit-font-smoothing: antialiased; }

/* SOFT CARD SYSTEM — borderless, subtle layered shadow (Jiron-style) */
.soft-card {
  border: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.10);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.dark .soft-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.20), 0 8px 24px -12px rgba(0, 0, 0, 0.45);
}
.soft-card.interactive:hover {
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 12px 28px -12px rgba(15, 23, 42, 0.14);
}
.dark .soft-card.interactive:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 28px -12px rgba(0, 0, 0, 0.55);
}

/* HEADER — Apple-style translucent glass blur, sticky over scrolling content */
.app-header {
  position: relative;
}
.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  bottom: -24px;
  background: rgba(248, 250, 252, 0.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 24px), transparent 100%);
  pointer-events: none;
  z-index: -1;
}
.dark .app-header::before {
  background: rgba(15, 23, 42, 0.72);
}

/* SIDEBAR SHADOW — borderless full-height panel, shadow cast to the right only
   (still used by the mobile slide-in sidebar, which stays edge-to-edge) */
.soft-sidebar {
  border: none;
  box-shadow: 1px 0 1px rgba(15, 23, 42, 0.02), 6px 0 16px -10px rgba(15, 23, 42, 0.07);
}
.dark .soft-sidebar {
  box-shadow: 1px 0 1px rgba(0, 0, 0, 0.10), 6px 0 16px -10px rgba(0, 0, 0, 0.28);
}

/* FLOATING SIDEBAR (Desktop) — a rounded card sitting off the edges with a
   shadow all the way around, rather than flush against the viewport edge. */
.soft-sidebar-floating {
  border: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 28px -10px rgba(15, 23, 42, 0.12);
}
.dark .soft-sidebar-floating {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15), 0 12px 28px -10px rgba(0, 0, 0, 0.45);
}

.input-editor {
  width: 100%; padding: 0.5rem; font-size: 16px;
  background-color: transparent; color: inherit;
  border: 1px solid #e2e8f0; border-radius: 6px; outline: none; text-align: center;
  transition: all 0.2s ease; font-weight: 600; font-family: 'JetBrains Mono', monospace;
}
.dark .input-editor { border-color: #334155; }
.input-editor:focus { border-color: #3b82f6; background-color: #eff6ff; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08); color: #1e40af; }
.dark .input-editor:focus { background-color: rgba(59, 130, 246, 0.08); border-color: #3b82f6; color: #60a5fa; }
.input-editor:disabled { opacity: 0.4; cursor: not-allowed; background-color: #f8fafc; }
.dark .input-editor:disabled { background-color: rgba(255,255,255,0.02); }

select.input-editor {
    appearance: none; font-family: 'Inter', sans-serif !important; font-size: 0.875rem !important; font-weight: 500 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem;
    padding-right: 2rem !important;
}
.dark select.input-editor {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}
.dark select option { background-color: #1E293B; color: #f1f5f9; }

.table-input {
  width: 100%; max-width: 100px; padding: 0.25rem 0.5rem; font-size: 14px;
  background-color: transparent; color: inherit;
  border: 1px solid transparent; border-radius: 6px; outline: none; text-align: center;
  transition: all 0.2s ease; font-weight: 600; font-family: 'JetBrains Mono', monospace;
}
.table-input:hover { border-color: #e2e8f0; background-color: #f8fafc; }
.dark .table-input:hover { border-color: #334155; background-color: rgba(255,255,255,0.02); }
.table-input:focus { border-color: #3b82f6; background-color: #eff6ff; color: #1e40af; }
.dark .table-input:focus { border-color: #3b82f6; background-color: rgba(59, 130, 246, 0.1); color: #60a5fa; }

.table-responsive { scrollbar-width: none; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive::-webkit-scrollbar { display: none; }

table { width: 100%; border-collapse: collapse; min-width: 350px; }
th { padding: 0.75rem 1rem; font-size: 12px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid #f1f5f9; text-align: center; white-space: nowrap; }
.dark th { color: #64748b; border-bottom-color: rgba(255,255,255,0.04); }
td { padding: 0.5rem 1rem; text-align: center; border-bottom: 1px solid #f8fafc; transition: background 0.2s; height: 48px; }
.dark td { border-bottom-color: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.dark tr:hover td { background: rgba(255,255,255,0.02); }

.today-row td { background: rgba(59, 130, 246, 0.06) !important; }
.dark .today-row td { background: rgba(59, 130, 246, 0.08) !important; }
.today-row td:first-child { box-shadow: inset 3px 0 0 0 #3b82f6; }

.today-log-row { background: rgba(59, 130, 246, 0.06); border-radius: 0.5rem; margin: 0 -0.5rem; padding-left: 0.5rem; padding-right: 0.5rem; }
.dark .today-log-row { background: rgba(59, 130, 246, 0.08); }


/* PAGE ROUTER: dashboard / settings / notes */
.app-page { display: none; }
.app-page.active { display: block; }


.nav-link {
  position: relative;
}
.nav-link.active {
  background-color: transparent;
  color: #0f172a;
  font-weight: 700;
}
.dark .nav-link.active {
  color: #f8fafc;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: calc(-1rem + 2px);
  top: 0;
  width: 3px;
  height: 100%;
  border-radius: 9999px;
  background-color: #3b82f6;
}

/* HOLIDAY PLANNER — flip card (list front / calendar back).
   Both faces are absolutely stacked at full size, so the wrapper's own
   height/background/rounded corners are what the user actually sees —
   this is what keeps the card a clean, fully-opaque white rectangle in
   both states instead of the page background peeking through underneath
   whichever face is taller. */
.hp-flip-card {
  position: relative;
  perspective: 1600px;
  /* Height comes from the front face's own normal-flow content (see
     .hp-flip-front below), exactly like the plain Worked Saturdays card —
     so this card competes on equal footing for the CSS Grid row's
     implicit/stretched height, and the row is still sized by whichever
     sibling's real content is tallest.
     min-height is set to fit the LONGEST possible calendar back face (a
     6-week month): p-6 padding (24px*2=48) + header/nav row (~28px) +
     gap-4 (16px) + weekday row (~20px) + 6 day-rows * 30px (180) + 5 *
     4px row-gap (20) = ~312px, rounded up with a small safety margin.
     This guarantees the back face never gets clipped even when the
     front-content siblings are all shorter than a full month view. */
  min-height: 340px;
  background: #fff;
  border-radius: 1.75rem;
  overflow: hidden;
}
.dark .hp-flip-card {
  background: #1e293b;
}
.hp-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}
.hp-flip-card.is-flipped .hp-flip-inner {
  transform: rotateY(180deg);
}
.hp-flip-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* Front face stays in normal document flow (so its real content height
   still contributes to sizing .hp-flip-card / the grid row, exactly like
   every other plain, non-flip card) but ALSO stretches to fill 100% of
   whatever height the grid stretch ends up giving .hp-flip-inner — via
   min-height, not height, so it can still grow past that if its own
   content is taller. This is what makes the back face (which is
   absolutely positioned at inset:0 relative to .hp-flip-inner, and so
   only ever gets .hp-flip-inner's actual box height) always have the
   FULL stretched card height available, instead of being capped at
   whatever the front's own un-stretched content happened to need. */
.hp-flip-front {
  position: relative;
  width: 100%;
  min-height: 100%;
}
/* Back face is the one absolutely stacked on top, since it's only ever
   shown after the flip and must not add to the resting-state height.
   No overflow/scroll here: the calendar's own cell height is kept small
   enough (see .hp-calendar-day) that a full 6-week month always fits
   within the card's front-content-driven height, so a scrollbar should
   never actually be needed — and we'd rather clip an odd extra pixel
   than show a scrollbar on a view that looks fully visible. */
.hp-flip-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transform: rotateY(180deg);
}

.hp-holiday-row {
  cursor: pointer;
}
@media (hover: hover) {
  .hp-holiday-row:hover { background-color: rgba(59, 130, 246, 0.06); }
  .dark .hp-holiday-row:hover { background-color: rgba(59, 130, 246, 0.1); }
}
.hp-holiday-row { -webkit-tap-highlight-color: transparent; transition: background-color .4s ease, box-shadow .4s ease; }
.hp-holiday-row:active { background-color: rgba(59, 130, 246, 0.14); }
/* the tip you tapped keeps its tint + ring, also after returning from the calendar view */
.hp-holiday-row.vp-row-selected { background-color: rgba(59, 130, 246, 0.12) !important; box-shadow: inset 0 0 0 1.5px #3b82f6; }
.dark .hp-holiday-row.vp-row-selected { background-color: rgba(59, 130, 246, 0.2) !important; }

/* Calendar grid (7 columns, month view). No row/column gap so the
   range-highlight track behind consecutive days reads as one continuous
   pill instead of a row of separate rounded chips. */
.hp-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
}
.hp-calendar-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  padding-bottom: 8px;
}
.dark .hp-calendar-dow { color: #64748b; }

.hp-calendar-day {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
}
.dark .hp-calendar-day { color: #e2e8f0; }
.hp-calendar-day.hp-day-empty { visibility: hidden; }

/* Pill-shaped range highlight behind the taken/off days: each in-range cell
   paints a full-bleed (edge-to-edge, no side inset) rectangle so adjacent
   days touch seamlessly; only the first/last cell of the range rounds its
   outer edge, so the whole run reads as one continuous rounded track. */
.hp-calendar-day.hp-day-in-range::before {
  content: '';
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 0;
  right: 0;
  background: rgba(59, 130, 246, 0.12);
  z-index: 0;
}
.dark .hp-calendar-day.hp-day-in-range::before {
  background: rgba(59, 130, 246, 0.18);
}
.hp-calendar-day.hp-range-start::before { border-radius: 9999px 0 0 9999px; left: 10%; }
.hp-calendar-day.hp-range-end::before { border-radius: 0 9999px 9999px 0; right: 10%; }
.hp-calendar-day.hp-range-start.hp-range-end::before { border-radius: 9999px; left: 10%; right: 10%; }

.hp-calendar-day span {
  position: relative;
  z-index: 1;
}

.hp-calendar-day.hp-day-bridge span {
  background: #3b82f6;
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hp-calendar-day.hp-day-already-off span {
  background: rgba(59, 130, 246, 0.35);
  color: #1e3a8a;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dark .hp-calendar-day.hp-day-already-off span {
  color: #dbeafe;
}
.hp-calendar-day.hp-day-today span {
  box-shadow: inset 0 0 0 1.5px #3b82f6;
  width: 26px;
  height: 26px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hp-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  display: inline-block;
}
.hp-legend-bridge { background: #3b82f6; }
.hp-legend-off { background: rgba(59, 130, 246, 0.35); }


/* VACATION BALANCE DONUT */
.vacation-donut {
  position: relative;
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
}
.vacation-donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.vacation-donut-track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 12;
}
.dark .vacation-donut-track { stroke: #334155; }
.vacation-donut-fill {
  fill: none;
  stroke: #3b82f6;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.vacation-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}


/* ---- vacation-planner additions ---- */
.hp-calendar-day.hp-day-school::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 9999px;
  background: #94a3b8;
  z-index: 1;
}
.hp-legend-school { background: #94a3b8; }

.vp-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  font-weight: 500;
  background-color: transparent;
  color: inherit;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dark .vp-input { border-color: #334155; color-scheme: dark; }
.vp-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08); }

.vp-icon-btn {
  padding: 0.5rem;
  border-radius: 0.5rem;
  color: #94a3b8;
  transition: color 0.2s ease, background-color 0.2s ease;
}
/* hover only where a real pointer exists, so a tap on touch screens doesn't leave a "stuck" state */
@media (hover: hover) {
  .vp-icon-btn:hover { color: #3b82f6; background-color: rgba(59, 130, 246, 0.08); }
  .vp-icon-btn.danger:hover { color: #ec4899; background-color: rgba(236, 72, 153, 0.08); }
}
.vp-icon-btn:active { color: #3b82f6; background-color: rgba(59, 130, 246, 0.08); }
.vp-icon-btn.danger:active { color: #ec4899; background-color: rgba(236, 72, 153, 0.08); }
.vp-icon-btn { -webkit-tap-highlight-color: transparent; }

/* ---------- QoL: toast, next-off pill, form hints, import rows ---------- */
.vp-toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateY(16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; border-radius: 12px;
  background: #0f172a; color: #f1f5f9; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.5);
  transition: opacity .2s ease, transform .2s ease; z-index: 60;
}
.vp-toast.show { opacity: 1; transform: none; pointer-events: auto; }
@media (min-width: 640px) {
  .vp-toast { left: 50%; right: auto; width: max-content; max-width: 420px; transform: translate(-50%, 16px); }
  .vp-toast.show { transform: translate(-50%, 0); }
}
.vp-toast button { color: #93c5fd; font-weight: 700; font-size: 14px; flex: none; padding: 8px; margin: -8px; }
.dark .vp-toast { background: #e2e8f0; color: #0f172a; }
.dark .vp-toast button { color: #2563eb; }

.vp-next-off {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: #1d4ed8; background: #eff6ff; text-align: center;
}
.dark .vp-next-off { color: #93c5fd; background: rgba(59, 130, 246, 0.12); }

.vp-hint { font-size: 12px; line-height: 1.4; color: #94a3b8; }
.vp-hint.warn { color: #d97706; }
.dark .vp-hint.warn { color: #fbbf24; }

.vp-edit-ring { box-shadow: inset 0 0 0 1.5px #3b82f6; }

.vp-book-btn {
  padding: 4px 8px; border-radius: 8px; font-size: 12px; font-weight: 700;
  color: #fff; background: #3b82f6; transition: background .15s;
}
.vp-book-btn:hover { background: #2563eb; }

.vp-import-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 8px 12px; border-radius: 8px; background: #f8fafc;
}
.dark .vp-import-row { background: rgba(51, 65, 85, 0.4); }
.vp-import-row select {
  font-size: 12px; padding: 4px; border-radius: 8px; background: transparent;
  border: 1px solid #e2e8f0; color: inherit;
}
.dark .vp-import-row select { border-color: #334155; background: #0f172a; }

/* ---------- brand ---------- */
.brand-word {
  font-family: 'Nunito', 'Inter', sans-serif; font-weight: 800;
  font-size: 24px; line-height: 1; letter-spacing: 0.06em;
}

/* ---------- mobile UX: touch targets, no overflow, iOS-friendly inputs ---------- */
/* date inputs have an intrinsic width on iOS Safari and push out of grid cells */
.vp-input[type="date"] {
  -webkit-appearance: none; appearance: none;
  display: block; min-width: 0; max-width: 100%; width: 100%;
  text-align: left;
}
.vp-input[type="date"]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
#vacation-form .grid > *, #break-form .grid > *, #vacation-form .flex > .vp-input { min-width: 0; }

@media (max-width: 1023px) {
  /* the min-height only exists so a flipped calendar fits; don't reserve it when showing the list */
  .hp-flip-card { min-height: 0; }
  /* flipped: the calendar (back) drives the height, the long tips list (front) leaves the flow */
  .hp-flip-card.is-flipped .hp-flip-front { position: absolute; inset: 0; height: 100%; min-height: 0; overflow: hidden; }
  .hp-flip-card.is-flipped .hp-flip-back { position: relative; inset: auto; height: auto; overflow: visible; }
}

@media (max-width: 639px) {
  /* 16px stops iOS from zooming the page on focus */
  .vp-input { font-size: 16px; min-height: 44px; padding: 0.5rem 0.75rem; }
  .vp-icon-btn {
    display: inline-grid; place-items: center;
    min-width: 40px; min-height: 40px; padding: 0;
  }
    #vac-submit, #vac-cancel, #break-form button[type="submit"],
  #ics-export-btn, #cal-import-btn, #export-btn, #import-btn, #install-btn,
  #import-confirm, #import-cancel {
    min-height: 44px; padding-left: 1rem; padding-right: 1rem;
  }
  .vp-book-btn { min-height: 36px; padding: 0 16px; font-size: 12px; }
  .theme-btn { min-height: 44px; }
  .vp-import-row { padding: 12px 16px; }
  .vp-import-row select { font-size: 12px; min-height: 36px; }
  .vp-import-row input[type="checkbox"], #ics-include-school { width: 20px; height: 20px; }
  #import-all, #import-none { min-height: 36px; padding: 0 12px; }
  .hp-holiday-row { min-height: 52px; }
  .vp-toast button { min-height: 36px; padding: 0 8px; }
}

.settings-btn { color: #64748b; background: #fff; border-radius: 0.75rem; box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px rgba(15,23,42,.10); }
.dark .settings-btn { color: #cbd5e1; background: #1E293B; }
@media (hover: hover) { .settings-btn:hover { color: #3b82f6; } }
.settings-btn:active { color: #3b82f6; }

/* ---------- UX simplification: segmented buttons, outline buttons, details, sheet, FAB ---------- */
.seg-btn {
  min-height: 44px; padding: 0.5rem; border-radius: 0.75rem;
  border: 1px solid #e2e8f0; background: #fff; color: #475569;
  font-size: 0.875rem; font-weight: 500; transition: all .15s ease;
}
.dark .seg-btn { border-color: #334155; background: #1E293B; color: #cbd5e1; }
.seg-btn.active { border-color: #3b82f6; color: #2563eb; background: #eff6ff; }
.dark .seg-btn.active { color: #60a5fa; background: rgba(59, 130, 246, 0.1); }

.btn-outline {
  min-height: 44px; padding: 0.5rem 1rem; border-radius: 0.5rem;
  border: 1px solid #e2e8f0; font-size: 0.75rem; font-weight: 600; color: inherit;
  transition: background-color .15s ease;
}
.btn-outline:hover { background: #f8fafc; }
.dark .btn-outline { border-color: #334155; }
.dark .btn-outline:hover { background: #1e293b; }

.vp-details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-height: 44px; }
.vp-details > summary::-webkit-details-marker { display: none; }
#break-add > summary { font-size: 12px; font-weight: 600; color: #3b82f6; }

.vp-break-row {
  display: flex; flex-direction: column; gap: 12px;
  padding: 12px; border-radius: 16px; background: #f8fafc;
}
.dark .vp-break-row { background: rgba(51, 65, 85, 0.4); }

/* bottom sheet */
.vp-sheet { position: fixed; inset: 0; z-index: 50; visibility: hidden; pointer-events: none; }
.vp-sheet.open { visibility: visible; pointer-events: auto; }
.vp-sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); opacity: 0; transition: opacity .2s ease; }
.vp-sheet.open .vp-sheet-backdrop { opacity: 1; }
.vp-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 94dvh; overflow-y: auto;
  background: #fff; color: #0f172a; border-radius: 1.75rem 1.75rem 0 0;
  padding: 16px 24px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
  transform: translateY(100%); transition: transform .25s ease;
}
.dark .vp-sheet-panel { background: #1E293B; color: #f1f5f9; }
.vp-sheet.open .vp-sheet-panel { transform: none; }
.vp-sheet-handle { width: 36px; height: 4px; border-radius: 9999px; background: #cbd5e1; align-self: center; flex-shrink: 0; position: relative; }
.vp-sheet-handle::after { content: ''; position: absolute; inset: -12px -32px; }
@media (min-width: 640px) {
  .vp-sheet-panel { left: 50%; right: auto; bottom: auto; top: 50%; width: 420px; border-radius: 1.75rem; padding-bottom: 16px; opacity: 0; transform: translate(-50%, -46%); transition: transform .2s ease, opacity .2s ease; }
  .vp-sheet.open .vp-sheet-panel { opacity: 1; transform: translate(-50%, -50%); }
  .vp-sheet-handle { display: none; }
}

/* tap-to-pick calendar inside the sheet */
.vp-pick-grid .hp-calendar-day {
  height: 44px; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.vp-pick-grid .hp-calendar-day.hp-day-empty { cursor: default; }
.vp-pick-grid .hp-calendar-day span { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 9999px; }
.vp-pick-grid .hp-calendar-day.hp-day-bridge span,
.vp-pick-grid .hp-calendar-day.hp-day-already-off span,
.vp-pick-grid .hp-calendar-day.hp-day-today span { width: 36px; height: 36px; }
.vp-pick-grid .hp-calendar-day.hp-day-nonwork:not(.hp-day-bridge) span { color: #94a3b8; }
.dark .vp-pick-grid .hp-calendar-day.hp-day-nonwork:not(.hp-day-bridge) span { color: #64748b; }

/* floating "add days off" button */
.vp-fab {
  position: fixed; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 40;
  min-width: 56px; height: 56px; padding: 0 16px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #3b82f6; color: #fff; box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.55);
  transition: background-color .15s ease, transform .15s ease;
}
.vp-fab:hover { background: #2563eb; }
.vp-fab:active { transform: scale(0.96); }
.vp-fab.vp-fab-hidden { display: none; }
.vp-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- year bar (below the header) ---------- */
.app-yearbar {
  position: sticky; top: var(--hdr-h, 64px); z-index: 35;
  padding-top: 4px;
  transition: transform .25s ease, opacity .25s ease;
}
/* same glass + fade-out below as the header */
.app-yearbar::before {
  content: ''; position: absolute; inset: 0; bottom: -24px; z-index: -1; pointer-events: none;
  background: rgba(248, 250, 252, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 24px), transparent 100%);
}
.dark .app-yearbar::before { background: rgba(15, 23, 42, 0.72); }
.app-yearbar.bar-hidden { transform: translateY(-110%); opacity: 0; pointer-events: none; }
.app-yearbar.hidden { display: none; }
@media (min-width: 640px) {
  .app-yearbar { position: static; }
  .app-yearbar::before { display: none; }
  .app-yearbar.bar-hidden { transform: none; opacity: 1; pointer-events: auto; }
}

/* no double-tap zoom; pinch zoom still works for accessibility */
*, *::before, *::after { touch-action: manipulation; }

/* bottom safe zone: room for the + button (56px + 16px gap) plus the home-indicator inset */
.vp-main { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) { .vp-main { padding-bottom: 40px; } }

/* Top edge: the first 40% is a solid page-colour fill (iOS Safari tints the status bar from it),
   the remaining 60% fades into a blur, so scrolling content is never cut off sharply there. */
#top-fill {
  position: fixed; top: 0; left: 0; right: 0; height: calc(env(safe-area-inset-top) + 32px);
  background: rgba(248, 250, 252, 1); z-index: 20; pointer-events: none;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 100%);
}
.dark #top-fill { background: rgba(15, 23, 42, 1); }
.app-header { padding-top: calc(env(safe-area-inset-top) + 16px) !important; }

html, body { min-height: 100vh; min-height: 100dvh; }

/* days-off export popover: fade + slight scale from the button corner */
#off-export-menu { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-4px) scale(0.96); transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s; }
#off-export-menu.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) { #off-export-menu, #off-export-menu.open { transition: none; } }

/* custom checkbox that matches the design (settings) */
.vp-check {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 24px; height: 24px; border-radius: 8px; margin: 0;
  border: 2px solid #cbd5e1; background: #fff center / 14px no-repeat;
  transition: background-color .15s ease, border-color .15s ease;
}
.dark .vp-check { border-color: #475569; background-color: #1e293b; }
.vp-check:checked {
  border-color: #3b82f6; background-color: #3b82f6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.vp-check:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
