/* =============================================
   PredictiCare - Design System & Styles
   ============================================= */

:root {
  /* ═══════════════════════════════════════════════════════════════════════
     NEW DESIGN SYSTEM - warm, trustworthy, non-clinical (light values).
     Dark values live in the [data-theme=dark] / prefers-color-scheme blocks
     below so light+dark stay together per token. Canonical legacy tokens
     (--primary, --accent, --bg, --text…) are re-pointed at these so the whole
     platform recolors through one layer.
     ═══════════════════════════════════════════════════════════════════════ */
  --color-primary:       #3D7A73;   /* Sage Teal - brand, nav, active, links   */
  --color-primary-dark:  #2C5A55;   /* hover / pressed                          */
  --color-primary-tint:  #E3EEEC;   /* light sage surface (badge/active bg)     */
  --color-accent:        #C9704F;   /* Terracotta - PRIMARY CTA BUTTONS ONLY    */
  --color-accent-dark:   #A85B3D;   /* CTA hover / pressed                      */

  --color-bg:            #F7F3EC;   /* Warm Sand - page canvas (never card)     */
  --color-surface:       #FFFFFF;   /* card / panel                             */
  --color-surface-2:     #EFE9DE;   /* secondary surface / hover                */
  --color-text:          #2A3B3D;   /* Deep Ink                                 */
  --color-text-muted:    #566361;   /* captions/timestamps - darkened to ~5.7:1 on sand (AA) */
  --color-text-faint:    #7A8683;   /* tertiary                                 */

  --color-success:       #5F8D74;   /* Moss - confirmed / on schedule / done    */
  --color-success-dark:  #4E7561;   /* success button face (white text ~5.2:1)  */
  --color-warning:       #C98A2E;   /* Muted Gold - needs attention / pending   */
  --color-critical:      #A6473E;   /* Muted Rust - urgent action / routine err */
  --color-emergency:     #D32F2F;   /* RESERVED - true safety emergencies only  */

  --color-border:        #E4DDCF;   /* dividers / card borders                  */
  --color-border-strong: #D8CFBD;

  /* Light accent tints for text on the dark sage hero (KPI numbers etc.).
     The hero is always dark in both themes, so these are single values. */
  --on-hero-positive:    #9FE3C0;   /* light mint - good / on-track metrics */
  --on-hero-attention:   #F3B58C;   /* light amber - needs-attention metrics */

  /* ── Canonical legacy tokens, re-pointed at the new palette ─────────────── */
  --primary:        var(--color-primary-dark);
  --primary-mid:    var(--color-primary);
  --primary-light:  #5A9C94;
  --accent:         var(--color-primary);   /* active/underline/focus = sage (accent≠CTA) */
  --accent-bg:      var(--color-primary-tint);

  --bg:             var(--color-bg);
  --bg-card:        var(--color-surface);
  --bg-secondary:   var(--color-surface-2);
  --bg-hover:       var(--color-surface-2);

  --text:           var(--color-text);
  --text-2:         var(--color-text-muted);
  --text-3:         var(--color-text-faint);

  --border:         var(--color-border);
  --border-md:      var(--color-border-strong);

  --radius-sm:      5px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  /* Risk / Stability Index - CLINICAL 4-level pattern, intentionally UNCHANGED */
  --green:          #3B6D11;
  --green-mid:      #639922;
  --green-bg:       #EAF3DE;
  --green-border:   #C0DD97;
  --yellow:         #BA7517;
  --yellow-mid:     #EF9F27;
  --yellow-bg:      #FAEEDA;
  --yellow-border:  #FAC775;
  --orange:         #D85A30;
  --orange-mid:     #F0997B;
  --orange-bg:      #FAECE7;
  --orange-border:  #F5C4B3;
  --red:            #A32D2D;
  --red-mid:        #E24B4A;
  --red-bg:         #FCEBEB;
  --red-border:     #F7C1C1;

  --shadow-sm:  0 1px 3px rgba(40,50,50,0.10);
  --shadow-md:  0 2px 8px rgba(40,50,50,0.12);
  --shadow-lg:  0 4px 20px rgba(40,50,50,0.16);

  /* ─────────────────────────────────────────────────────────────────────
     TOKEN ALIASES - single source of truth.
     Historically the codebase accrued a second naming convention
     (--color-*, --border-radius-*, --text-1, --bg-primary, etc.). Rather
     than rewrite every call site, these alias the canonical tokens above so
     all references resolve consistently in both the prototype and any
     production build. Prefer the canonical names for NEW code.
     ───────────────────────────────────────────────────────────────────── */
  --text-1:                    var(--text);
  --color-text-secondary:      var(--text-2);
  --color-text-tertiary:       var(--text-3);
  --color-text-danger:         var(--color-critical);   /* routine errors → muted rust */
  --color-text-success:        var(--color-success);
  --color-text-warning:        var(--color-warning);
  --text-info:                 var(--color-primary);

  --bg-primary:                var(--bg-card);
  --bg-2:                      var(--bg-secondary);
  --bg-3:                      var(--bg-hover);
  --bg-info:                   var(--color-primary-tint);
  --primary-bg:                var(--color-primary-tint);
  --color-background-secondary:var(--bg-secondary);
  --color-background-danger:   var(--color-critical-bg);
  --color-background-warning:  var(--color-warning-bg);

  --border-sm:                 var(--border);
  --border-info:               #C7D9D6;
  --color-border-tertiary:     var(--border);
  --color-border-secondary:    var(--border-md);
  --color-border-danger:       var(--color-critical);

  --border-radius-sm:          var(--radius-sm);
  --border-radius-md:          var(--radius-md);
  --border-radius-lg:          var(--radius-lg);

  --amber:                     var(--color-warning);

  /* Semantic status surface tints (for pills/toasts/banners, light) */
  --color-success-bg:          #E3EDE6;
  --color-warning-bg:          #F6ECD8;
  --color-critical-bg:         #F1E2DF;
  --color-emergency-bg:        #FBE4E4;
  /* Mode-aware badge text (dark in light mode / bright in dark mode) so pill
     labels stay legible on their tint in both themes */
  --color-success-text:        #3F6252;
  --color-warning-text:        #8A5E14;
  --color-critical-text:       #A6473E;
  --color-emergency-text:      #B02020;
}

/* ═══════════════════════════════════════════════════════════════════════
   DARK MODE
   Default source of truth = prefers-color-scheme. A manual choice stored on
   <html data-theme="dark|light"> takes precedence. Values are duplicated in
   both selectors intentionally (CSS has no shared custom-media) so the two
   never drift - edit them together.
   Clinical Stability hues are preserved; only their dark surface tints and a
   legibility-lightened foreground apply in dark mode (flagged for review).
   ═══════════════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary:       #4E9089;
    --color-primary-dark:  #3D7A73;
    --color-primary-tint:  rgba(78,144,137,0.16);
    --color-accent:        #D68A66;
    --color-accent-dark:   #C9704F;
    --color-bg:            #1B2422;
    --color-surface:       #232E2B;
    --color-surface-2:     #2C3835;
    --color-text:          #EAF0EE;
    --color-text-muted:    #8AA6A0;
    --color-text-faint:    #6E837E;
    --color-success:       #7FB396;
    --color-warning:       #D9A441;
    --color-critical:      #C15F55;
    --color-emergency:     #E5534B;
    --color-border:        rgba(255,255,255,0.08);
    --color-border-strong: rgba(255,255,255,0.14);
    --color-success-bg:    rgba(127,179,150,0.16);
    --color-warning-bg:    rgba(217,164,65,0.16);
    --color-critical-bg:   rgba(193,95,85,0.18);
    --color-emergency-bg:  rgba(229,83,75,0.20);
    --color-success-text:  #7FB396;
    --color-warning-text:  #D9A441;
    --color-critical-text: #C15F55;
    --color-emergency-text:#E5534B;
    --border-info:         rgba(255,255,255,0.12);
    --primary-light:       #63A79E;
    --green:  #8CBE4F; --green-bg:  rgba(99,153,34,0.18);  --green-border:  rgba(99,153,34,0.4);
    --yellow: #E7A93C; --yellow-bg: rgba(239,159,39,0.16); --yellow-border: rgba(239,159,39,0.4);
    --orange: #EE8A63; --orange-bg: rgba(216,90,48,0.16);  --orange-border: rgba(216,90,48,0.4);
    --red:    #E0736B; --red-bg:    rgba(226,75,74,0.16);  --red-border:    rgba(226,75,74,0.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.45);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.5);
  }
}
:root[data-theme="dark"] {
  --color-primary:       #4E9089;
  --color-primary-dark:  #3D7A73;
  --color-primary-tint:  rgba(78,144,137,0.16);
  --color-accent:        #D68A66;
  --color-accent-dark:   #C9704F;
  --color-bg:            #1B2422;
  --color-surface:       #232E2B;
  --color-surface-2:     #2C3835;
  --color-text:          #EAF0EE;
  --color-text-muted:    #8AA6A0;
  --color-text-faint:    #6E837E;
  --color-success:       #7FB396;
  --color-warning:       #D9A441;
  --color-critical:      #C15F55;
  --color-emergency:     #E5534B;
  --color-border:        rgba(255,255,255,0.08);
  --color-border-strong: rgba(255,255,255,0.14);
  --color-success-bg:    rgba(127,179,150,0.16);
  --color-warning-bg:    rgba(217,164,65,0.16);
  --color-critical-bg:   rgba(193,95,85,0.18);
  --color-emergency-bg:  rgba(229,83,75,0.20);
  --border-info:         rgba(255,255,255,0.12);
  --primary-light:       #63A79E;
  --green:  #8CBE4F; --green-bg:  rgba(99,153,34,0.18);  --green-border:  rgba(99,153,34,0.4);
  --yellow: #E7A93C; --yellow-bg: rgba(239,159,39,0.16); --yellow-border: rgba(239,159,39,0.4);
  --orange: #EE8A63; --orange-bg: rgba(216,90,48,0.16);  --orange-border: rgba(216,90,48,0.4);
  --red:    #E0736B; --red-bg:    rgba(226,75,74,0.16);  --red-border:    rgba(226,75,74,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.45);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.5);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: var(--bg); color: var(--text); min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* Visible keyboard focus for accessibility (mouse clicks stay unaffected) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
[role="button"]:focus-visible, .nav-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Global Nav ---- */
.global-nav {
  background: var(--primary);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.cg-nav { background: #0F6E56; }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.logo-mark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 17px;
  flex-shrink: 0;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-name  { font-size: 15px; font-weight: 600; color: #fff; }
.logo-agency{ font-size: 10px; color: rgba(255,255,255,0.45); }

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px; height: 52px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.55);
  background: none; border: none;
  border-bottom: 3px solid transparent;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-btn i { font-size: 16px; }
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-btn.active { color: #fff; border-bottom-color: var(--accent); }

/* Grouped "Setup" dropdown in the global nav */
.nav-dropdown { position: relative; display: flex; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%; right: 0;
  min-width: 210px;
  background: var(--primary-mid);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
}
.nav-dropdown-menu.open { display: block; }
.nav-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 12px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.75);
  background: none; border: none;
  border-radius: var(--radius-sm);
  text-align: left;
}
.nav-menu-item i { font-size: 16px; }
.nav-menu-item:hover { background: rgba(255,255,255,0.10); color: #fff; }
.nav-menu-item.active { color: #fff; background: rgba(93,202,165,0.18); }

.nav-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}

.theme-toggle {
  background: rgba(255,255,255,0.12);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.theme-toggle:hover { background: rgba(255,255,255,0.22); }

/* Personal account menu (top-right avatar dropdown) */
.acct-menu {
  position: fixed; top: 54px; right: 14px; z-index: 300;
  min-width: 230px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.acct-menu-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.acct-menu-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-menu-sub  { font-size: 11px; color: var(--text-2); }
.acct-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 9px 12px;
  font-size: 13px; color: var(--text);
  background: none; border: none;
  border-radius: var(--radius-sm);
}
.acct-menu-item i { font-size: 16px; color: var(--text-2); }
.acct-menu-item:hover { background: var(--bg-secondary); }

.role-switcher {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}
.role-btn {
  padding: 4px 12px;
  font-size: 11px; font-weight: 500;
  color: rgba(255,255,255,0.6);
  background: none; border: none;
  border-radius: 16px;
  transition: all .15s;
}
.role-btn.active { background: rgba(255,255,255,0.2); color: #fff; }
.role-btn:hover:not(.active) { color: #fff; }

.nav-alert-bell {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(255,255,255,0.6);
  border-radius: 50%;
  transition: background .15s;
}
.nav-alert-bell:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-alert-bell i { font-size: 20px; }
.bell-badge {
  position: absolute; top: 4px; right: 4px;
  background: #E24B4A; color: #fff;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--primary);
}

.nav-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 8px 4px 4px;
  border-radius: 20px;
  transition: background .15s;
}
.nav-user:hover { background: rgba(255,255,255,0.1); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: #fff;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 12px; color: rgba(255,255,255,0.8); }

/* ---- Breadcrumb ---- */
.breadcrumb-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 38px;
  display: flex; align-items: center;
}
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2);
}
.breadcrumb .bc-sep { color: var(--text-3); }
.breadcrumb .bc-link { cursor: pointer; color: var(--primary-light); }
.breadcrumb .bc-link:hover { text-decoration: underline; }
.breadcrumb .bc-current { color: var(--text); font-weight: 500; }

/* ---- Layout Utilities ---- */
.page-wrap   { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-wrap-sm{ padding: 20px 24px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad  { padding: 16px 18px; }
.card-head {
  font-size: 13px; font-weight: 600;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  color: var(--text);
}
.card-head .ch-icon { font-size: 17px; color: var(--primary-mid); margin-right: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* ---- KPI Stat Cards ---- */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.kpi-label { font-size: 11px; color: var(--text-2); margin-bottom: 5px; }
.kpi-num   { font-size: 26px; font-weight: 600; line-height: 1; margin-bottom: 3px; }
.kpi-sub   { font-size: 11px; color: var(--text-3); }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.form-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26,58,92,0.1);
}
textarea.form-control { resize: vertical; min-height: 76px; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.form-hint { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-section {
  font-size: 11px; font-weight: 600;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.form-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }

.checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 3px 0;
}
.checkbox-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary-mid); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius-md);
  border: none; cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn i { font-size: 16px; }
/* Primary CTA = terracotta accent. Uses the -dark face so white labels clear
   AA (~5:1) on field-facing screens; brightens slightly on hover. */
.btn-primary   { background: var(--color-accent-dark); color: #fff; }
.btn-primary:hover   { filter: brightness(1.06); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border-md); }
.btn-secondary:hover { background: var(--bg-secondary); }
.btn-success   { background: var(--color-success-dark); color: #fff; }
.btn-success:hover   { filter: brightness(1.06); }
/* Destructive/routine-danger = muted rust critical (NOT emergency red) */
.btn-danger    { background: var(--color-critical); color: #fff; }
.btn-danger:hover    { filter: brightness(0.93); }
.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 11px 24px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Badges / Pills ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
/* Clinical Stability badges - intentionally unchanged */
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
/* Non-clinical badges → new palette */
.badge-blue   { background: var(--color-primary-tint); color: var(--color-primary); }
.badge-gray   { background: var(--bg-secondary); color: var(--text-2); }
.badge-teal   { background: var(--color-primary-tint); color: var(--color-primary-dark); }
/* Semantic status pills - success / warning / critical / emergency */
.badge-success   { background: var(--color-success-bg);   color: var(--color-success-text); }
.badge-warning   { background: var(--color-warning-bg);   color: var(--color-warning-text); }
.badge-critical  { background: var(--color-critical-bg);  color: var(--color-critical-text); }
.badge-emergency { background: var(--color-emergency-bg); color: var(--color-emergency-text); }

/* ---- Risk dot ---- */
.risk-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.risk-dot.green  { background: var(--green); }
.risk-dot.yellow { background: var(--yellow-mid); }
.risk-dot.orange { background: var(--orange); }
.risk-dot.red    { background: var(--red-mid); }

/* ---- Toggle Switch ---- */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-wrap:last-child { border-bottom: none; padding-bottom: 0; }
.toggle-info h4  { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.toggle-info p   { font-size: 11px; color: var(--text-2); line-height: 1.5; }
.toggle {
  width: 40px; height: 22px;
  background: var(--border-md);
  border-radius: 11px; position: relative;
  cursor: pointer; flex-shrink: 0;
  transition: background .2s;
  border: none;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  top: 3px; left: 3px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { left: 21px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 999;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-critical); }   /* routine errors → muted rust, not emergency */
.toast.warning { background: var(--color-warning); }
.toast.emergency { background: var(--color-emergency); } /* reserved: true safety alerts only */

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 540px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  font-size: 16px; font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 50%; border: none;
  background: var(--bg-secondary);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
}

/* ============================================
   HOME PAGE
   ============================================ */
.home-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  padding: 32px 24px 28px;
}
.home-hero h1 { font-size: 22px; font-weight: 600; color: #fff; margin-bottom: 4px; }
.home-hero p  { font-size: 13px; color: rgba(255,255,255,0.55); }
.home-kpi-strip {
  display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap;
}
.home-kpi {
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  min-width: 120px;
}
.home-kpi .k-num { font-size: 22px; font-weight: 700; color: #fff; }
.home-kpi .k-lbl { font-size: 11px; color: rgba(255,255,255,0.5); }

.home-body { padding: 24px; background: var(--bg); }

.nav-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.nav-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(93,202,165,0.15);
}
.nc-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.nc-blue   { background: #E6F1FB; color: var(--primary-mid); }
.nc-teal   { background: var(--accent-bg); color: #0F6E56; }
.nc-purple { background: #EEEDFE; color: #534AB7; }
.nc-amber  { background: #FAEEDA; color: #854F0B; }
.nc-title  { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.nc-desc   { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.nc-arrow  { margin-top: auto; font-size: 18px; color: var(--text-3); transition: color .15s; }
.nav-card:hover .nc-arrow { color: var(--accent); }

.home-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.alert-list-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.alert-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.alert-list-item:hover { background: var(--bg-hover); margin: 0 -4px; padding: 9px 4px; border-radius: var(--radius-sm); }
.ali-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.ali-title { font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.ali-sub   { font-size: 11px; color: var(--text-2); line-height: 1.4; }
.ali-time  { margin-left: auto; font-size: 10px; color: var(--text-3); flex-shrink: 0; white-space: nowrap; }

.visit-list-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.visit-list-item:last-child { border-bottom: none; padding-bottom: 0; }
.vli-av {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-mid);
  color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.vli-info { flex: 1; }
.vli-name { font-weight: 500; }
.vli-sub  { font-size: 11px; color: var(--text-2); }

/* ============================================
   DIRECTORY (Clients / Caregivers)
   ============================================ */
.dir-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 90px);
}
.dir-toolbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.search-wrap {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  flex: 1; max-width: 320px;
}
.search-wrap i   { font-size: 16px; color: var(--text-3); flex-shrink: 0; }
.search-wrap input {
  background: none; border: none; outline: none;
  font-size: 13px; color: var(--text); width: 100%;
}
.filter-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border-md);
  border-radius: 20px;
  font-size: 12px; color: var(--text-2);
  background: var(--bg-card);
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.filter-pill:hover { background: var(--bg-secondary); }
.filter-pill.active { background: var(--accent-bg); border-color: var(--accent); color: #0F6E56; font-weight: 500; }
.filter-pill i { font-size: 14px; }

.dir-body {
  display: flex; flex: 1; overflow: hidden;
}
.dir-list {
  width: 320px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-card);
}
.dir-list-count {
  padding: 8px 16px;
  font-size: 11px; color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.dir-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.dir-row:hover    { background: var(--bg-hover); }
.dir-row.selected { background: #EFF6FF; border-left: 3px solid var(--primary-mid); padding-left: 13px; }
.dr-av {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-mid); color: #fff;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dr-info h4   { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.dr-info p    { font-size: 11px; color: var(--text-2); }
.dr-right     { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dr-date      { font-size: 10px; color: var(--text-3); }

.dir-detail {
  flex: 1; overflow-y: auto;
  background: var(--bg);
  padding: 20px;
}
.dir-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-3); gap: 10px; padding: 40px;
  text-align: center;
}
.dir-empty i { font-size: 40px; opacity: .3; }
.dir-empty p { font-size: 13px; }

/* detail panel inside directory */
.detail-hero {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 14px;
}
.detail-av {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary-mid); color: #fff;
  font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.detail-info h2 { font-size: 17px; font-weight: 600; margin-bottom: 3px; }
.detail-info p  { font-size: 12px; color: var(--text-2); }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }

.kv-table { width: 100%; }
.kv-table tr td { padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.kv-table tr:last-child td { border-bottom: none; padding-bottom: 0; }
.kv-table td:first-child { color: var(--text-2); width: 45%; }
.kv-table td:last-child  { font-weight: 500; text-align: right; }

/* stability mini timeline */
.stability-mini {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  margin-bottom: 5px;
}
.sm-green  { background: var(--green-bg);  border: 1px solid var(--green-border); }
.sm-yellow { background: var(--yellow-bg); border: 1px solid var(--yellow-border); }
.sm-orange { background: var(--orange-bg); border: 1px solid var(--orange-border); }
.sm-red    { background: var(--red-bg);    border: 1px solid var(--red-border); }
.sm-date  { font-weight: 600; min-width: 50px; flex-shrink: 0; }
.sm-notes { flex: 1; color: var(--text-2); }
.sm-level { font-weight: 600; flex-shrink: 0; }

/* ============================================
   CLIENT PROFILE - TABS
   ============================================ */
.profile-header {
  background: var(--primary-mid);
  padding: 16px 24px;
  display: flex; align-items: center; gap: 14px;
}
.profile-header-av {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 17px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-header-info h1 { font-size: 18px; font-weight: 600; color: #fff; margin-bottom: 3px; }
.profile-header-info p  { font-size: 12px; color: rgba(255,255,255,0.6); }
.profile-header-right   { margin-left: auto; display: flex; gap: 9px; align-items: center; }

/* Top-level grouped tabs (client profile) */
.profile-groups {
  background: var(--primary);
  display: flex; overflow-x: auto; flex-shrink: 0;
  padding: 0 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.profile-group {
  display: flex; align-items: center; gap: 7px;
  padding: 0 20px; height: 46px;
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,0.55);
  background: none; border: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap; cursor: pointer;
  transition: all .15s;
}
.profile-group i { font-size: 16px; }
.profile-group:hover  { color: rgba(255,255,255,0.9); }
.profile-group.active { color: #fff; border-bottom-color: var(--accent); }

.profile-tabs {
  background: var(--primary-mid);
  display: flex; overflow-x: auto; flex-shrink: 0;
}
.profile-tabs::-webkit-scrollbar { height: 2px; }
.profile-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 0 18px; height: 42px;
  font-size: 12px; font-weight: 500;
  color: rgba(255,255,255,0.5);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap; cursor: pointer;
  transition: all .15s;
}
.profile-tab i { font-size: 15px; }
.profile-tab:hover  { color: rgba(255,255,255,0.85); }
.profile-tab.active { color: #fff; border-bottom-color: var(--accent); }
.profile-tab .tab-badge {
  background: rgba(240,153,123,0.3);
  color: #F0997B;
  border-radius: 8px; padding: 1px 5px;
  font-size: 10px;
}

.profile-body { background: var(--bg); padding: 20px 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ADL History bars */
.adl-trend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.adl-trend-card { padding: 12px; }
.adl-trend-card h4 { font-size: 12px; font-weight: 600; margin-bottom: 9px; display: flex; align-items: center; gap: 5px; }
.adl-trend-card h4 i { font-size: 15px; color: var(--primary-mid); }
.trend-bar-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: 11px; }
.trend-date { color: var(--text-3); width: 46px; flex-shrink: 0; }
.trend-track { flex: 1; height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.trend-fill  { height: 100%; border-radius: 4px; }
.tf-ok   { background: var(--green); }
.tf-warn { background: var(--yellow-mid); }
.tf-risk { background: var(--orange); }
.tf-crit { background: var(--red-mid); }
.trend-label { font-size: 10px; min-width: 60px; }

/* Care notes */
.note-card { padding: 12px; margin-bottom: 8px; }
.note-header { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.note-av { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-mid); color: #fff; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.note-meta { font-size: 11px; color: var(--text-2); }
.note-body { font-size: 12px; line-height: 1.7; color: var(--text); }
.note-flags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.note-flag { font-size: 10px; padding: 2px 7px; border-radius: 8px; background: var(--yellow-bg); color: var(--yellow); }
.note-flag.danger { background: var(--red-bg); color: var(--red); }

/* Healthcare */
.dx-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.dx-row:last-child { border-bottom: none; }
.dx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); flex-shrink: 0; }
.dx-name { flex: 1; font-weight: 500; }
.dx-since { color: var(--text-3); font-size: 11px; }
.med-row  { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.med-row:last-child { border-bottom: none; }
.med-name { flex: 1; font-weight: 500; }
.med-dose { color: var(--text-2); }

/* Alert rows */
.alert-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: 8px;
}
.alert-card.red    { background: var(--red-bg);    border-color: var(--red-border); }
.alert-card.orange { background: var(--orange-bg); border-color: var(--orange-border); }
.alert-card.yellow { background: var(--yellow-bg); border-color: var(--yellow-border); }
.alert-card.green  { background: var(--green-bg);  border-color: var(--green-border); }
.alert-card i { font-size: 19px; flex-shrink: 0; margin-top: 1px; }
.alert-card.red i    { color: var(--red); }
.alert-card.orange i { color: var(--orange); }
.alert-card.yellow i { color: var(--yellow); }
.alert-card.green i  { color: var(--green); }
.alert-card h4 { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.alert-card p  { font-size: 11px; color: var(--text-2); line-height: 1.6; }
.alert-time    { margin-left: auto; font-size: 10px; color: var(--text-3); flex-shrink: 0; white-space: nowrap; }

/* Documents */
.doc-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.doc-row:last-child { border-bottom: none; }
.doc-row i { font-size: 20px; color: var(--primary-mid); flex-shrink: 0; }
.doc-name  { flex: 1; font-weight: 500; }
.doc-meta  { color: var(--text-2); font-size: 11px; }
.upload-zone {
  border: 2px dashed var(--border-md);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.upload-zone i { font-size: 28px; display: block; margin-bottom: 7px; }

/* ============================================
   CAREGIVER CHECKOUT (EVV)
   ============================================ */
.checkout-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
  height: calc(100vh - 90px);
}

/* Left - mobile form */
.checkout-left {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-card);
}
.checkout-client-bar {
  background: var(--primary-mid);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.checkout-client-bar .cbar-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.checkout-client-bar h2 { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.checkout-client-bar p  { font-size: 11px; color: rgba(255,255,255,0.6); }

.env-bar {
  background: var(--primary);
  padding: 8px 14px;
  display: flex; gap: 10px; align-items: center;
  flex-shrink: 0;
}
.env-bar label { font-size: 10px; color: rgba(255,255,255,0.55); }
.env-input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: 12px; color: #fff;
  width: 100%;
}
.env-input option { color: #000; }

.season-alert {
  background: #7c2d12;
  color: #fde8d8;
  padding: 6px 14px;
  font-size: 11px;
  display: none;
  align-items: center;
  gap: 6px;
}
.season-alert.show { display: flex; }

.checkout-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cs-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 8px;
}

/* ADL card */
.adl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 7px;
  overflow: hidden;
}
.adl-card-head {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background .1s;
}
.adl-card-head:hover { background: var(--bg-hover); }
.adl-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-mid); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.adl-title { font-size: 13px; font-weight: 500; flex: 1; }
.adl-badge { margin-left: auto; }
.adl-chevron { font-size: 16px; color: var(--text-3); transition: transform .2s; }
.adl-card.open .adl-chevron { transform: rotate(180deg); }

.adl-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  display: none;
  background: var(--bg-secondary);
}
.adl-card.open .adl-body { display: block; }

.step-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-2); text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 6px; margin-top: 10px;
}
.step-label:first-child { margin-top: 0; }

/* Segmented buttons */
.seg-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.seg-btn {
  text-align: left;
  padding: 7px 11px;
  font-size: 12px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
}
.seg-btn:hover        { border-color: var(--primary-light); background: #EFF6FF; }
.seg-btn.sel-normal   { background: #EFF6FF; border-color: var(--primary-mid); color: var(--primary-mid); font-weight: 500; }
.seg-btn.sel-warn     { background: var(--yellow-bg); border-color: var(--yellow-mid); color: var(--yellow); font-weight: 500; }
.seg-btn.sel-danger   { background: var(--red-bg);    border-color: var(--red-mid);    color: var(--red);    font-weight: 500; }

/* Check grid */
.check-grid { display: flex; flex-direction: column; gap: 5px; }
.check-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  cursor: pointer; font-size: 12px; line-height: 1.4;
  transition: all .15s;
  background: var(--bg-card);
}
.check-item input { display: none; }
.check-item:hover   { background: var(--bg-hover); }
.check-item.checked { background: #EFF6FF; border-color: var(--primary-mid); color: var(--primary-mid); }
.check-item.checked-warn   { background: var(--yellow-bg); border-color: var(--yellow-mid); color: var(--yellow); }
.check-item.checked-danger { background: var(--red-bg);    border-color: var(--red-mid);    color: var(--red); }

/* Plate picker */
.plate-row { display: flex; gap: 6px; }
.plate-opt {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px;
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  cursor: pointer; font-size: 10px; text-align: center;
  transition: all .15s;
  background: var(--bg-card);
}
.plate-opt:hover { border-color: var(--primary-light); }
.plate-opt.sel   { border-color: var(--primary-mid); background: #EFF6FF; }
.plate-opt.sel-warn   { border-color: var(--yellow-mid); background: var(--yellow-bg); }
.plate-opt.sel-danger { border-color: var(--red-mid);    background: var(--red-bg); }
.plate-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-md);
  overflow: hidden; position: relative;
}
.plate-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #c8b04a;
}

/* Hydration */
.hydration-ctrl { display: flex; align-items: center; gap: 12px; }
.hyd-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-md);
  background: var(--bg-card);
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; color: var(--text);
}
.hyd-btn:hover { background: var(--primary-mid); color: #fff; border-color: var(--primary-mid); }
.hyd-count { font-size: 24px; font-weight: 700; min-width: 32px; text-align: center; }
.hyd-icons { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.hyd-icon  { font-size: 20px; color: var(--border-md); transition: color .15s; }
.hyd-icon.filled { color: var(--primary-mid); }

/* NLP warning */
.nlp-warn {
  background: var(--yellow-bg); border: 1px solid var(--yellow-border);
  border-radius: var(--radius-md);
  padding: 7px 10px; font-size: 11px; color: var(--yellow);
  margin-top: 6px; display: none;
  line-height: 1.5;
}
.nlp-warn.show { display: block; }

/* Progress bar */
.progress-wrap { margin-bottom: 3px; }
.progress-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.progress-track { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill  { height: 100%; background: var(--primary-mid); border-radius: 3px; transition: width .3s; }

/* Submit bar */
.checkout-submit {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.submit-main {
  width: 100%;
  padding: 12px;
  background: var(--primary-mid);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.submit-main:not(:disabled):hover { background: var(--primary-light); }
.submit-main:disabled {
  background: var(--bg-secondary);
  color: var(--text-3);
  cursor: not-allowed;
}
.submit-hint {
  font-size: 11px; color: var(--text-3);
  text-align: center; margin-top: 7px;
}

/* Right - live dashboard */
.checkout-right {
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
}
.stability-ring-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 14px;
}
.ring-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  flex-shrink: 0; transition: background .4s;
}
.ring-gray   { background: #9ca3af; }
.ring-green  { background: var(--green); }
.ring-yellow { background: var(--yellow); }
.ring-orange { background: var(--orange); }
.ring-red    { background: var(--red-mid); }

.ring-info h3 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.ring-info p  { font-size: 12px; color: var(--text-2); }

.adl-flag-row { display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.adl-flag-row:last-child { border-bottom: none; }
.afr-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.afr-adl { font-weight: 500; min-width: 80px; }
.afr-note { flex: 1; color: var(--text-2); }

.routing-box {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-top: 8px;
}
.routing-box i { font-size: 24px; flex-shrink: 0; }

.script-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 12px; line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.dash-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
  color: var(--text-3); gap: 12px;
}
.dash-empty i { font-size: 48px; opacity: .25; }
.dash-empty p { font-size: 13px; max-width: 260px; line-height: 1.6; }

/* ============================================
   ORDINAL PICKER COMPONENT
   ============================================ */
.ord-picker {
  display: flex; gap: 4px; margin-bottom: 8px;
}
.ord-option {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 3px; border: 1.5px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all .15s; background: var(--bg-card);
  min-width: 0;
}
.ord-option:hover { background: var(--bg-hover); border-color: var(--border-md); }

.ord-option.selected.lv-0 { background: var(--green-bg);  border-color: var(--green);       }
.ord-option.selected.lv-1 { background: #f0fdf4;           border-color: #16a34a;             }
.ord-option.selected.lv-2 { background: var(--yellow-bg); border-color: var(--yellow-mid);   }
.ord-option.selected.lv-3 { background: var(--orange-bg); border-color: var(--orange);       }
.ord-option.selected.lv-4 { background: var(--red-bg);    border-color: var(--red-mid);      }

.ord-lv {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.ord-lv-0 { background: var(--green); }
.ord-lv-1 { background: #16a34a; }
.ord-lv-2 { background: var(--yellow); }
.ord-lv-3 { background: var(--orange); }
.ord-lv-4 { background: var(--red-mid); }

.ord-name {
  font-size: 9px; color: var(--text-2); text-align: center;
  line-height: 1.2; font-weight: 500; white-space: nowrap;
}

.ord-anchor {
  font-size: 11px; line-height: 1.6; color: var(--text-2);
  padding: 7px 10px; border-radius: var(--radius-md);
  background: var(--bg-secondary); border: 1px solid var(--border);
  min-height: 34px; transition: color .15s;
}
.ord-anchor.has-val { font-weight: 500; }

/* IADL section within checkout */
.iadl-section-header {
  background: var(--primary); color: rgba(255,255,255,0.75);
  padding: 9px 14px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 7px;
}
.iadl-section-header i { font-size: 15px; opacity: .7; }

/* Observability step for IADLs */
.obs-group { display: flex; gap: 5px; margin-bottom: 4px; }
.obs-btn {
  flex: 1; padding: 6px 4px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--border-md); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text-2); cursor: pointer; transition: all .15s;
  text-align: center;
}
.obs-btn:hover { background: var(--bg-hover); }
.obs-btn.obs-yes   { background: var(--accent-bg); border-color: var(--accent); color: #0F6E56; }
.obs-btn.obs-part  { background: var(--yellow-bg); border-color: var(--yellow-mid); color: var(--yellow); }
.obs-btn.obs-na    { background: var(--bg-secondary); border-color: var(--border-md); color: var(--text-3); }

/* Sub-scores display panel in checkout right pane */
.sub-scores-bar {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.sub-score-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 8px; text-align: center;
}
.sub-score-label { font-size: 9px; color: var(--text-2); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sub-score-val   { font-size: 20px; font-weight: 700; line-height: 1; }
.sub-score-unit  { font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* Interaction matrix triggered note in results */
.interaction-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: #EEEDFE; border: 0.5px solid #AFA9EC;
  border-radius: var(--radius-md); font-size: 11px; color: #3C3489; margin-top: 6px;
}

/* Velocity indicator badge on ADL card header */
.vel-badge {
  font-size: 9px; font-weight: 700; padding: 1px 6px;
  border-radius: 8px; margin-left: 4px;
}
.vel-0 { background:#D3D1C7;color:#444441 }
.vel-1 { background:var(--yellow-bg);color:var(--yellow) }
.vel-2 { background:var(--orange-bg);color:var(--orange) }
.vel-3,.vel-4 { background:var(--red-bg);color:var(--red) }

/* ============================================
   REPORTING PAGE
   ============================================ */
.rep-kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.rep-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; }
.rep-kpi .rk-label { font-size: 11px; color: var(--text-2); margin-bottom: 6px; }
.rep-kpi .rk-num   { font-size: 26px; font-weight: 700; margin-bottom: 3px; }
.rep-kpi .rk-delta { font-size: 11px; }
.rk-up   { color: var(--red); }
.rk-down { color: var(--green); }
.rk-good { color: var(--green); }

.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bc-row    { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bc-label  { width: 80px; color: var(--text-2); flex-shrink: 0; font-size: 11px; }
.bc-track  { flex: 1; height: 14px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bc-fill   { height: 100%; border-radius: 4px; }
.bc-val    { width: 34px; text-align: right; font-weight: 600; font-size: 11px; }

.rep-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rep-table th { font-size: 11px; color: var(--text-2); text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); font-weight: 600; }
.rep-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.rep-table tr:last-child td { border-bottom: none; }
.rep-table tr:hover td { background: var(--bg-hover); }

/* ============================================
   OPTIONS PAGE
   ============================================ */
.opts-shell { display: grid; grid-template-columns: 220px 1fr; gap: 20px; }
.opts-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  height: fit-content;
  position: sticky; top: 100px;
}
.opts-sidebar-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px 4px; }
.opts-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: all .1s; background: none; border: none; width: 100%; text-align: left;
}
.opts-nav-item i { font-size: 16px; }
.opts-nav-item:hover   { background: var(--bg-hover); color: var(--text); }
.opts-nav-item.active  { background: #EFF6FF; color: var(--primary-mid); font-weight: 500; }

.opts-panel { display: none; }
.opts-panel.active { display: block; }

.opt-select-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.opt-select-row:last-child { border-bottom: none; }
.opt-select-row select { width: auto; min-width: 100px; }

/* ============================================
   CAREGIVER SCHEDULE / PORTAL
   ============================================ */
.cg-portal-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

.schedule-day { margin-bottom: 20px; }
.schedule-day-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 9px; }
.schedule-visit {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: box-shadow .15s;
}
.schedule-visit:hover { box-shadow: var(--shadow-md); }
.sv-time { font-size: 13px; font-weight: 600; color: var(--primary-mid); min-width: 90px; flex-shrink: 0; }
.sv-info { flex: 1; }
.sv-name { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.sv-sub  { font-size: 11px; color: var(--text-2); }
.sv-actions { display: flex; gap: 7px; }

/* ============================================
   SCHEDULING PAGE
   ============================================ */

/* ── Page shell ── */
.sched-shell { display:flex; flex-direction:column; height:calc(100vh - 90px); }

.sched-toolbar {
  background:var(--bg-card); border-bottom:1px solid var(--border);
  padding:10px 20px; display:flex; align-items:center; gap:10px;
  flex-shrink:0; flex-wrap:wrap;
}
.sched-week-nav { display:flex; align-items:center; gap:6px; }
.sched-week-nav .wn-btn {
  width:30px; height:30px; border-radius:50%;
  border:1px solid var(--border-md); background:var(--bg-card);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all .15s; color:var(--text-2);
}
.sched-week-nav .wn-btn:hover { background:var(--primary-mid); color:#fff; border-color:var(--primary-mid); }
.sched-week-label { font-size:14px; font-weight:600; min-width:160px; text-align:center; }
.view-toggle { display:flex; background:var(--bg-secondary); border-radius:var(--radius-md); padding:2px; gap:2px; }
.view-toggle-btn {
  padding:5px 12px; font-size:12px; font-weight:500; border-radius:var(--radius-sm);
  border:none; cursor:pointer; background:none; color:var(--text-2); transition:all .15s;
}
.view-toggle-btn.active { background:var(--bg-card); color:var(--text); box-shadow:0 1px 3px rgba(0,0,0,.1); }

.sched-stats {
  background:var(--bg-card); border-bottom:1px solid var(--border);
  padding:8px 20px; display:flex; gap:24px; flex-shrink:0;
}
.sched-stat { display:flex; flex-direction:column; }
.sched-stat .ss-num { font-size:18px; font-weight:700; line-height:1; }
.sched-stat .ss-lbl { font-size:10px; color:var(--text-2); margin-top:2px; text-transform:uppercase; letter-spacing:.05em; }

.sched-body { flex:1; overflow:hidden; background:var(--bg); }

/* ── Service line legend ── */
.sl-legend { display:flex; gap:10px; flex-wrap:wrap; margin-left:auto; align-items:center; }
.sl-badge  { display:flex; align-items:center; gap:5px; font-size:11px; color:var(--text-2); }
.sl-dot    { width:10px; height:10px; border-radius:3px; flex-shrink:0; }

/* ── Calendar grid ── */
.cal-wrap {
  overflow:auto; height:100%;
}
.cal-grid {
  display:flex; min-width:820px;
}

/* Time label column */
.cal-time-col   { width:56px; flex-shrink:0; position:sticky; left:0; z-index:3; background:var(--bg-card); border-right:1px solid var(--border); }
.cal-time-header{ height:56px; border-bottom:1px solid var(--border); }
.cal-time-row   { height:60px; display:flex; align-items:flex-start; padding:4px 6px 0; }
.cal-time-row span { font-size:10px; font-weight:600; color:var(--text-3); white-space:nowrap; }

/* Day column */
.cal-day-col  { flex:1; min-width:110px; border-right:1px solid var(--border); }
.cal-day-col:last-child { border-right:none; }

.cal-day-header {
  height:56px; text-align:center; padding:6px 4px;
  position:sticky; top:0; background:var(--bg-card);
  border-bottom:1px solid var(--border); z-index:2;
}
.cal-day-header.today { background:#EFF6FF; }
.cal-day-header .dh-name { font-size:11px; color:var(--text-2); font-weight:500; }
.cal-day-header .dh-num  { font-size:18px; font-weight:700; line-height:1.1; }
.cal-day-header .dh-num.is-today { color:var(--primary-mid); }
.cal-day-header .dh-mon  { font-size:10px; color:var(--text-3); }
.cal-add-btn {
  position: absolute; top: 6px; right: 6px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: var(--bg-2); color: var(--text-3);
  font-size: 10px; line-height: 1; cursor: pointer; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .12s, background .12s, color .12s;
}
.cal-day-col:hover .cal-add-btn { opacity: 1; }
.cal-add-btn:hover { background: var(--primary); color: #fff; }

.cal-day-body { position:relative; height:900px; cursor: pointer; }   /* 15 hours × 60px */

.cal-hour-line {
  position:absolute; left:0; right:0; height:1px;
  background:var(--border);
  pointer-events:none;
}
.cal-half-line {
  position:absolute; left:0; right:0; height:1px;
  background:var(--border);
  opacity:.4;
  pointer-events:none;
}

/* Shift block */
.cal-shift {
  position:absolute; left:2px; right:2px;
  border-radius:var(--radius-md);
  padding:4px 7px;
  font-size:11px; color:#fff;
  cursor:pointer;
  overflow:hidden;
  transition:filter .15s, transform .1s;
  z-index:1;
}
.cal-shift:hover { filter:brightness(1.1); transform:scaleX(1.02); z-index:2; }
.cal-shift.unassigned {
  background:var(--bg-secondary) !important;
  color:var(--text-2) !important;
  border:1.5px dashed var(--border-md);
}
.cal-shift.missed    { background:var(--red) !important; }
.cal-shift.completed { opacity:.75; }
.cal-shift.cancelled { background:var(--bg-secondary) !important; color:var(--text-3) !important; text-decoration:line-through; }
.cal-shift .cs-client { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-shift .cs-cg     { opacity:.85; font-size:10px; }
.cal-shift .cs-time   { opacity:.7;  font-size:10px; }

/* Current time indicator */
.cal-now-line {
  position:absolute; left:0; right:0; height:2px;
  background:var(--red-mid); z-index:3; pointer-events:none;
}
.cal-now-dot {
  position:absolute; left:-4px; top:-4px;
  width:10px; height:10px; border-radius:50%; background:var(--red-mid);
}

/* ── List view ── */
.sched-list { padding:16px 20px; overflow-y:auto; height:100%; }
.sched-day-group { margin-bottom:20px; }
.sched-day-label {
  font-size:12px; font-weight:700; color:var(--text-2);
  text-transform:uppercase; letter-spacing:.05em;
  margin-bottom:8px; padding-bottom:6px;
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:8px;
}
.sched-day-label .today-chip {
  background:var(--primary-mid); color:#fff;
  font-size:10px; padding:1px 7px; border-radius:8px; font-weight:600;
}
.sched-list-shift {
  background:var(--bg-card); border:1px solid var(--border);
  border-radius:var(--radius-md); padding:12px 14px;
  display:flex; align-items:center; gap:12px;
  margin-bottom:6px; cursor:pointer; transition:box-shadow .15s;
  border-left:4px solid var(--primary-mid);
}
.sched-list-shift:hover { box-shadow:var(--shadow-md); }
.sched-list-shift.unassigned { border-left-color:var(--border-md); background:var(--bg-secondary); }
.sched-list-shift.completed  { opacity:.8; }
.sched-list-shift.missed     { border-left-color:var(--red); }
.sl-shift-time { font-size:13px; font-weight:600; color:var(--primary-mid); min-width:100px; flex-shrink:0; }
.sl-shift-client { font-size:14px; font-weight:500; }
.sl-shift-meta   { font-size:11px; color:var(--text-2); margin-top:2px; }

/* ── Shift detail modal ── */
.modal-box-xl {
  width:700px; max-width:96vw;
  max-height:88vh; overflow-y:auto;
}
.shift-modal-header {
  display:flex; align-items:flex-start; gap:12px;
  padding-bottom:14px; margin-bottom:0;
  border-bottom:1px solid var(--border);
}
.shift-modal-av {
  width:44px; height:44px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:15px; font-weight:600; color:#fff;
}
.shift-modal-tabs {
  display:flex; gap:0; border-bottom:1px solid var(--border);
  margin:0 -24px; padding:0 24px; overflow-x:auto;
}
.shift-modal-tab {
  padding:10px 16px; font-size:12px; font-weight:500;
  color:var(--text-2); border:none; background:none;
  border-bottom:2px solid transparent; cursor:pointer;
  white-space:nowrap; transition:all .15s;
}
.shift-modal-tab:hover  { color:var(--text); }
.shift-modal-tab.active { color:var(--primary-mid); border-bottom-color:var(--primary-mid); }
.shift-tab-panel { padding-top:16px; }

/* Rate card within modal */
.rate-section {
  background:var(--bg-secondary); border-radius:var(--radius-md);
  padding:12px 14px; margin-bottom:10px;
}
.rate-section .rs-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--text-3); margin-bottom:8px; }
.rate-row { display:flex; justify-content:space-between; font-size:12px; padding:3px 0; border-bottom:1px solid var(--border); }
.rate-row:last-child { border-bottom:none; font-weight:600; font-size:13px; }
.rate-row .rr-label { color:var(--text-2); }

/* Status badge in modal */
.shift-status-badge {
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 10px; border-radius:10px; font-size:11px; font-weight:600;
}
.ssb-confirmed  { background:#E6F1FB; color:var(--primary-mid); }
.ssb-completed  { background:var(--green-bg); color:var(--green); }
.ssb-unassigned { background:var(--bg-secondary); color:var(--text-2); border:1px dashed var(--border-md); }
.ssb-missed     { background:var(--red-bg); color:var(--red); }
.ssb-pending    { background:var(--yellow-bg); color:var(--yellow); }

/* ============================================
   SAFETY BRIEF + CLOCK-IN
   ============================================ */

.brief-overlay {
  position: absolute; inset: 0;
  background: var(--bg-card);
  z-index: 10;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.brief-header {
  background: #7C2D12; color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.brief-header h2 { font-size: 14px; font-weight: 600; color: #fff; }
.brief-header p  { font-size: 11px; color: rgba(255,255,255,0.7); }
.brief-section {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brief-section-label {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); margin-bottom: 5px;
}
.brief-safety-note {
  background: var(--orange-bg); border: 1px solid var(--orange-border);
  border-radius: var(--radius-md); padding: 8px 10px;
  font-size: 12px; color: var(--orange); line-height: 1.5; font-weight: 500;
}
.brief-flag-row {
  display: flex; gap: 7px; flex-wrap: wrap; margin-top: 4px;
}
.brief-flag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 600;
}
.brief-flag.danger { background: var(--red-bg); color: var(--red); }
.brief-flag.warn   { background: var(--yellow-bg); color: var(--yellow); }
.brief-flag.info   { background: var(--accent-bg); color: #0F6E56; }
.brief-alert-item {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11px; padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.brief-alert-item:last-child { border-bottom: none; }
.brief-last-visit {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 8px 10px; font-size: 12px; line-height: 1.6;
}
.brief-clock-in-btn {
  width: 100%; padding: 14px;
  background: #0F6E56; color: #fff;
  border: none; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.brief-clock-in-btn:hover { background: #085041; }
.brief-clock-in-footer {
  padding: 14px; background: var(--bg-card);
  border-top: 1px solid var(--border); flex-shrink: 0;
}

/* Clock-in status bar (shown during active visit) */
.clock-status-bar {
  background: #0F6E56; color: #fff;
  padding: 7px 14px; font-size: 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.clock-status-bar .cs-left { display: flex; align-items: center; gap: 8px; }
.clock-status-bar .cs-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5DCAA5; animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* Prior visit summary (collapsible) */
.prior-visit-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px; overflow: hidden;
}
.prior-visit-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
  font-size: 11px; font-weight: 600;
}
.prior-visit-header:hover { background: var(--bg-hover); }
.prior-visit-body {
  padding: 8px 12px; border-top: 1px solid var(--border);
  font-size: 11px; line-height: 1.6; color: var(--text-2);
  display: none;
}
.prior-visit-body.open { display: block; }

/* Missed visit modal */
.missed-reason-grid {
  display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px;
}
.missed-reason-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--border-md);
  border-radius: var(--radius-md); cursor: pointer;
  font-size: 12px; transition: all .15s;
}
.missed-reason-opt:hover { background: var(--bg-hover); }
.missed-reason-opt.selected {
  background: var(--red-bg); border-color: var(--red-border); color: var(--red);
}
.missed-reason-opt input { display: none; }

/* Auth utilization warning */
.auth-warn-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: 6px;
  font-size: 9px; font-weight: 700;
}
/* Schedule gap / PTO conflict = needs-attention & urgent, NOT clinical/emergency */
.auth-warn-amber { background: var(--color-warning-bg);  color: var(--color-warning); }
.auth-warn-red   { background: var(--color-critical-bg); color: var(--color-critical); }

/* Recurring shift toggle */
.recur-panel {
  background: var(--bg-secondary); border-radius: var(--radius-md);
  padding: 10px 12px; margin-top: 8px;
  border: 1px solid var(--border);
}
.recur-pattern-btns { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.recur-btn {
  padding: 5px 12px; border: 1px solid var(--border-md);
  border-radius: 16px; font-size: 11px; font-weight: 500;
  cursor: pointer; background: var(--bg-card); color: var(--text-2);
  transition: all .15s;
}
.recur-btn.active {
  background: var(--primary-mid); color: #fff; border-color: var(--primary-mid);
}

/* ============================================
   SCHEDULING V2 - STATUS BAR + SWIMLANE MATRIX
   ============================================ */

/* Status intelligence bar */
.status-intel-bar {
  background: var(--primary-mid); padding: 8px 18px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
}
.status-tile {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 14px; border-radius: var(--radius-md); cursor: pointer;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  transition: all .15s; min-width: 80px;
}
.status-tile:hover { background: rgba(255,255,255,0.14); }
.status-tile.active { background: rgba(93,202,165,0.25); border-color: rgba(93,202,165,0.5); }
.st-count { font-size: 20px; font-weight: 700; color: #fff; line-height: 1.1; }
.st-label { font-size: 9px; color: rgba(255,255,255,0.5); font-weight: 500; white-space: nowrap; }
.status-tile.tile-warn .st-count { color: #FAC775; }
.status-tile.tile-red  .st-count { color: #F7C1C1; }
.status-tile.tile-ok   .st-count { color: #9FE1CB; }

/* Filter chip bar */
.filter-chip-bar {
  padding: 5px 18px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  min-height: 34px; flex-shrink: 0;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 10px;
  background: var(--bg-info); color: var(--text-info);
  font-size: 11px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border-info); transition: opacity .15s;
}
.filter-chip:hover { opacity: 0.8; }
.no-filters-msg { font-size: 11px; color: var(--text-3); }

/* Group-by toggle */
.group-by-toggle {
  display: flex; background: rgba(255,255,255,0.1);
  border-radius: 14px; padding: 2px; gap: 1px; margin-left: 6px;
}
.gb-btn {
  padding: 3px 11px; font-size: 11px; font-weight: 500;
  color: rgba(255,255,255,0.55); background: none; border: none;
  border-radius: 12px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.gb-btn.active { background: rgba(255,255,255,0.2); color: #fff; }
.gb-btn:hover:not(.active) { color: rgba(255,255,255,0.85); }

/* Swimlane matrix */
.swimlane-wrap { overflow: auto; flex: 1; }
.sl-grid {
  display: grid;
  grid-template-columns: 190px repeat(7, minmax(110px, 1fr));
  min-width: 980px; border-top: 1px solid var(--border);
}
.sl-hd-resource {
  background: var(--primary-mid); color: rgba(255,255,255,0.7);
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 8px 12px; position: sticky; top: 0; left: 0; z-index: 4;
  border-right: 2px solid rgba(255,255,255,0.15);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 6px;
}
.sl-hd-day {
  background: var(--bg-secondary); padding: 8px 8px 6px;
  text-align: center; position: sticky; top: 0; z-index: 3;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.sl-hd-day.today { background: var(--bg-info); }
.sl-hd-day .day-name { font-size: 11px; color: var(--text-2); font-weight: 500; }
.sl-hd-day .day-num  { font-size: 18px; font-weight: 700; line-height: 1.1; }
.sl-hd-day.today .day-num { color: var(--primary-mid); }
.sl-hd-day .day-mon  { font-size: 10px; color: var(--text-3); }
.sl-resource-cell {
  background: var(--bg-card); border-right: 2px solid var(--border-md);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px; position: sticky; left: 0; z-index: 1;
  display: flex; align-items: flex-start; gap: 7px;
  min-height: 56px;
}
.sl-resource-cell .rc-av {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  font-size: 10px; font-weight: 600; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.sl-resource-cell .rc-name { font-size: 12px; font-weight: 500; line-height: 1.3; }
.sl-resource-cell .rc-sub  { font-size: 10px; color: var(--text-3); }
.sl-day-cell {
  background: var(--bg-card); border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 4px; min-height: 56px;
  display: flex; flex-direction: column; gap: 3px;
  position: relative;
}
.sl-day-cell.today { background: #EFF6FF; }
.sl-add-btn {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px;
  border-radius: 50%; border: none; background: var(--bg-2); color: var(--text-3);
  font-size: 10px; line-height: 1; cursor: pointer; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .12s, background .12s, color .12s;
}
.sl-day-cell:hover .sl-add-btn { opacity: 1; }
.sl-add-btn:hover { background: var(--primary); color: #fff; }
.sl-shift {
  border-radius: 4px; padding: 3px 6px; cursor: pointer;
  font-size: 10px; line-height: 1.3; transition: filter .12s;
  display: flex; align-items: center; gap: 4px;
}
.sl-shift:hover { filter: brightness(1.08); }
.sl-shift.status-unassigned {
  background: var(--bg-secondary); color: var(--text-2);
  border: 1.5px dashed var(--border-md);
}
.sl-shift.status-confirmed   { background: #1a3a5c; color: #fff; }
.sl-shift.status-in_progress { background: #0F6E56; color: #fff; animation: sl-pulse 2s infinite; }
.sl-shift.status-completed   { background: #3B6D11; color: #fff; opacity: .75; }
.sl-shift.status-missed      { background: var(--red); color: #fff; }
.sl-shift.status-cancelled   { background: var(--bg-secondary); color: var(--text-3); text-decoration: line-through; }
@keyframes sl-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(15,110,86,0.5); }
  50%      { box-shadow: 0 0 0 3px rgba(15,110,86,0); }
}
.sl-shift .sh-av {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.22); font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sl-shift .sh-label { overflow: hidden; }
.sl-shift .sh-name  { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; }
.sl-shift .sh-time  { opacity: .75; font-size: 9px; }
.sl-empty { color: var(--text-3); font-size: 10px; text-align: center; padding: 14px 0; }
.sl-more  { font-size: 9px; color: var(--text-3); padding: 1px 4px; text-align: center; cursor: pointer; }

/* Priority list V2 */
.priority-list-wrap { overflow: auto; flex: 1; }
.pt-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.pt-table th {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  padding: 7px 12px; border-bottom: 2px solid var(--border);
  text-align: left; background: var(--bg-secondary);
  position: sticky; top: 0; cursor: pointer; user-select: none;
}
.pt-table th:hover { color: var(--text); }
.pt-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
.pt-table tr:hover td { background: var(--bg-hover); }
.pt-priority { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* Coverage matrix */
.coverage-wrap { overflow: auto; flex: 1; }
.cov-grid {
  display: grid; grid-template-columns: 200px repeat(7, 1fr);
  min-width: 820px; border-top: 1px solid var(--border);
}
.cov-hd-res {
  background: var(--primary-mid); color: rgba(255,255,255,0.7);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 12px; position: sticky; top: 0; left: 0; z-index: 4;
  border-right: 2px solid rgba(255,255,255,0.15); border-bottom: 1px solid rgba(255,255,255,0.1);
}
.cov-hd-day {
  background: var(--bg-secondary); padding: 8px 6px; text-align: center;
  font-size: 11px; font-weight: 500; position: sticky; top: 0; z-index: 3;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.cov-res {
  background: var(--bg-card); border-right: 2px solid var(--border-md);
  border-bottom: 1px solid var(--border); padding: 6px 10px;
  position: sticky; left: 0; z-index: 1; font-size: 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.cov-auth-bar { height: 3px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: 3px; }
.cov-auth-fill { height: 100%; border-radius: 2px; }
.cov-cell {
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px 4px; min-height: 48px; font-size: 10px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-align: center; cursor: pointer; transition: filter .1s;
}
.cov-cell:hover { filter: brightness(0.95); }
.cov-ok   { background: var(--green-bg);  color: var(--green); }
.cov-warn { background: var(--yellow-bg); color: var(--yellow); }
.cov-open { background: var(--orange-bg); color: var(--orange); }
.cov-none { background: var(--bg-secondary); color: var(--text-3); }
.cov-gap  { background: var(--red-bg); color: var(--red); }
.cov-cell .cc-cg { font-size: 9px; font-weight: 500; opacity: .8; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 960px) {
  .nav-cards    { grid-template-columns: 1fr 1fr; }
  .home-panels  { grid-template-columns: 1fr; }
  .checkout-shell { grid-template-columns: 1fr; }
  .checkout-right { display: none; }
  .rep-kpi-grid { grid-template-columns: 1fr 1fr; }
  .rep-grid     { grid-template-columns: 1fr; }
  .dir-list     { width: 260px; }
  .opts-shell   { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-cards    { grid-template-columns: 1fr; }
  .dir-shell    { height: auto; }
  .dir-body     { flex-direction: column; }
  .dir-list     { width: 100%; height: 280px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .adl-trend-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════
   MATCHING ENGINE UI
   ══════════════════════════════════════════════ */

/* ── Instant Recommendations Panel ─ */
.match-panel        { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; }
.match-panel-head   { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: linear-gradient(135deg, #0d2240 0%, #1a3a5c 100%); color: #fff; }
.match-panel-title  { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.match-panel-sub    { font-size: 10px; opacity: .7; margin-top: 1px; }

/* ── Match candidate card ─ */
.match-card         { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background .15s; cursor: default; }
.match-card:last-child { border-bottom: none; }
.match-card:hover   { background: var(--bg-2); }
.match-rank         { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.match-rank-1       { background: #FFD700; color: #7A5C00; }
.match-rank-2       { background: #C0C0C0; color: #444; }
.match-rank-3       { background: #cd7f32; color: #fff; }
.match-av           { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.match-info         { flex: 1; min-width: 0; }
.match-name         { font-size: 13px; font-weight: 600; line-height: 1.3; }
.match-meta         { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.match-score-wrap   { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 70px; }
.match-score-num    { font-size: 20px; font-weight: 800; line-height: 1; }
.match-score-bar    { width: 64px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.match-score-fill   { height: 100%; border-radius: 3px; transition: width .4s; }
.match-gates        { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.gate-pill          { font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 10px; border: 1px solid; }
.gate-pass          { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.gate-fail          { background: #ffebee; color: #c62828; border-color: #ef9a9a; }
.gate-warn          { background: #fff8e1; color: #f57f17; border-color: #ffe082; }
.match-actions      { display: flex; flex-direction: column; gap: 4px; }

/* ── Score meter circle ─ */
.score-ring-wrap    { position: relative; width: 48px; height: 48px; flex-shrink: 0; }
.score-ring-wrap svg { transform: rotate(-90deg); }
.score-ring-bg      { fill: none; stroke: var(--border); stroke-width: 4; }
.score-ring-fill    { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .5s; }
.score-ring-label   { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }

/* ── Funnel breakdown tooltip / detail row ─ */
.funnel-detail      { background: var(--bg-2); border-radius: var(--radius-md); padding: 10px 14px; margin: 0 16px 12px; }
.funnel-row         { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 11px; border-bottom: 1px solid var(--border-light, rgba(0,0,0,.04)); }
.funnel-row:last-child { border-bottom: none; }
.funnel-icon        { width: 14px; height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 800; flex-shrink: 0; }
.fi-pass            { background: var(--green); color: #fff; }
.fi-fail            { background: var(--red);   color: #fff; }
.fi-na              { background: var(--text-3); color: #fff; }
.funnel-label       { flex: 1; color: var(--text-2); }
.funnel-value       { font-weight: 600; font-size: 10px; }

/* ── Applicant queue ─ */
.aq-table           { width: 100%; border-collapse: collapse; font-size: 12px; }
.aq-table thead tr  { border-bottom: 2px solid var(--border); }
.aq-table th        { text-align: left; padding: 6px 10px; font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--text-3); }
.aq-table td        { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.aq-table tbody tr:last-child td { border-bottom: none; }
.aq-table tbody tr:hover td { background: var(--bg-2); }

/* ── Open shift feed (caregiver view) ─ */
.open-feed          { display: flex; flex-direction: column; gap: 10px; }
.open-shift-card    { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.open-shift-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(26,58,92,.08); }
.os-badge           { background: linear-gradient(135deg, #1a3a5c, #0F6E56); border-radius: var(--radius-md); padding: 10px 14px; color: #fff; text-align: center; min-width: 64px; flex-shrink: 0; }
.os-date            { font-size: 9px; font-weight: 700; text-transform: uppercase; opacity: .8; }
.os-day             { font-size: 20px; font-weight: 800; line-height: 1.1; }
.os-time            { font-size: 10px; opacity: .75; }
.os-info            { flex: 1; min-width: 0; }
.os-client          { font-size: 13px; font-weight: 600; }
.os-detail          { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.os-score           { font-size: 22px; font-weight: 800; text-align: center; min-width: 52px; }
.os-score-label     { font-size: 9px; color: var(--text-3); text-align: center; text-transform: uppercase; }

/* ── Publish/broadcast status banner ─ */
.broadcast-banner   { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md); border: 1.5px dashed; font-size: 12px; }
.bb-draft           { background: var(--bg-2);     border-color: var(--border);  color: var(--text-3); }
.bb-published       { background: #e8f5e9;          border-color: #a5d6a7;        color: #1b5e20; }
.bb-filled          { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }

/* ── Assessment / personality intake ─ */
.assess-question    { background: var(--bg-2); border-radius: var(--radius-md); padding: 14px 16px; margin-bottom: 12px; }
.assess-q-text      { font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.assess-option      { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer; border: 1.5px solid transparent; transition: border-color .15s, background .15s; margin-bottom: 4px; }
.assess-option:hover{ background: var(--bg-card); border-color: var(--border); }
.assess-option.selected { background: var(--primary-bg); border-color: var(--primary); }
.assess-option input { flex-shrink: 0; }
.assess-opt-label   { font-size: 12px; }
.assess-opt-sub     { font-size: 10px; color: var(--text-3); }

/* ══════════════════════════════════════════════
   EVV - Electronic Visit Verification
   ══════════════════════════════════════════════ */

/* ── Offline banner ─ */
.evv-offline-banner  { position:fixed; top:0; left:0; right:0; z-index:9999; background:#BA7517; color:#fff; padding:8px 20px; display:flex; align-items:center; gap:10px; font-size:12px; font-weight:600; box-shadow:0 2px 8px rgba(0,0,0,.2); }
.evv-offline-banner.syncing  { background:#1a3a5c; }
.evv-offline-badge   { background:rgba(255,255,255,.25); border-radius:10px; padding:2px 8px; font-size:10px; font-weight:700; letter-spacing:.05em; }

/* ── Visit package cards ─ */
.evv-pkg-grid        { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:12px; }
.evv-pkg-card        { background:var(--bg-card); border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; }
.evv-pkg-card.downloaded { border-color:var(--green); background:#F1F8E9; }
.evv-pkg-head        { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.evv-pkg-client      { font-size:13px; font-weight:600; }
.evv-pkg-time        { font-size:11px; color:var(--text-3); }
.evv-pkg-bar         { height:4px; border-radius:2px; background:var(--border); overflow:hidden; margin:8px 0; }
.evv-pkg-bar-fill    { height:100%; border-radius:2px; background:var(--green); transition:width .3s; }

/* ── Geofence UI ─ */
.evv-geo-ring        { position:relative; width:180px; height:180px; border-radius:50%; border:3px solid var(--border); margin:0 auto; display:flex; align-items:center; justify-content:center; flex-direction:column; }
.evv-geo-ring.within { border-color:var(--green); background:#F1F8E9; }
.evv-geo-ring.outside{ border-color:var(--red);   background:#FFEBEE; }
.evv-geo-ring.warn   { border-color:var(--yellow); background:#FFF8E1; }
.evv-geo-pulse       { position:absolute; inset:-8px; border-radius:50%; border:2px solid; opacity:.4; animation:geo-pulse 1.6s ease-out infinite; }
.evv-geo-ring.within .evv-geo-pulse  { border-color:var(--green); }
.evv-geo-ring.outside .evv-geo-pulse { border-color:var(--red);   }
@keyframes geo-pulse { 0%{transform:scale(1);opacity:.4} 100%{transform:scale(1.15);opacity:0} }
.evv-geo-dist        { font-size:22px; font-weight:800; line-height:1.1; }
.evv-geo-label       { font-size:10px; color:var(--text-3); text-transform:uppercase; letter-spacing:.05em; }
.evv-geo-status      { font-size:11px; font-weight:700; margin-top:4px; }
.evv-coord-row       { display:flex; gap:8px; align-items:center; font-size:11px; }
.evv-coord-badge     { background:var(--bg-2); border-radius:6px; padding:4px 10px; font-family:monospace; font-size:11px; }
.evv-map-frame       { width:100%; height:260px; border-radius:var(--radius-md); border:1px solid var(--border); overflow:hidden; }

/* ── Grace zone selector ─ */
.evv-zone-pills      { display:flex; gap:6px; flex-wrap:wrap; }
.evv-zone-pill       { padding:5px 14px; border-radius:20px; font-size:11px; font-weight:600; cursor:pointer; border:1.5px solid var(--border); background:var(--bg-2); transition:all .15s; }
.evv-zone-pill.active{ background:var(--primary); color:#fff; border-color:var(--primary); }
.evv-zone-pill.strict{ --pill-color:#3B6D11; }
.evv-zone-pill.standard{ --pill-color:#BA7517; }
.evv-zone-pill.flexible{ --pill-color:#534AB7; }

/* ── Signature pad ─ */
.evv-sig-wrap        { border:2px dashed var(--border); border-radius:var(--radius-md); background:var(--bg-2); position:relative; overflow:hidden; }
.evv-sig-wrap.signed { border-color:var(--green); border-style:solid; background:#F1F8E9; }
.evv-sig-canvas      { display:block; width:100%; cursor:crosshair; touch-action:none; }
.evv-sig-label       { position:absolute; bottom:8px; left:50%; transform:translateX(-50%); font-size:10px; color:var(--text-3); pointer-events:none; white-space:nowrap; }
.evv-sig-clear       { position:absolute; top:6px; right:6px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:3px 8px; font-size:10px; cursor:pointer; }
.evv-sig-steps       { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.evv-sig-step-head   { font-size:11px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:.05em; margin-bottom:6px; }

/* ── Clock-out gate ─ */
.evv-gate-list       { display:flex; flex-direction:column; gap:6px; }
.evv-gate-item       { display:flex; align-items:center; gap:8px; font-size:12px; padding:8px 12px; border-radius:var(--radius-md); }
.evv-gate-item.pass  { background:#E8F5E9; color:#2E7D32; }
.evv-gate-item.fail  { background:#FFEBEE; color:#C62828; }

/* ── Alert toast ─ */
.evv-alert-toast     { position:fixed; bottom:24px; right:24px; z-index:9998; background:#1a3a5c; color:#fff; border-radius:var(--radius-lg); padding:14px 18px; min-width:280px; max-width:360px; box-shadow:0 4px 20px rgba(0,0,0,.25); display:flex; gap:12px; align-items:flex-start; animation:toast-in .25s ease; }
.evv-alert-toast.warn { background:#BA7517; }
.evv-alert-toast.danger { background:#A32D2D; }
@keyframes toast-in { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }
.eat-icon            { font-size:20px; flex-shrink:0; margin-top:1px; }
.eat-title           { font-size:13px; font-weight:700; }
.eat-body            { font-size:11px; opacity:.85; margin-top:2px; }
.eat-close           { margin-left:auto; background:none; border:none; color:rgba(255,255,255,.7); cursor:pointer; font-size:16px; padding:0; flex-shrink:0; }

/* ── EVV settings panel ─ */
.evv-settings-grid   { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.evv-toggle-row      { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--border); }
.evv-toggle-label    { font-size:13px; }
.evv-toggle-sub      { font-size:11px; color:var(--text-3); }
.evv-toggle          { position:relative; width:40px; height:22px; flex-shrink:0; }
.evv-toggle input    { opacity:0; width:0; height:0; }
.evv-toggle-slider   { position:absolute; inset:0; background:var(--border); border-radius:11px; cursor:pointer; transition:background .2s; }
.evv-toggle input:checked + .evv-toggle-slider { background:var(--green); }
.evv-toggle-slider::before { content:''; position:absolute; height:16px; width:16px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:transform .2s; }
.evv-toggle input:checked + .evv-toggle-slider::before { transform:translateX(18px); }

/* ══════════════════════════════════════════════
   FAMILY & CLIENT PORTAL
   ══════════════════════════════════════════════ */

/* ── Login page ─ */
.fp-login-wrap     { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#0d2240 0%,#1a3a5c 50%,#0F6E56 100%); }
.fp-login-card     { background:#fff; border-radius:16px; padding:36px 40px; width:100%; max-width:400px; box-shadow:0 12px 40px rgba(0,0,0,.25); }
.fp-login-logo     { text-align:center; margin-bottom:24px; }
.fp-login-logo h2  { font-size:22px; font-weight:800; color:var(--primary); margin:8px 0 2px; }
.fp-login-logo p   { font-size:12px; color:var(--text-3); }

/* ── Family nav ─ */
.fp-nav            { background:linear-gradient(135deg,#1a3a5c,#0F6E56); padding:0 20px; display:flex; align-items:center; gap:4px; height:56px; }
.fp-nav-brand      { font-size:16px; font-weight:800; color:#fff; margin-right:auto; }
.fp-nav-btn        { background:rgba(255,255,255,.12); border:none; color:rgba(255,255,255,.85); padding:6px 14px; border-radius:20px; font-size:12px; cursor:pointer; transition:background .15s; display:flex; align-items:center; gap:6px; }
.fp-nav-btn:hover  { background:rgba(255,255,255,.22); }
.fp-nav-btn.active { background:rgba(255,255,255,.25); color:#fff; font-weight:600; }
.fp-nav-user       { color:rgba(255,255,255,.7); font-size:11px; margin-left:8px; }

/* ── Family portal shell ─ */
.fp-shell          { display:flex; flex-direction:column; min-height:100vh; background:var(--bg); }
.fp-body           { flex:1; padding:20px; max-width:900px; margin:0 auto; width:100%; }

/* ── Welcome hero ─ */
.fp-hero           { background:linear-gradient(135deg,#1a3a5c,#0d2240); border-radius:var(--radius-lg); padding:24px 28px; color:#fff; margin-bottom:20px; display:flex; align-items:center; gap:16px; }
.fp-hero-av        { width:52px; height:52px; border-radius:50%; background:rgba(255,255,255,.2); display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:700; flex-shrink:0; }
.fp-hero-name      { font-size:20px; font-weight:700; }
.fp-hero-sub       { font-size:12px; opacity:.75; margin-top:2px; }

/* ── Section cards ─ */
.fp-section-grid   { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; margin-bottom:20px; }
.fp-nav-card       { background:var(--bg-card); border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:18px 20px; cursor:pointer; transition:border-color .15s, box-shadow .15s; display:flex; align-items:center; gap:14px; }
.fp-nav-card:hover { border-color:var(--primary); box-shadow:0 2px 12px rgba(26,58,92,.08); }
.fp-nav-card-icon  { width:40px; height:40px; border-radius:var(--radius-md); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.fp-nav-card-label { font-size:13px; font-weight:600; }
.fp-nav-card-sub   { font-size:11px; color:var(--text-3); margin-top:2px; }

/* ── Schedule (family read-only) ─ */
.fp-shift-card     { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; margin-bottom:10px; display:flex; align-items:center; gap:12px; }
.fp-shift-date     { background:var(--primary); border-radius:var(--radius-md); padding:8px 12px; color:#fff; text-align:center; min-width:56px; flex-shrink:0; }
.fp-shift-day      { font-size:20px; font-weight:800; line-height:1; }
.fp-shift-mon      { font-size:9px; text-transform:uppercase; opacity:.8; }
.fp-shift-info     { flex:1; }
.fp-shift-caregiver{ font-size:14px; font-weight:600; }
.fp-shift-time     { font-size:11px; color:var(--text-3); margin-top:2px; }
.fp-shift-status   { flex-shrink:0; }

/* ── Kudos / recognition ─ */
.kudos-feed        { display:flex; flex-direction:column; gap:12px; }
.kudos-card        { background:var(--bg-card); border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:16px 18px; }
.kudos-card.featured { border-color:#FFD700; background:#FFFEF0; }
.kudos-header      { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.kudos-cat-badge   { display:flex; align-items:center; gap:5px; padding:4px 10px; border-radius:20px; font-size:10px; font-weight:700; background:var(--primary-bg); color:var(--primary); }
.kudos-from        { font-size:11px; color:var(--text-3); margin-left:auto; }
.kudos-message     { font-size:13px; color:var(--text); line-height:1.5; margin-bottom:10px; }
.kudos-cg-row      { display:flex; align-items:center; gap:8px; }
.kudos-cg-av       { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:700; color:#fff; }
.kudos-cg-name     { font-size:12px; font-weight:500; }
.kudos-cg-client   { font-size:10px; color:var(--text-3); }
.kudos-star        { color:#FFD700; font-size:14px; margin-right:2px; }

/* ── Kudos category selector ─ */
.kudos-cat-grid    { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:14px; }
.kudos-cat-btn     { border:1.5px solid var(--border); background:var(--bg-2); border-radius:var(--radius-md); padding:10px 8px; text-align:center; cursor:pointer; transition:all .15s; font-size:11px; }
.kudos-cat-btn:hover { border-color:var(--primary); }
.kudos-cat-btn.selected { border-color:#FFD700; background:#FFFEF0; }
.kudos-cat-btn i   { font-size:18px; display:block; margin-bottom:4px; }

/* ── Kudos leaderboard (admin) ─ */
.kudos-lb-row      { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.kudos-lb-rank     { width:24px; height:24px; border-radius:50%; background:var(--bg-2); display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; flex-shrink:0; }
.kudos-lb-rank.gold   { background:#FFD700; color:#7A5C00; }
.kudos-lb-rank.silver { background:#C0C0C0; color:#444; }
.kudos-lb-rank.bronze { background:#cd7f32; color:#fff; }
.kudos-lb-count    { margin-left:auto; font-size:16px; font-weight:800; color:var(--primary); }

/* ── Feedback (admin-only view) ─ */
.fb-card           { background:var(--bg-card); border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; margin-bottom:10px; }
.fb-card.unread    { border-color:var(--yellow); }
.fb-severity       { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:10px; font-size:10px; font-weight:700; }
.fb-severity.low   { background:#E8F5E9; color:#2E7D32; }
.fb-severity.medium{ background:#FFF8E1; color:#F57F17; }
.fb-severity.high  { background:#FFEBEE; color:#C62828; }

/* ══════════════════════════════════════════════
   INTERNAL GAMIFICATION - Recognition System
   ══════════════════════════════════════════════ */

/* ── Celebration overlay ─ */
.gam-celebration   { position:fixed; inset:0; z-index:99999; background:rgba(10,20,50,.92); display:flex; align-items:center; justify-content:center; }
.gam-cel-box       { background:#fff; border-radius:20px; padding:36px 40px; max-width:520px; width:90%; text-align:center; position:relative; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.4); animation:cel-pop .4s cubic-bezier(.175,.885,.32,1.275); }
@keyframes cel-pop { from{transform:scale(.7);opacity:0} to{transform:scale(1);opacity:1} }
.gam-cel-banner    { font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.12em; color:var(--primary); margin-bottom:8px; }
.gam-cel-name      { font-size:26px; font-weight:800; margin-bottom:4px; }
.gam-cel-cat       { display:inline-flex; align-items:center; gap:8px; padding:8px 20px; border-radius:30px; font-size:14px; font-weight:700; margin:12px 0; }
.gam-cel-msg       { font-size:14px; color:var(--text-2); line-height:1.6; margin:12px 0 16px; font-style:italic; }
.gam-cel-from      { font-size:12px; color:var(--text-3); margin-bottom:16px; }
.gam-cel-points    { font-size:28px; font-weight:800; color:#FFD700; margin-bottom:4px; }
.gam-cel-tier      { display:inline-flex; align-items:center; gap:6px; padding:5px 14px; border-radius:20px; font-size:12px; font-weight:700; margin-bottom:20px; }
.gam-cel-actions   { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }

/* ── Confetti particles ─ */
.confetti-wrap     { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.confetti-piece    { position:absolute; width:8px; height:8px; top:-10px; border-radius:2px; animation:confetti-fall linear infinite; }
@keyframes confetti-fall {
  0%   { transform:translateY(-10px) rotate(0deg);   opacity:1; }
  100% { transform:translateY(110vh) rotate(720deg); opacity:0; }
}

/* ── Points badge ─ */
.gam-points-badge  { display:inline-flex; align-items:center; gap:5px; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:700; background:#FFFEF0; color:#BA7517; border:1.5px solid #FFD700; }
.gam-tier-badge    { display:inline-flex; align-items:center; gap:5px; padding:4px 12px; border-radius:20px; font-size:11px; font-weight:700; }

/* ── Recognition category selector ─ */
.gam-cat-grid      { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:14px; }
.gam-cat-btn       { border:1.5px solid var(--border); background:var(--bg-2); border-radius:var(--radius-md); padding:10px 6px; text-align:center; cursor:pointer; transition:all .15s; }
.gam-cat-btn:hover { border-color:var(--primary); transform:translateY(-1px); }
.gam-cat-btn.selected { border-width:2px; transform:translateY(-1px); box-shadow:0 2px 8px rgba(0,0,0,.12); }
.gam-cat-btn i     { font-size:20px; display:block; margin-bottom:4px; }
.gam-cat-btn span  { font-size:10px; font-weight:600; display:block; }
.gam-cat-pts       { font-size:9px; color:var(--text-3); margin-top:2px; }

/* ── Recipient selector ─ */
.gam-recipient-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
.gam-recip-card    { border:1.5px solid var(--border); background:var(--bg-card); border-radius:var(--radius-md); padding:12px; text-align:center; cursor:pointer; transition:all .15s; }
.gam-recip-card:hover { border-color:var(--primary); }
.gam-recip-card.selected { border-color:var(--primary); background:var(--primary-bg); }
.gam-recip-av      { width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:#fff; margin:0 auto 6px; }
.gam-recip-name    { font-size:12px; font-weight:600; }
.gam-recip-shared  { font-size:10px; color:var(--text-3); margin-top:2px; }

/* ── Leaderboard ─ */
.gam-lb-card       { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; display:flex; align-items:center; gap:12px; margin-bottom:8px; transition:box-shadow .15s; }
.gam-lb-card:hover { box-shadow:0 2px 12px rgba(0,0,0,.08); }
.gam-lb-rank       { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; flex-shrink:0; }
.gam-lb-av         { width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:#fff; flex-shrink:0; }
.gam-lb-info       { flex:1; }
.gam-lb-name       { font-size:13px; font-weight:600; }
.gam-lb-tier       { font-size:10px; margin-top:2px; }
.gam-lb-pts        { text-align:right; }
.gam-lb-pts-num    { font-size:20px; font-weight:800; }
.gam-lb-pts-label  { font-size:10px; color:var(--text-3); }
.gam-lb-kudos-ct   { font-size:11px; color:var(--text-3); }

/* ── Certificate preview (in-app) ─ */
.gam-cert-wrap     { border-radius:var(--radius-lg); overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,.15); }
.gam-cert-canvas   { display:block; width:100%; }

/* ── Points progress bar ─ */
.gam-progress-track{ height:8px; background:var(--border); border-radius:4px; overflow:hidden; margin:6px 0; }
.gam-progress-fill { height:100%; border-radius:4px; transition:width .5s; }

/* ── Recognition card (feed) ─ */
.gam-rec-card      { background:var(--bg-card); border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:14px 16px; margin-bottom:10px; }
.gam-rec-card.unseen { border-color:var(--primary); background:var(--primary-bg); }
.gam-rec-head      { display:flex; align-items:center; gap:8px; margin-bottom:8px; }
.gam-rec-cat-badge { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:20px; font-size:10px; font-weight:700; }
.gam-rec-msg       { font-size:13px; color:var(--text); line-height:1.5; margin-bottom:8px; }
.gam-rec-footer    { display:flex; align-items:center; gap:8px; font-size:11px; color:var(--text-3); }

/* ── Settings ─ */
.gam-color-row     { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.gam-color-swatch  { width:32px; height:32px; border-radius:50%; cursor:pointer; border:2px solid var(--border); flex-shrink:0; }
.gam-cat-edit-row  { display:flex; align-items:center; gap:8px; padding:8px 0; border-bottom:1px solid var(--border); }
.gam-cat-icon-pick { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.gam-icon-opt      { font-size:18px; padding:5px; border-radius:6px; cursor:pointer; border:1.5px solid transparent; }
.gam-icon-opt.active { border-color:var(--primary); background:var(--primary-bg); }

/* ══════════════════════════════════════════════
   ONBOARDING WIZARD
   ══════════════════════════════════════════════ */

/* ── Full-screen wizard overlay ─ */
.wiz-overlay        { position:fixed; inset:0; z-index:9000; background:rgba(8,18,40,.88); display:flex; align-items:center; justify-content:center; padding:20px; }
.wiz-box            { background:var(--bg-card); border-radius:20px; width:100%; max-width:680px; max-height:90vh; display:flex; flex-direction:column; box-shadow:0 24px 64px rgba(0,0,0,.4); overflow:hidden; animation:wiz-in .3s cubic-bezier(.175,.885,.32,1.275); }
@keyframes wiz-in   { from{transform:scale(.94) translateY(16px);opacity:0} to{transform:scale(1) translateY(0);opacity:1} }

/* ── Wizard header ─ */
.wiz-header         { background:linear-gradient(135deg,#0d2240,#1a3a5c); padding:20px 28px 16px; color:#fff; flex-shrink:0; }
.wiz-title          { font-size:18px; font-weight:800; margin-bottom:3px; }
.wiz-subtitle       { font-size:12px; opacity:.7; }

/* ── Step progress bar ─ */
.wiz-steps          { display:flex; align-items:center; gap:0; margin-top:14px; }
.wiz-step           { display:flex; align-items:center; gap:0; flex:1; }
.wiz-step-dot       { width:26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; flex-shrink:0; transition:all .2s; border:2px solid rgba(255,255,255,.3); color:rgba(255,255,255,.6); }
.wiz-step-dot.done  { background:#FFD700; border-color:#FFD700; color:#7A5C00; }
.wiz-step-dot.active{ background:#fff; border-color:#fff; color:#1a3a5c; }
.wiz-step-line      { flex:1; height:2px; background:rgba(255,255,255,.2); margin:0 4px; }
.wiz-step-line.done { background:#FFD700; }
.wiz-step-label     { font-size:9px; text-align:center; margin-top:3px; opacity:.7; white-space:nowrap; }
.wiz-step.active .wiz-step-label { opacity:1; font-weight:700; }

/* ── Wizard body (scrollable) ─ */
.wiz-body           { flex:1; overflow-y:auto; padding:24px 28px; }

/* ── Wizard footer ─ */
.wiz-footer         { padding:14px 28px; border-top:1px solid var(--border); display:flex; gap:10px; align-items:center; background:var(--bg-card); flex-shrink:0; }
.wiz-step-counter   { font-size:11px; color:var(--text-3); margin-right:auto; }

/* ── Intake question styles ─ */
.wiz-section        { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; color:var(--text-3); margin:18px 0 10px; padding-top:14px; border-top:1px solid var(--border); }
.wiz-section:first-child { margin-top:0; border-top:none; padding-top:0; }
.wiz-check-grid     { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.wiz-check-grid-3   { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; }
.wiz-check-item     { display:flex; align-items:center; gap:8px; padding:8px 10px; border:1.5px solid var(--border); border-radius:var(--radius-md); cursor:pointer; transition:all .15s; font-size:12px; }
.wiz-check-item:hover { border-color:var(--primary); }
.wiz-check-item.selected { border-color:var(--primary); background:var(--primary-bg); font-weight:500; }
.wiz-check-item input { flex-shrink:0; }
.wiz-radio-group    { display:flex; flex-direction:column; gap:6px; }
.wiz-radio-item     { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border:1.5px solid var(--border); border-radius:var(--radius-md); cursor:pointer; transition:all .15s; }
.wiz-radio-item:hover { border-color:var(--primary); }
.wiz-radio-item.selected { border-color:var(--primary); background:var(--primary-bg); }
.wiz-radio-item input { margin-top:2px; flex-shrink:0; }
.wiz-radio-label    { font-size:13px; font-weight:500; }
.wiz-radio-sub      { font-size:11px; color:var(--text-3); margin-top:1px; }

/* ── Review step ─ */
.wiz-review-grid    { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.wiz-review-card    { background:var(--bg-2); border-radius:var(--radius-md); padding:12px 14px; }
.wiz-review-head    { font-size:10px; font-weight:700; text-transform:uppercase; color:var(--text-3); margin-bottom:8px; }
.wiz-review-row     { display:flex; justify-content:space-between; font-size:11px; padding:3px 0; border-bottom:1px solid var(--border-light,rgba(0,0,0,.04)); }
.wiz-review-row:last-child { border-bottom:none; }
.wiz-review-key     { color:var(--text-3); }
.wiz-review-val     { font-weight:500; text-align:right; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── Document intelligence overlay ─ */
.doc-intel-overlay  { position:fixed; inset:0; z-index:9500; background:rgba(8,18,40,.92); display:flex; align-items:center; justify-content:center; padding:20px; }
.doc-intel-box      { background:var(--bg-card); border-radius:16px; width:100%; max-width:640px; max-height:92vh; display:flex; flex-direction:column; box-shadow:0 24px 64px rgba(0,0,0,.4); overflow:hidden; }
.doc-intel-header   { background:linear-gradient(135deg,#0d2240,#0F6E56); padding:18px 24px; color:#fff; }
.doc-intel-body     { flex:1; overflow-y:auto; padding:20px 24px; }
.doc-intel-field    { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); }
.doc-intel-field:last-child { border-bottom:none; }
.doc-intel-label    { font-size:11px; color:var(--text-3); width:140px; flex-shrink:0; }
.doc-intel-val      { flex:1; }
.doc-intel-conf     { font-size:9px; padding:2px 6px; border-radius:8px; flex-shrink:0; }
.doc-intel-conf.high   { background:#E8F5E9; color:#2E7D32; }
.doc-intel-conf.med    { background:#FFF8E1; color:#F57F17; }
.doc-intel-conf.low    { background:#FFEBEE; color:#C62828; }
.doc-upload-zone    { border:2px dashed var(--border); border-radius:var(--radius-lg); padding:32px; text-align:center; cursor:pointer; transition:border-color .2s; }
.doc-upload-zone:hover { border-color:var(--primary); }
.doc-upload-zone.dragging { border-color:var(--primary); background:var(--primary-bg); }
.doc-processing     { text-align:center; padding:32px; }
.doc-processing-spinner { width:48px; height:48px; border:4px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:spin 1s linear infinite; margin:0 auto 16px; }
@keyframes spin      { to { transform:rotate(360deg); } }

/* ── Integration pages ─ */
.int-provider-grid  { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; }
.int-provider-card  { border:1.5px solid var(--border); border-radius:var(--radius-lg); padding:16px; text-align:center; cursor:pointer; transition:all .15s; }
.int-provider-card:hover { border-color:var(--primary); }
.int-provider-card.selected { border-color:var(--primary); background:var(--primary-bg); }
.int-provider-logo  { font-size:28px; margin-bottom:8px; }
.int-provider-name  { font-size:12px; font-weight:600; }
.int-lead-table     { width:100%; border-collapse:collapse; font-size:12px; }
.int-lead-table th  { text-align:left; padding:6px 10px; font-size:10px; font-weight:700; text-transform:uppercase; color:var(--text-3); border-bottom:2px solid var(--border); }
.int-lead-table td  { padding:10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.int-lead-table tbody tr:hover td { background:var(--bg-2); }

/* ── Billing (family view) ─ */
.fp-invoice-row    { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); font-size:12px; }
.fp-invoice-row:last-child { border-bottom:none; }
.fp-payment-method { background:var(--bg-2); border-radius:var(--radius-md); padding:12px 16px; display:flex; align-items:center; gap:10px; margin-bottom:12px; }

/* ── Family account table (admin) ─ */
.fa-table          { width:100%; border-collapse:collapse; font-size:12px; }
.fa-table th       { text-align:left; padding:6px 10px; font-size:10px; font-weight:700; text-transform:uppercase; color:var(--text-3); border-bottom:2px solid var(--border); }
.fa-table td       { padding:10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.fa-table tbody tr:hover td { background:var(--bg-2); }

/* ── Toggle rows (re-used from EVV but scoped to fp-) ─ */
.fp-toggle-section { margin-bottom:20px; }
.fp-toggle-head    { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--text-3); margin-bottom:8px; padding-bottom:6px; border-bottom:1px solid var(--border); }

/* ── Disabled section placeholder ─ */
.fp-disabled-section { padding:32px; text-align:center; color:var(--text-3); font-size:13px; background:var(--bg-2); border-radius:var(--radius-lg); border:1.5px dashed var(--border); }
.fp-disabled-section i { font-size:28px; display:block; margin-bottom:8px; }


/* Scheduling service-type filter dropdown */
.svc-filter summary::-webkit-details-marker { display:none; }
.svc-filter summary::marker { content:""; }
.svc-filter summary { user-select:none; }
.svc-filter[open] summary .ti-chevron-down { transform:rotate(180deg); }

/* ─────────────────────────────────────────────────────────────────────
   RESPONSIVE / MOBILE PASS
   The caregiver portal + checkout are the mobile-primary surfaces; the
   admin app degrades gracefully to narrow widths.
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .nav-links { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-links::-webkit-scrollbar { height: 0; }
  .nav-btn { padding: 0 12px; }
  .home-kpi-strip { flex-wrap: wrap; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .nav-cards { grid-template-columns: 1fr !important; }
  .home-panels { grid-template-columns: 1fr !important; }
  .profile-body { padding: 14px; }
  .sched-stats { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  html { font-size: 14px; }
  .global-nav { padding: 0 10px; }
  .logo-agency { display: none; }
  .profile-header { flex-wrap: wrap; }
  .profile-header-right { width: 100%; margin-top: 8px; }
  .breadcrumb-bar { display: none !important; }
  .modal-box { width: 94vw; max-width: 94vw; }
  .role-switcher { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────
   UTILITY CLASSES - adopt these in place of repeated inline styles.
   ───────────────────────────────────────────────────────────────────── */
.u-muted    { color: var(--text-2); }
.u-faint    { color: var(--text-3); }
.u-sm       { font-size: 12px; }
.u-xs       { font-size: 11px; }
.u-bold     { font-weight: 600; }
.u-row      { display: flex; align-items: center; }
.u-row-gap  { display: flex; align-items: center; gap: 8px; }
.u-col      { display: flex; flex-direction: column; }
.u-between  { display: flex; align-items: center; justify-content: space-between; }
.u-wrap     { flex-wrap: wrap; }
.u-mt-8  { margin-top: 8px; }  .u-mt-12 { margin-top: 12px; } .u-mt-16 { margin-top: 16px; }
.u-mb-8  { margin-bottom: 8px; } .u-mb-12 { margin-bottom: 12px; }
.u-divider { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
