/* Rithma Care - Stylesheet */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #14b8a6;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0ea5e9;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: opacity 160ms ease-out;
}
body.page-leaving {
  opacity: 0;
  /* No ``pointer-events: none`` here. Safari (and other WebKit builds) re-check
     pointer-events on the click target *during* link activation, and setting
     it to ``none`` on <body> mid-click silently cancels the navigation the
     same click was about to perform — e.g. "Sign out" or auth-page switches
     looking like they "do nothing". The fade is purely a visual cue; the
     browser already serializes click-driven navigations. */
}
@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  body.page-leaving { opacity: 1; }
  .main.page-swapping,
  .main.main--swap-loading::before {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .rithma-toast {
    transition: none !important;
  }
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
html, body {
  /* Pin html and body strictly to the visible viewport. ``position: fixed``
     on html anchors the document so content can't bleed past the right
     edge — the standard fix for stubborn iOS WebView side-scroll where
     ``overflow-x: hidden`` alone isn't enough. */
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  /* Vertical pan only — kills any horizontal swipe gesture at the page level. */
  touch-action: pan-y;
}
html {
  height: 100%;
  position: relative;
}
body {
  /* Body fills html and may extend below the fold for vertical scrolling. */
  min-height: 100%;
}
/* Lock body scroll only on logged-in pages (which contain `.layout`).
   Auth pages have no `.layout`, so they keep their natural scroll. */
body:has(.layout) { overflow: hidden; }
.layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
}
.sidebar {
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  /* Use safe-area insets so the sidebar respects iPhone notches / Android cutouts
     when packaged with Capacitor; harmless on the web because env() defaults to 0. */
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  overflow-y: auto;
}
.sidebar .brand {
  font-weight: 700;
  font-size: 1.3em;
  color: var(--primary);
  margin-bottom: 6px;
}
.sidebar .role-badge {
  font-size: 0.75em;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-agency-name {
  display: block;
  max-width: 100%;
  margin: 0 0 20px;
  color: var(--text);
  font-size: 0.9em;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.sidebar nav a {
  display: block;
  padding: 9px 12px;
  margin-bottom: 2px;
  color: var(--text);
  border-radius: 6px;
  font-size: 0.95em;
}
.sidebar nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar nav a.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.sidebar .logout {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9em;
  color: var(--muted);
  text-align: center;
}
.sidebar .device-local-time {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  font-size: 0.88em;
  margin-bottom: 10px;
}
.main {
  flex: 1;
  min-width: 0; /* lets flex children clamp to the available width */
  padding: 30px 40px;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: max(30px, env(safe-area-inset-top));
  padding-right: max(40px, env(safe-area-inset-right));
  padding-bottom: max(30px, env(safe-area-inset-bottom));
}
.main.page-swapping {
  pointer-events: none;
  will-change: opacity, transform;
}
.main.main--swap-loading {
  position: relative;
}
.main.main--swap-loading::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10002;
  pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform-origin: left center;
  animation: rithma-swap-loading-bar 1s ease-in-out infinite;
  box-shadow: 0 1px 6px rgba(37, 99, 235, 0.35);
}
@keyframes rithma-swap-loading-bar {
  0% { transform: scaleX(0.12); opacity: 0.65; }
  45% { transform: scaleX(0.55); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0.55; }
}

/* Safety net: keep any long content (URLs, images, code, embeds) inside the
   page boundary so a single oversized element can't make the layout shift. */
.main img,
.main video,
.main iframe,
.main canvas,
.main svg { max-width: 100%; height: auto; }
.main pre,
.main code { max-width: 100%; overflow-x: auto; word-break: break-word; }
.main p,
.main li,
.main h1,
.main h2,
.main h3,
.main h4 { overflow-wrap: anywhere; }
.main .card { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }

/* Mobile drawer trigger + scrim — hidden by default, shown only at narrow widths.
   The same markup used by the desktop layout becomes a slide-out drawer below
   the tablet breakpoint without changing per-page templates. */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  /* Add 8px on top of the safe-area inset so the white iOS status bar
     icons sit cleanly against the brand-blue top bar without crowding. */
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  /* Brand-blue top bar so the LIGHT-content iOS status bar (white time /
     battery icons) stays clearly readable instead of blending into a
     white background. */
  background: var(--primary);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.mobile-topbar__title {
  font-weight: 700;
  color: #ffffff;
  font-size: 1.05em;
}
.mobile-topbar__menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  color: #ffffff;
  font-size: 1.2em;
}
.mobile-topbar__menu:active { background: rgba(255, 255, 255, 0.22); }
.mobile-topbar__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  color: #ffffff;
  font-size: 1.5em;
  line-height: 1;
  padding: 0 0 3px;
  font-weight: 600;
}
.mobile-topbar__back:active { background: rgba(255, 255, 255, 0.22); }
.mobile-topbar__back[hidden] { display: none; }

/* Desktop in-page back button (hidden on mobile — the top-bar one takes over). */
.app-desktop-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border, #d4d4d8);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text, #111827);
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1.1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.app-desktop-back:hover {
  background: var(--bg-soft, #f3f4f6);
  border-color: var(--border-strong, #b0b3b8);
}
.app-desktop-back:active { transform: translateY(1px); }
.app-desktop-back > span[aria-hidden="true"] {
  font-size: 1.4em;
  line-height: 0.7;
  margin-right: 2px;
}
.app-desktop-back[hidden] { display: none; }
@media (max-width: 830px) {
  .app-desktop-back { display: none; }
  .app-desktop-back[hidden] { display: none; }
}

.mobile-topbar__wake {
  position: relative;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease,
    box-shadow 160ms ease;
}
.mobile-topbar__wake[hidden] { display: none; }
.mobile-topbar__wake:active { transform: scale(0.96); }
.mobile-topbar__wake .mobile-topbar__wake-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 2px var(--primary, #1d4ed8);
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease, transform 220ms ease;
}
.mobile-topbar__wake.is-on {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.mobile-topbar__wake.is-on .mobile-topbar__wake-dot {
  opacity: 1;
  background: #34d399;
}
.mobile-topbar__wake.is-listening .mobile-topbar__wake-dot {
  animation: rithma-wake-pulse 1.4s ease-in-out infinite;
}
.mobile-topbar__wake.is-suspended .mobile-topbar__wake-dot {
  background: #fbbf24;
  animation: none;
}
.mobile-topbar__wake.is-resource-paused .mobile-topbar__wake-dot {
  background: #f97316;
}
.mobile-topbar__wake.is-locked,
.mobile-topbar__wake:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  background: rgba(148, 163, 184, 0.28);
  border-color: rgba(226, 232, 240, 0.45);
  box-shadow: none;
}
.mobile-topbar__wake.is-locked:active,
.mobile-topbar__wake:disabled:active {
  transform: none;
}
.mobile-topbar__wake.just-fired {
  background: #ffffff;
  color: var(--primary, #1d4ed8);
  border-color: #ffffff;
}
.mobile-topbar__wake.just-fired .mobile-topbar__wake-dot {
  background: var(--primary, #1d4ed8);
  transform: scale(1.4);
}
@keyframes rithma-wake-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-topbar__wake.is-listening .mobile-topbar__wake-dot { animation: none; }
  .main-wake-desktop.is-listening .main-wake-dot { animation: none; }
}

/* Wake-word on wide layouts: keep control in <main> — compact top bar hidden ≥831px,
   and UA [hidden] rules can fight sidebar-only placement. */
.main-top-tools {
  display: none;
}
@media (min-width: 831px) {
  .main-top-tools {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: -4px 0 16px;
    min-height: 0;
    flex-wrap: wrap;
    gap: 8px;
  }
  /* No extra gutter when wake-word toggle stays hidden (unsupported). */
  .main-top-tools:not(:has(.main-wake-desktop:not([hidden]))) {
    display: none !important;
  }
}
@media (max-width: 830px) {
  .main-top-tools {
    display: none !important;
  }
}

.main-wake-desktop {
  display: none;
  position: relative;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: #fff;
  color: var(--primary, #2563eb);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.main-wake-desktop .main-wake-dot {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 2px var(--border, #e2e8f0);
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
}
.main-wake-desktop.is-on {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.08);
}
.main-wake-desktop.is-on .main-wake-dot {
  opacity: 1;
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
}
.main-wake-desktop.is-listening .main-wake-dot {
  animation: rithma-wake-pulse 1.4s ease-in-out infinite;
}
.main-wake-desktop.is-suspended .main-wake-dot {
  background: #fbbf24;
  animation: none;
}
.main-wake-desktop.is-resource-paused .main-wake-dot {
  background: #f97316;
}
.main-wake-desktop.is-locked,
.main-wake-desktop:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
.main-wake-desktop.just-fired {
  background: rgba(37, 99, 235, 0.16);
}
@media (min-width: 831px) {
  /* Defeat UA [hidden]{display:none!important} edge cases when JS clears hidden. */
  .main-wake-desktop:not([hidden]) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
}
.mobile-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 45;
  opacity: 0;
  transition: opacity 160ms ease;
}
body.is-sidebar-open .mobile-scrim { display: block; opacity: 1; }

/* Tablet: narrow but always-on sidebar so split-view stays comfortable. */
@media (max-width: 1024px) and (min-width: 831px) {
  .sidebar { width: 200px; padding: 16px 12px; }
  .main { padding: 24px 28px; }
}

/* Phones / small tablets in portrait: sidebar becomes a drawer. */
@media (max-width: 830px) {
  body:has(.layout) { overflow: auto; }
  .layout { flex-direction: column; height: auto; overflow: visible; }
  .mobile-topbar { display: flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 84%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    z-index: 50;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.is-sidebar-open .sidebar { transform: translateX(0); }
  .main {
    flex: 0 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow-y: visible;
    overflow-x: hidden;
    padding: 18px 16px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  /* Tighten typography + spacing so dashboards stay readable on a phone. */
  .page-header h1 { font-size: 1.3em; }
  .card { padding: 16px; }
  .form-group label { font-size: 1em; }
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* prevent iOS zoom-on-focus */
    padding: 11px 12px;
  }
  .btn { padding: 11px 18px; font-size: 1em; min-height: 44px; }
  .btn-sm { min-height: 36px; }
  /* Tap targets in the sidebar should also feel native. */
  .sidebar nav a { padding: 12px 14px; font-size: 1em; }
  /* Wide tables should scroll horizontally instead of overflowing the page. */
  table { font-size: 0.95em; }
  .table-wrap, .responsive-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Honor user prefs in installed-app contexts. */
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .mobile-scrim { transition: none; }
}

/* Auth pages */
/* Paint the gradient on html + body so it covers the entire WebView,
   including the area under the iPhone notch / Dynamic Island and the
   home indicator. The wrapper itself is transparent so it inherits it.
   We avoid ``background-attachment: fixed`` because iOS WKWebView ignores it
   inconsistently — instead the html + body each get a gradient that
   stretches to their full size. */
html:has(.auth-wrapper),
body:has(.auth-wrapper),
html.rithma-auth-shell,
body.rithma-auth-shell {
  background: linear-gradient(135deg, #2563eb 0%, #14b8a6 100%);
  background-repeat: no-repeat;
  background-size: cover;
  /* Only constrain horizontal overscroll; blocking vertical can fight iOS/WKWebView. */
  overscroll-behavior-x: none;
}
html:has(.auth-wrapper),
html.rithma-auth-shell {
  /* Root scroll container for auth: matches global ``height: 100%`` on html but adds a
     vertical scroll layer so tall cards (reset password + keyboard) always pan. */
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
body:has(.auth-wrapper),
body.rithma-auth-shell {
  min-height: 100%;
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  /* Body grows with content; scrolling happens on ``html`` — reliable on mobile WebViews. */
  overflow-y: visible;
}
.auth-wrapper {
  /* Use dynamic viewport units when available so the layout shrinks/grows
     with the iOS keyboard / dynamic toolbars; fall back to 100vh on browsers
     that don't support dvh. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  /* Anchor the form near the top so there's always a clear gap between
     the iPhone notch / Dynamic Island and the start of the card. The
     wrapper still grows to fill the viewport for the gradient. */
  align-items: flex-start;
  justify-content: center;
  background: transparent;
  padding: 20px;
  /* width: 100% inherits from body which is already clamped to viewport. */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* Hard-clamp horizontal overflow even if a child tries to widen the layout. */
  overflow-x: hidden;
  /* Safe-area aware horizontal padding: the iPhone notch can extend the
     left/right insets in landscape too. */
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  /* Always leave at least 88px between the top of the device (status bar /
     Dynamic Island) and the card. When ``env(safe-area-inset-top)`` reports
     a real value (most iPhones) we add 32px on top of it; when it returns 0
     (older devices, simulator quirks, contentInset:never) the absolute
     ``max()`` floor still keeps the card clear of the system UI. */
  padding-top: max(88px, calc(env(safe-area-inset-top, 0px) + 32px));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
@media (max-width: 480px) {
  .auth-wrapper {
    /* Even more headroom on phones with taller notches / Dynamic Island. */
    padding-top: max(96px, calc(env(safe-area-inset-top, 0px) + 40px));
  }
}
.auth-card {
  /* Soft off-white with a very faint cool tint so the card is clearly
     distinct from pure white but still reads as a clean, neutral surface
     against the blue / teal gradient behind it. */
  background: #f5f8fc;
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  /* Defend against any inner content that might push past the card's own
     width (long emails, wide buttons, etc.). */
  overflow-x: hidden;
}
.auth-hero {
  display: none;
}
.auth-kicker {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.auth-kicker--card {
  display: none;
}
.auth-hero__features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.auth-hero__features span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.88rem;
  font-weight: 600;
}
/* Belt-and-braces clamp for everything inside auth pages: no descendant
   may exceed its own container, eliminating any chance of sideways scroll. */
.auth-wrapper *,
.auth-wrapper {
  max-width: 100%;
}
.auth-wrapper input,
.auth-wrapper select,
.auth-wrapper textarea,
.auth-wrapper button {
  max-width: 100%;
}
@media (max-width: 480px) {
  .auth-card { padding: 24px 20px; border-radius: 14px; }
}
.auth-card h1 { margin: 0 0 6px 0; color: var(--primary); }
.auth-card__desktop-title {
  display: none;
}
.auth-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 0.95em; }

@media (max-width: 899px) {
  .auth-card { max-width: 460px; padding: 24px 20px; border-radius: 14px; }
}

@media (min-width: 900px) {
  html:has(.auth-wrapper),
  body:has(.auth-wrapper),
  html.rithma-auth-shell,
  body.rithma-auth-shell {
    background:
      radial-gradient(circle at top left, rgba(20, 184, 166, 0.26), transparent 34rem),
      linear-gradient(135deg, #eef6ff 0%, #f8fafc 48%, #e6fffb 100%);
  }
  .auth-wrapper {
    align-items: flex-start;
    justify-content: center;
    padding: 48px;
    padding-left: max(48px, env(safe-area-inset-left));
    padding-right: max(48px, env(safe-area-inset-right));
    padding-top: max(48px, env(safe-area-inset-top));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
  .auth-wrapper::before {
    content: "";
    position: fixed;
    inset: auto auto 8% 7%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.12);
    filter: blur(8px);
    pointer-events: none;
  }
  .auth-wrapper::after {
    content: "";
    position: fixed;
    inset: 12% 8% auto auto;
    width: 180px;
    height: 180px;
    border-radius: 45px;
    background: rgba(20, 184, 166, 0.14);
    transform: rotate(18deg);
    pointer-events: none;
  }
  .auth-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, 460px);
    align-items: start;
    gap: 0;
    max-width: 1080px;
    margin: 0 auto;
  }
  .auth-hero,
  .auth-card {
    position: relative;
    z-index: 1;
  }
  .auth-hero {
    display: flex;
    align-self: start;
    position: sticky;
    top: max(48px, env(safe-area-inset-top));
    height: 620px;
    flex-direction: column;
    justify-content: flex-end;
    padding: 56px;
    border-radius: 28px 0 0 28px;
    background:
      linear-gradient(160deg, rgba(37, 99, 235, 0.94), rgba(20, 184, 166, 0.88)),
      var(--primary);
    color: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  }
  .auth-hero .auth-kicker {
    color: rgba(255, 255, 255, 0.78);
  }
  .auth-hero h1 {
    margin: 0 0 14px;
    color: #ffffff;
    font-size: clamp(2.6rem, 5vw, 4.2rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
  }
  .auth-hero p:not(.auth-kicker) {
    max-width: 36rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 1.08rem;
    line-height: 1.7;
  }
  .auth-card {
    min-height: 620px;
    max-width: 460px;
    padding: 54px 48px;
    border-radius: 0 28px 28px 0;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-left: 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  }
  .auth-kicker--card {
    display: block;
  }
  .auth-card h1 {
    color: var(--text);
    font-size: 2rem;
    letter-spacing: -0.03em;
  }
  .auth-card__mobile-title {
    display: none;
  }
  .auth-card__desktop-title {
    display: inline;
  }
}

/* Biometric sign-in (mobile shell only — JS reveals these). */
.biometric-save {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 0.9em;
  color: var(--muted);
  line-height: 1.35;
}
.biometric-save input[type="checkbox"] {
  margin-top: 3px;
  flex: 0 0 auto;
}
.biometric-save strong { color: var(--text); font-weight: 600; }
.biometric-unlock {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.biometric-unlock__icon { font-size: 1.1em; }
.biometric-hint {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85em;
  line-height: 1.35;
  text-align: center;
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 5px; font-size: 0.92em; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95em;
  font-family: inherit;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Password reveal toggle — input wrapped by password-reveal.js */
.password-input-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
}
.password-input-wrap > input[type="password"],
.password-input-wrap > input[type="text"] {
  padding-right: 5.25rem;
}
.password-input-reveal-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.password-input-reveal-btn:hover {
  background: var(--card);
  border-color: var(--primary-light);
}
.password-input-reveal-btn:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Checkboxes and radios should keep their native size — never stretch like text inputs. */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0 6px 0 0;
  vertical-align: middle;
  accent-color: var(--primary);
  cursor: pointer;
  box-shadow: none;
}
.form-group input[type="checkbox"]:focus,
.form-group input[type="radio"]:focus {
  box-shadow: 0 0 0 2px var(--primary-light);
  border-color: var(--primary);
}
/* Labels that wrap a checkbox/radio (inline pattern). */
.form-group label:has(> input[type="checkbox"]),
.form-group label:has(> input[type="radio"]),
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Inline validation feedback for email/phone (and any input flagged invalid). */
input.input-invalid,
.form-group input.input-invalid,
.form-field input.input-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
input.input-invalid:focus,
.form-group input.input-invalid:focus,
.form-field input.input-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22);
}
.input-error {
  display: none;
  color: var(--danger);
  font-size: 0.82em;
  margin-top: 4px;
  line-height: 1.3;
}

/* Live password requirements */
.password-policy-hint {
  margin-top: 8px;
}
.password-policy-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.password-policy-card.is-complete {
  border-color: rgba(22, 163, 74, 0.35);
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}
.password-policy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
}
.password-policy-head strong {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.password-policy-card.is-complete .password-policy-head strong {
  color: var(--success);
}
.password-policy-meter {
  height: 6px;
  margin: 8px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}
.password-policy-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--warning);
  transition: width 160ms ease, background-color 160ms ease;
}
.password-policy-card.is-complete .password-policy-meter span {
  background: var(--success);
}
.password-policy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.password-policy-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.25;
}
.password-policy-row strong {
  display: block;
  color: inherit;
  font-size: 0.84rem;
}
.password-policy-row small {
  display: block;
  margin-top: 1px;
  color: inherit;
  font-size: 0.78rem;
}
.password-policy-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
}
.password-policy-row.met {
  color: var(--success);
}
.password-policy-row.met .password-policy-mark {
  border-color: rgba(22, 163, 74, 0.25);
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
}
.password-confirm-message {
  margin: 6px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.3;
}
.password-confirm-warn {
  background: #fef2f2;
  color: var(--danger);
}
.password-confirm-ok {
  background: #f0fdf4;
  color: var(--success);
}
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 600px) {
  .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) and (min-width: 601px) {
  .form-row-4 { grid-template-columns: 1fr 1fr; }
}

/* Client Intake Form sections — visually grouped to mirror the
   numbered sections of the paper PDF. Each <fieldset> sits on a soft
   blue rule so the form scans like a clinical document. */
.intake-section {
  border: 1px solid #d6e3ec;
  border-radius: 8px;
  padding: 14px 16px 18px;
  margin-top: 18px;
  background: var(--bg, #fff);
}
.intake-section > legend {
  padding: 0 8px;
  font-weight: 700;
  color: var(--primary, #2563eb);
  font-size: 1.05rem;
}
.intake-subhead {
  margin: 14px 0 6px;
  font-size: 0.95rem;
  color: var(--text, #111);
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 14px;
  margin-top: 4px;
}
.checkbox-grid__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  font-size: 0.92rem;
  cursor: pointer;
}
.checkbox-grid__item input[type="checkbox"] {
  flex-shrink: 0;
}
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  margin-top: 4px;
}
.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  font-size: 0.92rem;
  cursor: pointer;
}
/* Radio "pills" — small toggle-style choices for Yes/No and short
   enumerations, so the agency can choose with one tap on tablets. */
.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid #d6e3ec;
  border-radius: 16px;
  background: var(--bg, #fff);
  cursor: pointer;
  font-weight: normal;
  font-size: 0.9rem;
  user-select: none;
}
.radio-pill:has(input:checked) {
  border-color: var(--primary, #2563eb);
  background: color-mix(in srgb, var(--primary, #2563eb) 10%, var(--bg, #fff));
}

/* Weekly availability picker (part-time caregivers) */
.availability-grid-wrap { margin: 14px 0; }
.availability-grid {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  background: white;
}
.availability-grid > legend {
  padding: 0 8px;
  font-weight: 600;
  font-size: 0.95em;
}
.avail-day {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.avail-day:first-of-type { border-top: none; }
.avail-day .avail-day-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
  font-weight: normal;
  cursor: pointer;
  color: var(--muted);
}
.avail-day.is-on .avail-day-toggle { color: var(--text); }
.avail-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.avail-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.avail-slot input[type="time"] {
  /* The time-picker hides the native input and inserts its own .tp-wrap chip;
     this rule covers the rare case where it hasn't upgraded yet. */
  width: auto;
  min-width: 110px;
}
.avail-sep { color: var(--muted); }
.avail-add-slot {
  align-self: start;
  padding-top: 6px;
  white-space: nowrap;
}
.avail-remove-slot {
  color: var(--danger);
  font-size: 1.2em;
  line-height: 1;
  padding: 0 6px;
}
.avail-day:not(.is-on) .avail-slots,
.avail-day:not(.is-on) .avail-add-slot { display: none; }
@media (max-width: 700px) {
  .avail-day {
    grid-template-columns: 1fr;
  }
  .avail-day .avail-day-toggle { padding-top: 0; }
}

/* Friendly read-only display of structured availability. */
.avail-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 0;
}
.avail-summary-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 10px;
  font-size: 0.92em;
}
.avail-summary-row .avail-day-name { color: var(--muted); font-weight: 500; }

/* Role picker (login) */
.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.role-picker label {
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.role-picker input { display: none; }
.role-picker input:checked + span { color: var(--primary-dark); }
.role-picker label:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.role-picker .role-icon { display: block; font-size: 1.4em; margin-bottom: 4px; }

/* Register: caregiver subtype (shown only after Caregiver is selected) */
.caregiver-type-panel {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius, 10px);
  background: var(--card);
}
.caregiver-type-panel[hidden] {
  display: none !important;
}
.caregiver-type-panel__legend {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0;
  margin: 0 0 8px;
  color: var(--text);
}
.caregiver-type-panel__choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.caregiver-type-panel__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-weight: 500;
}
.caregiver-type-panel__row:hover {
  background: rgba(37, 99, 235, 0.04);
}
.caregiver-type-panel__row:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary-dark);
}
.caregiver-type-panel__row input[type="radio"] {
  flex-shrink: 0;
  margin-top: 3px;
}
.caregiver-type-panel__row span {
  flex: 1;
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-block { display: block; width: 100%; }
.btn-secondary { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-outline {
  background: white;
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.4);
}
.btn-danger-outline:hover { background: #fef2f2; color: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 5px 12px; font-size: 0.85em; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.is-loading {
  position: relative;
  pointer-events: none;
}
.btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards & layout */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card h2 { margin-top: 0; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { margin: 0; font-size: 1.6em; }

.empty-state {
  max-width: 520px;
  margin: 12px auto;
  padding: 28px 22px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  text-align: center;
}
.empty-state--compact {
  max-width: none;
  margin: 8px 0;
  padding: 16px;
  text-align: left;
}
.empty-state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
}
.empty-state__title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--text);
}
.empty-state p {
  margin: 0;
}

.notice-card {
  margin: 12px 0;
  padding: 11px 13px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-left: 4px solid var(--info);
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.06);
  color: #075985;
  font-size: 0.9rem;
}
.notice-card--warning {
  border-color: rgba(245, 158, 11, 0.28);
  border-left-color: var(--warning);
  background: #fffbeb;
  color: #92400e;
}
.notice-card strong {
  color: inherit;
}

.schedule-filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.filter-bar {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.filter-bar__count {
  align-self: center;
  justify-self: end;
  padding-bottom: 0 !important;
  font-weight: 600;
}
.schedule-filter-bar .form-group {
  margin-bottom: 0;
}
.schedule-filter-bar .text-sm {
  padding-bottom: 7px;
}
.schedule-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 14px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-dark);
  padding: 4px 9px;
  font-size: 0.84rem;
}
.filter-chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0 1px;
}
@media (max-width: 760px) {
  .schedule-filter-bar {
    grid-template-columns: 1fr;
  }
  .schedule-filter-bar .text-sm {
    padding-bottom: 0;
  }
}

/* Right-side slide-in panels */
.side-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.34);
  opacity: 0;
  transition: opacity 180ms ease;
}
.side-panel-backdrop.is-open {
  opacity: 1;
}
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(440px, 100vw);
  /* `dvh` keeps the panel inside the visible viewport on iOS (so the close
     button isn't hidden under the dynamic toolbars). `vh` is the fallback. */
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--card);
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform 180ms ease;
  display: flex;
  flex-direction: column;
}
.side-panel.is-open {
  transform: translateX(0);
}
.side-panel--wide {
  width: min(760px, 100vw);
}
.side-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  /* Push the header below the iOS notch / status bar when the WebView
     overlays the system UI. Falls back to the base 20px on browsers
     without env() support. */
  padding-top: max(20px, env(safe-area-inset-top, 20px));
  border-bottom: 1px solid var(--border);
}
.side-panel__header h3 {
  margin: 0 0 4px;
}
.side-panel__header p {
  margin: 0;
}
.side-panel__body {
  padding: 20px 22px 28px;
  /* Keep the submit button above the iPhone home indicator. */
  padding-bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 20px));
  /* Fill the remaining panel height and scroll inside instead of letting a
     long form push past the bottom edge. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Lock the underlying page scroll while a side panel is open so the body
   doesn't drift behind the backdrop on touch. */
body.has-side-panel-open {
  overflow: hidden;
  touch-action: none;
}
.side-panel-validation {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 8px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 0.88rem;
}
.side-panel-validation strong {
  display: block;
  margin-bottom: 4px;
}
.side-panel-validation ul {
  margin: 0;
  padding-left: 18px;
}
.senior-detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}
.senior-detail-list > div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.senior-detail-list > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.senior-detail-list dt {
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.senior-detail-list dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.senior-detail-section__title {
  margin: 18px 0 10px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.senior-shift-detail-panel-body .senior-detail-section:first-child .senior-detail-section__title {
  margin-top: 0;
}
.recurring-daily-suggestion {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 0.84rem;
}
.recurring-daily-suggestion .btn {
  margin-left: 6px;
}
@media (max-width: 520px) {
  .side-panel {
    width: 100vw;
  }
  .side-panel__header,
  .side-panel__body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .side-panel--wide .table,
  .manual-segments-table {
    min-width: 620px;
  }
  .manual-seg-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Stat grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--card);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat-card .label { color: var(--muted); font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 1.9em; font-weight: 700; color: var(--primary); margin-top: 4px; word-break: break-word; }

/* Phone & small tablet: pack two compact stat cards per row instead of
   one tall card. Restyled to feel like an iOS widget — soft gradient
   surface, layered shadow, tabular numerics, and a chip-style action
   link instead of a plain web underline. Desktop styling above is
   unchanged. Breakpoint matches the `table-app-list` mobile threshold
   so all mobile UI patterns flip together. */
@media (max-width: 830px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    /* Layered surface: subtle top highlight gradient + soft border + a
       short close shadow paired with a softer ambient one. */
    padding: 14px 14px 12px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: linear-gradient(180deg, #ffffff 0%, var(--card) 60%);
    box-shadow:
      0 1px 2px rgba(15, 23, 42, 0.04),
      0 6px 16px rgba(15, 23, 42, 0.06);
    min-height: 96px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: transform 120ms ease, box-shadow 120ms ease;
    -webkit-tap-highlight-color: transparent;
  }
  .stat-card:active {
    transform: scale(0.985);
    box-shadow:
      0 1px 1px rgba(15, 23, 42, 0.05),
      0 2px 6px rgba(15, 23, 42, 0.05);
  }
  .stat-card .label {
    font-size: 0.66em;
    letter-spacing: 0.8px;
    line-height: 1.25;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--muted);
  }
  .stat-card .value {
    font-size: 1.7em;
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
  }
  /* Status text (e.g. "Needs attention") sits right under the value. */
  .stat-card span.text-sm {
    font-size: 0.74em;
    margin-top: 2px;
    line-height: 1.3;
  }
  /* Action link styled as a pill chip pinned to the bottom of the card —
     the same affordance pattern used by iOS Home-screen widgets. */
  .stat-card a.text-sm {
    align-self: flex-start;
    margin-top: auto;
    padding: 5px 10px 5px 11px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.74em;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.25;
    -webkit-tap-highlight-color: transparent;
    transition: background 120ms ease, transform 120ms ease;
  }
  .stat-card a.text-sm::after {
    content: "›";
    margin-left: 4px;
    font-weight: 700;
    opacity: 0.7;
  }
  .stat-card a.text-sm:active {
    background: rgba(37, 99, 235, 0.18);
    transform: scale(0.97);
  }
}

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.92em; }
.table th { background: var(--bg); color: var(--muted); text-transform: uppercase; font-size: 0.78em; letter-spacing: 0.5px; }
.table tr:hover { background: var(--bg); }

/* Horizontally scrollable wrapper for tables. Lets wide tables scroll
   sideways inside their card without pushing past the page boundary, and
   keeps the leading id/name columns pinned in place via `table-sticky-1`
   or `table-sticky-2` on the inner <table>. */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-scroll > .table { margin: 0; width: 100%; }
.table-scroll > .table.table-wide { min-width: 720px; }

.table-scroll > .table.table-sticky-1,
.table-scroll > .table.table-sticky-2 {
  /* Sticky cells need separated borders so they paint reliably in WebKit. */
  border-collapse: separate;
  border-spacing: 0;
}
.table-scroll > .table.table-sticky-1 th,
.table-scroll > .table.table-sticky-1 td,
.table-scroll > .table.table-sticky-2 th,
.table-scroll > .table.table-sticky-2 td {
  border-bottom: 1px solid var(--border);
}

.table-scroll > .table.table-sticky-1 > thead > tr > th:first-child,
.table-scroll > .table.table-sticky-1 > tbody > tr > td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  box-shadow: 1px 0 0 var(--border);
  min-width: 160px;
  max-width: 240px;
  white-space: normal;
}
.table-scroll > .table.table-sticky-1 > thead > tr > th:first-child {
  background: var(--bg);
  z-index: 3;
}

.table-scroll > .table.table-sticky-2 > thead > tr > th:nth-child(1),
.table-scroll > .table.table-sticky-2 > tbody > tr > td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  width: 110px;
  min-width: 110px;
  max-width: 130px;
  white-space: nowrap;
}
.table-scroll > .table.table-sticky-2 > thead > tr > th:nth-child(2),
.table-scroll > .table.table-sticky-2 > tbody > tr > td:nth-child(2) {
  position: sticky;
  left: 110px;
  z-index: 2;
  background: var(--card);
  min-width: 160px;
  max-width: 240px;
  box-shadow: 1px 0 0 var(--border);
}
.table-scroll > .table.table-sticky-2 > thead > tr > th:nth-child(1),
.table-scroll > .table.table-sticky-2 > thead > tr > th:nth-child(2) {
  background: var(--bg);
  z-index: 3;
}

/* Keep row hover consistent across sticky and non-sticky cells. Sticky cells
   paint their own backgrounds, so we need to repaint them on hover too. */
.table-scroll > .table.table-sticky-1 tbody tr:hover > td,
.table-scroll > .table.table-sticky-2 tbody tr:hover > td {
  background: var(--bg);
}

/* Cells that span multiple columns (e.g. empty-state rows that say
   "no results") should opt out of sticky positioning so they render
   across the full row instead of getting pinned to the left edge. */
.table-scroll > .table.table-sticky-1 > tbody > tr > td[colspan]:first-child,
.table-scroll > .table.table-sticky-2 > tbody > tr > td[colspan]:nth-child(1),
.table-scroll > .table.table-sticky-2 > tbody > tr > td[colspan]:nth-child(2) {
  position: static;
  width: auto;
  min-width: 0;
  max-width: none;
  box-shadow: none;
  white-space: normal;
}

/* Tighter sticky-column widths on phones so the scrolling area still has
   room for the trailing data columns. */
@media (max-width: 480px) {
  .table-scroll > .table.table-sticky-2 > thead > tr > th:nth-child(1),
  .table-scroll > .table.table-sticky-2 > tbody > tr > td:nth-child(1) {
    width: 88px;
    min-width: 88px;
    max-width: 100px;
  }
  .table-scroll > .table.table-sticky-2 > thead > tr > th:nth-child(2),
  .table-scroll > .table.table-sticky-2 > tbody > tr > td:nth-child(2) {
    left: 88px;
    min-width: 130px;
    max-width: 170px;
  }
  .table-scroll > .table.table-sticky-1 > thead > tr > th:first-child,
  .table-scroll > .table.table-sticky-1 > tbody > tr > td:first-child {
    min-width: 130px;
    max-width: 170px;
  }
}

/* === Visible-row cap (~10 rows) =========================================
   Opt-in via `table-scroll--max-rows` on the .table-scroll wrapper.
   Caps the visible portion of a list at roughly the first 10 body rows
   on desktop; anything past that scrolls in place. The thead stays
   pinned so the column labels are always visible while scrolling.

   Phone widths intentionally skip the cap: `table-app-list` reflows
   rows into stacked cards and the wrapper's existing
   `overflow: visible` rule (further below) keeps mobile lists flowing
   with the page scroll instead of nesting a fixed-height scroll
   region inside the card. */
@media (min-width: 831px) {
  .table-scroll--max-rows {
    /* thead (~40px) + 10 typical rows (~48px each) + 8px hint that
       reveals the next row's top edge when the cap is engaged. */
    max-height: calc(40px + 48px * 10 + 8px);
    overflow-y: auto;
  }
  .table-scroll--max-rows > .table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--bg);
  }
  /* Re-assert z-index for sticky-left thead cells (table-sticky-1 /
     table-sticky-2) so they keep painting above the non-corner sticky-
     top thead cells when the user scrolls horizontally too. Same
     specificity as the originals; source order wins. */
  .table-scroll--max-rows > .table.table-sticky-1 > thead > tr > th:first-child,
  .table-scroll--max-rows > .table.table-sticky-2 > thead > tr > th:nth-child(1),
  .table-scroll--max-rows > .table.table-sticky-2 > thead > tr > th:nth-child(2) {
    z-index: 5;
  }
}

/* === Working-hours card control rows ===================================
   Used by the Caregivers page to lay out the prev/next month controls
   and the custom-range date pickers. The `hidden` global attribute
   takes precedence (display:none) when present, so toggling a row's
   visibility is just `el.hidden = true/false` from JS — no inline
   style flips required. */
.hours-controls-row {
  display: flex;
}
.hours-controls-row[hidden] {
  display: none;
}

/* Documents page filename trigger — looks like a regular link but is
   wired to a click handler that opens the inline preview modal
   instead of navigating. We keep the underline-on-hover affordance
   so the user can still see it's interactive. */
.document-preview-trigger {
  cursor: pointer;
}
.document-preview-trigger:hover {
  text-decoration: underline;
}

/* Inline preview modal for agency Documents.
   --------------------------------------------------------------------
   Hidden by default; the [open] attribute (toggled in JS) flips it to
   a centered flex overlay. Click on the backdrop or the close button
   tears it down. The body region is sized to the viewport so a tall
   PDF gets a real, scrollable preview area without pushing the page
   layout around.
*/
.document-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.document-preview-modal[open] {
  display: flex;
}
.document-preview-modal__backdrop {
  position: absolute;
  inset: 0;
}
.document-preview-modal__content {
  position: relative;
  background: var(--bg, #fff);
  border-radius: 10px;
  max-width: min(1100px, 95vw);
  width: 100%;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.document-preview-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.document-preview-modal__title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.document-preview-modal__close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 10px;
  cursor: pointer;
  color: inherit;
}
.document-preview-modal__body {
  flex: 1 1 auto;
  overflow: auto;
  background: #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.document-preview-modal__body iframe {
  width: 100%;
  height: 75vh;
  border: 0;
  background: #fff;
  display: block;
}
.document-preview-modal__body img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  background: #fff;
  display: block;
}
.document-preview-modal__fallback {
  padding: 40px;
  text-align: center;
  color: var(--text, #1e293b);
  background: var(--bg, #fff);
  width: 100%;
  align-self: stretch;
}
.document-preview-modal__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  /* Phone-friendly full-bleed preview — modal padding becomes
     wasted space when the screen is small. */
  .document-preview-modal { padding: 0; }
  .document-preview-modal__content {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .document-preview-modal__body iframe { height: 70vh; }
}
/* Lock body scroll while the preview overlay is open so the
   underlying page doesn't scroll out from under it on touch
   devices when the user pans inside the modal. */
html.document-preview-modal-open,
html.document-preview-modal-open body {
  overflow: hidden;
}

/* Documents page tab strip — sits directly above the file list and
   the upload form. Active tab gets a 2px underline that visually
   continues the bottom border of the container, mirroring the
   "tab over a card" pattern other agency pages use. */
.documents-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
button.documents-tab {
  background: transparent;
  border: none;
  font: inherit;
  font-family: inherit;
  cursor: pointer;
}
.documents-tab:hover {
  background: var(--bg);
}
.documents-tab--active {
  border-bottom-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
}

/* === App-list mobile pattern ============================================
   Opt-in via `table-app-list` on a <table>. On phone widths the row's
   non-essential cells are hidden and the remaining cells (tagged with
   `app-id`, `app-name`, `app-meta`, `app-actions`) re-flow as a card
   that mirrors the visual language of `.dash-upcoming-card`: soft
   border with a 4px teal accent rail, name on the left + id badge on
   the right of the top row, muted meta underneath, and a divided
   action row at the bottom. Desktop layout is untouched. */
@media (max-width: 830px) {
  /* Neutralize the horizontal scroll wrapper for app-list tables so cards
     flow naturally instead of being trapped inside a scroller. */
  .table-scroll:has(> .table.table-app-list) {
    overflow: visible;
    border: 0;
    -webkit-overflow-scrolling: auto;
    overscroll-behavior-x: auto;
  }

  .table.table-app-list,
  .table-scroll > .table.table-app-list {
    display: block;
    width: 100%;
    min-width: 0 !important;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
  }
  .table.table-app-list > thead { display: none; }
  .table.table-app-list > tbody { display: block; }

  /* Card surface — matches `.dash-upcoming-card` exactly so all of the
     mobile lists share the same visual language. */
  .table.table-app-list > tbody > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 0;
    padding: 14px 16px;
    margin: 0 0 11px;
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    box-sizing: border-box;
    position: static;
    transition:
      border-color 0.15s ease,
      box-shadow 0.15s ease,
      transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .table.table-app-list > tbody > tr:last-child {
    margin-bottom: 0;
  }
  /* Tactile press feedback — same teal-tinted shadow used by the
     upcoming-shift cards on hover. */
  .table.table-app-list > tbody > tr:active {
    transform: scale(0.995);
    box-shadow: 0 2px 10px rgba(20, 184, 166, 0.12);
  }
  /* Respect the [hidden] attribute on rows (e.g. filter empty-state row). */
  .table.table-app-list > tbody > tr[hidden] {
    display: none;
  }

  /* Hide every cell by default — only the explicitly tagged ones show. */
  .table.table-app-list > tbody > tr > td {
    display: none;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent !important;
    box-shadow: none !important;
    width: auto;
    min-width: 0;
    max-width: none;
    position: static !important;
    left: auto !important;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Top row, left side — primary title. Mirrors
     `.dash-upcoming-card__date` (bold, slightly tightened tracking). */
  .table.table-app-list > tbody > tr > .app-name {
    grid-row: 1;
    grid-column: 1;
    display: block;
    align-self: center;
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: var(--text);
  }
  /* Top row, right side — id chip pinned to the trailing edge, the same
     way the status badge sits in `.dash-upcoming-card__head`. */
  .table.table-app-list > tbody > tr > .app-id {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
    display: inline-flex;
    align-items: center;
    align-self: center;
    flex-shrink: 0;
    font-size: 0.85em;
    line-height: 1.2;
  }
  .table.table-app-list > tbody > tr > .app-id .badge {
    font-size: 0.76rem;
    padding: 4px 9px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  /* Defensive: if a row has no id chip, let the name span the full row. */
  .table.table-app-list > tbody > tr:not(:has(> .app-id)) > .app-name {
    grid-column: 1 / -1;
  }

  /* Secondary line — muted, scannable. Matches `.dash-upcoming-card__who`. */
  .table.table-app-list > tbody > tr > .app-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: center;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
  }
  .table.table-app-list > tbody > tr > .app-meta strong {
    color: var(--text);
    font-weight: 600;
  }
  .table.table-app-list > tbody > tr > .app-meta .badge {
    font-size: 0.74rem;
    padding: 3px 8px;
  }

  /* Action row sits below a hairline divider so the buttons read as a
     distinct affordance shelf rather than competing with the summary. */
  .table.table-app-list > tbody > tr > .app-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .table.table-app-list > tbody > tr > .app-actions form {
    margin: 0;
    display: inline-flex;
  }
  .table.table-app-list > tbody > tr > .app-actions .btn {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 14px;
    font-size: 0.88rem;
  }
  /* Inline button groups inside the actions cell shouldn't stretch — pull
     them out of their row-flex wrapper so each button stays tight. */
  .table.table-app-list > tbody > tr > .app-actions .row-flex {
    display: contents;
  }

  /* Empty-state / informational rows that span every column should fill the
     card width instead of squeezing into the name slot. */
  .table.table-app-list > tbody > tr > td[colspan] {
    display: block;
    grid-column: 1 / -1;
    grid-row: auto;
  }

  /* Cancel the row-hover background reset that the sticky tables add. */
  .table-scroll > .table.table-app-list tbody tr:hover > td {
    background: transparent !important;
  }
}

.upcoming-shifts-scroll {
  max-height: min(40vh, 20rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Senior / Family — upcoming visits as scannable cards */
.dash-upcoming-stack {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.dash-upcoming-stack > li {
  margin: 0;
}
.dash-upcoming-card {
  display: block;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}
.dash-upcoming-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(20, 184, 166, 0.12);
  text-decoration: none;
  transform: translateY(-1px);
  color: inherit;
}
.dash-upcoming-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.dash-upcoming-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.dash-upcoming-card__date {
  font-weight: 700;
  font-size: 0.94em;
  color: var(--text);
  letter-spacing: -0.01em;
}
.dash-upcoming-card__time {
  font-size: 1.12em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}
.dash-upcoming-card__who {
  font-size: 0.9em;
  line-height: 1.45;
  color: var(--muted);
}
.dash-upcoming-card__who strong {
  color: var(--text);
  font-weight: 600;
}
.dash-upcoming-card__unassigned {
  font-style: italic;
}
@media (max-width: 830px) {
  .dash-upcoming-card:hover {
    transform: none;
  }
}

.upcoming-shifts-scroll--cards {
  max-height: min(52vh, 28rem);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 0.78em;
  font-weight: 500;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: var(--primary-light); color: var(--primary-dark); }
.badge-muted { background: #e2e8f0; color: var(--muted); }
.task-source-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}
.task-source-badge--shift { background: #ecfdf5; color: #047857; }
.task-source-badge--period { background: #eff6ff; color: var(--primary-dark); }
.task-source-badge--manual { background: #f5f3ff; color: #6d28d9; }

/* Flash messages */
.flash { padding: 11px 16px; border-radius: 6px; margin-bottom: 12px; font-size: 0.92em; }
.flash-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--success); }
.flash-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.flash-info { background: var(--primary-light); color: var(--primary-dark); border-left: 4px solid var(--primary); }
.flash-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }

/* Toasts: flash messages promoted after in-place navigation (page-swap.js) */
.rithma-toast-host {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  left: max(12px, env(safe-area-inset-left));
  z-index: 10003;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
  margin-left: auto;
}
.rithma-toast-host .rithma-toast {
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  margin-bottom: 0;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  transform: translateY(-12px) scale(0.98);
  opacity: 0;
  transition:
    opacity 280ms cubic-bezier(0.33, 1, 0.68, 1),
    transform 280ms cubic-bezier(0.33, 1, 0.68, 1);
}
.rithma-toast-host .rithma-toast.rithma-toast--in {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.rithma-toast-host .rithma-toast.rithma-toast--out {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}
@media (max-width: 600px) {
  .rithma-toast-host {
    left: 10px;
    right: 10px;
    align-items: stretch;
    max-width: none;
  }
  .rithma-toast-host .rithma-toast { max-width: none; }
}

/* Calendar */
.month-title {
  font-size: 1.15em;
  font-weight: 600;
  margin: 4px 4px 10px;
  color: var(--text);
}
.calendar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}
.calendar-month .calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.calendar-month .calendar-weekdays > div {
  text-align: center;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 0;
}
.calendar-month .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(110px, auto);
  gap: 6px;
}
.calendar-day {
  background: var(--bg);
  padding: 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.calendar-day .day-num {
  font-weight: 600;
  font-size: 0.92em;
  margin-bottom: 2px;
  color: var(--text);
}
.calendar-day .day-num-long { display: none; }
.calendar-day.out-of-month { background: transparent; }
.calendar-day.out-of-month .day-num { color: var(--muted); opacity: 0.55; }
.calendar-day.out-of-month .calendar-shift { opacity: 0.55; }
.calendar-day.today { background: var(--primary-light); }
.calendar-day.today .day-num-short {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.82em;
}
.calendar-shift {
  background: white;
  border-left: 3px solid var(--primary);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.74em;
  line-height: 1.25;
  display: block;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-shift:hover { background: var(--primary-light); text-decoration: none; }
.calendar-shift.upcoming-shift {
  background: #dbeafe;
  border-left-color: var(--primary);
}
.calendar-shift.upcoming-shift:hover { background: #bfdbfe; }
.calendar-shift.past-shift {
  background: #dcfce7;
  border-left-color: var(--success);
}
.calendar-shift.past-shift:hover { background: #bbf7d0; }
.calendar-shift.unassigned { border-left-color: var(--warning); }
.calendar-shift.pending-approval {
  background: #fef3c7;
  border-left-color: var(--warning);
}
.calendar-shift.pending-approval:hover { background: #fde68a; }
.calendar-shift.in-progress { border-left-color: var(--success); }
.calendar-shift.completed { border-left-color: var(--muted); opacity: 0.7; }
.calendar-shift .time { font-weight: 600; }
.calendar-shift .name { color: var(--muted); font-size: 0.95em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-shift__status {
  color: #92400e;
  font-size: 0.85em;
  font-weight: 600;
  margin-top: 2px;
}
.calendar-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 4px 12px;
}

@media (max-width: 900px) {
  .calendar-month .calendar-weekdays { display: none; }
  .calendar-month .calendar-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .calendar-day { min-height: auto; }
  .calendar-day.out-of-month { display: none; }
  .calendar-day:not(:has(.calendar-shift)) { display: none; }
  .calendar-day .day-num-short { display: none; }
  .calendar-day .day-num-long { display: inline; }
  .calendar-day.today .day-num-long {
    background: var(--primary);
    color: white;
    border-radius: 999px;
    padding: 2px 10px;
  }
  .calendar-shift { white-space: normal; font-size: 0.85em; }
}

/* Daily scheduler (agency) */
.scheduler-page { max-width: 1100px; margin: 0 auto; }
.scheduler-page-header {
  align-items: flex-start;
}
.scheduler-page-heading { min-width: min(100%, 340px); }
.scheduler-page-heading h1 { margin-bottom: 6px; font-size: 1.75em; letter-spacing: -0.02em; }
.scheduler-page-sub { margin: 0; font-size: 0.95em; line-height: 1.45; }
.scheduler-page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.scheduler-date-banner {
  background: linear-gradient(145deg, #ffffff 0%, var(--primary-light) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.scheduler-date-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
}
.scheduler-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.scheduler-nav-btn:hover {
  background: var(--bg);
  border-color: var(--primary);
  text-decoration: none;
}
.scheduler-date-center { flex: 1; max-width: 420px; text-align: center; }
.scheduler-date-label {
  display: block;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.scheduler-date-value-wrap { position: relative; display: inline-block; width: 100%; max-width: 320px; }
.scheduler-headline-date {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.3;
  display: block;
  padding-right: 42px;
}
.scheduler-date-input {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 34px;
  opacity: 0.01;
  cursor: pointer;
  z-index: 2;
}
.scheduler-date-value-wrap::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E") center/18px no-repeat;
  border: 1px solid var(--border);
  pointer-events: none;
}
.scheduler-date-help { margin: 10px 0 0; font-size: 0.85em; }

.scheduler-quick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(37, 99, 235, 0.12);
}
.scheduler-today-btn {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}
.scheduler-today-btn:hover { background: var(--bg); }
.scheduler-today-btn,
.scheduler-add-primary {
  padding-left: 22px;
  padding-right: 22px;
  font-weight: 600;
  font-size: 0.95em;
}

.scheduler-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.scheduler-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.scheduler-stat--warn .scheduler-stat-value { color: var(--warning); }
.scheduler-stat-value {
  display: block;
  font-size: 1.65em;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.15;
}
.scheduler-stat-label {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Scheduler sub-views (Schedule vs Duplicate visits) */
.scheduler-subtabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 4px;
  margin: 0 0 18px;
  padding: 0 2px;
  border-bottom: 1px solid var(--border);
}
.scheduler-subtab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: -1px;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.scheduler-subtab:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--primary);
}
.scheduler-subtab--active {
  border-bottom-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.04);
}
.scheduler-subtab-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
  animation: scheduler-clipboard-pulse 2s ease-in-out infinite;
}

.scheduler-period-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.scheduler-period-row label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.scheduler-source-period {
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.45);
}
.scheduler-paste-live {
  min-height: 1.25em;
  margin: 10px 0 0;
}

/* ----- Scheduler copy & paste (interactive) ----- */
.scheduler-copy-panel {
  overflow: hidden;
  margin-bottom: 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.04) 0%, var(--card) 42%, var(--card) 100%);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}
.scheduler-copy-panel-inner {
  padding: 18px 20px 22px;
}
.scheduler-copy-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.scheduler-copy-panel-head-text h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.scheduler-copy-badge-dot {
  display: inline-flex;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  animation: scheduler-clipboard-pulse 2s ease-in-out infinite;
}
.scheduler-copy-panel-head--empty .scheduler-copy-badge-dot {
  background: var(--muted);
  box-shadow: none;
  animation: none;
}
@keyframes scheduler-clipboard-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.92); }
}
.scheduler-copy-lead {
  margin: 0;
  font-size: 0.9em;
  line-height: 1.45;
  color: var(--muted);
  max-width: 52ch;
}
.scheduler-copy-grid-2col {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 920px) {
  .scheduler-copy-grid-2col {
    grid-template-columns: 1fr;
  }
}
.scheduler-duplicate-single-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 920px) {
  .scheduler-duplicate-single-grid {
    grid-template-columns: 1fr;
  }
}
.scheduler-copy-column,
.scheduler-paste-column {
  border-radius: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: var(--card);
  min-height: 100%;
  box-sizing: border-box;
}
.scheduler-copy-column {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.scheduler-paste-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.scheduler-paste-column--ready {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08), 0 8px 24px rgba(37, 99, 235, 0.08);
}
.scheduler-field-legend {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 10px;
  padding: 0;
}
.scheduler-scope-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.scheduler-scope-chip {
  position: relative;
  cursor: pointer;
  margin: 0;
}
.scheduler-scope-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.scheduler-scope-chip span {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.scheduler-scope-chip:hover span {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.05);
}
.scheduler-scope-chip input:focus-visible + span {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.scheduler-scope-chip input:checked + span {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}
.scheduler-scope-chip-icon {
  font-size: 1.1em;
  line-height: 1;
  opacity: 0.9;
}
.scheduler-shift-pick {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: opacity 0.2s, max-height 0.25s ease;
  max-height: 280px;
  opacity: 1;
}
.scheduler-shift-pick[hidden] {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}
.scheduler-shift-pick label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.scheduler-select {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.92rem;
  background: var(--card);
  color: var(--text);
}
.scheduler-copy-row {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.scheduler-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.scheduler-switch-row .scheduler-switch-caption {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.scheduler-switch {
  position: relative;
  width: 44px;
  max-width: 44px;
  height: 24px;
  flex: 0 0 auto;
  box-sizing: border-box;
}
.scheduler-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.scheduler-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s;
  cursor: pointer;
}
.scheduler-switch-slider::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}
.scheduler-switch input:checked + .scheduler-switch-slider {
  background: var(--primary);
}
.scheduler-switch input:checked + .scheduler-switch-slider::after {
  transform: translateX(20px);
}
.scheduler-switch input:focus-visible + .scheduler-switch-slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.rithma-minical {
  width: 100%;
  max-width: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--card);
  box-sizing: border-box;
  user-select: none;
}
.rithma-minical-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.rithma-minical-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  flex: 1;
  text-align: center;
}
.rithma-minical-nav {
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text);
  flex: 0 0 auto;
}
.rithma-minical-nav:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.35);
}
.rithma-minical-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.rithma-minical-weekdays > span {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  padding: 4px 0;
}
.rithma-minical-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.rithma-minical-cell {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 0;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.rithma-minical-cell:hover:not(:disabled) {
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.06);
}
.rithma-minical-cell.is-other {
  color: var(--muted);
  opacity: 0.55;
}
.rithma-minical-cell.is-in-range {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(37, 99, 235, 0.28);
  color: var(--text);
}
.rithma-minical-cell.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}
.rithma-minical-cell.is-disabled,
.rithma-minical-cell:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.rithma-minical-cell:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.scheduler-copy-preview {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.07);
  border: 1px dashed rgba(37, 99, 235, 0.28);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  min-height: 3.2em;
  margin-bottom: 14px;
}
.scheduler-copy-preview strong {
  color: var(--primary);
}
.scheduler-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.btn.scheduler-copy-submit {
  font-weight: 600;
  padding-left: 20px;
  padding-right: 20px;
}
.scheduler-paste-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 12px;
  min-height: 160px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  background: rgba(15, 23, 42, 0.02);
}
.scheduler-paste-placeholder-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.65;
}
.scheduler-paste-ready-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.scheduler-paste-ready-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.scheduler-paste-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}
.scheduler-paste-date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.scheduler-paste-date-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  flex: 1 1 180px;
}
.scheduler-paste-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scheduler-paste-quick button {
  padding: 6px 11px;
  font-size: 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.scheduler-paste-quick button:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}
.scheduler-paste-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}
.btn.scheduler-paste-btn {
  font-weight: 700;
  padding-left: 22px;
  padding-right: 22px;
}
.scheduler-paste-clear {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}
.scheduler-paste-clear:hover {
  color: var(--text);
}

.scheduler-shifts-card { padding-top: 20px; }
.scheduler-shifts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.scheduler-shifts-title { margin: 0; font-size: 1.15rem; font-weight: 600; }

.scheduler-shift-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.scheduler-shift-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(to bottom, #ffffff, #fafbff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.scheduler-shift-card:hover {
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.scheduler-shift-card--upcoming {
  border-left: 4px solid var(--primary);
  background: #ffffff;
}
.scheduler-shift-card--past {
  border-left: 4px solid var(--success);
  background: #ffffff;
}
.scheduler-shift-card--unassigned {
  border-left: 4px solid var(--warning);
}
.scheduler-shift-card--pending {
  border-left: 4px solid var(--warning);
  background: #ffffff;
}

.scheduler-shift-main {
  display: flex;
  gap: 16px;
  flex: 1 1 280px;
  min-width: 0;
}
.scheduler-shift-timeblock {
  flex-shrink: 0;
  width: 88px;
  padding: 10px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.scheduler-shift-time-start,
.scheduler-shift-time-end {
  display: block;
  font-weight: 700;
  font-size: 0.95em;
}
.scheduler-shift-time-sep {
  display: block;
  font-size: 0.7em;
  opacity: 0.7;
  line-height: 1.2;
}
.scheduler-shift-body { min-width: 0; flex: 1; }
.scheduler-shift-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.scheduler-shift-client {
  font-size: 1.08em;
  font-weight: 600;
  color: var(--text);
}
.scheduler-shift-id { font-weight: 400; }
.scheduler-shift-status { margin-left: auto; }

.scheduler-shift-assign-row { margin-top: 2px; }
.scheduler-assign-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.scheduler-assign-pill--ok {
  background: #ecfdf5;
  color: #047857;
}
.scheduler-assign-icon { font-size: 0.85em; }
.scheduler-assign-pill--warn {
  background: #fff7ed;
  color: #c2410c;
  font-weight: 500;
}

.scheduler-shift-actions {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.scheduler-assign-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.scheduler-assign-select {
  flex: 1 1 160px;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9em;
  background: white;
}
.scheduler-assign-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.scheduler-shift-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.scheduler-remove-form { display: inline; margin: 0; }

.scheduler-rec-panel {
  width: 100%;
  flex-basis: 100%;
  margin: 0;
  padding: 0;
  border: none;
}
.scheduler-rec-inner {
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
}
.scheduler-rec-title { display: block; margin-bottom: 8px; font-size: 0.88em; }
.scheduler-rec-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.9em;
}
.scheduler-rec-item { margin: 4px 0; }
.scheduler-rec-badge {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.scheduler-rec-badge--ok { background: #d1fae5; color: #065f46; }
.scheduler-rec-badge--no { background: #fee2e2; color: #991b1b; }
.scheduler-rec-loading { padding: 8px 0; }

.scheduler-empty {
  text-align: center;
  padding: 36px 20px 28px;
  max-width: 420px;
  margin: 0 auto;
}
.scheduler-empty-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.85;
}
.scheduler-empty-title { margin: 0 0 8px; font-size: 1.15em; }
.scheduler-empty-second { margin-top: 10px; }
.scheduler-empty .muted { margin-bottom: 18px; }

@media (max-width: 820px) {
  .scheduler-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .scheduler-page-header { flex-direction: column; align-items: stretch; }
  .scheduler-page-header-actions { justify-content: flex-start; }
  .scheduler-shift-main { flex-direction: column; }
  .scheduler-shift-timeblock {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }
  .scheduler-shift-time-start,
  .scheduler-shift-time-end { display: inline; }
  .scheduler-shift-time-sep { display: inline; }
  .scheduler-shift-status { margin-left: 0; }
  .scheduler-assign-form .scheduler-assign-select { flex: 1 1 100%; }
}

/* Vaccination checklist */
.vaccination-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.vaccination-list label {
  font-size: 0.92em;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}
.vaccination-list label:has(input:checked) {
  background: #dcfce7;
  border-color: var(--success);
}
@media (max-width: 600px) { .vaccination-list { grid-template-columns: 1fr; } }

/* Family member input rows (legacy compact grid kept for any older callers) */
.family-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}
.family-row .form-group { margin-bottom: 0; }
@media (max-width: 700px) { .family-row { grid-template-columns: 1fr; } }

/* Card-style family member entries on Add Client */
.family-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.family-empty {
  padding: 12px 14px;
  margin: 0 0 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: var(--bg);
}
.family-empty[hidden] { display: none !important; }
.family-card {
  border: 1px solid #d6e3ec;
  border-radius: 10px;
  padding: 12px 14px 14px;
  background: #fff;
  margin: 0;
}
.family-card__legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 4px;
  font-weight: 600;
}
.family-card__title { font-size: 0.95rem; }
.family-card__remove {
  background: transparent;
  color: #b91c1c;
  border: 0;
  padding: 2px 6px;
  font-weight: 500;
  cursor: pointer;
}
.family-card__remove:hover { text-decoration: underline; }
.family-card .form-row { margin-bottom: 8px; }
.family-card .form-row:last-child { margin-bottom: 0; }
.family-card__login { align-items: top; }

/* Client intake — primary user designation (metadata only) */
.intake-primary-user {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #e2e8f0);
}
.primary-user-radios {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.primary-user-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}
.primary-user-radio input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.primary-user-detail-form {
  margin-top: 12px;
}

/* Senior / client feedback on shifts */
blockquote.senior-feedback-quote {
  margin: 12px 0 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: var(--bg);
  border-radius: 0 8px 8px 0;
  font-size: 0.96em;
}

/* Snippets / chat-like */
.snippet {
  background: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}
.snippet .meta { font-size: 0.78em; color: var(--muted); margin-bottom: 3px; }
/* Optimistic snippet appended on the Current Shift page while the device is
   offline. Visually distinct so the caregiver knows it hasn't been synced
   yet; the .snippet--pending class is removed by static/js/offline-queue.js
   once the queue successfully drains. */
.snippet--pending {
  border-left-color: #94a3b8;
  background: repeating-linear-gradient(
    -45deg,
    var(--bg),
    var(--bg) 10px,
    rgba(148, 163, 184, 0.08) 10px,
    rgba(148, 163, 184, 0.08) 20px
  );
}
.snippet--pending .snippet__pending-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* --- Offline action queue banner --------------------------------------- */
/* Floating chip rendered by static/js/offline-queue.js on the caregiver
   Current Shift page (mobile shell only). Fixed to the bottom so it
   doesn't push the shift cards around as the queue grows / drains. */
.offline-status {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  max-width: calc(100% - 32px);
  text-align: center;
}
.offline-status[hidden] { display: none; }
.offline-status--offline {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.offline-status--syncing {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Task checklist */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-list li {
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.task-delete-inline.task-delete-modal-form {
  margin-left: auto;
  flex-shrink: 0;
}

.task-list li.done { text-decoration: line-through; color: var(--muted); }
.task-list li.task-incomplete {
  border-left: 3px solid var(--warning, #f59e0b);
}
.task-list li.task-incomplete.task-incomplete--confirmed {
  border-left-color: var(--primary, #2563eb);
}
/* "Refused by client" state — visually distinct from .done so a
   refused task isn't mistaken for a completed one in a quick glance.
   Keep the strikethrough so it still reads as "out of the queue", but
   tint the row red-orange and the text muted instead of grey. */
.task-list li.refused {
  text-decoration: line-through;
  color: var(--muted);
  border-left: 3px solid var(--danger, #dc2626);
  background: color-mix(in srgb, var(--danger, #dc2626) 8%, var(--bg));
}
.task-list .task-refused-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 6px;
  white-space: nowrap;
}
.task-refuse-btn {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.05em;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.65;
}
.task-refuse-btn:hover { opacity: 1; }
.task-refuse-btn:disabled { cursor: not-allowed; opacity: 0.35; }
.task-refuse-btn.is-active { opacity: 1; }

.period-task-checkbox-btn {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.1em;
  padding: 0 4px 0 0;
  line-height: 1;
}

.period-shared-tasks-card .period-task-section + .period-task-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
}
.period-task-li {
  flex-wrap: wrap;
}
.period-task-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.period-task-ended-note {
  margin-top: 10px;
}

.task-followup-details__summary,
.overtime-details__summary,
.agency-profile-missing__summary,
.profile-dash-gaps__summary,
.profile-self-missing__summary {
  cursor: pointer;
  display: list-item;
  list-style-position: outside;
  padding: 2px 0 4px;
  font-weight: 600;
}
.task-followup-details__summary::-webkit-details-marker,
.agency-profile-missing__summary::-webkit-details-marker {
  color: var(--info);
}
.overtime-details__summary::-webkit-details-marker {
  color: var(--warning);
}
.profile-dash-gaps__summary::-webkit-details-marker,
.profile-self-missing__summary::-webkit-details-marker {
  color: var(--danger);
}
.task-followup-details__title,
.overtime-details__title,
.agency-profile-missing__title,
.profile-dash-gaps__title,
.profile-self-missing__title {
  display: inline;
}
.task-followup-details__counts,
.overtime-details__counts,
.agency-profile-missing__counts,
.profile-dash-gaps__counts,
.profile-self-missing__counts {
  display: inline;
  font-weight: 400;
  margin-left: 0.35em;
}
.task-followup-details.card,
.overtime-details.card,
.agency-profile-missing-card.card,
.profile-dash-gaps-card.card,
.profile-self-missing-card.card {
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.task-followup-filter-bar {
  margin-bottom: 14px;
}
.task-followup-item:last-child {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
.profile-dash-gaps__person-sum {
  cursor: pointer;
  font-weight: 600;
  padding: 4px 0;
}
.profile-dash-gaps__person {
  margin-bottom: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.profile-dash-gaps__person:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Login switch link */
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.92em; color: var(--muted); }
.auth-forgot-password { text-align: center; margin-top: 12px; margin-bottom: 0; font-size: 0.92em; }

/* Page actions row */
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Message inbox */
.message-list .message-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.message-list .message-item.unread { background: var(--primary-light); }
.message-list .message-item .from { font-weight: 600; }
.message-list .message-item .subject { color: var(--muted); font-size: 0.9em; }
.message-list .message-item .body { margin-top: 6px; font-size: 0.95em; }

/* GPS status */
.gps-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #dcfce7;
  color: #166534;
  border-radius: 20px;
  font-size: 0.85em;
}
.gps-indicator .dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; animation: pulse 2s infinite; }
.gps-indicator[hidden] { display: none; }
.gps-indicator--hint {
  background: #f1f5f9;
  color: #334155;
}
.gps-indicator--hint .dot,
.gps-indicator .dot--muted {
  background: #94a3b8;
  animation: none;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- Persistent location-permission banner --------------------------- */
/* Lives in templates/base.html outside <main> so it survives client-side
   page-swaps. Populated by static/js/shift-gps.js whenever a caregiver
   in the native app has location permission denied. The slot itself is
   always present and just sizes to its (often empty) child. */
.gps-permission-banner-slot:empty {
  display: none;
}
.gps-permission-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #fef3c7;
  color: #78350f;
  border-bottom: 1px solid #fcd34d;
  font-size: 0.92em;
  line-height: 1.35;
}
.gps-permission-banner__msg {
  flex: 1 1 240px;
  min-width: 0;
}
.gps-permission-banner__btn {
  flex: 0 0 auto;
  background: #b45309;
  color: #fff;
  border: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9em;
  cursor: pointer;
}
.gps-permission-banner__btn:disabled {
  opacity: 0.7;
  cursor: progress;
}
.gps-permission-banner__btn:hover:not(:disabled) {
  background: #92400e;
}

/* Inline permission-error block under the Start Shift button. Mirrors
   the banner palette so the two reads as one error condition. */
.cs-permission-error {
  margin-top: 10px;
  padding: 12px 14px;
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  font-size: 0.92em;
  line-height: 1.4;
}
.cs-permission-error[hidden] { display: none; }
.cs-permission-error__msg {
  margin: 0 0 8px 0;
}
.start-rithma-popup {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.9em;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.start-rithma-popup[hidden] {
  display: none;
}
.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.notification-item.unread {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.notification-item__body p {
  margin: 4px 0 6px;
  color: var(--muted);
}
.stat-split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 10px;
}
.stat-split-row > div + div {
  border-left: 1px solid var(--border);
  padding-left: 10px;
}
.stat-split-row .value {
  line-height: 1;
}
.stat-card-link {
  display: block;
  color: inherit;
}
.stat-card-link:hover {
  text-decoration: none;
}
.assignment-status-card {
  border-left: 4px solid #2563eb;
}
.assignment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.muted { color: var(--muted); }
.text-sm { font-size: 0.88em; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* --- Form aliases & layout used across role pages --- */
/* `.form-field` mirrors `.form-group` so old markup works the same. */
.form,
.form-field {
  margin-bottom: 14px;
}
.form-field label,
.form > label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9em;
  color: var(--text);
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="tel"],
.form-field input[type="password"],
.form-field input[type="date"],
.form-field input[type="time"],
.form-field input[type="number"],
.form-field input[type="url"],
.form-field input[type="search"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95em;
  font-family: inherit;
  background: white;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field input[type="checkbox"],
.form-field input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0 6px 0 0;
  vertical-align: middle;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-field label:has(> input[type="checkbox"]),
.form-field label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
}

/* Button row at the bottom of a form. */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  align-items: center;
}

/* Two-column responsive grid (used by family/senior cards). */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* Button variants used in some templates. */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-link {
  background: transparent;
  color: var(--primary);
  border: 0;
  padding: 4px 6px;
  text-decoration: underline;
  box-shadow: none;
}
.btn-link:hover { background: transparent; color: var(--primary-dark); }
.btn-link.btn-danger { color: var(--danger); background: transparent; }
.btn-link.btn-danger:hover { color: #991b1b; background: transparent; }
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Linked-seniors list on family/profile.html */
.senior-list { list-style: none; padding: 0; margin: 0; }
.senior-list li {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  background: var(--bg);
}

/* Message pages */
.messages-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.messages-header {
  align-items: flex-start;
  margin-bottom: 0;
}
.messages-header h1 {
  margin-bottom: 4px;
}
.messages-header p {
  margin: 0;
  max-width: 680px;
}
.msg-filter-card {
  padding: 16px 18px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(20, 184, 166, 0.06)),
    var(--card);
}
.msg-filter-card select {
  max-width: 360px;
}
.messages-grid {
  align-items: start;
}
.msg-compose-card,
.msg-inbox-card,
.msg-sent-card {
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}
.msg-compose-card {
  position: sticky;
  top: 18px;
}
.msg-sent-card {
  margin-top: 4px;
}
.msg-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.msg-card-head h3 {
  margin: 0 0 2px;
}
.msg-card-head p {
  margin: 0;
}
.msg-count-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.82em;
  font-weight: 700;
  white-space: nowrap;
}
.msg-compose-card select[multiple] {
  min-height: 190px;
  border-radius: 12px;
  background: #f8fafc;
}
.msg-compose-card textarea {
  min-height: 130px;
  border-radius: 12px;
}
.msg-compose-card input[type="text"] {
  border-radius: 12px;
}
.msg-list {
  list-style: none;
  padding: 2px;
  margin: 0;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg-list > li {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.msg-list > li:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}
.msg-list > li.unread {
  border-color: rgba(37, 99, 235, 0.38);
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.85), #ffffff);
}
.msg-list > li.unread .msg-meta strong { color: var(--primary-dark); }

/* The foldable element inside each <li> */
.msg-item { width: 100%; }
.msg-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  user-select: none;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: start;
  position: relative;
}
.msg-item > summary::-webkit-details-marker { display: none; }
.msg-item > summary::before {
  content: ">";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  transition: transform 0.15s ease;
  font-size: 0.75em;
  font-weight: 800;
}
.msg-item[open] > summary::before { transform: rotate(90deg); }
.msg-item[data-unread="1"] > summary::after {
  content: '';
  position: absolute;
  top: 16px;
  right: 16px;
  display: block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}
.msg-item .msg-snippet {
  grid-column: 2;
  display: block;
  margin: 2px 18px 0 0;
  color: var(--muted);
  font-size: 0.9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-item[data-unread="1"] .msg-snippet,
.msg-item[data-unread="1"] .msg-meta {
  font-weight: 500;
  color: var(--text);
}
.msg-item .msg-body {
  margin: 0 16px 16px 46px;
  padding: 12px 14px;
  border-left: 3px solid var(--primary-light);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.95em;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.msg-meta {
  grid-column: 2;
  display: block;
  min-width: 0;
  padding-right: 18px;
  font-size: 0.92em;
  color: var(--text);
}
.msg-subject { font-weight: 600; }
.msg-empty {
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f8fafc;
}
@media (max-width: 800px) {
  .messages-page {
    gap: 14px;
  }
  .msg-compose-card {
    position: static;
  }
  .msg-card-head {
    align-items: flex-start;
  }
  .msg-list {
    max-height: none;
  }
}
@media (max-width: 520px) {
  .msg-card-head {
    flex-direction: column;
  }
  .msg-count-pill {
    align-self: flex-start;
  }
  .msg-item > summary {
    padding: 12px 14px;
  }
  .msg-item .msg-body {
    margin: 0 14px 14px;
  }
}

/* Inline-action mini forms (e.g. "Remove" inside a table row) should not
   add their own block spacing or stretch. */
table .form-group,
table form,
.row-flex form {
  margin: 0;
}

/* Address autocomplete suggestions */
.addr-suggest {
  position: absolute;
  z-index: 200;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.92em;
}
.addr-suggest-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.35;
}
.addr-suggest-item:last-child { border-bottom: 0; }
.addr-suggest-item:hover,
.addr-suggest-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Scroll-snap time picker */
.tp-wrap {
  position: relative;
  display: inline-block;
  margin-top: 4px;
}
.tp-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  cursor: pointer;
  min-width: 140px;
  justify-content: space-between;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.tp-display:hover {
  border-color: var(--primary);
}
.tp-display--empty {
  color: var(--muted);
  font-weight: 500;
}
.tp-wrap.tp-open .tp-display {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.tp-display-label {
  font-weight: 600;
}
.tp-display-caret {
  color: var(--muted);
  font-size: 0.8em;
  transition: transform 0.15s ease;
}
.tp-wrap.tp-open .tp-display-caret {
  transform: rotate(180deg);
}
.tp-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 10px;
}
.tp-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.tp-done {
  padding: 6px 14px;
  background: var(--primary);
  color: white;
  border: 0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.tp-done:hover { background: var(--primary-dark); }
.tp-picker {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 6px 10px;
  background: white;
  border-radius: 10px;
  width: max-content;
}
.tp-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 40px;
  transform: translateY(-50%);
  border-top: 1px solid var(--primary-light);
  border-bottom: 1px solid var(--primary-light);
  background: var(--primary-light);
  border-radius: 6px;
  pointer-events: none;
  opacity: 0.55;
}
.tp-col {
  position: relative;
  width: 56px;
  height: 200px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 1;
}
.tp-col::-webkit-scrollbar { display: none; }
.tp-col-inner {
  display: flex;
  flex-direction: column;
}
.tp-item {
  height: 40px;
  line-height: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  color: var(--muted);
  scroll-snap-align: center;
  cursor: pointer;
  transition: color 0.15s ease, font-weight 0.15s ease, transform 0.15s ease;
  user-select: none;
}
.tp-item.tp-spacer {
  pointer-events: none;
  cursor: default;
}
.tp-item.tp-active {
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 1.2rem;
}
.tp-sep {
  align-self: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 2px;
  z-index: 2;
}

/* Agency: second-step removal confirmation modal */
.agency-removal-overlay[hidden],
.agency-removal-overlay[aria-hidden="true"] {
  display: none !important;
}
.agency-removal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.5);
}
.agency-removal-overlay__dialog {
  width: min(100%, 420px);
  max-height: min(90vh, 520px);
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
  border: 1px solid var(--border);
}
.agency-removal-overlay__head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.agency-removal-overlay__title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text);
}
.agency-removal-overlay__body {
  padding: 16px 20px;
}
.agency-removal-overlay__foot {
  padding: 12px 20px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}
.agency-removal-overlay__msg {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 0.95rem;
}
.agency-removal-overlay label.agency-removal-overlay__ack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
}
.agency-removal-overlay label.agency-removal-overlay__ack input {
  margin-top: 3px;
  flex-shrink: 0;
}

/* === Voice input ========================================================
   `static/js/voice-input.js` wraps qualifying text inputs / textareas in
   `.voice-input-wrap` and appends a mic button on the trailing edge.
   The button is only injected when an engine is verified available, so
   in environments without speech recognition this layer adds nothing
   to the page. */
.voice-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}
/* Reserve room on the right of the field for the mic button. The
   `!important` overrides the default 11px form-group padding. */
.voice-input-wrap > input,
.voice-input-wrap > textarea {
  padding-right: 42px !important;
}
.voice-input-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
/* For single-line inputs, vertically centre the icon instead of pinning
   to the top — the input is short enough that centering looks better. */
.voice-input-wrap:not(.voice-input-wrap--textarea) .voice-input-btn {
  top: 50%;
  transform: translateY(-50%);
}
.voice-input-wrap:not(.voice-input-wrap--textarea) .voice-input-btn:active {
  transform: translateY(-50%) scale(0.92);
}
.voice-input-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}
.voice-input-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.voice-input-wrap--textarea .voice-input-btn:active {
  transform: scale(0.92);
}
/* Listening state — red mic with a soft ring pulse, mirroring the
   feedback iOS Dictation gives when the keyboard mic is active. */
.voice-input-btn--listening,
.voice-input-btn--listening:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  animation: voice-input-pulse 1.2s ease-in-out infinite;
}
.voice-input-btn--error {
  animation: voice-input-shake 0.4s linear 1;
  color: var(--danger);
}
@keyframes voice-input-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
@keyframes voice-input-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}
/* On single-line inputs the centering transform is needed during the
   shake / pulse, so override the keyframes to keep `translateY(-50%)`. */
.voice-input-wrap:not(.voice-input-wrap--textarea) .voice-input-btn--listening {
  animation: voice-input-pulse-centered 1.2s ease-in-out infinite;
}
.voice-input-wrap:not(.voice-input-wrap--textarea) .voice-input-btn--error {
  animation: voice-input-shake-centered 0.4s linear 1;
}
@keyframes voice-input-pulse-centered {
  0%, 100% {
    transform: translateY(-50%);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45);
  }
  50% {
    transform: translateY(-50%);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
  }
}
@keyframes voice-input-shake-centered {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  25%      { transform: translateY(-50%) translateX(-3px); }
  75%      { transform: translateY(-50%) translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-input-btn--listening,
  .voice-input-wrap:not(.voice-input-wrap--textarea) .voice-input-btn--listening {
    animation: none;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.35);
  }
  .voice-input-btn--error,
  .voice-input-wrap:not(.voice-input-wrap--textarea) .voice-input-btn--error {
    animation: none;
  }
}

/* === Shift Logs (per-shift Logs tab) ====================================
   Shared by every role's shift_page.html via templates/_shift_logs.html.
   The vital-signs sub-tab has 13 columns — too many for the default
   .table-app-list mobile reflow which would stack each row into a tall
   unreadable card. Instead we keep a real <table> with horizontal
   scroll, a sticky header, and a fixed visible-row cap that scrolls
   in place vertically when the list grows past ~10 rows. ====================== */
.shift-logs-table-scroll {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow-x: auto;
  overflow-y: auto;
  /* thead (~40px) + 10 typical rows (~44px) + 8px peek so the user
     sees there's more below the fold. Same heuristic as the global
     .table-scroll--max-rows utility, but kept local because that
     utility is desktop-only and we want phones to scroll vertically
     too. */
  max-height: calc(40px + 44px * 10 + 8px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.shift-logs-table {
  /* width: max-content forces columns to their natural width so they
     reach beyond the viewport and trigger horizontal scroll instead
     of squeezing into a too-narrow grid. */
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
  margin: 0;
  background: transparent;
}
.shift-logs-table th,
.shift-logs-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.shift-logs-table tbody td {
  white-space: normal;
}
.shift-logs-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
}
.shift-logs-table tbody tr:last-child td {
  border-bottom: 0;
}
.shift-logs-table tbody tr:hover td {
  background: var(--bg);
}

/* Add-entry form — clearly separates inputs, notes, and actions, and
   sizes each field by the column's declared `width` (set as the
   `--field-min` CSS variable from the spec) so wide fields like
   "Blood Sugar (mg/dL)" don't get the same width as a 2-character
   "Initials" cell. */
.shift-logs-add-form {
  background: var(--bg);
  padding: 14px 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shift-logs-add-form__header h4 {
  margin: 0 0 4px 0;
  font-size: 1rem;
}
.shift-logs-add-form__header p {
  margin: 0;
}
.shift-logs-add-form__grid {
  display: grid;
  /* Use the per-field `--field-min` variable as the minmax minimum so
     small fields (Initials, Pain) don't get the same column width as
     "Blood Sugar (mg/dL)". 1fr lets the row stretch to fill the card. */
  grid-template-columns: repeat(auto-fit, minmax(var(--shift-logs-field-min, 130px), 1fr));
  gap: 10px;
}
.shift-logs-add-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  --shift-logs-field-min: var(--field-min, 130px);
  min-width: var(--shift-logs-field-min);
}
.shift-logs-add-form__field > span {
  font-weight: 600;
  color: var(--muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shift-logs-add-form__field > input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.92rem;
}
.shift-logs-add-form__notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.shift-logs-add-form__notes > span {
  font-weight: 600;
  color: var(--muted, #6b7280);
}
.shift-logs-add-form__notes > textarea {
  width: 100%;
  resize: vertical;
}
.shift-logs-add-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .shift-logs-add-form__grid {
    /* Tighten the minimum on phones so two narrow numeric inputs can
       sit side-by-side instead of always stacking. */
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  .shift-logs-add-form__field {
    min-width: 0;
  }
  .shift-logs-add-form__actions {
    justify-content: stretch;
  }
  .shift-logs-add-form__actions > .btn {
    flex: 1 1 auto;
  }
  .shift-logs-table-scroll {
    /* Slightly shorter cap so the table doesn't dominate small screens. */
    max-height: calc(40px + 44px * 6 + 8px);
  }
}

/* Inline “Correct entry” disclosure — hide default marker when summary is styled as a button. */
.shift-log-row-correct > summary {
  list-style: none;
}
.shift-log-row-correct > summary::-webkit-details-marker {
  display: none;
}

/* Profile secondary nav (Profile / Billing tabs under account settings) */
.profile-secondary-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 20px;
  padding: 5px;
  background: color-mix(in srgb, var(--border, #e2e8f0) 45%, transparent);
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
}
.profile-secondary-nav__tab {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 9px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted, #64748b);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.profile-secondary-nav__tab:hover {
  color: var(--text, #0f172a);
  background: color-mix(in srgb, var(--surface, #fff) 70%, transparent);
}
.profile-secondary-nav__tab.is-active {
  color: var(--text, #0f172a);
  background: var(--surface, #fff);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Consumer household tier picker (primary user billing) */
.consumer-tier-switch {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.consumer-tier-switch__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.consumer-tier-switch__lead {
  margin: 0 0 16px;
}
.consumer-tier-switch__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.consumer-tier-option {
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid var(--border, #e2e8f0);
  background: var(--surface-alt, #f8fafc);
}
.consumer-tier-option--current {
  border-color: color-mix(in srgb, var(--success, #16a34a) 55%, var(--border));
  background: color-mix(in srgb, var(--success, #16a34a) 8%, var(--surface-alt, #f8fafc));
}
.consumer-tier-option__badge {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text, #0f172a);
}
.consumer-tier-option__badge--advanced {
  color: var(--accent-strong, #0369a1);
}
.consumer-tier-option__text {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
  line-height: 1.45;
}
.consumer-tier-switch__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.consumer-tier-switch__portal {
  margin: 0;
  padding-top: 6px;
}
.btn-text-like {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: var(--link, #0369a1);
  text-decoration: underline;
}
.btn-text-like:hover {
  color: var(--text, #0f172a);
}

.rithma-dialog {
  border: none;
  padding: 0;
  border-radius: 10px;
  max-width: 440px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
}
.rithma-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.rithma-dialog__panel {
  padding: 22px 24px;
}
.rithma-dialog__actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

/* Billing / subscription gate modal (native <dialog>) */
.billing-gate-modal {
  width: min(calc(100vw - 24px), 28rem);
  max-width: 100%;
  max-height: min(90vh, 32rem);
  margin: auto;
  overflow: hidden;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
}
.billing-gate-modal::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(2px);
}
.billing-gate-modal--warning .billing-gate-modal__head {
  background: color-mix(in srgb, var(--info, #2563eb) 10%, var(--card, #fff));
  border-bottom-color: color-mix(in srgb, var(--info, #2563eb) 28%, var(--border, #e2e8f0));
}
.billing-gate-modal--warning .billing-gate-modal__icon {
  background: color-mix(in srgb, var(--info, #2563eb) 18%, transparent);
  color: var(--info, #1d4ed8);
}
.billing-gate-modal--warning .billing-gate-modal__subtitle {
  color: var(--info, #1d4ed8);
}
.billing-gate-modal__surface {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 32rem);
}
.billing-gate-modal__head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: color-mix(in srgb, var(--warning, #d97706) 12%, var(--card, #fff));
}
.billing-gate-modal__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning, #d97706) 22%, transparent);
  color: var(--warning, #b45309);
}
.billing-gate-modal__icon svg {
  display: block;
}
.billing-gate-modal__head-text {
  min-width: 0;
}
.billing-gate-modal__title {
  margin: 0 0 4px;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text, #0f172a);
}
.billing-gate-modal__subtitle {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
}
.billing-gate-modal__body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.billing-gate-modal__lead {
  margin: 0 0 12px;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text, #0f172a);
}
.billing-gate-modal__hint {
  margin: 0;
  line-height: 1.45;
}
.billing-gate-modal__foot {
  flex-shrink: 0;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border, #e2e8f0);
  background: var(--surface-alt, #f8fafc);
}
.billing-gate-modal__actions-primary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.billing-gate-modal__actions-primary .billing-gate-modal__btn {
  text-align: center;
}
.billing-gate-modal__form {
  margin: 0;
}
@media (min-width: 420px) {
  .billing-gate-modal__actions-primary {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .billing-gate-modal__actions-primary .billing-gate-modal__btn {
    flex: 1 1 12rem;
    min-width: 0;
    width: auto !important;
  }
  .billing-gate-modal__actions-primary .billing-gate-modal__form {
    flex: 1 1 12rem;
    min-width: 0;
    display: flex;
  }
  .billing-gate-modal__actions-primary .billing-gate-modal__form .btn {
    width: 100%;
  }
}
.billing-gate-modal__actions-dismiss {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
  text-align: center;
}
.billing-gate-modal__dismiss {
  font-size: 0.92rem;
}

/* Post-agency Advanced retention (consumer household prompt) */
.advanced-retention-banner {
  margin: 0 0 20px;
  padding: 0;
}
.advanced-retention-banner__inner {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--primary, #0369a1) 35%, var(--border, #e2e8f0));
  background: color-mix(in srgb, var(--primary-light, #e0f2fe) 55%, var(--surface-alt, #f8fafc));
}
.advanced-retention-banner__household {
  margin: 0 0 8px;
}
.advanced-retention-banner__title {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text, #0f172a);
}
.advanced-retention-banner__inner > p {
  margin: 0 0 10px;
  line-height: 1.45;
  color: var(--text, #0f172a);
}
.advanced-retention-banner__inner > p:last-of-type {
  margin-bottom: 0;
}
.advanced-retention-banner__actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
