:root {
  --ink: #20202b;
  --muted: #6c6c7b;
  --line: #e7e4ed;
  --surface: #ffffff;
  --page: #f7f6f8;
  --purple: #5b3fc1;
  --purple-soft: #f0eafe;
  --lavender: #9a76e8;
  --green: #3d9660;
  --green-soft: #e9f7ed;
  --blue: #477cc8;
  --blue-soft: #e9f3ff;
  --pink: #d03c82;
  --pink-soft: #fff0f6;
  --amber: #d98a08;
  --amber-soft: #fff6dc;
  --red: #d92d20;
  --shadow: 0 20px 60px rgba(50, 35, 90, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--page);
  font-family: "DM Sans", system-ui, sans-serif;
}

[hidden] { display: none !important; }

.login-page {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(380px, .95fr);
  min-height: 100vh;
  background: white;
}
.login-welcome { display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 8vw, 110px); color: white; background: linear-gradient(145deg, #342173, #694bd0 62%, #8f72e1); }
.login-brand-logo {
  display: block;
  width: min(440px, 90%);
  max-height: 430px;
  margin-bottom: 28px;
  object-fit: contain;
  object-position: left center;
  border-radius: 22px;
  box-shadow: 0 20px 55px rgba(20, 15, 45, .28);
}
.login-welcome .eyebrow { color: #e8e0ff; }
.login-welcome h1 { margin: 0; font: 700 clamp(46px, 7vw, 82px) "Fraunces", serif; line-height: .98; }
.login-welcome > p:not(.eyebrow) { max-width: 620px; margin: 25px 0; color: #eeeaff; font-size: 17px; line-height: 1.7; }
.login-feature-list { display: grid; gap: 10px; margin-top: 16px; }
.login-feature-list span::before { content: "✓"; display: inline-grid; place-items: center; width: 23px; height: 23px; margin-right: 10px; color: #352276; background: white; border-radius: 50%; font-weight: 800; }
.login-panel { display: grid; place-items: center; padding: 40px; background: #faf9fc; }
.login-card { width: min(440px, 100%); padding: 38px; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 8px; font: 700 32px "Fraunces", serif; }
.login-help { margin: 0 0 26px; color: var(--muted); line-height: 1.5; }
.login-card label { display: block; margin-top: 16px; color: var(--muted); font-size: 12px; font-weight: 700; }
.login-card input { width: 100%; margin-top: 6px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.login-button { width: 100%; margin-top: 12px; }
.login-error { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 12px; font-weight: 700; }
.login-security-note { margin: 20px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }
.role-badge { padding: 5px 8px; color: var(--purple); background: var(--purple-soft); border-radius: 999px; font-size: 9px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.logout-button { padding: 7px 9px; border: 1px solid var(--line); background: white; border-radius: 7px; font-size: 10px; font-weight: 800; white-space: nowrap; }
body.caretaker-mode .admin-only { display: none !important; }
.caretaker-only { display: none !important; }
body.caretaker-mode .caretaker-only { display: block !important; }
/* My Schedule section: hidden by default, shown only for caretakers with manageCaretakers permission */
.caretaker-manage-section { display: none !important; }
body.caretaker-can-manage .caretaker-manage-section { display: block !important; }

/* Branded secure login portal */
.login-page {
  grid-template-columns: minmax(480px, 1.28fr) minmax(430px, .72fr);
  border-top: 5px solid #c83735;
}
.login-welcome {
  position: relative;
  align-items: center;
  min-height: calc(100vh - 5px);
  padding: 50px clamp(45px, 8vw, 120px) 34px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 17%, rgba(103,158,245,.38), transparent 27%), linear-gradient(155deg, #17266f 0%, #21489d 48%, #3167c8 100%);
  text-align: center;
}
.login-welcome::before { content: ""; position: absolute; inset: 0; opacity: .16; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 72%); }
.login-welcome > * { position: relative; z-index: 1; }
.login-brand-logo--centered {
  width: min(440px, 78%);
  height: auto;
  max-height: 390px;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  box-shadow: none;
  padding: 12px;
  background: rgba(255,255,255,.96);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(8,20,70,.26);
  mix-blend-mode: normal;
}
.login-logo-seal { display: grid; place-items: center; width: 190px; height: 190px; overflow: hidden; background: white; border: 8px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 6px rgba(26,36,100,.55), 0 18px 38px rgba(7,18,70,.42); }
.login-logo-seal .login-brand-logo { width: 153%; height: 153%; max-height: none; margin: 0; object-fit: cover; object-position: center 24%; border-radius: 0; box-shadow: none; }
.login-wordmark { margin-top: 17px; line-height: 1; }
.login-wordmark strong { display: block; font-size: 31px; letter-spacing: .04em; }
.login-wordmark strong span { color: #e2473f; }
.login-wordmark small { display: block; margin-top: 8px; color: #c9d8fa; font-size: 10px; font-weight: 800; letter-spacing: .28em; text-transform: uppercase; }
.login-divider { width: 56px; height: 2px; margin: 48px 0 25px; background: linear-gradient(90deg, transparent, #9fc1ff, transparent); }
.login-platform-label { margin: 0 0 12px; color: #b9cef5; font-size: 10px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; }
.login-platform-label::before, .login-platform-label::after { content: ""; display: inline-block; width: 30px; height: 1px; margin: 0 12px 3px; background: #7da5e8; }
.login-welcome h1 { margin: 0; font: 700 clamp(36px, 4vw, 54px) "DM Sans", sans-serif; line-height: 1.05; }
.login-welcome > p:not(.login-platform-label):not(.login-copyright) { max-width: 510px; margin: 20px 0 0; color: #c7d6f3; font-size: 14px; line-height: 1.7; }
.login-feature-list { grid-template-columns: 1fr 1fr; gap: 10px; width: min(470px, 100%); margin-top: 28px; text-align: left; }
.login-feature-list span { display: flex; align-items: center; min-height: 54px; padding: 11px 13px; color: #e7efff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13); border-radius: 9px; font-size: 11px; font-weight: 700; }
.login-feature-list span::before { display: inline-grid; place-items: center; width: 29px; height: 29px; flex: none; margin-right: 10px; color: white; background: #dc3e39; border-radius: 7px; font-weight: 800; }
.feature-schedule::before { content: "□"; }.feature-alerts::before { content: "!"; }.feature-shifts::before { content: "●"; }.feature-rehab::before { content: "↗"; }
.login-copyright { margin: auto 0 0; padding-top: 35px; color: rgba(218,229,251,.45); font-size: 9px; }
.login-panel { min-height: calc(100vh - 5px); padding: 55px clamp(35px, 5vw, 76px); background: white; }
.login-card { width: min(440px, 100%); padding: 0; border: 0; border-radius: 0; box-shadow: none; }
.login-access-label { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; color: #315da7; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; }
.login-access-label span { display: grid; place-items: center; width: 34px; height: 34px; color: white; background: #db3d39; border-radius: 9px; box-shadow: 0 6px 14px rgba(219,61,57,.25); font-size: 19px; }
.login-card h2 { margin: 0 0 9px; color: #101c59; font: 800 34px "DM Sans", sans-serif; line-height: 1.12; }
.login-help { margin: 0 0 28px; color: #8a8f9b; font-size: 12px; line-height: 1.55; }
.login-role-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 25px; padding: 4px; background: #eef1f4; border: 1px solid #d8dde3; border-radius: 9px; }
.login-role-tabs button { padding: 9px 5px; color: #81858d; background: transparent; border: 0; border-radius: 7px; font-size: 11px; font-weight: 700; }
.login-role-tabs button.active { color: #17235f; background: white; box-shadow: 0 2px 6px rgba(30,42,75,.12); }
.login-card label { margin-top: 15px; color: #202746; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.login-input-wrap { display: flex; align-items: center; width: 100%; margin-top: 7px; padding-left: 13px; color: #bac1ca; background: #f8f9fb; border: 1px solid #dce1e7; border-radius: 9px; }
.login-card .login-input-wrap input { width: 100%; margin: 0; padding: 13px 12px 13px 9px; border: 0; outline: 0; background: transparent; font-size: 12px; text-transform: none; }
.forgot-password { display: block; margin: 8px 0 0 auto; padding: 0; color: #315da7; background: none; border: 0; font-size: 10px; }
.login-account-links { display: flex; justify-content: space-between; gap: 14px; margin-top: 9px; }
.login-account-links .forgot-password { margin: 0; }
.login-button { margin-top: 8px; padding: 14px; background: linear-gradient(90deg, #17266f, #3565bd); border-radius: 8px; box-shadow: 0 9px 20px rgba(31,67,145,.24); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.login-error { min-height: 18px; margin: 5px 0 0; font-size: 11px; }
.login-system-status { margin-top: 22px; padding: 10px 12px; color: #3062a7; background: #edf7ff; border: 1px solid #b9d7f1; border-radius: 7px; font-size: 10px; }
.login-system-status span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; background: #4aba55; border-radius: 50%; box-shadow: 0 0 0 3px #dff4e2; }
.login-protected-note { margin-top: 25px; padding-top: 20px; color: #7d8290; border-top: 1px solid #dce1e7; font-size: 9px; line-height: 1.5; text-align: center; }
.login-protected-note strong { display: block; color: #293251; }
.login-protected-note p { margin: 5px 0 0; }

.portal-page { min-height: 100vh; background: linear-gradient(180deg, #f7f9fe, #f4f1fb); }
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 94px;
  padding: 12px clamp(24px, 5vw, 72px);
  background: white;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(42, 50, 94, .06);
}
.portal-brand img { display: block; width: 190px; height: 68px; object-fit: contain; object-position: left center; }
.portal-user { display: flex; align-items: center; gap: 18px; text-align: right; }
.portal-user small, .portal-user strong, .portal-user span { display: block; }
.portal-user small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.portal-user strong { margin-top: 2px; color: #101c59; font-size: 15px; }
.portal-user span { margin-top: 2px; color: var(--purple); font-size: 10px; font-weight: 800; }
.portal-content { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0; }
.portal-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 34px; }
.portal-heading h1 { margin: 4px 0 8px; color: #111b51; font: 700 clamp(36px, 5vw, 54px) "Fraunces", serif; }
.portal-heading p:last-child { margin: 0; color: var(--muted); }
.portal-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.client-board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.client-board-card {
  position: relative;
  min-height: 285px;
  padding: 28px;
  overflow: hidden;
  color: #17235f;
  background: white;
  border: 1px solid #e1dced;
  border-radius: 20px;
  box-shadow: 0 16px 44px rgba(51, 45, 91, .09);
  text-align: left;
}
.client-board-card::after { content: ""; position: absolute; right: -42px; bottom: -54px; width: 160px; height: 160px; background: var(--purple-soft); border-radius: 50%; }
.client-board-card:hover { transform: translateY(-3px); border-color: #c8b8ee; box-shadow: 0 22px 54px rgba(51, 45, 91, .14); }
.client-board-house { position: relative; z-index: 1; display: grid; place-items: center; width: 76px; height: 76px; overflow: hidden; color: white; background: linear-gradient(145deg, #3f2a8d, #7251d4); border-radius: 22px; font-size: 37px; box-shadow: 0 12px 24px rgba(70, 46, 151, .22); }
.client-board-house img { width: 100%; height: 100%; object-fit: cover; }
.client-board-card h2 { position: relative; z-index: 1; margin: 24px 0 7px; font: 700 28px "Fraunces", serif; }
.client-board-card p { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.client-board-open { position: relative; z-index: 1; display: inline-flex; margin-top: 22px; color: var(--purple); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.portal-empty { grid-column: 1 / -1; padding: 54px 28px; color: var(--muted); background: white; border: 1px dashed #cac4d7; border-radius: 18px; text-align: center; }
.portal-empty strong { display: block; margin-bottom: 8px; color: #202746; font-size: 18px; }
.access-modal { max-width: 520px; }
.access-modal h2 { margin: 0 0 8px; font: 700 30px "Fraunces", serif; }
.field-help { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.45; text-transform: none; letter-spacing: 0; }

button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: 76px minmax(calc(100vh - 76px), auto);
  max-width: 1800px;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 260px 280px minmax(300px, 1fr) auto;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  border-right: 1px solid var(--line);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: white;
  background: linear-gradient(145deg, #886be1, #4f32ad);
  border-radius: 14px 14px 18px 18px;
  font-size: 22px;
  box-shadow: 0 8px 18px rgba(91,63,193,.24);
}

.brand strong, .brand small { display: block; white-space: nowrap; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); font-size: 11px; }

.view-tabs { display: flex; gap: 8px; padding-left: 28px; }
.view-tab, .date-button, .icon-button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 9px;
}
.view-tab { padding: 10px 20px; font-weight: 600; }
.view-tab.active { color: white; border-color: var(--purple); background: var(--purple); }

.date-controls { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.date-button { display: flex; align-items: center; gap: 18px; padding: 9px 14px; font-weight: 600; }
.icon-button { width: 40px; height: 40px; font-size: 22px; }
#datePicker { position: absolute; opacity: 0; pointer-events: none; }

.topbar-actions { display: flex; align-items: center; gap: 12px; padding: 0 22px; }
.client-switcher { display: grid; gap: 2px; color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.client-switcher select { max-width: 150px; padding: 6px 24px 6px 8px; border: 1px solid var(--line); background: white; border-radius: 7px; font-size: 11px; font-weight: 700; text-transform: none; }
.client-manager-button { padding: 7px 9px; color: var(--purple); background: var(--purple-soft); border: 0; border-radius: 7px; font-size: 10px; font-weight: 800; }
#liveClock { min-width: 82px; font-weight: 700; white-space: nowrap; }
.notification-button { position: relative; color: var(--purple); }
.notification-count {
  position: absolute;
  top: -7px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: white;
  background: var(--red);
  border: 2px solid white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  border-right: 1px solid var(--line);
  background: #fcfbfd;
}

.profile-card, .caregiver-card { padding: 24px 28px; border-bottom: 1px solid var(--line); }
.profile-card { cursor: pointer; transition: background .18s; }
.profile-card:hover, .profile-card:focus-visible { background: #f7f3ff; outline: none; }
.eyebrow { margin: 0 0 16px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.accent { color: var(--purple); margin-bottom: 6px; }
.profile-heading { display: flex; gap: 14px; align-items: center; }
.avatar { display: grid; place-items: center; width: 72px; height: 72px; flex: none; overflow: hidden; color: white; background: linear-gradient(145deg, #d9ccf5, #ad90e5); border-radius: 50%; font: 700 30px "Fraunces", serif; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-heading small, .profile-detail small { display: block; color: var(--muted); }
.profile-heading h1 { margin: 2px 0 0; font: 700 27px "Fraunces", serif; }
.profile-detail { display: grid; gap: 6px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.hydration-mini { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.hydration-mini span, .hydration-mini strong { display: block; font-size: 11px; }
.hydration-mini span { color: var(--muted); }
.hydration-mini strong { margin: 3px 0 7px; color: var(--blue); }
.hydration-bar { height: 6px; overflow: hidden; background: #e5eefb; border-radius: 999px; }
.hydration-bar i { display: block; width: 0; height: 100%; background: var(--blue); border-radius: inherit; transition: width .2s; }
.profile-open-hint { display: block; margin-top: 10px; color: var(--purple); font-size: 10px; font-weight: 700; }
.profile-detail a, .caregiver-card a { color: var(--purple); font-weight: 700; text-decoration: none; }
.caregiver-card { display: grid; gap: 8px; }
.caregiver-card p { margin: 0; color: var(--muted); }
.card-heading-row, .rail-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-heading-row .eyebrow { margin: 0; }
#caregiverSummary { display: grid; gap: 8px; }
.sidebar-shift + .sidebar-shift { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.sidebar-shift { display: grid; gap: 5px; }
.caregiver-name { display: flex; align-items: center; gap: 9px; font-size: 17px; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #55b96a; box-shadow: 0 0 0 4px #e9f8ec; }
.no-caregiver { padding: 12px; color: var(--muted); background: white; border: 1px dashed #c9c5d0; border-radius: 10px; font-size: 13px; }
.small-add-button { padding: 7px 10px; border: 0; color: var(--purple); background: var(--purple-soft); border-radius: 8px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.manage-button { width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid #d8cafa; color: var(--purple); background: white; border-radius: 8px; font-size: 12px; font-weight: 800; }

.side-nav { display: grid; gap: 4px; padding: 18px 14px; }
.side-nav button {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  text-align: left;
}
.side-nav button span { width: 20px; color: var(--purple); font-size: 18px; text-align: center; }
.side-nav button:hover, .side-nav button.active { color: var(--purple); background: var(--purple-soft); font-weight: 700; }

.main-content {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(590px, 1fr) 330px;
  min-width: 0;
}

.schedule-panel { min-width: 0; padding: 24px 28px 32px; }
.right-rail { border-left: 1px solid var(--line); background: #fcfcfd; }
.dashboard-intro { margin-bottom: 22px; padding: 18px 20px; color: #fff; background: linear-gradient(135deg, #3b267f, #694bd0); border-radius: 14px; }
.dashboard-intro .eyebrow { color: #ddd3ff; }
.dashboard-intro h2 { margin: 0; font: 700 26px "Fraunces", serif; }
.dashboard-intro p:last-child { margin: 6px 0 0; color: #eeeaff; font-size: 12px; }
.caretaker-shift-header {
  margin-bottom: 16px;
  padding: 22px;
  color: white;
  background: linear-gradient(135deg, #342173, #674acb);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(62, 41, 126, .2);
}
.caretaker-shift-header > div:first-child { margin-bottom: 18px; }
.caretaker-shift-header .eyebrow { margin-bottom: 5px; color: #ddd3ff; }
.caretaker-shift-header h2 { margin: 0; font: 700 30px "Fraunces", serif; }
.caretaker-shift-header p:last-child { margin: 6px 0 0; color: #eeeaff; font-size: 13px; }
.caretaker-shift-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.caretaker-shift-facts div { padding: 11px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); border-radius: 10px; }
.caretaker-shift-facts span, .caretaker-shift-facts strong { display: block; }
.caretaker-shift-facts span { margin-bottom: 3px; color: #ded7f7; font-size: 9px; text-transform: uppercase; }
.caretaker-shift-facts strong { font-size: 12px; }
.caretaker-shift-button { margin-top: 14px; padding: 10px 14px; color: #203f87; background: white; border: 0; border-radius: 8px; font-size: 11px; font-weight: 800; }
.caretaker-alert-panel { margin-bottom: 14px; padding: 16px; background: #fff3f1; border: 1px solid #f0b6af; border-radius: 14px; }
.caretaker-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.caretaker-panel-heading .eyebrow { margin-bottom: 2px; color: var(--red); }
.caretaker-panel-heading h3 { margin: 0; font-size: 18px; }
.caretaker-count { display: grid; place-items: center; width: 34px; height: 34px; color: white; background: var(--red); border-radius: 50%; font-weight: 800; }
#caretakerAlerts { display: grid; gap: 7px; margin-top: 12px; }
.caretaker-alert-item { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 2px 10px; padding: 11px; color: #6b211b; background: white; border: 1px solid #efc7c2; border-radius: 9px; text-align: left; }
.caretaker-alert-item span { grid-row: 1 / 3; font-weight: 800; }
.caretaker-alert-item small { color: #86534e; }
.caretaker-now-next { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
body.caretaker-mode .caretaker-now-next { display: grid !important; }
.caretaker-now-next > article { min-height: 132px; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.caretaker-now-next > article:first-child { border-color: #d8cafa; box-shadow: inset 4px 0 var(--purple); }
.caretaker-now-next .eyebrow { margin-bottom: 8px; color: var(--purple); }
.caretaker-priority-task { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }
.caretaker-priority-task > span { color: var(--purple); font-weight: 800; }
.caretaker-priority-task p { grid-column: 1 / -1; margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.caretaker-empty { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.caretaker-empty.success { color: #236a3e; }
.subheading.blue > span { color: var(--blue); font-size: 14px; font-weight: 800; }
.caretaker-summary-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 9px; padding: 9px; background: white; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.caretaker-summary-row > span:first-child { color: var(--blue); font-weight: 800; }
.caretaker-summary-row > span:last-child { color: var(--amber); font-weight: 800; }
.caretaker-summary-row button { padding: 6px 8px; color: white; background: var(--blue); border: 0; border-radius: 6px; font-size: 9px; font-weight: 800; }
.caretaker-summary-row button.done { color: #236a3e; background: var(--green-soft); }
.caretaker-summary-row.done { opacity: .62; }
.caretaker-summary-row.done > span:last-child { color: var(--green); }
.caretaker-water-progress { margin-top: 12px; padding: 12px; color: #315f9f; background: var(--blue-soft); border-radius: 9px; }
.caretaker-water-progress strong, .caretaker-water-progress span { display: block; }
.caretaker-water-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.caretaker-water-actions button { padding: 8px; color: #315f9f; background: white; border: 1px solid #bed8f4; border-radius: 7px; font-size: 10px; font-weight: 800; }
.caretaker-water-actions button.done { color: #236a3e; background: var(--green-soft); border-color: #bce0c5; }
.caretaker-contact { color: white; background: linear-gradient(135deg, #315f9f, #477cc8); }
.caretaker-contact .eyebrow { margin-bottom: 6px; color: #d7e7ff; }
.caretaker-contact strong, .caretaker-contact a { display: block; }
.caretaker-contact a { margin-top: 10px; padding: 10px; color: #234f8a; background: white; border-radius: 8px; font-weight: 800; text-align: center; text-decoration: none; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 0; font: 700 28px "Fraunces", serif; }
.section-heading p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); }
.day-hours-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.day-hours-button { padding: 6px 9px; border: 1px solid #d8cafa; color: var(--purple); background: var(--purple-soft); border-radius: 7px; font-size: 11px; font-weight: 800; }
.progress-ring {
  --progress: 0deg;
  display: grid;
  place-items: center;
  align-content: center;
  width: 78px;
  height: 78px;
  flex: none;
  background: radial-gradient(closest-side, white 75%, transparent 76%), conic-gradient(var(--purple) var(--progress), #ece8f5 0);
  border-radius: 50%;
}
.progress-ring strong, .progress-ring span { display: block; line-height: 1.1; }
.progress-ring span { color: var(--muted); font-size: 10px; }

.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 18px 0 14px; }
.legend span { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: #f5f4f7; border-radius: 8px; color: #555360; font-size: 12px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; }
.legend .routine { background: var(--lavender); }
.legend .exercise { background: var(--green); }
.legend .medication { background: var(--blue); }
.legend .appointment { background: var(--pink); }
.legend .caregiver { background: var(--amber); }

.calendar-view { display: none; }
.calendar-view.active { display: block; }
.schedule-list { display: grid; gap: 6px; }
.schedule-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.schedule-time { color: #4d4c58; font-size: 13px; font-weight: 600; text-align: right; }
.task-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 9px 13px;
  border: 1px solid;
  border-radius: 10px;
  text-align: left;
}
.task-card.editable { grid-template-columns: 22px 28px minmax(0, 1fr) auto auto auto; }
.task-card:hover { filter: saturate(1.12); transform: translateY(-1px); }
.task-card.routine { background: var(--purple-soft); border-color: #d8cafa; }
.task-card.exercise { background: var(--green-soft); border-color: #bce0c5; }
.task-card.medication { background: var(--blue-soft); border-color: #bed8f4; }
.task-card.appointment { background: var(--pink-soft); border-color: #f0bad3; }
.task-card.caregiver { background: var(--amber-soft); border-color: #f0d18c; }
.task-card.care { background: #fafafa; border-color: #ddd; }
.task-icon { display: grid; place-items: center; width: 26px; height: 26px; font-size: 17px; }
.task-title { font-weight: 700; }
.task-detail { color: var(--muted); font-size: 12px; }
.task-duration { color: #4d4c58; font-size: 12px; white-space: nowrap; }
.drag-handle { display: grid; place-items: center; width: 22px; height: 32px; color: var(--muted); cursor: grab; font-weight: 900; letter-spacing: -2px; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.task-edit-button { padding: 6px 8px; border: 0; color: var(--purple); background: rgba(255,255,255,.72); border-radius: 6px; font-size: 10px; font-weight: 800; }
.task-select-button { padding: 7px 9px; border: 0; color: white; background: var(--purple); border-radius: 6px; font-size: 10px; font-weight: 800; }
.task-actions { display: flex; align-items: center; gap: 5px; }
.task-remark-button { padding: 6px 8px; border: 0; color: #6d6250; background: rgba(255,255,255,.72); border-radius: 6px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.task-remark-button.has-remark { color: #795b09; background: #fff5bd; }
.task-remark-button.needs-review { color: #7a4b00; background: #ffd95c; box-shadow: 0 0 0 2px rgba(213, 151, 0, .22); }
.task-remark-button.needs-review span { color: #b26700; }
.task-card.has-unreviewed-remark { box-shadow: inset 4px 0 #e4a900; }
.task-alert-badge { padding: 4px 6px; color: white; background: var(--red); border-radius: 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.task-check { width: 22px; height: 22px; padding: 0; border: 2px solid currentColor; background: transparent; border-radius: 50%; opacity: .45; }
.task-card.completed { opacity: .57; }
.task-card.completed .task-title { text-decoration: line-through; }
.task-card.completed .task-check { position: relative; color: var(--green); background: var(--green); opacity: 1; }
.task-card.completed .task-check::after { content: "✓"; position: absolute; inset: -3px 0 0; color: white; font-size: 14px; text-align: center; }
.schedule-row.dragging { opacity: .38; }
.schedule-row.drop-target .task-card { outline: 3px solid var(--purple); outline-offset: 2px; transform: translateY(2px); }
.schedule-note { margin: 14px 0 0 82px; color: var(--muted); font-size: 12px; }

.overview-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.subheading { display: flex; align-items: center; gap: 10px; }
.subheading h3 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.subheading > span { color: var(--purple); font-size: 22px; }
.subheading.pink > span { color: var(--pink); }
.subheading.green > span { color: var(--green); }
.overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.overview-card { min-height: 108px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #faf9fc; }
.overview-card strong { display: block; margin-bottom: 7px; font-size: 13px; }
.overview-card p { margin: 3px 0; color: var(--muted); font-size: 12px; }

.rail-section { padding: 24px 18px; border-bottom: 1px solid var(--line); }
.appointment-card { margin-top: 14px; padding: 16px; border: 1px solid #efb4cd; background: linear-gradient(145deg, #fff7fa, #fff0f6); border-radius: 14px; }
.appointment-card + .appointment-card { margin-top: 10px; border-color: var(--line); background: white; }
.appointment-card.therapy-card { border-left: 5px solid var(--pink); }
.appointment-card.general-card { border-left: 5px solid var(--blue); background: linear-gradient(145deg, #f8fbff, #edf5ff); }
.appointment-card.general-card .appointment-type { color: var(--blue); }
.appointment-card h4 { margin: 0 0 8px; font-size: 16px; }
.appointment-card p { margin: 4px 0; font-size: 13px; }
.appointment-card .address { color: var(--muted); line-height: 1.45; }
.appointment-type { display: inline-block; margin-bottom: 8px; padding: 4px 7px; color: var(--pink); background: white; border-radius: 6px; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.appointment-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.delete-entry { padding: 5px 8px; border: 0; color: #a33a32; background: #fff; border-radius: 6px; font-size: 10px; font-weight: 700; }
.empty-state { margin: 14px 0 0; padding: 18px; border: 1px dashed #c9c5d0; border-radius: 12px; color: var(--muted); text-align: center; }
.conditional-note { color: var(--muted); font-size: 11px; }
.exercise-status { display: inline-block; margin: 12px 0 0; padding: 5px 8px; color: white; background: var(--green); border-radius: 7px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.home-plan.muted .exercise-status { background: var(--muted); }
.home-plan ol { margin: 14px 0 0; padding-left: 24px; line-height: 1.7; font-size: 13px; }
.home-plan li span { color: var(--muted); }
.home-plan.active { background: linear-gradient(145deg, #fbfffc, #eef9f1); }
.home-plan.muted { opacity: .5; }
.handoff-section { background: linear-gradient(145deg, #fff9c9, #ffef8a); }
.handoff-section textarea {
  width: 100%;
  min-height: 170px;
  margin-top: 14px;
  padding: 18px;
  border: 0;
  border-radius: 2px;
  resize: vertical;
  color: #3d3522;
  background: #fff3a6;
  box-shadow: 0 8px 18px rgba(115, 86, 16, .18), inset 0 -1px rgba(120, 87, 0, .16);
  font-family: "Segoe Print", "Comic Sans MS", cursive;
  font-size: 14px;
  line-height: 1.6;
}
.handoff-section .subheading > span, .handoff-section .subheading h3 { color: #795b09; }
.handoff-section .note-footer button { color: #654600; background: #ffd95c; }
.task-remark-modal { max-width: 620px; }
.remark-review-status { margin-top: 14px; padding: 12px; color: #65552a; background: #fff8cf; border: 1px solid #ecd679; border-radius: 9px; font-size: 11px; line-height: 1.5; }
.add-shifts-assignment { color: #654600; background: #fff0ae; }
.note-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.note-footer button { padding: 7px 10px; border: 0; color: var(--purple); background: var(--purple-soft); border-radius: 7px; font-weight: 700; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.week-day { min-height: 410px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #faf9fb; }
.week-day.today { border: 2px solid var(--purple); background: #fbf9ff; }
.week-day h3 { margin: 0; font-size: 13px; }
.week-day .day-number { display: block; margin: 4px 0 14px; color: var(--muted); font-size: 12px; }
.mini-task { margin: 6px 0; padding: 7px; border-left: 3px solid var(--lavender); background: white; border-radius: 5px; font-size: 10px; line-height: 1.35; }
.mini-task.exercise { border-color: var(--green); }
.mini-task.medication { border-color: var(--blue); }
.mini-task.appointment { border-color: var(--pink); }
.mini-task.caregiver { border-color: var(--amber); }
.mini-task.home-required { border-color: var(--green); background: var(--green-soft); }

body.caretaker-mode .app-shell { grid-template-columns: 1fr; }
body.caretaker-mode .topbar { grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.5fr) auto; }
body.caretaker-mode .view-tabs,
body.caretaker-mode #previousDate,
body.caretaker-mode #nextDate,
body.caretaker-mode #openSettings,
body.caretaker-mode #testAlert,
body.caretaker-mode .legend,
body.caretaker-mode .supply-summary-section { display: none !important; }

/* Hide sidebar for caretakers by default */
body.caretaker-mode .sidebar { display: none !important; }

/* Show a compact sidebar with only the Manage caretakers button when permitted */
body.caretaker-mode.can-manage-shifts .sidebar { display: block !important; }
body.caretaker-mode.can-manage-shifts .profile-card,
body.caretaker-mode.can-manage-shifts .profile-open-hint,
body.caretaker-mode.can-manage-shifts .side-nav { display: none !important; }
body.caretaker-mode.can-manage-shifts .caregiver-card { display: grid !important; }
body.caretaker-mode.can-manage-shifts .app-shell { grid-template-columns: 240px 1fr; }
body.caretaker-mode .date-controls { justify-content: flex-start; padding-left: 18px; }
body.caretaker-mode #datePickerButton { pointer-events: none; }
body.caretaker-mode .main-content { grid-column: 1; grid-template-columns: minmax(0, 1fr); background: #f8f7fb; }
body.caretaker-mode.can-manage-shifts .main-content { grid-column: 2; }
body.caretaker-mode .schedule-panel { max-width: 1180px; width: 100%; margin: 0 auto; padding-bottom: 18px; }
body.caretaker-mode .right-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 1180px; width: 100%; margin: 0 auto; padding: 0 28px 32px; border: 0; background: transparent; }
body.caretaker-mode .right-rail .rail-section { background: white; border: 1px solid var(--line); border-radius: 14px; }
body.caretaker-mode .right-rail .handoff-section { background: linear-gradient(145deg, #fff9c9, #ffef8a); }
body.caretaker-mode .right-rail .caretaker-contact { background: linear-gradient(135deg, #315f9f, #477cc8); }
body.caretaker-mode .section-heading { margin-top: 4px; }
body.caretaker-mode .day-hours-button { display: none; }
body.caretaker-mode .task-card { grid-template-columns: 28px minmax(0, 1fr) auto auto; min-height: 62px; padding: 11px 13px; }
body.caretaker-mode .task-card .drag-handle,
body.caretaker-mode .task-card .task-edit-button,
body.caretaker-mode .task-duration { display: none !important; }
body.caretaker-mode .task-actions { display: block; }
body.caretaker-mode .task-remark-button { min-width: 82px; padding: 8px; }
body.caretaker-mode .task-check { width: 28px; height: 28px; }
body.caretaker-mode .schedule-note { margin-left: 0; padding: 10px; background: white; border-radius: 8px; }

.month-weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-weekdays { color: var(--muted); font-size: 11px; text-align: center; }
.month-weekdays span { padding: 8px; }
.month-grid { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.month-day { min-height: 105px; padding: 8px; color: inherit; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; font: inherit; text-align: left; }
.month-day:hover { background: #f8f5ff; }
.month-day.outside { color: #aaa6b0; background: #fafafa; }
.month-day.today .month-number { display: grid; place-items: center; width: 25px; height: 25px; color: white; background: var(--purple); border-radius: 50%; }
.month-number { font-size: 12px; font-weight: 700; }
.month-dots { display: flex; gap: 3px; margin-top: 10px; }
.month-dots i { width: 7px; height: 7px; border-radius: 50%; }
.month-summary { margin-top: 8px; color: var(--muted); font-size: 9px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 19, 35, .52);
  backdrop-filter: blur(5px);
}
.modal-backdrop[hidden] { display: none; }
.reminder-modal, .settings-modal { position: relative; width: min(440px, 100%); padding: 38px; background: white; border-radius: 22px; box-shadow: var(--shadow); }
.reminder-modal { border: 5px solid var(--red); text-align: center; animation: alertIn .25s ease-out; }
.reminder-modal.alarm-active { animation: alertIn .25s ease-out, alarmPulse 1.2s ease-in-out infinite; }
.reminder-modal.alarm-active .alert-bell { animation: bellShake 0.6s ease-in-out infinite; }
.reminder-modal.alarm-active .modal-backdrop-bg { animation: backdropFlash 1.2s ease-in-out infinite; }
.modal-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; font-size: 28px; }
.alert-bell {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  color: white;
  background: var(--red);
  border-radius: 50%;
  font-size: 34px;
  box-shadow: 0 0 0 10px #fff0ed;
}
.alert-bell::after { content: "♬"; }
.alert-label { margin: 0; color: var(--red); font-size: 22px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.reminder-modal h2 { margin: 12px 0 8px; font: 700 26px "Fraunces", serif; }
.reminder-modal > p:not(.alert-label) { color: var(--muted); line-height: 1.6; }
.reminder-modal .acknowledge-note { margin: 16px 0 0; padding: 10px; color: #8b2018; background: #fff0ed; border-radius: 8px; font-size: 12px; font-weight: 700; }
.primary-button, .secondary-button, .text-button { padding: 11px 18px; border-radius: 9px; font-weight: 700; }
.primary-button { border: 0; color: white; background: var(--purple); }
.reminder-modal .primary-button { display: block; width: 100%; margin-top: 20px; background: var(--red); }
.text-button { border: 0; color: var(--muted); background: transparent; }
.secondary-button { border: 1px solid var(--line); background: white; }
.settings-modal h2 { margin: 0 0 22px; font: 700 27px "Fraunces", serif; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { color: var(--muted); font-size: 12px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; margin-top: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }
.form-grid textarea { resize: vertical; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-help { color: var(--muted); font-size: 11px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.entry-modal { width: min(620px, 100%); max-height: 92vh; overflow-y: auto; }
.therapy-rule { margin-top: 14px; padding: 11px 12px; color: #236a3e; background: var(--green-soft); border: 1px solid #bce0c5; border-radius: 9px; font-size: 12px; font-weight: 700; }
.therapy-rule.non-therapy { color: #795b09; background: var(--amber-soft); border-color: #f0d18c; }
.caregiver-line { color: var(--amber); font-weight: 700; }
.time-presets { display: flex; gap: 8px; margin-top: 12px; }
.time-presets button { padding: 7px 10px; border: 1px solid #d8cafa; color: var(--purple); background: var(--purple-soft); border-radius: 7px; font-size: 11px; font-weight: 700; }
.apply-default { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; color: var(--ink); font-size: 12px; line-height: 1.4; }
.apply-default input { margin-top: 2px; }
.form-grid .alert-toggle { display: flex; align-items: center; gap: 9px; padding: 11px; color: #8b2018; background: #fff0ed; border: 1px solid #f3c0ba; border-radius: 9px; }
.form-grid .alert-toggle input { width: auto; margin: 0; }
.alert-option.disabled { opacity: .45; pointer-events: none; }
.supply-summary-section { background: #fbfffc; }
.supply-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.supply-count { padding: 9px 5px; background: white; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.supply-count strong, .supply-count span { display: block; }
.supply-count strong { font-size: 18px; }
.supply-count span { color: var(--muted); font-size: 9px; }
.supply-count.needed strong { color: var(--red); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(24, 19, 35, .42);
}
.drawer-backdrop[hidden] { display: none; }
.caretaker-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(520px, 100%);
  height: 100%;
  overflow-y: auto;
  background: #fbfafd;
  box-shadow: -18px 0 50px rgba(40, 30, 70, .18);
  animation: drawerIn .22s ease-out;
}
.appointments-drawer { width: min(920px, 100%); }
.exercises-drawer { width: min(760px, 100%); }
.users-drawer { width: min(720px, 100%); }
#userList { display: grid; gap: 10px; max-height: 360px; margin-top: 14px; overflow-y: auto; }
.user-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px; border: 1px solid var(--line); background: white; border-radius: 10px; }
.user-card h4 { margin: 0; font-size: 15px; }
.user-card p { margin: 4px 0; color: var(--muted); font-size: 11px; }
.user-role { display: inline-block; margin-top: 4px; padding: 3px 7px; color: var(--purple); background: var(--purple-soft); border-radius: 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.user-role.active { color: #236a3e; background: var(--green-soft); }
.user-role.inactive { color: #8b3b34; background: #fff0ed; }
.toggle-user { color: #795b09; background: var(--amber-soft); }
.selected-client { border-color: #bcaaf1; background: #f7f3ff; }
.user-permissions { line-height: 1.6; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 18px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.permission-grid legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.permission-grid label { display: flex; align-items: flex-start; gap: 7px; color: var(--ink); font-size: 11px; line-height: 1.35; }
.permission-grid input { width: auto; margin-top: 2px; }
.permission-grid.disabled { opacity: .5; pointer-events: none; }
.daily-workout-assignment { padding: 20px 24px; background: var(--green-soft); border-bottom: 1px solid #bce0c5; }
.daily-workout-assignment h3 { margin: 0; font-size: 16px; }
.daily-workout-assignment .drawer-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.daily-workout-assignment .primary-button { margin-top: 12px; }
.workout-selection-status { display: inline-block; margin: 4px 0 12px; padding: 6px 9px; color: #8b2018; background: #fff0ed; border-radius: 7px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.workout-selection-status.confirmed { color: #236a3e; background: white; }
.exercise-library-filters { display: grid; grid-template-columns: 180px 1fr; gap: 10px; margin-top: 14px; }
.exercise-library-filters select, .exercise-library-filters input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
#exerciseLibraryList { display: grid; gap: 10px; max-height: 520px; margin-top: 14px; overflow-y: auto; }
.exercise-library-card { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 13px; padding: 12px; border: 1px solid #bce0c5; background: white; border-radius: 11px; }
.exercise-library-card img { width: 86px; height: 86px; object-fit: cover; border-radius: 8px; }
.exercise-placeholder { display: grid; place-items: center; width: 86px; height: 86px; padding: 8px; color: #31704a; background: var(--green-soft); border-radius: 8px; font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
.exercise-library-card h4 { margin: 0; font-size: 15px; }
.exercise-library-card p { margin: 4px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.exercise-category-badge { display: inline-block; margin-bottom: 5px; padding: 3px 7px; color: #236a3e; background: var(--green-soft); border-radius: 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.appointments-manager-toolbar {
  position: sticky;
  top: 89px;
  z-index: 1;
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(251, 250, 253, .97);
  border-bottom: 1px solid var(--line);
}
.appointments-manager-toolbar label { color: var(--muted); font-size: 11px; font-weight: 700; }
.appointments-manager-toolbar select, .appointments-manager-toolbar input {
  width: 100%;
  margin-top: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.appointments-manager-content { padding: 22px 24px 40px; }
.appointments-manager-summary { display: flex; gap: 10px; margin-bottom: 18px; }
.appointment-count-chip { padding: 7px 10px; color: var(--purple); background: var(--purple-soft); border-radius: 999px; font-size: 11px; font-weight: 800; }
.appointment-group { margin-bottom: 26px; }
.appointment-group-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.appointment-group-heading h3 { margin: 0; font: 700 21px "Fraunces", serif; }
.appointment-group-heading span { color: var(--muted); font-size: 11px; }
.all-appointment-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 10px;
  padding: 15px;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--pink);
  border-radius: 11px;
}
.all-appointment-card.past { opacity: .7; border-left-color: #aaa5b2; }
.appointment-date-block { text-align: center; }
.appointment-date-block strong, .appointment-date-block span { display: block; }
.appointment-date-block strong { color: var(--purple); font-size: 24px; }
.appointment-date-block span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.all-appointment-details h4 { margin: 0 0 4px; font-size: 15px; }
.all-appointment-details p { margin: 3px 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.all-appointment-actions { display: flex; flex-direction: column; gap: 7px; }
.all-appointment-actions button { white-space: nowrap; }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.drawer-header .eyebrow { margin-bottom: 4px; }
.drawer-header h2 { margin: 0; font: 700 28px "Fraunces", serif; }
.drawer-header .modal-close { position: static; }
.drawer-list-section, .drawer-form { padding: 20px 24px; }
.drawer-list-section { border-bottom: 1px solid var(--line); background: white; }
.drawer-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-section-heading h3, .drawer-form h3 { margin: 0; font-size: 15px; }
#caregiverAssignmentList { display: grid; gap: 9px; max-height: 280px; margin-top: 14px; overflow-y: auto; }
#supplyItemList { display: grid; gap: 9px; max-height: 360px; margin-top: 14px; overflow-y: auto; }
#medicationList { display: grid; gap: 9px; max-height: 430px; margin-top: 14px; overflow-y: auto; }
.assignment-card { padding: 13px; border: 1px solid var(--line); background: #fbfafc; border-radius: 10px; }
.assignment-card strong { display: block; }
.assignment-card p { margin: 4px 0; color: var(--muted); font-size: 12px; }
.assignment-card-actions { display: flex; gap: 7px; margin-top: 10px; }
.assignment-card-actions button { padding: 6px 9px; border: 0; border-radius: 6px; font-size: 10px; font-weight: 800; }
.edit-assignment { color: var(--purple); background: var(--purple-soft); }
.copy-assignment { color: #236a3e; background: var(--green-soft); }
.caretaker-profile-schedule {
  padding: 12px;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 11px;
}
.caretaker-profile-schedule-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); }
.caretaker-profile-schedule-heading span { color: var(--purple); font-weight: 800; }
.caretaker-profile-shift-list { display: grid; gap: 6px; max-height: 180px; margin-top: 10px; overflow-y: auto; }
.caretaker-profile-shift-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.caretaker-profile-shift-list strong { color: var(--ink); white-space: nowrap; }
.caretaker-profile-schedule p { margin: 8px 0 0; }
.profile-shift-more { color: var(--purple); font-weight: 700; }
.additional-shifts { padding: 13px; background: #f7f4ff; border: 1px solid #d9ccf5; border-radius: 10px; }
.additional-shifts-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.additional-shifts-heading h4 { margin: 0; font-size: 13px; }
.additional-shifts-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.additional-shift-list { display: grid; gap: 9px; margin-top: 10px; }
.additional-shift-row { display: grid; grid-template-columns: minmax(130px, 1.35fr) 1fr 1fr auto; gap: 8px; align-items: end; padding-top: 9px; border-top: 1px solid #d9ccf5; }
.additional-shift-row label { font-size: 10px; }
.additional-shift-row input { margin-top: 4px; }
.remove-known-shift { min-height: 38px; padding: 8px 10px; color: #a23228; background: white; border: 1px solid #efc8c4; border-radius: 8px; font-size: 10px; font-weight: 800; }
.supply-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 11px; padding: 11px; border: 1px solid var(--line); background: white; border-radius: 10px; }
.supply-thumb { display: grid; place-items: center; width: 54px; height: 54px; overflow: hidden; color: var(--muted); background: #f2f0f5; border-radius: 8px; font-size: 10px; text-align: center; }
.supply-thumb img { width: 100%; height: 100%; object-fit: cover; }
.supply-card h4 { margin: 0; font-size: 14px; }
.supply-card p { margin: 3px 0; color: var(--muted); font-size: 11px; }
.supply-card a { color: var(--purple); font-size: 11px; font-weight: 700; }
.supply-status { display: inline-block; margin-top: 4px; padding: 3px 6px; border-radius: 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.supply-status.ok { color: #236a3e; background: var(--green-soft); }
.supply-status.low { color: #795b09; background: var(--amber-soft); }
.supply-status.needed { color: #9d251b; background: #fff0ed; }
.supply-image-preview { display: grid; place-items: center; min-height: 90px; padding: 8px; color: var(--muted); background: white; border: 1px dashed #c9c5d0; border-radius: 9px; font-size: 11px; }
.supply-image-preview img { max-width: 100%; max-height: 140px; border-radius: 7px; }
.weekly-supply-settings { border-top: 1px solid var(--line); background: white; }
.weekly-supply-settings .primary-button { margin-top: 12px; }
.drawer-search { display: block; margin-top: 14px; color: var(--muted); font-size: 11px; font-weight: 700; }
.drawer-search input { width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.medication-card { padding: 13px; border: 1px solid #bed8f4; background: linear-gradient(145deg, #fff, #f2f7ff); border-radius: 10px; }
.medication-card h4 { margin: 0; font-size: 14px; }
.medication-card p { margin: 4px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.medication-card .medication-directions { color: var(--ink); }
.medication-status { display: inline-block; margin-top: 5px; padding: 3px 6px; border-radius: 5px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.medication-status.active { color: #315f9f; background: var(--blue-soft); }
.medication-status.as-needed { color: #795b09; background: var(--amber-soft); }
.medication-status.paused, .medication-status.discontinued { color: #6a6871; background: #eceaed; }
.medication-safety-note { padding: 9px; color: #795b09; background: var(--amber-soft); border-radius: 8px; }
.profile-photo-editor { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-photo-editor label { color: var(--muted); font-size: 12px; font-weight: 700; }
.profile-photo-editor input { display: block; margin-top: 7px; max-width: 260px; }
.profile-photo-preview { display: grid; place-items: center; width: 94px; height: 94px; flex: none; overflow: hidden; color: white; background: linear-gradient(145deg, #d9ccf5, #8d69d8); border-radius: 50%; font: 700 38px "Fraunces", serif; }
.profile-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.hydration-settings { margin-top: 20px; padding: 18px; background: var(--blue-soft); border: 1px solid #bed8f4; border-radius: 12px; }
.hydration-settings h3 { margin: 0 0 14px; color: #315f9f; font-size: 15px; }
.drawer-form h3 { margin-bottom: 14px; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 11px; border: 1px solid var(--line); border-radius: 9px; }
.weekday-picker legend { padding: 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.weekday-picker label { display: flex; align-items: center; gap: 4px; padding: 6px 8px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
.weekday-picker input { width: auto; margin: 0; }

@keyframes drawerIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 200; padding: 12px 16px; color: white; background: #292633; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }

@keyframes alertIn {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes alarmPulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7), 0 8px 40px rgba(0,0,0,.18); border-color: #dc2626; }
  40%  { box-shadow: 0 0 0 18px rgba(220, 38, 38, 0), 0 8px 40px rgba(0,0,0,.18); border-color: #ff4444; }
  60%  { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0), 0 8px 40px rgba(0,0,0,.18); border-color: #dc2626; }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7), 0 8px 40px rgba(0,0,0,.18); border-color: #dc2626; }
}

@keyframes bellShake {
  0%   { transform: rotate(0deg) scale(1); }
  15%  { transform: rotate(-18deg) scale(1.1); }
  30%  { transform: rotate(18deg) scale(1.1); }
  45%  { transform: rotate(-12deg) scale(1.05); }
  60%  { transform: rotate(12deg) scale(1.05); }
  75%  { transform: rotate(-6deg) scale(1); }
  90%  { transform: rotate(6deg) scale(1); }
  100% { transform: rotate(0deg) scale(1); }
}

@keyframes backdropAlarmFlash {
  0%, 100% { background: rgba(24, 19, 35, .52); }
  50%       { background: rgba(180, 20, 20, .35); }
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .topbar { grid-template-columns: 220px 240px 1fr auto; }
  .brand { padding: 0 16px; }
  .main-content { grid-template-columns: minmax(500px, 1fr) 290px; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .portal-header, .portal-heading { align-items: flex-start; flex-direction: column; }
  .portal-header { gap: 12px; }
  .portal-user { width: 100%; justify-content: space-between; text-align: left; }
  .portal-actions { justify-content: flex-start; }
  .portal-content { width: min(100% - 28px, 1180px); padding: 38px 0; }
  .login-page { grid-template-columns: 1fr; }
  .login-welcome { min-height: 40vh; padding: 45px 30px; }
  .login-brand-logo { width: min(360px, 90%); max-height: 330px; margin: 0 auto 24px; object-position: center; }
  .login-panel { padding: 30px 18px; }
  .app-shell { display: block; }
  .topbar { display: flex; flex-wrap: wrap; height: auto; padding: 10px; position: static; }
  .brand { width: 100%; height: 58px; border-right: 0; border-bottom: 1px solid var(--line); }
  .view-tabs { order: 2; padding: 10px 0 0; }
  .date-controls { order: 3; flex: 1; padding-top: 10px; }
  .topbar-actions { order: 4; padding: 10px 0 0; }
  .sidebar { border-right: 0; }
  .profile-card, .caregiver-card { display: inline-grid; width: 50%; vertical-align: top; min-height: 180px; }
  .appointments-manager-toolbar { position: static; grid-template-columns: 1fr; }
  .exercise-library-filters { grid-template-columns: 1fr; }
  .all-appointment-card { grid-template-columns: 62px minmax(0, 1fr); }
  .all-appointment-actions { grid-column: 1 / -1; flex-direction: row; }
  .side-nav { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
  .side-nav button { white-space: nowrap; }
  .main-content { display: block; }
  .right-rail { display: grid; grid-template-columns: 1fr 1fr; border: 0; }
  .handoff-section { grid-column: 1 / -1; }
  body.caretaker-mode .topbar { display: flex; }
  body.caretaker-mode .brand { width: auto; flex: 1; border-bottom: 0; }
  body.caretaker-mode .date-controls { order: 2; width: auto; flex: 1; padding: 0; }
  body.caretaker-mode .topbar-actions { order: 3; padding: 0; }
  body.caretaker-mode .caretaker-shift-facts { grid-template-columns: 1fr 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-welcome { min-height: auto; padding: 45px 30px 35px; }
  .login-logo-seal { width: 150px; height: 150px; }
  .login-brand-logo--centered { width: min(400px, 88%); max-height: 340px; }
  .login-divider { margin: 32px 0 20px; }
  .login-copyright { margin-top: 26px; }
  .login-panel { min-height: auto; padding: 45px 24px; }
}

@media (max-width: 620px) {
  .view-tab { padding: 9px 12px; }
  .date-controls { width: 100%; flex: auto; justify-content: flex-start; }
  .date-button { flex: 1; justify-content: space-between; }
  #liveClock { display: none; }
  .profile-card, .caregiver-card { display: grid; width: 100%; min-height: 0; }
  .schedule-panel { padding: 20px 14px; }
  .right-rail { display: block; }
  .task-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .task-card { grid-template-columns: 24px minmax(0, 1fr) auto auto; }
  .task-card.editable { grid-template-columns: 18px 24px minmax(0, 1fr) auto auto; }
  .task-actions { align-items: stretch; flex-direction: column; }
  .task-duration { display: none; }
  .schedule-row { grid-template-columns: 58px minmax(0, 1fr); gap: 7px; }
  .schedule-time { font-size: 11px; }
  .schedule-note { margin-left: 65px; }
  .overview-grid { grid-template-columns: 1fr; }
  .month-day { min-height: 72px; padding: 5px; }
  .month-summary { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .additional-shifts-heading { align-items: flex-start; flex-direction: column; }
  .additional-shift-row { grid-template-columns: 1fr 1fr; }
  .additional-shift-row label:first-child { grid-column: 1 / -1; }
  .remove-known-shift { grid-column: 1 / -1; }
  .caretaker-profile-shift-list div { align-items: flex-start; flex-direction: column; gap: 3px; }
  .permission-grid { grid-template-columns: 1fr; }
  .settings-modal { max-height: 90vh; overflow-y: auto; padding: 28px 22px; }
  body.caretaker-mode .topbar { gap: 8px; }
  body.caretaker-mode .brand { width: 100%; }
  body.caretaker-mode .date-controls { order: 2; width: 100%; }
  body.caretaker-mode .topbar-actions { order: 3; width: 100%; justify-content: space-between; }
  body.caretaker-mode .schedule-panel { padding: 16px 12px; }
  body.caretaker-mode .right-rail { grid-template-columns: 1fr; padding: 0 12px 24px; }
  body.caretaker-mode .caretaker-now-next { grid-template-columns: 1fr; }
  body.caretaker-mode .caretaker-shift-facts { grid-template-columns: 1fr 1fr; }
  body.caretaker-mode .task-card { grid-template-columns: 24px minmax(0, 1fr) auto; }
  body.caretaker-mode .task-actions { grid-column: 2; }
  body.caretaker-mode .task-check { grid-column: 3; grid-row: 1 / 3; }
  .caretaker-alert-item { grid-template-columns: 58px minmax(0, 1fr); }
  .login-feature-list { grid-template-columns: 1fr; }
  .login-wordmark strong { font-size: 27px; }
  .login-card h2 { font-size: 30px; }
  .login-role-tabs button { font-size: 9px; }
}


/* ============================================================
   MISSING CSS — Added to match current index.php class names
   ============================================================ */

/* ── Login Page (new layout) ─────────────────────────────── */
#loginPage {
  min-height: 100vh;
  background: white;
}
.login-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
@media (max-width: 800px) {
  .login-split { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(40px, 7vw, 100px);
  background: linear-gradient(155deg, #1a3a2e 0%, #2d6a4f 55%, #40916c 100%);
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .08;
  background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px);
  background-size: 40px 40px;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
}
.login-logo {
  width: min(260px, 80%);
  height: auto;
  margin-bottom: 28px;
  border-radius: 16px;
  background: rgba(255,255,255,.95);
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}
.login-platform-label {
  margin: 0 0 10px;
  color: rgba(255,255,255,.7);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .25em;
  text-transform: uppercase;
}
.login-platform-label::before,
.login-platform-label::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  margin: 0 10px 2px;
  background: rgba(255,255,255,.4);
}
.login-hero-title {
  margin: 0 0 14px;
  font: 700 clamp(32px, 4vw, 48px) "Fraunces", serif;
  line-height: 1.05;
  color: white;
}
.login-hero-desc {
  margin: 0 0 24px;
  color: rgba(255,255,255,.8);
  font-size: 14px;
  line-height: 1.7;
  max-width: 400px;
}
.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-bottom: 32px;
}
.login-features span {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 9px;
  color: rgba(255,255,255,.9);
  font-size: 11px;
  font-weight: 600;
}
.login-features span::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  margin-right: 8px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}
.login-copyright {
  margin: 0;
  color: rgba(255,255,255,.4);
  font-size: 10px;
}

/* Login Form Panel */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 80px);
  background: #faf9fc;
}
.login-form-inner {
  width: min(420px, 100%);
}
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 6px 14px;
  background: #ede9fe;
  color: #5b3fc1;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.login-badge span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: #5b3fc1;
  color: white;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}
.login-title {
  margin: 0 0 10px;
  font: 700 clamp(28px, 3.5vw, 38px) "Fraunces", serif;
  color: #101c59;
  line-height: 1.1;
}
.login-subtitle {
  margin: 0 0 24px;
  color: #6c6c7b;
  font-size: 13px;
  line-height: 1.6;
}
.login-role-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 22px;
  padding: 4px;
  background: #eef1f4;
  border: 1px solid #d8dde3;
  border-radius: 9px;
}
.login-role-tabs button {
  padding: 9px 5px;
  color: #81858d;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}
.login-role-tabs button.active {
  color: #17235f;
  background: white;
  box-shadow: 0 2px 6px rgba(30,42,75,.12);
}
.login-field {
  margin-bottom: 14px;
}
.login-field label {
  display: block;
  margin-bottom: 6px;
  color: #202746;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.login-field input {
  width: 100%;
  padding: 12px 14px;
  background: #f8f9fb;
  border: 1px solid #dce1e7;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.login-field input:focus {
  border-color: #5b3fc1;
  background: white;
}
.login-submit-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  background: linear-gradient(90deg, #17266f, #3565bd);
  color: white;
  border: 0;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(31,67,145,.24);
  transition: opacity .2s;
}
.login-submit-btn:hover { opacity: .9; }
.login-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 12px;
  background: #edf7ff;
  border: 1px solid #b9d7f1;
  border-radius: 7px;
  color: #3062a7;
  font-size: 10px;
  font-weight: 600;
}
.login-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  background: #4aba55;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #dff4e2;
}
.login-protected-note {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #dce1e7;
  color: #7d8290;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}
.login-protected-note strong {
  display: block;
  color: #293251;
  margin-bottom: 4px;
}

/* ── Client Portal Page ───────────────────────────────────── */
.portal-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.portal-body {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0;
}
.portal-section-label {
  margin: 0 0 6px;
  color: #5b3fc1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.portal-title {
  margin: 0 0 8px;
  font: 700 clamp(32px, 4vw, 48px) "Fraunces", serif;
  color: #111b51;
}
.portal-subtitle {
  margin: 0 0 28px;
  color: #6c6c7b;
  font-size: 14px;
}

/* ── App Shell (main dashboard) ──────────────────────────── */
#appShell {
  min-height: 100vh;
  background: var(--page);
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 0 20px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(42,50,94,.07);
  backdrop-filter: blur(8px);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}
.app-brand img {
  height: 38px;
  width: auto;
}
.app-brand strong { font-size: 14px; }
.app-brand small { display: block; color: var(--muted); font-size: 10px; }
.app-brand-heart {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, #5b3fc1, #3565bd);
  color: white;
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}
.app-header-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: center;
}
.view-tabs {
  display: flex;
  gap: 4px;
  background: #f3f0fa;
  border-radius: 9px;
  padding: 4px;
}
.view-tabs button {
  padding: 7px 16px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: all .2s;
}
.view-tabs button.active {
  background: white;
  color: #5b3fc1;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.date-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.date-nav button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.date-nav button:hover { background: var(--purple-soft); }
.app-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.app-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  min-height: calc(100vh - 64px);
}
@media (max-width: 1100px) {
  .app-body { grid-template-columns: 240px minmax(0, 1fr); }
  .app-rail { display: none; }
}
@media (max-width: 768px) {
  .app-body { grid-template-columns: 1fr; }
  .app-sidebar { display: none; }
}

/* ── Sidebar ─────────────────────────────────────────────── */
.app-sidebar {
  border-right: 1px solid var(--line);
  background: #fcfbfd;
  overflow-y: auto;
}
.sidebar-card {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.sidebar-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sidebar-sublabel {
  margin: 10px 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar-client-name {
  margin: 0 0 4px;
  font: 700 22px "Fraunces", serif;
  color: #111b51;
}
.client-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(145deg, #5b3fc1, #3565bd);
  color: white;
  border-radius: 16px;
  font: 700 24px "Fraunces", serif;
  margin-bottom: 10px;
}
.sidebar-phone {
  display: block;
  color: var(--purple);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  margin-top: 2px;
}
.hydration-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sidebar-nav {
  display: grid;
  gap: 2px;
  padding: 12px 10px;
}
.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: all .15s;
}
.nav-item:hover { background: var(--purple-soft); color: var(--purple); }
.nav-item.active { background: var(--purple-soft); color: var(--purple); font-weight: 700; }

/* ── Main Content ─────────────────────────────────────────── */
.app-main {
  padding: 24px 28px;
  overflow-y: auto;
  min-width: 0;
}
.content-section { display: none; }
.content-section.active { display: block; }

/* ── Right Rail ───────────────────────────────────────────── */
.app-rail {
  border-left: 1px solid var(--line);
  background: #fcfcfd;
  overflow-y: auto;
  padding: 16px;
}
.rail-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.rail-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #111b51;
}

/* ── Content Sections ─────────────────────────────────────── */
.admin-banner {
  margin-bottom: 20px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #3b267f, #694bd0);
  color: white;
  border-radius: 14px;
}
.admin-banner strong { font-size: 15px; }
.admin-banner p { margin: 4px 0 0; color: #ddd3ff; font-size: 12px; }
.today-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-top: 20px;
}
.today-card h3 { margin: 0 0 14px; font-size: 16px; }
.task-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--muted);
}
.section-label {
  margin: 0 0 4px;
  color: var(--purple);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}