/**
 * FamilyMedApp - Comprehensive UI Stylesheet
 * @version  5.0.0
 * @updated  2026-04-04
 * @changelog v5.0.0 (2026-04-04) — UX-13.0: Calendar centering, full-width vitals table, collapsible med tracker grid (130px columns), care team styles
 * @changelog v4.4.0 (2026-04-01) — Care Team filter padding fix
 * Added horizontal padding (0 6px) to .care-team-filters
 *
 * @changelog v4.3.0 (2026-04-01) — Dashboard cleanup
 * Removed Recent Notes CSS (.dashboard-recent-notes, .recent-note-*)
 *
 * @changelog v4.2.0 (2026-04-01) — UX Review 2 Items 2, 7
 * Item 2: Vitals mobile card width normalization (tests-panel padding, vitals-cards-view 6px)
 * Item 7: Removed care-team-header/title/subtitle/add-btns dead CSS
 *
 * @changelog v4.1.0 (2026-04-01) — UX Review Items 8, 10, 11
 * Item 8: condition-mini-table-wrap for full-width condition detail tables
 * Item 10: Swapped completed/upcoming badge colors (completed=gray, upcoming=green)
 * Item 11: Recent Notes section styles for Home page dashboard
 *
 * @changelog v4.0.0 (2026-04-01) — UX Implementation Playbook (Sessions 1–8)
 * S1: .onboarding-choice-grid/btn/icon/text styles, .empty-state-card/icon/msg styles
 * S2: .inline-create-panel styles, .form-advanced-toggle + .form-advanced-fields styles
 * S5: All font sizes converted to rem, touch targets increased to 44px min (.btn, inputs, selects, badges)
 * S6: Dashboard styles (.dashboard-container, .dashboard-card, .compliance-bar, quick-action grid)
 * S7: html.large-text { font-size: 20px } — scales all rem-based sizes ~25% larger
 * S8: More panel slide-up overlay, 2-column grid, Care Team card/filter styles
 *
 * GDE-1.1: Quick Tips section styles for Help tab
 * GDE-1.0: Guided tour styles — spotlight overlay, tooltip cards, step indicators
 * HLP-1.0: Help tab styles — search, KB articles, chat widget, responsive
 * WP-6.4: Verified all badge colors WCAG AA compliant (>=4.5:1 contrast)
 * - WP-3.4: Self-hosted Google Fonts (Outfit + Source Sans 3 WOFF2)
 * - Added swipe navigation CSS (touch-action, animations, transition classes)
 * - Design system: Outfit + Source Sans 3, Teal/Slate palette
 */

/* ═══════════════════════════════════════════════════════════════
   WP-3.4: SELF-HOSTED FONTS — Outfit + Source Sans 3
   Eliminates external requests to fonts.googleapis.com / fonts.gstatic.com.
   WOFF2 files in assets/fonts/. Latin subset only.
   ═══════════════════════════════════════════════════════════════ */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/outfit-300.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/outfit-400.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/outfit-500.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/outfit-600.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/outfit-700.woff2') format('woff2'); }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 800; font-display: swap; src: url('fonts/outfit-800.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 300; font-display: swap; src: url('fonts/source-sans-3-300.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/source-sans-3-400.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/source-sans-3-500.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/source-sans-3-600.woff2') format('woff2'); }

/* ═══════════════════════════════════════════════════════════════
   FAMILY MEDICAL APP — Comprehensive UI
   Design system: Outfit + Source Sans 3, Teal/Slate palette
   ═══════════════════════════════════════════════════════════════ */

/* ═══════ RESET & VARIABLES ═══════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* UX-7.0: Large Text Mode — scales all rem-based sizes ~25% larger */
html.large-text { font-size: 20px; }
:root {
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Source Sans 3', -apple-system, sans-serif;
    --teal-50: #f0fdfa; --teal-100: #ccfbf1; --teal-200: #99f6e4;
    --teal-400: #2dd4bf; --teal-500: #14b8a6; --teal-600: #0d9488;
    --teal-700: #0f766e; --teal-800: #115e59;
    --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0;
    --slate-300: #cbd5e1; --slate-400: #94a3b8; --slate-500: #64748b;
    --slate-600: #475569; --slate-700: #334155; --slate-800: #1e293b;
    --slate-900: #0f172a;
    --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.1);
    --gradient-primary: linear-gradient(135deg, var(--teal-700), var(--teal-600));
    --gradient-header: linear-gradient(135deg, var(--teal-800), var(--teal-600));
    --header-height: 48px;
}
body {
    font-family: var(--font-body); background: var(--slate-50);
    min-height: 100vh; min-height: 100dvh; color: var(--slate-900);
    line-height: 1.5; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }

/* ═══════ MEDICATION REMINDER BANNER ═══════ */
/* Banner sits directly below the sticky header, never overlapping nav */
.med-reminder-banner {
    position: fixed; left: 0; right: 0; z-index: 150;
    top: var(--header-height, 48px);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 2px 12px rgba(245,158,11,0.3);
    animation: bannerSlideDown 0.35s cubic-bezier(0.34,1.1,0.64,1);
}
@keyframes bannerSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.med-reminder-inner {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; max-width: 1400px; margin: 0 auto;
}
.med-reminder-icon { font-size: 1.1rem; flex-shrink: 0; }
.med-reminder-text {
    flex: 1; color: white; font-size: 0.85rem; font-weight: 600;
    font-family: var(--font-heading); line-height: 1.3;
}
.med-reminder-action {
    background: rgba(255,255,255,0.25); color: white;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 5px 14px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 0.78rem; font-weight: 700; white-space: nowrap;
    transition: all 0.2s; font-family: var(--font-heading);
}
.med-reminder-action:hover { background: rgba(255,255,255,0.4); }
.med-reminder-close {
    background: none; border: none; color: rgba(255,255,255,0.8);
    font-size: 1.3rem; cursor: pointer; padding: 2px 6px; line-height: 1;
    border-radius: 50%; transition: all 0.2s; flex-shrink: 0;
}
.med-reminder-close:hover { color: white; background: rgba(255,255,255,0.15); }

/* ═══════ AUTH ═══════ */
.auth-container {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column; justify-content: center; padding: 20px;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(204,251,241,.4) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 80% 60%, rgba(204,251,241,.25) 0%, transparent 70%),
        var(--slate-50);
}
.auth-inner {
    width: 100%; max-width: 420px; margin: 0 auto;
    background: white; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); padding: 36px 28px;
    border: 1px solid var(--slate-200);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
/* Concept C icon — rounded square, radial teal-500 (center) → teal-800 (edge), white ECG glyph */
.concept-c-icon {
    width: 64px; height: 64px; border-radius: 14px; /* ~22% corner radius */
    background: radial-gradient(circle at 50% 50%, var(--teal-500) 0%, var(--teal-800) 100%);
    box-shadow: 0 6px 20px rgba(15,118,110,0.30);
    margin: 0 auto 14px;
}
/* Wordmark — default treatment: "Family" slate-900 + "MedApp" teal-600 */
.wordmark {
    font-size: 1.6rem; font-weight: 700; font-family: var(--font-heading);
    letter-spacing: -0.01em; line-height: 1.1;
    -webkit-background-clip: initial; -webkit-text-fill-color: initial; background-clip: initial;
    background: none;
}
.wordmark .wm-family { color: var(--slate-900); }
.wordmark .wm-medapp { color: var(--teal-600); }
/* Reversed treatment — ONLY on the dark teal in-app header banner */
.wordmark-reversed .wm-family { color: var(--slate-900); }
.wordmark-reversed .wm-medapp { color: #ffffff; }
.auth-logo h1 {
    font-size: 1.6rem; font-weight: 700; font-family: var(--font-heading);
}
.auth-logo p { color: var(--slate-500); font-size: 0.9rem; margin-top: 6px; }
.auth-tabs {
    display: flex; margin-bottom: 24px;
    background: var(--slate-100); border-radius: var(--radius-md); padding: 4px;
}
.auth-tab {
    flex: 1; padding: 10px; border: none; background: none;
    border-radius: var(--radius-sm); cursor: pointer; transition: all 0.25s;
    font-size: 0.95rem; font-weight: 600; color: var(--slate-500);
    font-family: var(--font-heading);
}
.auth-tab.active { background: white; box-shadow: 0 1px 4px rgba(0,0,0,0.08); color: var(--teal-700); }
.auth-form { display: block; }
.auth-form.hidden { display: none; }
.btn-login {
    width: 100%; margin-top: 16px;
    background: var(--gradient-primary); color: white; border: none;
    padding: 13px 22px; border-radius: var(--radius-md); cursor: pointer;
    font-size: 0.95rem; font-weight: 700; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); text-align: center;
    box-shadow: 0 2px 8px rgba(13,148,136,0.25);
    gap: 0; letter-spacing: 0.02em;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(13,148,136,0.35); }
.btn-login:active { transform: scale(0.97); }

/* ═══════ APP SHELL ═══════ */
.container { min-height: 100vh; min-height: 100dvh; background: var(--slate-50); display: flex; flex-direction: column; }
/* Logged-in banner — white background to match the marketing-site top bar.
   Concept C pill + default wordmark (Family slate-900 / MedApp teal-600). */
.header {
    background: #ffffff; padding: 12px 16px; color: var(--slate-900);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
    border-bottom: 1px solid var(--slate-200);
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    --header-height: 48px;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
/* Small Concept C pill for the header (matches the marketing nav logo) */
.header-icon.concept-c-icon-sm {
    width: 34px; height: 34px; border-radius: 9px;
    background: radial-gradient(circle at 50% 50%, var(--teal-500) 0%, var(--teal-800) 100%);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(15,118,110,0.22);
}
/* Keep the class available in case non-wrapped SVGs still use it */
.header-icon:not(.concept-c-icon-sm) { flex-shrink: 0; }
.header h1 { font-size: 1.15rem; font-weight: 700; white-space: nowrap; font-family: var(--font-heading); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 0.85rem; font-weight: 500; display: none; color: var(--slate-600); }
.logout-btn {
    background: var(--teal-600); border: 1px solid var(--teal-600);
    color: white; padding: 7px 16px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: all 0.2s;
    font-family: var(--font-heading);
}
.logout-btn:hover { background: var(--teal-700); border-color: var(--teal-700); }
.main-content { flex: 1; padding: 0; padding-bottom: 72px; position: relative; overflow-x: hidden; touch-action: pan-y; }

/* ═══════ TABS ═══════ */
.tabs {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white; display: flex;
    border-top: 1px solid var(--slate-200);
    z-index: 100; box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    overflow-x: auto; scrollbar-width: none; padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1; min-width: 64px; padding: 6px 4px 8px;
    cursor: pointer; border: none; background: none;
    font-size: 0.85rem; color: var(--slate-400); transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; white-space: nowrap; border-top: 2.5px solid transparent;
    font-family: var(--font-body); font-weight: 500;
}
.tab .tab-icon { font-size: 1.2rem; line-height: 1; }
.tab.active { color: var(--teal-700); border-top-color: var(--teal-600); font-weight: 600; }
.tab:active { background: var(--teal-50); }
.tab-content { display: none; touch-action: pan-y; }
.tab-content.active { display: block; min-height: 100%; }

/* ═══════ SWIPE NAVIGATION ═══════ */
/* During swipe animation, the main-content clips both pages */
.main-content.swipe-animating { overflow: hidden; }

/* Temporarily visible page during drag/animation */
.tab-content.swipe-active {
    display: block !important;
    position: absolute;
    top: 0; left: 0; right: 0;
    min-height: 100%;
    will-change: transform;
    z-index: 2;
}
/* Active (outgoing) page during drag gets absolute positioning too */
.main-content.swipe-animating > .tab-content.active {
    position: absolute;
    top: 0; left: 0; right: 0;
    min-height: 100%;
    will-change: transform;
    z-index: 1;
}

/* Start positions for animated tab switch (non-drag, click-triggered with direction) */
.tab-content.swipe-in-right  { transform: translateX(100%); }
.tab-content.swipe-in-left   { transform: translateX(-100%); }
.tab-content.swipe-out-left  { transform: translateX(0); }
.tab-content.swipe-out-right { transform: translateX(0); }

/* End-state animations */
.tab-content.swipe-slide-center   { animation: swipeSlideCenter 0.28s cubic-bezier(0.2, 0, 0, 1) forwards; }
.tab-content.swipe-slide-out-left { animation: swipeSlideOutLeft 0.28s cubic-bezier(0.2, 0, 0, 1) forwards; }
.tab-content.swipe-slide-out-right{ animation: swipeSlideOutRight 0.28s cubic-bezier(0.2, 0, 0, 1) forwards; }

@keyframes swipeSlideCenter    { to { transform: translateX(0); } }
@keyframes swipeSlideOutLeft   { to { transform: translateX(-100%); } }
@keyframes swipeSlideOutRight  { to { transform: translateX(100%); } }

/* ═══════ TAB SCROLL INDICATORS (mobile only) ═══════ */
.tab-scroll-indicator {
    display: none; position: fixed; bottom: 0; z-index: 101;
    pointer-events: none;
    height: 54px; /* match tab bar height */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-scroll-indicator-left {
    left: 0;
    width: 28px;
    background: linear-gradient(to right, rgba(255,255,255,0.95) 30%, rgba(255,255,255,0) 100%);
}
.tab-scroll-indicator-right {
    right: 0;
    width: 28px;
    background: linear-gradient(to left, rgba(255,255,255,0.95) 30%, rgba(255,255,255,0) 100%);
}
.tab-scroll-indicator .tab-scroll-chevron {
    position: absolute; top: 50%; transform: translateY(calc(-50% - 2px));
    font-size: 0.7rem; color: var(--slate-300);
    line-height: 1;
    animation: tabScrollPulse 2s ease-in-out infinite;
}
.tab-scroll-indicator-left .tab-scroll-chevron { left: 4px; }
.tab-scroll-indicator-right .tab-scroll-chevron { right: 4px; }
@keyframes tabScrollPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}
.tab-scroll-indicator.visible { display: flex; align-items: center; }
@media (min-width: 769px) {
    .tab-scroll-indicator { display: none !important; }
}

/* ═══════ CONTROLS ═══════ */
.controls-bar { display: flex; flex-direction: column; gap: 8px; padding: 10px 6px; }
.controls-bar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view-toggles {
    display: flex; gap: 4px; background: var(--slate-100); padding: 3px;
    border-radius: var(--radius-md); border: 1px solid var(--slate-200);
}
.view-toggle {
    padding: 8px 14px; border: none; background: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.25s; font-size: 0.85rem; font-weight: 600;
    color: var(--slate-500); display: flex; align-items: center; gap: 4px;
    font-family: var(--font-heading);
}
.view-toggle.active { background: white; color: var(--teal-700); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.search-container { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.search-input {
    flex: 1; padding: 10px 14px; border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md); font-size: 0.9rem; background: white; min-width: 0;
    font-family: var(--font-body); transition: all 0.2s;
}
.search-input:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(13,148,136,0.12); }
.search-clear {
    padding: 8px 14px; border: 1.5px solid var(--slate-200); background: white;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
    color: var(--slate-600); white-space: nowrap; font-weight: 500; transition: all 0.2s;
}
.search-clear:hover { border-color: var(--slate-300); background: var(--slate-50); }
.filter-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-dropdown { position: relative; }
.filter-btn {
    padding: 8px 12px; border: 1.5px solid var(--slate-200); background: white;
    border-radius: var(--radius-md); cursor: pointer; font-size: 0.85rem;
    display: flex; align-items: center; gap: 4px; white-space: nowrap;
    color: var(--slate-700); transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--teal-400); color: var(--teal-700); }
.filter-dropdown-content {
    display: none; position: absolute; background: white; min-width: 240px;
    box-shadow: var(--shadow-xl); border-radius: var(--radius-lg);
    z-index: 200; max-height: 300px; overflow-y: auto; margin-top: 4px; left: 0;
    border: 1px solid var(--slate-200);
}
.filter-dropdown-content.show { display: block; }
.filter-dropdown-header {
    padding: 10px 12px; border-bottom: 1px solid var(--slate-200);
    display: flex; justify-content: space-between; gap: 8px;
}
.filter-option {
    padding: 10px 12px; cursor: pointer; display: flex;
    align-items: center; gap: 8px; font-size: 0.9rem; transition: background 0.15s;
}
.filter-option:hover { background: var(--teal-50); }
.filter-option input[type="checkbox"], .filter-option input[type="radio"] {
    cursor: pointer; width: 18px; height: 18px; accent-color: var(--teal-600);
}
.filter-option label { font-size: 0.9rem; font-weight: 400; }

/* ═══════ CALENDAR ═══════ */
.calendar-container {
    background: white; border-radius: var(--radius-lg); margin: 0 6px 12px;
    box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--slate-200);
}
.calendar-header { display: flex; justify-content: space-between; align-items: center; padding: 14px; flex-wrap: wrap; gap: 8px; }
.calendar-title { font-size: 1.1rem; font-weight: 700; color: var(--slate-800); order: -1; width: 100%; text-align: center; font-family: var(--font-heading); }
.calendar-nav { display: flex; gap: 6px; width: 100%; justify-content: center; }
.calendar-nav button {
    padding: 8px 16px; border: 1.5px solid var(--slate-200); background: white;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
    font-weight: 600; color: var(--slate-600); transition: all 0.2s; font-family: var(--font-heading);
}
.calendar-nav button:hover { background: var(--teal-50); border-color: var(--teal-500); color: var(--teal-700); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--slate-200); }
.calendar-day-header {
    background: var(--slate-800); color: white; padding: 8px 2px;
    text-align: center; font-weight: 600; font-size: 0.75rem;
    font-family: var(--font-heading);
}
.calendar-day {
    background: white; height: 80px; padding: 3px; position: relative;
    border-right: 1px solid var(--slate-100); border-bottom: 1px solid var(--slate-100);
    overflow: hidden; transition: background 0.15s;
}
.calendar-day:hover { background: var(--slate-50); }
.calendar-day-number { font-weight: 700; font-size: 0.9rem; color: var(--slate-700); margin-bottom: 2px; font-family: var(--font-heading); text-align: center; }
.calendar-day.other-month .calendar-day-number { color: var(--slate-300); }
.calendar-day.today { background: var(--teal-50); }
.calendar-day.today .calendar-day-number {
    background: var(--teal-600); color: white; width: 22px; height: 22px;
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.8125rem; margin: 0 auto;
}
.calendar-appointment {
    background: var(--gradient-primary); color: white; padding: 1px 4px; border-radius: 4px;
    font-size: 0.6rem; margin-bottom: 1px; cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4; font-weight: 500;
}
.calendar-appointment:hover { opacity: 0.88; }
.calendar-appointment.completed { background: #94a3b8 !important; opacity: 0.75; }

/* ═══════ DATA TABLE ═══════ */
.table-container {
    margin: 0 6px 8px; background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--slate-200);
}
.table-controls {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--slate-100);
}
.table-controls > div { font-size: 0.85rem; color: var(--slate-500); }
.column-config-btn {
    padding: 8px 12px; border: 1.5px solid var(--slate-200); background: white;
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem;
    display: flex; align-items: center; gap: 4px; transition: all 0.2s;
}
.column-config-btn:hover { border-color: var(--teal-400); color: var(--teal-700); }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrapper[style*="max-height"] { overflow-y: auto; scrollbar-gutter: stable; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: white; }
.data-table thead { position: sticky; top: 0; z-index: 10; background: linear-gradient(135deg, #f0fdfa, #f0f9ff); }
.data-table th {
    text-align: left;
    padding: 10px; text-align: left; color: var(--slate-700); font-weight: 600;
    font-size: 0.875rem; border-bottom: 2px solid #e2e8f0;
    cursor: pointer; user-select: none; white-space: nowrap; position: relative;
    font-family: var(--font-heading);
}
.data-table th:hover { background: rgba(13, 148, 136, 0.08); }
.data-table th.sortable:after { content: '\2195'; position: absolute; right: 4px; opacity: 0.35; color: var(--slate-500); }
.data-table th.sort-asc:after { content: '\2191'; opacity: 1; color: var(--teal-700); }
.data-table th.sort-desc:after { content: '\2193'; opacity: 1; color: var(--teal-700); }
.data-table td {
    text-align: left; padding: 10px; border-bottom: 1px solid var(--slate-100); font-size: 0.92rem; color: var(--slate-700); }
.data-table tbody tr { cursor: pointer; transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--teal-50); }
.data-table tbody tr:active { background: var(--teal-100); }
.data-table tbody tr.search-no-match { display: none; }
.data-table tbody tr.inactive-medication { color: var(--slate-400); }
.data-table tbody tr.time-filtered { display: none; }
.data-table .status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.8125rem; font-weight: 600; }
.data-table .status-badge.completed { background: #f1f5f9; color: #64748b; }
.data-table .status-badge.upcoming { background: #dcfce7; color: #166534; }
.table-actions { display: flex; gap: 4px; }
.table-action-btn {
    padding: 5px 10px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 0.78rem; font-weight: 600; transition: all 0.2s;
}
.table-action-btn.edit { background: #fef3c7; color: #92400e; }
.table-action-btn.delete { background: #fee2e2; color: #991b1b; }
.table-action-btn.manage { background: #dcfce7; color: #166534; }
.table-action-btn:hover { opacity: 0.82; transform: translateY(-1px); }
@media (max-width: 768px) {
    .data-table th {
    text-align: left; padding: 8px 7px; font-size: 0.8rem; }
    .data-table td {
    text-align: left; padding: 8px 7px; font-size: 0.88rem; white-space: nowrap; }
    .table-action-btn { padding: 5px 8px; font-size: 0.78rem; }
}

/* ═══════ BUTTONS ═══════ */
.add-btn-container { padding: 6px 6px 10px; margin: 0 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
    background: var(--gradient-primary); color: white; border: none;
    padding: 0.875rem 1.5rem; border-radius: var(--radius-md); cursor: pointer;
    font-size: 0.9375rem; font-weight: 600; transition: all 0.2s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    touch-action: manipulation; font-family: var(--font-heading);
    box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(13,148,136,0.35); }
.btn:active { transform: scale(0.97); }
.btn-secondary { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 2px 8px rgba(245,158,11,0.25); }
.btn-secondary:hover { box-shadow: 0 4px 14px rgba(245,158,11,0.35); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 2px 8px rgba(239,68,68,0.25); }
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239,68,68,0.35); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 2px 8px rgba(16,185,129,0.25); }
.btn-success:hover { box-shadow: 0 4px 14px rgba(16,185,129,0.35); }
.btn-small { padding: 0.625rem 1rem; font-size: 0.8rem; }
.btn-chart { background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 2px 8px rgba(99,102,241,0.25); }
.btn-chart:hover { box-shadow: 0 4px 14px rgba(99,102,241,0.35); }
.btn-outline { background: white; color: var(--teal-700); border: 1.5px solid var(--teal-400); box-shadow: none; }
.btn-outline:hover { background: var(--teal-50); box-shadow: none; }

/* ═══════ FORMS ═══════ */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.form-grid-2col { grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; margin-bottom: 14px; }
label { margin-bottom: 6px; font-weight: 600; color: var(--slate-700); font-size: 0.9375rem; font-family: var(--font-heading); }
input, select, textarea {
    padding: 0.875rem 0.875rem; border: 1.5px solid var(--slate-200); border-radius: var(--radius-md);
    font-size: 0.95rem; transition: all 0.2s; background: white; color: var(--slate-800);
    font-family: var(--font-body);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(13,148,136,0.12); }
textarea { resize: vertical; min-height: 80px; }
small { color: var(--slate-500); font-size: 0.8rem; margin-top: 4px; display: block; }

/* ═══════ TESTS TAB ═══════ */
.tests-nav {
    display: flex; gap: 6px; padding: 10px 10px 4px;
    overflow-x: auto; scrollbar-width: none;
}
.tests-nav::-webkit-scrollbar { display: none; }
.tests-nav-btn {
    padding: 10px 16px; border: 1.5px solid var(--slate-200); background: white;
    border-radius: var(--radius-xl); cursor: pointer; font-size: 0.85rem;
    font-weight: 600; color: var(--slate-500); transition: all 0.25s;
    font-family: var(--font-heading); white-space: nowrap;
    display: flex; align-items: center; gap: 4px;
}
.tests-nav-btn:hover { border-color: var(--teal-400); color: var(--teal-700); background: var(--teal-50); }
.tests-nav-btn.active {
    background: var(--gradient-primary); color: white;
    border-color: var(--teal-600); box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.tests-panel { display: none; }
.tests-panel.active { display: block; }

/* Reading cards for tests */
.readings-list { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; }
.reading-card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); border: 1px solid var(--slate-200);
    padding: 14px 16px; transition: all 0.15s; cursor: pointer;
    display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
    gap: 4px 12px; align-items: center;
}
.reading-card:hover { border-color: var(--teal-300); box-shadow: var(--shadow-md); }
.reading-main { display: flex; align-items: baseline; gap: 6px; }
.reading-value {
    font-size: 1.4rem; font-weight: 800; color: var(--teal-700);
    font-family: var(--font-heading); line-height: 1;
}
.reading-unit { font-size: 0.78rem; color: var(--slate-400); font-weight: 500; }
.reading-meta {
    font-size: 0.8rem; color: var(--slate-500); grid-column: 1;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.reading-tag {
    display: inline-block; padding: 1px 8px; border-radius: 10px;
    font-size: 0.72rem; font-weight: 600; background: var(--slate-100); color: var(--slate-600);
}
.reading-notes {
    grid-column: 1 / -1; font-size: 0.82rem; color: var(--slate-500);
    padding-top: 4px; border-top: 1px solid var(--slate-100); margin-top: 4px;
}
.reading-actions {
    grid-row: 1 / 3; display: flex; flex-direction: column; gap: 4px;
    align-self: center;
}
.reading-status {
    padding: 4px 10px; border-radius: 20px; font-size: 0.72rem;
    font-weight: 700; font-family: var(--font-heading); white-space: nowrap;
    grid-row: 1; grid-column: 2; justify-self: end;
}
.reading-status.normal { background: #dcfce7; color: #166534; }
.reading-status.elevated { background: #fde68a; color: #713f12; }
.reading-status.high { background: #fee2e2; color: #991b1b; }
.reading-status.low { background: #dbeafe; color: #1e40af; }

/* Reading card border accent by status */
.reading-card.reading-normal { border-left: 3px solid #10b981; }
.reading-card.reading-elevated { border-left: 3px solid #f59e0b; }
.reading-card.reading-high { border-left: 3px solid #ef4444; }
.reading-card.reading-low { border-left: 3px solid #3b82f6; }

/* Legacy test-reading-card (kept for BP table) */
.test-readings-list { padding: 0 8px 8px; }
.test-reading-card {
    background: white; border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm); border: 1px solid var(--slate-200);
    padding: 14px 16px; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: space-between;
    transition: all 0.15s; cursor: pointer;
}
.test-reading-card:hover { border-color: var(--teal-400); box-shadow: var(--shadow-md); }
.test-reading-card .reading-main { display: flex; align-items: baseline; gap: 10px; }
.test-reading-card .reading-value {
    font-size: 1.5rem; font-weight: 800; color: var(--teal-700);
    font-family: var(--font-heading); line-height: 1;
}
.test-reading-card .reading-unit { font-size: 0.8rem; color: var(--slate-400); font-weight: 500; }
.test-reading-card .reading-meta { font-size: 0.82rem; color: var(--slate-500); margin-top: 2px; }
.test-reading-card .reading-status {
    padding: 4px 10px; border-radius: 20px; font-size: 0.72rem;
    font-weight: 700; font-family: var(--font-heading); white-space: nowrap;
}
.test-reading-card .reading-actions { display: flex; gap: 4px; margin-left: 8px; }

/* ═══════ VITALS MOBILE CARD VIEW ═══════ */
.vitals-table-view { display: block; width: 100%; }
.vitals-cards-view { display: none; }
.tests-panel { padding: 0 2px; }

@media (max-width: 768px) {
    .vitals-table-view { display: none; }
    .vitals-cards-view { display: block; padding: 0 6px 8px; }
}

/* ═══════ LIST MOBILE CARD VIEW (Appointments, Medications, Conditions, Providers, Doctors, Categories) ═══════ */
.list-table-view { display: block; }
.list-cards-view { display: none; }

@media (max-width: 768px) {
    .list-table-view { display: none; }
    .list-cards-view { display: block; padding: 0 4px 8px; }
}

.list-cards-view .list-count {
    color: #6b7280; font-size: 0.82rem; padding: 4px 6px 8px;
}
.list-card {
    background: white; border-radius: 14px; padding: 14px 16px;
    margin-bottom: 8px; border: 1px solid var(--slate-200);
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); transition: all 0.15s;
    cursor: pointer; position: relative; overflow: hidden;
}
.list-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px; border-radius: 4px 0 0 4px;
}
.list-card.border-teal::before { background: var(--teal-600, #0d9488); }
.list-card.border-green::before { background: #10b981; }
.list-card.border-gray::before { background: #94a3b8; }
.list-card.border-blue::before { background: #3b82f6; }
.list-card.border-purple::before { background: #8b5cf6; }
.list-card.border-amber::before { background: #f59e0b; }
.list-card:hover { border-color: var(--teal-300); box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.list-card:active { transform: scale(0.99); }
.list-card-left { flex: 1; min-width: 0; padding-left: 4px; text-align: left; }
.list-card-title {
    font-size: 1rem; font-weight: 700; color: var(--slate-800, #1e293b);
    font-family: var(--font-heading); line-height: 1.2; text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-card-subtitle {
    font-size: 0.85rem; color: var(--teal-700, #0f766e); font-weight: 600;
    margin-top: 1px; text-align: left;
}
.list-card-meta {
    font-size: 0.78rem; color: var(--slate-500); margin-top: 3px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    justify-content: flex-start;
}
.list-card-meta span { white-space: nowrap; }
.list-card-tag {
    display: inline-block; background: var(--slate-100); color: var(--slate-600);
    padding: 1px 7px; border-radius: 8px; font-size: 0.7rem; font-weight: 600;
}
.list-card-right { flex-shrink: 0; margin-left: 12px; text-align: right; }
.list-card-status {
    padding: 4px 12px; border-radius: 20px; font-size: 0.72rem;
    font-weight: 700; font-family: var(--font-heading); white-space: nowrap;
}
.list-card-status.active { background: #dcfce7; color: #166534; }
.list-card-status.inactive { background: var(--slate-100); color: var(--slate-500); }
.list-card-status.upcoming { background: #dcfce7; color: #166534; }
.list-card-status.completed { background: #f1f5f9; color: #64748b; }
.list-card-badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 0.75rem; background: var(--teal-100); color: var(--teal-800);
    font-weight: 600;
}
.list-card.card-inactive { opacity: 0.6; }
.list-card.card-inactive .list-card-title { color: var(--slate-400); }

.vitals-cards-view .vitals-count {
    color: #6b7280; font-size: 0.82rem; padding: 4px 6px 8px; 
}
.vital-card {
    background: white; border-radius: 14px; padding: 14px 16px;
    margin-bottom: 8px; border: 1px solid var(--slate-200);
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); transition: all 0.15s;
    cursor: pointer; position: relative; overflow: hidden;
}
.vital-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 4px; border-radius: 4px 0 0 4px;
}
.vital-card.border-normal::before { background: #10b981; }
.vital-card.border-elevated::before { background: #f59e0b; }
.vital-card.border-high::before { background: #ef4444; }
.vital-card.border-low::before { background: #3b82f6; }
.vital-card.border-critical::before { background: #ec4899; }
.vital-card.border-none::before { background: var(--slate-300); }
.vital-card:hover { border-color: var(--teal-300); box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.vital-card:active { transform: scale(0.99); }
.vital-card-left { flex: 1; min-width: 0; padding-left: 4px; text-align: left; }
.vital-card-value {
    font-size: 1.3rem; font-weight: 800; color: var(--teal-700);
    font-family: var(--font-heading); line-height: 1.1; text-align: left;
}
.vital-card-unit {
    font-size: 0.75rem; color: var(--slate-400); font-weight: 500;
}
.vital-card-meta {
    font-size: 0.78rem; color: var(--slate-500); margin-top: 3px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    justify-content: flex-start;
}
.vital-card-context {
    display: inline-block; background: var(--slate-100); color: var(--slate-600);
    padding: 1px 7px; border-radius: 8px; font-size: 0.7rem; font-weight: 600;
}
.vital-card-right { flex-shrink: 0; margin-left: 12px; }
.vital-card-status {
    padding: 4px 12px; border-radius: 20px; font-size: 0.72rem;
    font-weight: 700; font-family: var(--font-heading); white-space: nowrap;
}
.vital-card-status.normal { background: #dcfce7; color: #166534; }
.vital-card-status.elevated { background: #fde68a; color: #713f12; }
.vital-card-status.high { background: #fee2e2; color: #991b1b; }
.vital-card-status.low { background: #dbeafe; color: #1e40af; }
.vital-card-status.critical { background: #fce7f3; color: #9d174d; }
.vital-card-trend { font-size: 0.78rem; font-weight: 700; font-family: var(--font-heading); }
.vital-card-trend.up { color: #ef4444; }
.vital-card-trend.down { color: #10b981; }
.vital-card-trend.flat { color: var(--slate-400); }

/* ═══════ MEDICATION COMPLIANCE ═══════ */
.med-compliance-section {
    margin: 0 6px 8px; background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); overflow: hidden;
    border: 1px solid var(--teal-200);
}
.compliance-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--slate-100);
    background: linear-gradient(135deg, var(--teal-50), white);
}
.compliance-header h3 {
    font-size: 1rem; font-weight: 700; color: var(--teal-800);
    font-family: var(--font-heading);
}
.compliance-progress-wrap { display: flex; align-items: center; gap: 8px; }
.compliance-progress { width: 80px; height: 8px; background: var(--slate-200); border-radius: 4px; overflow: hidden; }
.compliance-progress-bar { height: 100%; background: var(--gradient-primary); border-radius: 4px; transition: width 0.4s ease; }
.compliance-pct { font-size: 0.85rem; font-weight: 700; color: var(--teal-700); font-family: var(--font-heading); min-width: 36px; text-align: right; }
.compliance-list { padding: 4px 8px; }
.compliance-med {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 10px; border-radius: var(--radius-md); gap: 12px;
    margin-bottom: 4px; transition: background 0.15s;
}
.compliance-med:hover { background: var(--slate-50); }
.compliance-med-info { flex: 1; min-width: 0; }
.compliance-med-name { font-weight: 600; color: var(--slate-800); font-size: 0.92rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compliance-med-detail { font-size: 0.78rem; color: var(--slate-400); display: block; margin-top: 1px; }
.compliance-doses { display: flex; gap: 6px; flex-shrink: 0; }
.dose-btn {
    width: 38px; height: 38px; border-radius: 50%;
    border: 2px solid var(--slate-300); background: white;
    color: var(--slate-400); font-size: 0.82rem; font-weight: 700;
    cursor: pointer; transition: all 0.25s;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading);
}
.dose-btn:hover { border-color: var(--teal-400); color: var(--teal-600); background: var(--teal-50); transform: scale(1.08); }
.dose-btn.taken {
    background: var(--gradient-primary); color: white;
    border-color: var(--teal-600); box-shadow: 0 2px 8px rgba(13,148,136,0.3);
    transform: scale(1);
}
.dose-btn.taken:hover { opacity: 0.85; transform: scale(1.05); }
/* Inline dose-recorded flash — replaces stacking toasts */
.dose-btn.dose-flash-taken {
    animation: doseFlashTaken 0.5s ease;
}
@keyframes doseFlashTaken {
    0%   { box-shadow: 0 0 0 0 rgba(5,150,105,0.5); transform: scale(1); }
    40%  { box-shadow: 0 0 0 10px rgba(5,150,105,0.25); transform: scale(1.18); }
    100% { box-shadow: 0 2px 8px rgba(13,148,136,0.3); transform: scale(1); }
}
.dose-btn:disabled, .dose-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    transform: none;
}
.dose-btn:disabled:hover, .dose-btn.disabled:hover {
    transform: none;
    border-color: #e2e8f0;
    background: #f1f5f9;
    color: #94a3b8;
}
.compliance-actions {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--slate-100);
}
.compliance-actions-left { display: flex; align-items: center; gap: 6px; }
.compliance-actions-right { margin-left: auto; }
/* History nav arrow buttons */
.history-nav-arrow {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    font-size: 1.3rem; font-weight: 700; line-height: 1; padding: 0;
    border: 1.5px solid var(--slate-200); background: white;
    color: var(--slate-500); cursor: pointer;
    transition: all 0.15s; font-family: var(--font-heading);
}
.history-nav-arrow:hover:not(:disabled) {
    border-color: var(--teal-400); color: var(--teal-600); background: var(--teal-50);
}
.history-nav-arrow:active:not(:disabled) { transform: scale(0.93); }
.history-nav-arrow:disabled { opacity: 0.3; cursor: default; }
/* History nav Today button */
.history-nav-today {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 12px; height: 36px; border-radius: 8px;
    font-size: 0.8rem; font-weight: 600;
    border: 1.5px solid var(--slate-200); background: white;
    color: var(--slate-600); cursor: pointer;
    transition: all 0.15s; font-family: var(--font-heading);
}
.history-nav-today:hover:not(:disabled) {
    border-color: var(--teal-400); color: var(--teal-600); background: var(--teal-50);
}
.history-nav-today:active:not(:disabled) { transform: scale(0.96); }
.history-nav-today:disabled { opacity: 0.3; cursor: default; }
/* Collapsible compliance section */
.collapsible-header { cursor: pointer; user-select: none; }
.compliance-header-right { display: flex; align-items: center; gap: 10px; }
.collapsible-arrow { font-size: 0.75rem; color: var(--slate-400); transition: transform 0.2s; }
.collapsible-body { transition: max-height 0.3s ease, opacity 0.2s ease; overflow: hidden; }
.collapsible-body.collapsed { max-height: 0 !important; opacity: 0; padding: 0; overflow: hidden; }
.compliance-med.all-taken {
    background: var(--teal-50); border-radius: var(--radius-md);
}
.compliance-med.all-taken .compliance-med-detail { color: var(--teal-600); }
.compliance-history { padding: 8px 12px; overflow-x: auto; }
.history-grid { min-width: 0; width: 100%; }
.history-grid.history-cols-7 .history-header,
.history-grid.history-cols-7 .history-row { display: grid; grid-template-columns: 130px repeat(7, 1fr); gap: 2px; }
.history-grid.history-cols-3 .history-header,
.history-grid.history-cols-3 .history-row { display: grid; grid-template-columns: 130px repeat(3, 1fr); gap: 4px; }
.history-header { margin-bottom: 4px; }
.history-day-label {
    text-align: center; font-size: 0.72rem; color: var(--slate-500);
    font-weight: 600; font-family: var(--font-heading); line-height: 1.2; padding: 4px 0;
}
.history-day-label small { display: block; font-size: 0.65rem; color: var(--slate-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-row { margin-bottom: 2px; }
.history-med-label {
    font-size: 0.78rem; color: var(--slate-700); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 6px 4px; display: flex; align-items: center;
}
.history-cell {
    text-align: center; border-radius: 6px; padding: 6px 2px;
    font-size: 0.72rem; font-weight: 700; font-family: var(--font-heading);
    display: flex; align-items: center; justify-content: center;
}
.history-cell.editable { cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; }
.history-cell.editable:hover { transform: scale(1.08); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.history-cell.dose-flash-taken {
    animation: gridFlashTaken 0.5s ease;
}
@keyframes gridFlashTaken {
    0%   { box-shadow: 0 0 0 0 rgba(5,150,105,0.5); }
    40%  { box-shadow: 0 0 0 8px rgba(5,150,105,0.2); }
    100% { box-shadow: none; }
}
.history-cell.full { background: #dcfce7; color: #166534; }
.history-cell.partial { background: #fef9c3; color: #854d0e; }
.history-cell.empty { background: var(--slate-100); color: var(--slate-400); }
.history-cell.inactive-cell { background: var(--slate-50); color: var(--slate-300); cursor: default; font-weight: 400; font-style: italic; font-size: 0.65rem; }

/* History Day Editor Popup */
.history-day-editor-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s ease;
}
.history-day-editor-overlay.active { opacity: 1; }
.history-day-editor {
    background: white; border-radius: 16px; padding: 20px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); min-width: 260px; max-width: 340px;
    transform: scale(0.95); transition: transform 0.2s ease;
}
.history-day-editor-overlay.active .history-day-editor { transform: scale(1); }
.history-day-editor-header {
    display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px;
}
.history-day-editor-title {
    font-size: 1.05rem; font-weight: 700; color: var(--slate-800);
    font-family: var(--font-heading);
}
.history-day-editor-date {
    font-size: 0.82rem; color: var(--slate-500); margin-top: 2px;
}
.history-day-editor-doses {
    display: flex; gap: 10px; justify-content: center; padding: 12px 0;
}
.history-day-editor-doses .dose-btn { width: 44px; height: 44px; font-size: 0.9rem; }
.history-day-editor-hint {
    text-align: center; font-size: 0.75rem; color: var(--slate-400);
    margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--slate-100);
}

/* ===== Daily History swipe support ===== */
#complianceHistory { touch-action: pan-y; user-select: none; -webkit-user-select: none; }

/* ===== Full History clickable entries ===== */
.history-entry-clickable { cursor: pointer; }
.history-entry-clickable:hover { border-color: var(--teal-400); background: var(--teal-50); }
.history-entry-clickable:active { transform: scale(0.98); }
.history-entry-edit-icon {
    font-size: 0.82rem; color: var(--slate-600); opacity: 0.7;
    transition: opacity 0.15s; flex-shrink: 0;
}
.history-entry-clickable:hover .history-entry-edit-icon { opacity: 1; }
@media (max-width: 768px) {
    .history-entry-edit-icon { opacity: 0.7; }
}

/* ===== Full History Log Editor overlay ===== */
.history-log-editor {
    background: white; border-radius: 16px; padding: 20px 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2); min-width: 280px; max-width: 360px; width: 90vw;
    transform: scale(0.95); transition: transform 0.2s ease;
}
.history-day-editor-overlay.active .history-log-editor { transform: scale(1); }
.history-log-editor-fields {
    display: flex; flex-direction: column; gap: 14px; padding: 12px 0 16px;
}
.history-log-editor-label {
    display: flex; flex-direction: column; gap: 4px;
}
.history-log-editor-label span {
    font-size: 0.78rem; font-weight: 600; color: var(--slate-500);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.history-log-editor-label input {
    padding: 10px 12px; border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md); font-size: 0.92rem;
    color: var(--slate-800); background: var(--slate-50);
    transition: border-color 0.15s;
}
.history-log-editor-label input:focus {
    outline: none; border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(20,184,166,0.1);
}
.history-log-editor-actions {
    display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px;
}
.history-log-editor-actions .btn { min-width: 80px; }

/* ===== Fix 5: Separation between tracker and medication list ===== */
.med-section-divider {
    height: 1px; background: linear-gradient(to right, transparent, var(--slate-200), transparent);
    margin: 16px 6px;
}
.history-date-group { margin-bottom: 16px; }
.history-date-group h4 {
    font-size: 0.88rem; font-weight: 700; color: var(--teal-800);
    font-family: var(--font-heading); padding: 8px 0 6px;
    border-bottom: 2px solid var(--teal-100); margin-bottom: 8px;
    display: flex; align-items: center; justify-content: space-between;
}
.history-date-entries { display: flex; flex-direction: column; gap: 6px; }
.history-entry {
    display: flex; flex-direction: column; gap: 4px; padding: 10px 14px;
    background: white; border-radius: var(--radius-md); border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm); transition: all 0.15s;
}
.history-entry:hover { border-color: var(--teal-300); }
.history-entry-row1 {
    display: flex; align-items: center; gap: 8px;
}
.history-entry-row2 {
    display: flex; align-items: center; gap: 6px;
}
.history-entry-name { font-weight: 600; color: var(--slate-800); font-size: 0.88rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-entry-datetime { font-size: 0.78rem; color: var(--slate-500); flex-shrink: 0; text-align: right; line-height: 1.4; }
.history-entry-dose { font-size: 0.78rem; color: var(--teal-700); font-weight: 600; background: var(--teal-50); padding: 2px 8px; border-radius: 10px; }
.history-entry-time { font-size: 0.78rem; color: var(--slate-500); min-width: 50px; text-align: right; }
.med-history-load-more {
    display: block; width: 100%; margin: 14px 0 4px; padding: 12px;
    font-size: 0.88rem; font-weight: 600; text-align: center;
    border-radius: var(--radius-md);
}

/* ═══════ NOTES ═══════ */
.notes-tap-target { position: relative; cursor: pointer; width: 100%; }
.notes-tap-target textarea { width: 100%; }
.notes-preview {
    display: none; min-height: 80px; padding: 12px 14px;
    border: 1.5px solid var(--slate-200); border-radius: var(--radius-md);
    background: white; color: var(--slate-800); font-size: 0.95rem;
    line-height: 1.5; cursor: pointer; transition: all 0.2s;
    white-space: pre-wrap; word-break: break-word; position: relative;
}
.notes-preview.empty { color: var(--slate-400); }
.notes-preview::after { content: '✏️'; position: absolute; bottom: 10px; right: 12px; font-size: 0.85rem; opacity: 0.5; }
.notes-preview:active { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(13,148,136,0.12); }
#notesFullscreenOverlay {
    display: none; position: fixed; inset: 0; z-index: 99999;
    background: rgba(15,23,42,0.5); align-items: flex-end; justify-content: center;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#notesFullscreenOverlay.active { display: flex; }
.notes-sheet {
    width: 100%; max-width: 640px; height: 88vh;
    background: #fff; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex; flex-direction: column;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
    animation: notesSlideUp 0.28s cubic-bezier(0.34,1.1,0.64,1); overflow: hidden;
}
@keyframes notesSlideUp { from { transform: translateY(100%); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@keyframes notesSlideDown { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100%); opacity: 0; } }
.notes-sheet-handle { width: 40px; height: 4px; background: var(--slate-300); border-radius: 2px; margin: 10px auto 0; }
.notes-sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px 10px; border-bottom: 1px solid var(--slate-100);
}
.notes-sheet-title { font-size: 1rem; font-weight: 700; color: var(--slate-800); font-family: var(--font-heading); }
.notes-sheet-cancel { font-size: 0.9rem; color: var(--slate-500); background: none; border: none; padding: 6px 4px; cursor: pointer; }
.notes-sheet-done {
    font-size: 0.9rem; color: #fff; background: var(--gradient-primary);
    border: none; border-radius: 20px; padding: 6px 18px; cursor: pointer; font-weight: 600;
}
.notes-sheet-textarea {
    flex: 1; width: 100%; border: none; outline: none; resize: none;
    padding: 14px 18px; font-size: 1.05rem; line-height: 1.65;
    color: var(--slate-800); font-family: var(--font-body);
}
.notes-sheet-footer { padding: 8px 18px 12px; display: flex; justify-content: flex-end; border-top: 1px solid var(--slate-100); }
.notes-char-count { font-size: 0.78rem; color: var(--slate-400); }
@media (min-width: 601px) {
    .notes-preview { display: none !important; }
    .notes-tap-target textarea { display: block !important; }
}
@media (max-width: 600px) {
    .notes-tap-target textarea { display: none !important; }
    .notes-preview { display: block; }
    .notes-sheet { height: 92vh; }
}

/* ═══════ MODALS ═══════ */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.5); z-index: 1000; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal-content {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px 20px; max-height: 92vh; max-height: 92dvh;
    overflow-y: auto; animation: slideUp 0.3s cubic-bezier(0.34,1.1,0.64,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
    margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--slate-200);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; color: var(--slate-800); font-family: var(--font-heading); }
.close-btn {
    background: var(--slate-100); border: none; font-size: 1.3rem; cursor: pointer;
    color: var(--slate-500); width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.close-btn:hover { background: var(--slate-200); color: var(--slate-700); }

/* ═══════ CHART MODAL ═══════ */
.chart-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.6); z-index: 1001; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.chart-modal-content {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: white; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh; max-height: 92dvh; overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.34,1.1,0.64,1);
}
.chart-modal-header {
    background: var(--gradient-header); color: white; padding: 16px 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.chart-modal-header h2 { margin: 0; font-size: 1.1rem; font-weight: 700; font-family: var(--font-heading); }
.chart-modal-body { padding: 16px; overflow-y: auto; max-height: calc(92vh - 60px); }
.chart-controls, .chart-filters { display: flex; gap: 12px; margin-bottom: 16px; flex-direction: column; }
.chart-control-group, .chart-filter-group {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.chart-control-group label, .chart-filter-group label {
    font-size: 0.85rem; font-weight: 600; color: var(--slate-700); margin: 0; font-family: var(--font-heading);
}
.chart-control-group select, .chart-filter-group select {
    padding: 8px 10px; border: 1.5px solid var(--slate-200); border-radius: var(--radius-sm); font-size: 0.85rem;
}
/* Chart member pill selector (multi-select family member filter inside chart modal) */
.chart-member-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-member-pills label { font-size: 0.85rem; font-weight: 600; color: var(--slate-700); font-family: var(--font-heading); margin: 0; white-space: nowrap; }
.chart-pills-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chart-pill {
    padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: all 0.15s; border: 2px solid var(--pill-color, #6b7280);
    background: transparent; color: var(--pill-color, #6b7280);
    font-family: var(--font-heading); line-height: 1.3;
}
.chart-pill:hover { background: color-mix(in srgb, var(--pill-color, #6b7280) 15%, transparent); }
.chart-pill-active {
    background: var(--pill-color, #0d9488); color: white;
    border-color: var(--pill-color, #0d9488);
    box-shadow: 0 1px 4px color-mix(in srgb, var(--pill-color, #0d9488) 40%, transparent);
}
.chart-pill-active:hover { opacity: 0.9; }

#chartContainer { width: 100%; height: 280px; position: relative; min-height: 200px; }
#chartContainer canvas { width: 100% !important; height: 100% !important; }

/* ═══════ MED CARD MODAL ═══════ */
.medication-card-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.6); z-index: 1001; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.medication-card-modal-content {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--slate-50); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 92vh; overflow: hidden; animation: slideUp 0.3s cubic-bezier(0.34,1.1,0.64,1);
}
.medication-card-header {
    background: var(--gradient-header); color: white; padding: 16px 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.medication-card-header h2 { margin: 0; font-size: 1.1rem; font-weight: 700; font-family: var(--font-heading); }
.medication-card-body { padding: 16px; overflow-y: auto; max-height: calc(92vh - 60px); }
.medication-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card-section-title {
    grid-column: 1 / -1; color: var(--slate-700); margin: 12px 0 8px;
    font-size: 1.05rem; font-weight: 700; border-bottom: 2px solid var(--slate-200);
    padding-bottom: 6px; font-family: var(--font-heading);
}
.card-section-title:first-child { margin-top: 0; }
.medication-card {
    background: white; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--slate-200); transition: all 0.2s;
}
.medication-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.medication-card.inactive { opacity: 0.7; background: var(--slate-50); }
.medication-card .card-header {
    background: var(--gradient-primary); color: white; padding: 12px 14px;
    display: flex; justify-content: space-between; align-items: center;
}
.medication-card.inactive .card-header { background: linear-gradient(135deg, var(--slate-600), var(--slate-500)); }
.medication-card h4 { margin: 0; font-size: 1rem; font-weight: 700; font-family: var(--font-heading); }
.card-badge { padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; background: rgba(255,255,255,0.25); color: white; }
.card-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; }
.card-detail-item { font-size: 0.85rem; }
.card-detail-item .detail-label {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--slate-400); font-weight: 600; font-family: var(--font-heading); display: block; margin-bottom: 2px;
}
.card-detail-item .detail-value { color: var(--slate-700); font-weight: 500; }
.card-conditions { padding: 0 14px 14px; display: flex; flex-wrap: wrap; gap: 4px; }

/* ═══════ STATUS & MISC ═══════ */
.loading { text-align: center; padding: 40px 20px; color: var(--slate-500); font-size: 0.9rem; }
.error { color: #dc2626; background: #fee2e2; padding: 12px; border-radius: var(--radius-md); margin: 8px 0; font-size: 0.85rem; border: 1px solid #fecaca; }
.success { color: #059669; background: #d1fae5; padding: 12px; border-radius: var(--radius-md); margin: 8px 0; font-size: 0.85rem; border: 1px solid #a7f3d0; }
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--slate-400); font-size: 0.92rem;
    background: var(--slate-50); border-radius: var(--radius-lg); margin: 8px;
    border: 1.5px dashed var(--slate-200);
}
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.75rem; background: var(--teal-100); color: var(--teal-800); font-weight: 600; margin-left: 4px; }
.subcategory-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: var(--slate-50); border-radius: var(--radius-sm);
    margin-bottom: 6px; border: 1px solid var(--slate-200);
}
.subcategory-actions { display: flex; gap: 6px; }

/* ═══════ CONDITION DETAIL ═══════ */
.condition-detail-section { margin-bottom: 20px; }
.condition-detail-section h3 {
    font-size: 1rem; color: var(--slate-700); font-weight: 700;
    margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--teal-200);
    font-family: var(--font-heading);
}
.condition-widget-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.condition-widget { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-md); padding: 14px; }
.condition-widget h4 { font-size: 0.8rem; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; font-family: var(--font-heading); }
.condition-widget .widget-value { font-size: 1.3rem; font-weight: 700; color: var(--teal-700); font-family: var(--font-heading); }
.condition-mini-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.condition-mini-table th { background: var(--slate-100); padding: 8px 10px; text-align: left; font-weight: 700; color: var(--slate-700); border-bottom: 1px solid var(--slate-200); font-family: var(--font-heading); }
.condition-mini-table td { padding: 8px 10px; border-bottom: 1px solid var(--slate-100); color: var(--slate-600); }
.condition-note-item { background: var(--teal-50); border-left: 3px solid var(--teal-500); padding: 10px 14px; border-radius: 0 var(--radius-md) var(--radius-md) 0; margin-bottom: 10px; }
.condition-note-date { font-size: 0.75rem; color: var(--teal-800); font-weight: 700; margin-bottom: 4px; }
.condition-note-text { font-size: 0.875rem; color: var(--slate-700); line-height: 1.5; }
.condition-note-actions { display: flex; gap: 8px; margin-top: 6px; }
.condition-med-pill { display: inline-block; background: var(--teal-100); color: var(--teal-800); border-radius: 20px; padding: 4px 12px; font-size: 0.8rem; margin: 3px; font-weight: 600; }
.add-condition-note-form { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-lg); padding: 16px; margin-top: 12px; }
#conditionDetailModal .modal-content, #conditionModal .modal-content { overflow-x: hidden; }
#conditionDetailModal .condition-mini-table-wrap { overflow-x: auto; width: 100%; }
#conditionDetailModal .condition-mini-table { width: 100%; }
#conditionDetailModal .modal-header { position: sticky; top: 0; background: white; z-index: 10; border-bottom: 1px solid var(--slate-200); padding-bottom: 12px; margin-bottom: 16px; }

/* ═══════ CONDITION SUMMARY CARD ═══════ */
.condition-summary-card {
    background: linear-gradient(135deg, var(--teal-50) 0%, #f0fdf8 100%);
    border: 1px solid var(--teal-200); border-radius: var(--radius-lg);
    padding: 18px 20px; margin-bottom: 20px; position: relative;
}
.condition-summary-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.condition-summary-title {
    display: flex; align-items: center; gap: 8px;
}
.condition-summary-title h3 {
    font-size: 0.95rem; font-weight: 700; color: var(--teal-800);
    font-family: var(--font-heading); margin: 0; padding: 0; border: none;
}
.summary-icon {
    width: 22px; height: 22px; background: var(--gradient-primary);
    border-radius: 6px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}
.summary-icon svg { width: 14px; height: 14px; }
.summary-meta {
    font-size: 0.72rem; color: var(--slate-400);
    font-family: var(--font-heading); letter-spacing: 0.01em;
}
.condition-summary-body {
    font-size: 0.875rem; color: var(--slate-700); line-height: 1.65;
}
.condition-summary-body p { margin-bottom: 10px; }
.condition-summary-body p:last-child { margin-bottom: 0; }
.summary-flag {
    background: #fef3c7; border: 1px solid #fde68a;
    border-radius: var(--radius-sm); padding: 10px 14px;
    margin-top: 12px; display: flex; gap: 10px; align-items: flex-start;
}
.summary-flag-icon { flex-shrink: 0; font-size: 1rem; line-height: 1.5; }
.summary-flag-text {
    font-size: 0.82rem; color: #92400e; line-height: 1.55; font-weight: 500;
}
.summary-disclaimer {
    font-size: 0.7rem; color: var(--slate-400); margin-top: 12px;
    padding-top: 10px; border-top: 1px solid var(--teal-100);
    font-style: italic; line-height: 1.4;
}
/* Summary loading skeleton */
.summary-skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--teal-100) 25%, var(--teal-50) 50%, var(--teal-100) 75%);
    background-size: 200% 100%;
    animation: summaryShimmer 1.8s ease-in-out infinite;
    border-radius: 6px; margin-bottom: 10px;
}
.summary-skeleton-line:nth-child(1) { width: 95%; }
.summary-skeleton-line:nth-child(2) { width: 88%; }
.summary-skeleton-line:nth-child(3) { width: 72%; }
.summary-skeleton-line:nth-child(4) { width: 90%; margin-top: 16px; }
.summary-skeleton-line:nth-child(5) { width: 60%; }
@keyframes summaryShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ═══════ PROFILE ═══════ */
.profile-section { padding: 20px 16px; max-width: 520px; margin: 0 auto; }
.profile-section h2 { font-size: 1.3rem; margin-bottom: 24px; color: var(--slate-800); font-family: var(--font-heading); font-weight: 700; }
.danger-zone { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--slate-200); }
.danger-zone h3 { color: #dc2626; margin-bottom: 12px; font-size: 1rem; font-family: var(--font-heading); }
.danger-zone p { margin-bottom: 14px; color: var(--slate-500); font-size: 0.9rem; }
#columnConfigModal .modal-content { padding-bottom: 24px; }
#tableHeightSelect { width: 100%; }
.security-badge { margin-top: 8px; font-size: 0.72rem; color: var(--teal-700); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--font-heading); }
.security-info { margin-top: 24px; padding: 18px; background: var(--teal-50); border: 1px solid var(--teal-200); border-radius: var(--radius-lg); }
.security-info h3 { color: var(--teal-800); font-size: 1rem; margin-bottom: 10px; font-family: var(--font-heading); }
.security-info p { color: var(--teal-700); font-size: 0.85rem; margin-bottom: 6px; padding-left: 4px; }
.pref-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--slate-200); }
.pref-radio-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pref-radio { display: flex; align-items: center; gap: 5px; padding: 6px 12px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.85rem; transition: all 0.15s ease; }
.pref-radio:hover { border-color: var(--teal-400); background: var(--teal-50); }
.pref-radio input[type="radio"] { margin: 0; accent-color: var(--teal-600); }
.pref-radio input[type="radio"]:checked + span { color: var(--teal-700); font-weight: 600; }
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.92rem; color: var(--slate-700); }
.toggle-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal-600); cursor: pointer; flex-shrink: 0; }
.toggle-text { font-weight: 500; }

/* ═══════ TOAST ═══════ */
.toast-container { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
    background: var(--slate-800); color: white; padding: 12px 20px;
    border-radius: var(--radius-md); font-size: 0.88rem; font-weight: 500;
    box-shadow: var(--shadow-lg); pointer-events: auto;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ═══════ DESKTOP ═══════ */
@media (min-width: 769px) {
    .container { max-width: 100%; margin: 0 auto; }
    .header { padding: 12px 24px; }
    .header h1 { font-size: 1.35rem; }
    .user-name { display: inline; }
    .tabs {
        position: static; border-top: none; border-bottom: 1px solid var(--slate-200);
        box-shadow: none; background: white; padding: 0 16px;
        overflow-x: auto; justify-content: flex-start;
    }
    .tab {
        flex: none; flex-direction: row; padding: 12px 18px;
        font-size: 0.88rem; gap: 6px; border-top: none;
        border-bottom: 2.5px solid transparent;
    }
    .tab .tab-icon { font-size: 1rem; }
    .tab.active { border-top: none; border-bottom-color: var(--teal-600); }
    .main-content { padding-bottom: 0; }
    .toast-container { bottom: 32px; }
    .modal-content {
        position: absolute; top: 50%; left: 50%;
        transform: translate(-50%, -50%); bottom: auto; right: auto;
        border-radius: var(--radius-xl); width: 90%; max-width: 560px;
        animation: modalFadeIn 0.25s cubic-bezier(0.34,1.1,0.64,1);
        box-shadow: var(--shadow-xl);
    }
    .chart-modal-content {
        position: absolute; top: 50%; left: 50%;
        transform: translate(-50%, -50%); bottom: auto; right: auto;
        border-radius: var(--radius-xl); width: 95%; max-width: 900px;
        animation: modalFadeIn 0.25s cubic-bezier(0.34,1.1,0.64,1);
    }
    .medication-card-modal-content {
        position: absolute; top: 50%; left: 50%;
        transform: translate(-50%, -50%); bottom: auto; right: auto;
        border-radius: var(--radius-xl); width: 90%; max-width: 800px;
        animation: modalFadeIn 0.25s cubic-bezier(0.34,1.1,0.64,1);
    }
    #conditionDetailModal .modal-content {
        max-width: 800px;
    }
    @keyframes modalFadeIn {
        from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
        to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    }
    .form-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .calendar-container { margin: 0 10px 12px; }
    .calendar-title { width: auto; order: 0; }
    .calendar-nav { width: auto; }
    .calendar-day { height: 90px; }
    .calendar-day-number { font-size: 0.85rem; }
    .calendar-appointment { font-size: 0.72rem; padding: 2px 5px; }
    .chart-controls, .chart-filters { flex-direction: row; }
    .chart-control-group, .chart-filter-group { flex-direction: column; align-items: flex-start; }
    #chartContainer { height: 350px; }
    .medication-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .controls-bar { flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 10px; }
    .med-top-bar { padding: 12px 10px; }
    .add-btn-container { margin: 0 10px; }
    .family-info-text { margin-left: 10px; margin-right: 10px; }
    .table-container, .med-compliance-section { margin: 0 10px 10px; }
    .compliance-progress { width: 120px; }
    .readings-list { padding: 0 10px 10px; }
    .reading-card { padding: 16px 20px; }
}
@media (min-width: 1200px) {
    .container { max-width: 1400px; margin: 0 auto; }
    .calendar-day { height: 100px; }
    .calendar-appointment { font-size: 0.75rem; }
}
@media (max-width: 400px) {
    .condition-widget-row { grid-template-columns: 1fr; }
    .dose-btn { width: 34px; height: 34px; font-size: 0.75rem; }
    .tests-nav-btn { padding: 8px 12px; font-size: 0.8rem; }
    .reading-value { font-size: 1.2rem; }
    .reading-card { padding: 12px; }
}


/* ===== FIX 5: MEDICATION HISTORY MOBILE ===== */
.history-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
@media (max-width: 600px) {
    .history-grid {
        overflow-x: visible;
        white-space: normal;
    }
    .history-grid.history-cols-3 .history-header,
    .history-grid.history-cols-3 .history-row {
        grid-template-columns: 90px repeat(3, 1fr);
        gap: 4px;
    }
    .history-grid.history-cols-7 .history-header,
    .history-grid.history-cols-7 .history-row {
        display: inline-flex;
        min-width: max-content;
    }
    .history-med-label {
        min-width: 90px;
        max-width: 90px;
        flex-shrink: 0;
        position: sticky;
        left: 0;
        background: white;
        z-index: 1;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .history-day-label, .history-cell {
        min-width: 50px;
        flex-shrink: 0;
    }
    .med-history-date-group {
        padding: 0 4px;
    }
    .history-entry-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Fix 5: Mobile spacing between sections */
    .med-section-divider { margin: 12px 6px; }
}

/* ===== FIX 11: APPOINTMENT FILTERS MOBILE ===== */
@media (max-width: 768px) {
    .controls-bar-row {
        flex-direction: column;
        gap: 8px;
    }
    .filter-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }
    .filter-controls .filter-dropdown {
        flex: none;
    }
    .filter-controls .filter-btn {
        padding: 7px 10px;
        font-size: 0.78rem;
        white-space: nowrap;
    }
    .filter-controls .btn {
        padding: 7px 12px;
        font-size: 0.82rem;
    }
    .search-container {
        width: 100%;
    }
    .search-input {
        width: 100%;
    }
    .view-toggles {
        width: 100%;
        display: flex;
    }
    .view-toggle {
        flex: 1;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .filter-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .filter-controls .btn {
        grid-column: 1 / -1;
    }
    .filter-dropdown-content {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        max-height: 60vh;
        z-index: 1000;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }
}

/* ===== FAMILY MEMBER STYLES ===== */
.family-member-selector {
    display: none;
}
.tab-filter-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tab-filter-bar .filter-dropdown {
    position: relative;
}
.family-member-selector select {
    padding: 6px 28px 6px 10px;
    border: 1.5px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 16px;
    max-width: 160px;
}
.family-member-selector select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.6);
    background-color: rgba(255,255,255,0.25);
}
.family-member-selector select option {
    background: white;
    color: #1e293b;
}
.family-section {
    padding: 0;
}
.family-info-text {
    color: #64748b;
    font-size: 0.88rem;
    margin: 0 6px 16px;
    line-height: 1.5;
}
.family-member-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: white;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
    transition: all 0.2s;
    cursor: pointer;
}
.family-member-card:hover {
    border-color: #99f6e4;
    box-shadow: 0 2px 8px rgba(13,148,136,0.1);
}
.family-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.family-member-info {
    flex: 1;
    min-width: 0;
}
.family-member-info h4 {
    margin: 0 0 3px;
    font-size: 1rem;
    color: #1e293b;
}
.family-member-info p {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}
.family-member-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.color-picker-row input[type="color"] {
    width: 48px;
    height: 38px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    padding: 3px;
    transition: border-color 0.2s;
}
.color-picker-row input[type="color"]:hover {
    border-color: #0d9488;
}
.color-picker-label {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* FM Login table member cell with avatar */
.fm-login-member-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== READING TABLE STYLE (for glucose, weight, spo2, hr) ===== */
/* WP-6.4: All badge colors verified WCAG AA compliant (>=4.5:1 contrast ratio) */
.reading-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.reading-status-badge.normal { background: #dcfce7; color: #166534; }
.reading-status-badge.elevated { background: #fde68a; color: #713f12; }
.reading-status-badge.high { background: #fee2e2; color: #991b1b; }
.reading-status-badge.low { background: #dbeafe; color: #1e40af; }
.reading-status-badge.critical { background: #fce7f3; color: #9d174d; font-weight: 700; }

/* ===== SORTABLE COLUMN HEADERS ===== */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
}
.sortable::after {
    content: '⇅';
    position: absolute;
    right: 6px;
    opacity: 0.3;
    font-size: 0.7rem;
}
.sortable.sort-asc::after {
    content: '↑';
    opacity: 0.8;
    color: #0d9488;
}
.sortable.sort-desc::after {
    content: '↓';
    opacity: 0.8;
    color: #0d9488;
}
/* WP-5.8: Keyboard focus outline for sortable headers */
.sortable:focus {
    outline: 2px solid #0d9488;
    outline-offset: -2px;
}
.sortable:focus:not(:focus-visible) {
    outline: none;
}

/* Fix mobile data-table card layout — scoped to exclude views with dedicated card views */
@media (max-width: 768px) {
    :not(.vitals-table-view):not(.list-table-view) > .table-container .data-table thead,
    :not(.vitals-table-view):not(.list-table-view) > .table-wrapper > .data-table thead { display: none; }
    :not(.vitals-table-view):not(.list-table-view) > .table-container .data-table tbody tr,
    :not(.vitals-table-view):not(.list-table-view) > .table-wrapper > .data-table tbody tr {
        display: block;
        margin-bottom: 10px;
        background: white;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    }
    :not(.vitals-table-view):not(.list-table-view) > .table-container .data-table td,
    :not(.vitals-table-view):not(.list-table-view) > .table-wrapper > .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f1f5f9;
        text-align: right;
    }
    :not(.vitals-table-view):not(.list-table-view) > .table-container .data-table td:last-child,
    :not(.vitals-table-view):not(.list-table-view) > .table-wrapper > .data-table td:last-child {
        border-bottom: none;
    }
    :not(.vitals-table-view):not(.list-table-view) > .table-container .data-table td::before,
    :not(.vitals-table-view):not(.list-table-view) > .table-wrapper > .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--slate-500, #64748b);
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        text-align: left;
        margin-right: 12px;
    }
    :not(.vitals-table-view):not(.list-table-view) > .table-container .table-actions,
    :not(.vitals-table-view):not(.list-table-view) > .table-wrapper > .table-actions {
        justify-content: flex-end;
        width: 100%;
    }
}

/* =============================================
   NDC LOOKUP + MEDICATION TOP BAR
   ============================================= */

/* ===== NDC LOOKUP FIELD IN MEDICATION MODAL ===== */
.ndc-lookup-group {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(16, 185, 129, 0.06));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}
.ndc-lookup-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text, #1e293b);
    margin-bottom: 8px;
    font-family: var(--font-heading, 'Outfit', sans-serif);
}
.ndc-optional {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.75rem;
}
.ndc-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.ndc-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: 'Source Sans 3', monospace;
    letter-spacing: 0.03em;
    color: var(--text, #1e293b);
    background: white;
    transition: border-color 0.2s;
}
.ndc-input-row input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.ndc-input-row input::placeholder {
    color: #b0b8c4;
    font-weight: 400;
    letter-spacing: 0.02em;
}
.ndc-lookup-btn {
    padding: 10px 18px !important;
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: white !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    font-family: var(--font-heading, 'Outfit', sans-serif) !important;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.ndc-lookup-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
.ndc-lookup-btn:active {
    transform: scale(0.97);
}
.ndc-lookup-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* NDC lookup status messages */
.ndc-status {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-heading, 'Outfit', sans-serif);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 20px;
    line-height: 1.3;
}
.ndc-status:empty {
    display: none;
}
.ndc-status-loading {
    color: #6366f1;
}
.ndc-status-success {
    color: #059669;
}
.ndc-status-error {
    color: #dc2626;
}
.ndc-status svg {
    flex-shrink: 0;
}
.ndc-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: ndcSpin 0.6s linear infinite;
    flex-shrink: 0;
}
@keyframes ndcSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 420px) {
    .ndc-input-row {
        flex-direction: column;
    }
    .ndc-lookup-btn {
        width: 100% !important;
    }
}

/* ===== MEDICATION TOP BAR ===== */
.med-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 6px;
    flex-wrap: wrap;
}
.med-top-filter {
    flex-shrink: 0;
}
.med-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .med-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 6px;
    }
    .med-top-filter {
        display: flex;
        justify-content: flex-start;
    }
    .med-top-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .med-top-actions .btn {
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 0.85rem;
        justify-content: center;
        text-align: center;
        border-radius: 10px;
    }
}
@media (max-width: 380px) {
    .med-top-actions {
        grid-template-columns: 1fr;
    }
}



/* ===== MEDICATION HISTORY: TODAY COLUMN HIGHLIGHT ===== */
.history-day-label.today {
    color: #0d9488;
    font-weight: 700;
}
.history-cell.today {
    border-color: #99f6e4;
    background-color: #f0fdfa;
}
.history-cell.today.full {
    background: #ccfbf1;
    border-color: #5eead4;
}
.history-cell.today.partial {
    background: #fef9c3;
    border-color: #fde68a;
}
/* ===== DOCTOR FAMILY MEMBER CHECKBOXES ===== */
.fm-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}
.fm-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1.5px solid #d1d5db;
    background: #f9fafb;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    user-select: none;
}
.fm-checkbox-label:hover {
    border-color: #0d9488;
    background: #f0fdfa;
}
.fm-checkbox-label.checked {
    border-color: #0d9488;
    background: #ccfbf1;
}
.fm-checkbox-label input[type="checkbox"] {
    display: none;
}
.fm-checkbox-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    position: relative;
}
.fm-checkbox-label.checked .fm-checkbox-dot::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    color: white;
    font-weight: bold;
}

/* =============================================
   ROLE-BASED ACCESS CONTROL STYLES
   ============================================= */

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-left: 6px;
}
.role-admin { background: rgba(13, 148, 136, 0.2); color: #5eead4; }
.role-member { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.role-fm-admin { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Permission Pills */
.permission-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.perm-admin { background: #fef3c7; color: #92400e; }
.perm-member { background: #f0f9ff; color: #1e40af; }

/* Admin Link */
.admin-link {
    color: #5eead4;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid rgba(94, 234, 212, 0.3);
    transition: all 0.2s;
    margin-left: 8px;
}
.admin-link:hover {
    background: rgba(13, 148, 136, 0.2);
    border-color: rgba(94, 234, 212, 0.5);
}

/* Status Pills */
.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}
.status-active { background: #dcfce7; color: #166534; }
.status-suspended { background: #fee2e2; color: #991b1b; }
.status-none { background: #f1f5f9; color: #64748b; }

/* Family Member Login — shared avatar class (used by Family Members table) */
.fm-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.65rem;
    flex-shrink: 0;
}

/* =============================================
   TWO-FACTOR AUTHENTICATION TOGGLE
   ============================================= */

/* Item 15: Consistent profile settings section cards */
.two-factor-section,
.trusted-devices-section,
.pin-quick-unlock-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.two-factor-section h3,
.trusted-devices-section h3,
.pin-quick-unlock-section h3 {
    font-size: 1rem;
    color: #0f172a;
    margin-bottom: 4px;
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: background 0.25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    bottom: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: #0d9488;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(13,148,136,0.2);
}

/* ═══════ MEDICATION MEMBER INDICATORS ═══════ */

/* Compact member label (Today's Meds + Full History) */
.compliance-med-member {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--slate-500);
    margin-top: 2px;
}
.member-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Tiny member avatar for Daily History grid */
.history-member-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-right: 3px;
    line-height: 1;
}

/* Full History entry info wrapper — kept for legacy compatibility */

/* ═══════ MOBILE MEDICATION TABLE: ACTIVE/INACTIVE INDICATOR ═══════ */
@media (max-width: 768px) {
    #medicationsTable tbody tr {
        border-left: 4px solid var(--teal-500);
    }
    #medicationsTable tbody tr.inactive-medication {
        border-left: 4px solid var(--slate-300);
    }
}

/* ═══════ ONBOARDING WIZARD ═══════ */
.onboarding-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(15,23,42,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: onboardFadeIn 0.3s ease;
}
@keyframes onboardFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes onboardCardIn { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes onboardStepIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

.onboarding-card {
    background: white; border-radius: var(--radius-xl);
    box-shadow: 0 25px 60px rgba(0,0,0,0.18);
    width: 100%; max-width: 440px;
    padding: 36px 32px 28px;
    position: relative; overflow: hidden;
    animation: onboardCardIn 0.4s cubic-bezier(0.34,1.1,0.64,1);
}
.onboarding-skip {
    position: absolute; top: 16px; right: 18px;
    background: none; border: none; cursor: pointer;
    color: var(--slate-400); font-size: 0.85rem; font-family: var(--font-body);
    padding: 4px 8px; border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.onboarding-skip:hover { color: var(--slate-600); background: var(--slate-100); }

.onboarding-steps { position: relative; min-height: 280px; }
.onboarding-step {
    display: none; flex-direction: column; align-items: center; text-align: center;
}
.onboarding-step.active {
    display: flex;
    animation: onboardStepIn 0.35s ease;
}
.onboarding-icon-wrap {
    width: 80px; height: 80px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px; flex-shrink: 0;
}
.onboarding-icon-welcome { background: linear-gradient(135deg, #f0fdfa, #ccfbf1); color: var(--teal-600); }
.onboarding-icon-family { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
.onboarding-icon-doctors { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #7c3aed; }
.onboarding-icon-track { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }

.onboarding-title {
    font-family: var(--font-heading); font-weight: 700;
    font-size: 1.45rem; color: var(--slate-900);
    margin-bottom: 8px; line-height: 1.2;
}
.onboarding-subtitle {
    font-size: 0.95rem; color: var(--slate-500);
    line-height: 1.55; max-width: 360px; margin-bottom: 18px;
}
.onboarding-highlight-box {
    background: var(--teal-50); border: 1px solid var(--teal-200);
    border-radius: var(--radius-md); padding: 14px 18px;
    font-size: 0.88rem; color: var(--teal-800); line-height: 1.5;
    width: 100%;
}
.onboarding-highlight-box strong { color: var(--teal-700); }

.onboarding-tip {
    display: flex; align-items: flex-start; gap: 10px; text-align: left;
    background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius-md);
    padding: 14px 16px; font-size: 0.88rem; color: #92400e; line-height: 1.5;
    width: 100%;
}
.onboarding-tip-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

.onboarding-checklist {
    display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: left;
}
.onboarding-check-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--slate-50); border: 1px solid var(--slate-200);
    border-radius: var(--radius-md); padding: 14px 16px;
    font-size: 0.9rem; color: var(--slate-700); line-height: 1.4;
}
.onboarding-check-item strong { color: var(--slate-800); }
.onboarding-check-icon { font-size: 1.3rem; flex-shrink: 0; }

.onboarding-features-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    width: 100%;
}
.onboarding-feature-pill {
    display: flex; align-items: center; gap: 8px;
    background: var(--slate-50); border: 1px solid var(--slate-200);
    border-radius: var(--radius-md); padding: 12px 14px;
    font-size: 0.88rem; font-weight: 500; color: var(--slate-700);
    transition: border-color 0.2s, background 0.2s;
}
.onboarding-feature-pill span { font-size: 1.15rem; }

/* UX-1.0: Onboarding Step 4 — Action Choice Cards */
.onboarding-choice-grid {
    display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
}
.onboarding-choice-btn {
    display: flex; align-items: center; gap: 12px; padding: 13px 14px;
    background: #fff; border: 1.5px solid var(--slate-200); border-radius: 12px;
    cursor: pointer; transition: all 0.2s; text-align: left; width: 100%;
    font-family: inherit;
}
.onboarding-choice-btn:hover {
    border-color: var(--teal-400); background: var(--teal-50);
    transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.onboarding-choice-btn:active { transform: scale(0.98); }
.onboarding-choice-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
    flex-shrink: 0;
}
.onboarding-choice-icon.appts { background: #eff6ff; }
.onboarding-choice-icon.meds { background: #ecfdf5; }
.onboarding-choice-icon.vitals { background: #fef3c7; }
.onboarding-choice-icon.conditions { background: #fce7f3; }
.onboarding-choice-text h4 { font-size: 0.88rem; font-weight: 600; color: var(--slate-800); margin: 0; }
.onboarding-choice-text p { font-size: 0.75rem; color: var(--slate-500); margin: 2px 0 0; line-height: 1.35; }

/* UX-1.0: Empty State Cards */
.empty-state-card {
    text-align: center; padding: 24px;
    border: 1.5px dashed var(--slate-300); border-radius: 14px;
    margin: 20px auto; max-width: 400px;
}
.empty-state-icon { font-size: 2rem; margin-bottom: 8px; }
.empty-state-msg { color: var(--slate-500); font-size: 0.9rem; margin: 0 0 14px; }

/* UX-2.0: Inline Creation Panels */
.inline-create-panel {
    background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px;
    padding: 14px; margin: 10px 0;
}
.inline-create-title {
    font-weight: 600; font-size: 0.88rem; color: var(--teal-700); margin-bottom: 10px;
}
.inline-create-actions { display: flex; gap: 8px; margin-top: 10px; }

/* UX-2.0: Green "Add New" option in appointment dropdowns */
select option.add-new-option { color: #0d9488; font-weight: 600; }

/* UX-2.0: Quick-Add Form Toggle - Removed in v5.0 */
/* .form-advanced-toggle {
    color: var(--teal-600); cursor: pointer; margin: 8px 0; font-size: 0.85rem;
    user-select: none;
}
.form-advanced-toggle:hover { color: var(--teal-800); } */

/* Nav */
.onboarding-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 28px; padding-top: 20px;
    border-top: 1px solid var(--slate-100);
}
.onboarding-dots { display: flex; gap: 8px; }
.onboarding-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--slate-200); transition: all 0.3s ease;
}
.onboarding-dot.active {
    background: var(--teal-500); width: 24px; border-radius: 4px;
}
.onboarding-buttons { display: flex; gap: 10px; }
.onboarding-btn-back {
    background: none; border: 1px solid var(--slate-200);
    color: var(--slate-600); font-family: var(--font-body); font-weight: 600;
    padding: 10px 20px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.9rem; transition: all 0.2s;
}
.onboarding-btn-back:hover { background: var(--slate-50); border-color: var(--slate-300); }
.onboarding-btn-next {
    background: var(--gradient-primary); border: none;
    color: white; font-family: var(--font-body); font-weight: 600;
    padding: 10px 24px; border-radius: var(--radius-sm);
    cursor: pointer; font-size: 0.9rem; transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(13,148,136,0.25);
}
.onboarding-btn-next:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,148,136,0.3); }
.onboarding-btn-next.onboarding-btn-finish {
    background: linear-gradient(135deg, #059669, #10b981);
    box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}

/* Responsive */
@media (max-width: 480px) {
    .onboarding-card { padding: 28px 20px 22px; margin: 8px; }
    .onboarding-title { font-size: 1.25rem; }
    .onboarding-subtitle { font-size: 0.9rem; }
    .onboarding-icon-wrap { width: 64px; height: 64px; margin-bottom: 16px; }
    .onboarding-icon-wrap svg { width: 36px; height: 36px; }
    .onboarding-features-grid { gap: 8px; }
    .onboarding-feature-pill { padding: 10px 12px; font-size: 0.82rem; }
    .onboarding-steps { min-height: 260px; }
}

/* ═══════ CALENDAR SYNC ═══════ */
.calendar-sync-section {
    margin-top: 28px; padding: 20px; background: white;
    border: 1px solid var(--slate-200); border-radius: var(--radius-lg);
}
.calendar-sync-section h3 { font-size: 1.05rem; font-weight: 700; color: var(--slate-800); margin-bottom: 8px; font-family: var(--font-heading); }
.calendar-sync-desc { font-size: 0.88rem; color: var(--slate-600); margin-bottom: 12px; line-height: 1.5; }
.calendar-sync-privacy-note {
    font-size: 0.82rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
    padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 16px; line-height: 1.45;
}
.calendar-sync-apps { display: flex; flex-direction: column; gap: 10px; }
.calendar-sync-app {
    border: 1px solid var(--slate-200); border-radius: var(--radius-md);
    overflow: hidden; transition: border-color 0.2s;
}
.calendar-sync-app:hover { border-color: var(--teal-300); }
.calendar-sync-app-header {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: var(--slate-50); cursor: default;
}
.calendar-sync-app-icon {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; font-weight: 700; font-size: 0.9rem; color: white;
    background: var(--slate-500); flex-shrink: 0;
}
.calendar-sync-app[data-app="google"] .calendar-sync-app-icon { background: #4285f4; }
.calendar-sync-app[data-app="apple"] .calendar-sync-app-icon { background: #333; font-size: 1.1rem; }
.calendar-sync-app[data-app="outlook"] .calendar-sync-app-icon { background: #0078d4; }
.calendar-sync-app-name { font-size: 0.9rem; font-weight: 600; color: var(--slate-700); flex: 1; }
.calendar-sync-status { font-size: 0.78rem; font-weight: 500; color: var(--slate-400); }
.calendar-sync-status.connected { color: #059669; }
.calendar-sync-app-body { padding: 0 14px 14px; }
.calendar-sync-disconnected { padding-top: 8px; }
.calendar-sync-connected { padding-top: 8px; }
.calendar-sync-fields { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 10px; }
.calendar-sync-fields-label { font-size: 0.8rem; color: var(--slate-500); font-weight: 500; width: 100%; margin-bottom: 2px; }
.calendar-sync-field-toggle {
    font-size: 0.82rem; color: var(--slate-600); display: flex; align-items: center; gap: 4px; cursor: pointer;
}
.calendar-sync-field-toggle input { accent-color: var(--teal-600); width: 15px; height: 15px; cursor: pointer; }
.calendar-sync-meta { font-size: 0.78rem; color: var(--slate-400); margin-bottom: 10px; }
.calendar-sync-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; border-radius: var(--radius-sm); }
.btn-outline { background: white; color: var(--teal-700); border: 1.5px solid var(--teal-400); }
.btn-outline:hover { background: var(--teal-50); }
.btn-danger-outline { background: white; color: #dc2626; border: 1.5px solid #fca5a5; }
.btn-danger-outline:hover { background: #fef2f2; }
.calendar-sync-help { margin-top: 16px; }
.calendar-sync-help summary {
    font-size: 0.85rem; color: var(--teal-700); cursor: pointer; font-weight: 500;
    padding: 6px 0; list-style: none;
}
.calendar-sync-help summary::before { content: '▸ '; }
.calendar-sync-help[open] summary::before { content: '▾ '; }
.calendar-sync-help-content { padding: 10px 0 0; }
.calendar-sync-help-content p { font-size: 0.82rem; color: var(--slate-600); margin-bottom: 8px; line-height: 1.5; }

@media (max-width: 600px) {
    .calendar-sync-section { padding: 16px; }
    .calendar-sync-fields { gap: 4px 10px; }
}

/* ═══════════════════════════════════════════════════════════════
   HELP TAB — Conversational Chat UI
   v3.20.1 — 2026-03-28
   ═══════════════════════════════════════════════════════════════ */

/* ── Chat Container (full-tab layout) ──────────────────────── */
.help-chat-container {
    display: flex; flex-direction: column;
    height: calc(100vh - 140px); /* header + tab bar */
    height: calc(100dvh - 140px);
    background: var(--slate-100);
}
/* HLP-2E: Sticky header wrapping search bar + quick-links so both stay
   visible as the user scrolls the Help tab. The wrapper owns sticky
   positioning; individual rows just lay out inside it. */
.help-sticky-header {
    position: sticky; top: 0; z-index: 5;
    background: white;
    border-bottom: 1px solid var(--slate-200);
    flex-shrink: 0;
}
/* GDE-1.1 / HLP-2E: Search bar row (no longer sticky on its own — the wrapper handles it). */
.help-search-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px 8px;
    background: white;
}
/* HLP-2E: Quick-links row below the search bar — single horizontal row of chips. */
.help-quick-links {
    display: flex; align-items: center; gap: 8px;
    padding: 2px 16px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}
.help-quick-links::-webkit-scrollbar { display: none; } /* Safari/Chrome */
.help-quick-link {
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 14px;
    background: var(--teal-50, #f0fdfa);
    color: var(--teal-700, #0f766e);
    border: 1px solid var(--teal-200, #99f6e4);
    border-radius: 999px;
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.help-quick-link:hover {
    background: #ccfbf1;
    border-color: var(--teal-600, #0d9488);
}
.help-quick-link:focus-visible {
    outline: 2px solid var(--teal-600, #0d9488);
    outline-offset: 2px;
}
#help > .help-chat-messages {
    overflow-y: auto;
    padding: 20px 16px;
    scroll-behavior: smooth;
    background: var(--slate-100);
}

/* ── Messages Area ─────────────────────────────────────────── */
.help-chat-messages {
    flex: 1; overflow-y: auto; padding: 20px 16px;
    scroll-behavior: smooth;
}

/* ── Message Layout ────────────────────────────────────────── */
.help-chat-msg { display: flex; gap: 8px; margin-bottom: 16px; max-width: 780px; }
.help-chat-user { justify-content: flex-end; margin-left: auto; }
.help-chat-bot { justify-content: flex-start; }
.help-chat-system { justify-content: flex-start; margin-bottom: 4px; }

/* ── Bot Avatar ────────────────────────────────────────────── */
.help-chat-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--gradient-primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-size: 0.82rem; font-weight: 700;
    margin-top: 2px;
}

/* ── Chat Bubbles ──────────────────────────────────────────── */
.help-chat-bubble {
    max-width: 85%; padding: 12px 16px; border-radius: 16px;
    font-size: 0.9rem; line-height: 1.6;
}
.help-chat-bubble-user {
    background: var(--teal-600); color: white;
    border-bottom-right-radius: 4px;
}
.help-chat-bubble-bot {
    background: white; color: var(--slate-700);
    border: 1px solid var(--slate-200); border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.help-chat-bubble-bot p { margin-bottom: 8px; }
.help-chat-bubble-bot p:last-child { margin-bottom: 0; }
.help-chat-bubble-bot strong { color: var(--slate-800); }

/* ── Typing Indicator ──────────────────────────────────────── */
.help-typing-bubble { padding: 14px 20px; }
.help-typing { display: flex; gap: 5px; align-items: center; }
.help-typing span {
    width: 8px; height: 8px; border-radius: 50%; background: var(--slate-400);
    animation: helpTypingDot 1.2s infinite;
}
.help-typing span:nth-child(2) { animation-delay: 0.2s; }
.help-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes helpTypingDot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* ── Suggestion Chips ──────────────────────────────────────── */
.help-chat-suggestions {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.help-chat-suggestion {
    background: var(--teal-50); border: 1px solid var(--teal-200);
    border-radius: 18px; padding: 6px 14px; font-size: 0.82rem;
    font-weight: 500; color: var(--teal-700); cursor: pointer;
    font-family: var(--font-body); transition: all 0.2s; white-space: nowrap;
}
.help-chat-suggestion:hover {
    background: var(--teal-100); border-color: var(--teal-400); color: var(--teal-800);
}
.help-chat-topics { margin-top: 8px; }

/* ── Inline Tip (in bot response) ──────────────────────────── */
.help-chat-tip {
    margin-top: 10px; padding: 8px 12px;
    background: linear-gradient(135deg, var(--teal-50), #f0fdfa);
    border: 1px solid var(--teal-200); border-radius: var(--radius-sm);
    font-size: 0.84rem; color: var(--slate-600); line-height: 1.5;
}
.help-chat-tip strong { color: var(--teal-700); }

/* ── Source Links (article references below answer) ────────── */
.help-chat-sources {
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--slate-200);
}
.help-chat-sources-label {
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--slate-400); margin-bottom: 6px;
}
.help-chat-source-link {
    display: block; width: 100%; text-align: left;
    background: none; border: none; color: var(--teal-600);
    font-size: 0.84rem; font-weight: 500; cursor: pointer;
    font-family: var(--font-body); padding: 4px 0;
    transition: color 0.2s;
}
.help-chat-source-link:hover { color: var(--teal-800); }

/* ── Email Fallback (below sources when answer may not help) ─ */
.help-chat-email-fallback {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid var(--slate-100);
    font-size: 0.8rem; color: var(--slate-400); line-height: 1.5;
}
.help-chat-email-fallback a {
    color: var(--teal-600); text-decoration: none; font-weight: 500;
}
.help-chat-email-fallback a:hover { color: var(--teal-800); text-decoration: underline; }

/* ── Article badges (reused in sources) ────────────────────── */
.help-article-badge {
    display: inline-block; font-size: 0.68rem; font-weight: 600;
    text-transform: uppercase; padding: 2px 7px; border-radius: 10px;
    letter-spacing: 0.3px; margin-right: 4px; vertical-align: middle;
}
.help-type-how-to { background: var(--teal-100); color: var(--teal-700); }
.help-type-troubleshoot { background: #fef3c7; color: #92400e; }
.help-type-tip { background: #ede9fe; color: #5b21b6; }
.help-article-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.help-article-cat { font-size: 0.78rem; color: var(--slate-500); }

/* ── Full Article in Chat Bubble ───────────────────────────── */
.help-chat-article-bubble { max-width: 92%; }
.help-chat-article-full { }
.help-chat-article-title {
    font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700;
    color: var(--slate-900); margin-bottom: 12px; line-height: 1.3;
}
.help-article-body {
    font-size: 0.88rem; color: var(--slate-700); line-height: 1.6;
}
.help-article-body p { margin-bottom: 10px; }
.help-article-body p:last-child { margin-bottom: 0; }
.help-article-body strong { color: var(--slate-800); }

/* Ordered list (numbered steps) in chat */
.help-article-body ol.help-steps {
    list-style: none; counter-reset: help-step; padding: 0; margin: 4px 0 12px;
}
.help-article-body ol.help-steps li {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 5px 0; font-size: 0.88rem; color: var(--slate-700);
    line-height: 1.5; counter-increment: help-step;
}
.help-article-body ol.help-steps li::before {
    content: counter(help-step);
    display: flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; background: var(--teal-600); color: white;
    border-radius: 50%; font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
    margin-top: 2px;
}

/* Unordered list in chat */
.help-article-body ul.help-list {
    list-style: none; padding: 0; margin: 4px 0 12px;
}
.help-article-body ul.help-list li {
    padding: 4px 0 4px 12px; font-size: 0.88rem; color: var(--slate-700);
    line-height: 1.5; border-left: 2px solid var(--teal-300);
    margin-bottom: 4px;
}

/* ── Article Tips (in expanded article) ────────────────────── */
.help-article-tips {
    margin-top: 12px; background: linear-gradient(135deg, var(--teal-50), #f0fdfa);
    border: 1px solid var(--teal-200); border-radius: var(--radius-sm); padding: 10px 14px;
}
.help-article-tips-title {
    font-size: 0.82rem; font-weight: 600; color: var(--teal-700); margin-bottom: 6px;
}
.help-article-tip-item {
    font-size: 0.82rem; color: var(--slate-600); line-height: 1.5;
    padding: 3px 0 3px 10px; border-left: 2px solid var(--teal-300);
    margin-bottom: 4px;
}

/* ── Quick Answer (TL;DR) box (HLP-2A.1) ───────────────────── */
.help-quick-answer {
    margin: 0 0 14px;
    background: linear-gradient(135deg, #f0fdfa, #ecfeff);
    border: 1px solid var(--teal-300);
    border-left: 4px solid var(--teal-600);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.help-quick-answer-label {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase; color: var(--teal-700); margin-bottom: 4px;
}
.help-quick-answer-text {
    font-size: 0.88rem; color: var(--slate-800); line-height: 1.55;
}
.help-quick-answer-text strong { color: var(--slate-900); }

/* ── "Was this helpful?" feedback widget (HLP-2A.1) ────────── */
.help-feedback {
    margin-top: 14px; padding-top: 10px;
    border-top: 1px solid var(--slate-200);
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.help-feedback-question {
    font-size: 0.82rem; color: var(--slate-500); font-weight: 500;
}
.help-feedback-buttons { display: flex; gap: 6px; }
.help-feedback-btn {
    background: white; border: 1px solid var(--slate-300); color: var(--slate-700);
    font-family: var(--font-body); font-size: 0.8rem; font-weight: 500;
    padding: 4px 12px; border-radius: 14px; cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.help-feedback-btn:hover {
    background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-400);
}
.help-feedback-thanks {
    font-size: 0.8rem; color: var(--slate-500); line-height: 1.5;
}
.help-feedback-thanks a {
    color: var(--teal-600); text-decoration: none; font-weight: 500;
}
.help-feedback-thanks a:hover { text-decoration: underline; }

/* ── Verified / last-updated footer (HLP-2A.1) ─────────────── */
.help-verified {
    margin-top: 8px; padding-top: 6px;
    font-size: 0.7rem; color: var(--slate-400);
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════
   HLP-2B.1 — Help panel features
   What's-new banner, contextual starters, recently-viewed chips,
   search autocomplete, decision-tree card
   ═══════════════════════════════════════════════════════════════ */

/* ── What's-new banner ─────────────────────────────────────── */
.help-whatsnew {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin: 10px 0 14px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(13,148,136,0.08), rgba(45,212,191,0.08));
    border: 1px solid rgba(13,148,136,0.25);
    border-radius: 10px;
    font-size: 0.85rem;
}
.help-whatsnew-body {
    display: flex; align-items: center; gap: 8px; flex: 1;
    min-width: 0; /* allow text truncation */
}
.help-whatsnew-label {
    flex-shrink: 0;
    background: var(--teal-600, #0d9488); color: #fff;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 8px; border-radius: 999px;
}
.help-whatsnew-headline {
    color: var(--slate-900); line-height: 1.35;
}
.help-whatsnew-actions {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.help-whatsnew-btn {
    background: var(--teal-600, #0d9488); color: #fff; border: none;
    padding: 6px 12px; border-radius: 8px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer;
    transition: background 0.15s;
}
.help-whatsnew-btn:hover { background: var(--teal-700, #0f766e); }
.help-whatsnew-dismiss {
    background: transparent; border: none; cursor: pointer;
    color: var(--slate-400); font-size: 1.1rem; line-height: 1;
    padding: 4px 6px; border-radius: 6px;
}
.help-whatsnew-dismiss:hover { color: var(--slate-700); background: rgba(0,0,0,0.04); }

/* ── Starter section heading (contextual + generic) ────────── */
.help-starter-section { margin: 8px 0 4px; }
.help-starter-heading {
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.6px;
    text-transform: uppercase; color: var(--slate-500);
    margin-bottom: 6px;
}

/* ── Recently-viewed chips ─────────────────────────────────── */
.help-recent-section { margin: 12px 0 4px; }
.help-recent-heading {
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.6px;
    text-transform: uppercase; color: var(--slate-500);
    margin-bottom: 6px;
}
.help-recent-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.help-recent-chip {
    background: var(--slate-100, #f1f5f9);
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.help-recent-chip:hover {
    background: var(--teal-50, #f0fdfa);
    border-color: var(--teal-600, #0d9488);
    color: var(--teal-700, #0f766e);
}

/* ── Search autocomplete — HLP-2D: Inline Suggestions card ──────────
   Rendered as a message inside the chat stream (role: autocomplete).
   Replaces the previous floating dropdown which was being clipped by
   the help panel's overflow:hidden, and only ever showed one result. */
.help-chat-msg.help-chat-autocomplete {
    display: block;
    margin: 4px 0 16px;
    max-width: 780px;
}
.help-autocomplete-card {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15,23,42,0.06);
    overflow: hidden;
}
.help-autocomplete-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate-500);
    padding: 10px 14px 6px;
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-100);
}
.help-autocomplete-item {
    display: block; width: 100%; text-align: left;
    background: transparent; border: none; border-bottom: 1px solid var(--slate-100);
    padding: 10px 14px; cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}
.help-autocomplete-item:last-child { border-bottom: none; }
.help-autocomplete-item:hover,
.help-autocomplete-item:focus { background: var(--slate-50); outline: none; }
.help-autocomplete-title {
    font-size: 0.9rem; font-weight: 600; color: var(--slate-900);
    margin-bottom: 2px;
}
.help-autocomplete-hint {
    font-size: 0.78rem; color: var(--slate-500);
    line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ── HLP-2D: Clear-chat toolbar (shown above messages once a user
   has asked something) ─────────────────────────────────────── */
.help-chat-toolbar {
    display: flex; justify-content: flex-end;
    padding: 4px 2px 8px;
    position: sticky; top: 0;
    background: linear-gradient(to bottom, #fff 70%, rgba(255,255,255,0));
    z-index: 5;
}
.help-chat-clear {
    background: transparent;
    border: 1px solid var(--slate-200);
    color: var(--slate-600);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.help-chat-clear:hover {
    background: var(--slate-50);
    color: var(--teal-600);
    border-color: var(--teal-500);
}

/* ── HLP-2C.1: Inline help surfaces ────────────────────────── */

/* Small "?" icon next to a form label */
.field-help {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 18px; height: 18px;
    margin-left: 4px;
    background: var(--slate-100, #f1f5f9);
    color: var(--slate-500);
    border: 1px solid var(--slate-200);
    border-radius: 50%;
    font-size: 0.7rem; font-weight: 700;
    cursor: pointer;
    vertical-align: middle;
    padding: 0; line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.field-help:hover {
    background: var(--teal-50, #f0fdfa);
    color: var(--teal-700, #0f766e);
    border-color: var(--teal-600, #0d9488);
}
.field-help:focus-visible {
    outline: 2px solid var(--teal-600, #0d9488);
    outline-offset: 2px;
}

/* ── HLP-2E: In-modal field-help tooltip ───────────────────────────────
   Popped by showFieldHint() next to a ? button. Position is set inline
   from JS (fixed, clamped to viewport) so it floats above modal content
   without being clipped by modal overflow. */
.field-help-tooltip {
    position: fixed;
    z-index: 100000;
    max-width: 280px;
    min-width: 220px;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid var(--teal-200, #99f6e4);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    padding: 14px 16px 14px 16px;
    font-size: 0.9rem;
    line-height: 1.45;
    animation: fieldHelpFadeIn 0.12s ease-out;
}
@keyframes fieldHelpFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.field-help-close {
    position: absolute;
    top: 6px; right: 6px;
    width: 24px; height: 24px;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
}
.field-help-close:hover {
    background: #f3f4f6;
    color: #4b5563;
}
.field-help-title {
    font-weight: 600;
    color: var(--teal-700, #0f766e);
    margin-bottom: 6px;
    padding-right: 20px; /* room for close button */
    font-size: 0.92rem;
}
.field-help-body {
    color: #374151;
    margin-bottom: 10px;
}
.field-help-more {
    display: inline-block;
    color: var(--teal-700, #0f766e);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px dotted var(--teal-300, #5eead4);
    padding-bottom: 1px;
}
.field-help-more:hover {
    color: var(--teal-600, #0d9488);
    border-bottom-style: solid;
}

/* Subtle pill above modal content linking to a help article */
.help-pill {
    display: inline-flex; align-items: center;
    background: var(--teal-50, #f0fdfa);
    color: var(--teal-700, #0f766e);
    border: 1px solid var(--teal-200, #99f6e4);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.help-pill:hover {
    background: #ccfbf1;
    border-color: var(--teal-600, #0d9488);
}

/* "Learn more" link below empty-state CTA */
.empty-state-help {
    display: block;
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--teal-600, #0d9488);
    text-decoration: none;
    font-weight: 500;
}
.empty-state-help:hover { text-decoration: underline; }

/* Toast action link (e.g., Learn more on conflict toast) */
.toast-action {
    margin-left: 10px;
    font-size: 0.85rem;
}
.toast-action a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
    opacity: 0.95;
}
.toast-action a:hover { opacity: 1; }

/* ── Decision-tree troubleshooter card ─────────────────────── */
.help-tree-card {
    padding: 4px 2px 2px;
}
.help-tree-badge {
    display: inline-block;
    background: rgba(234,179,8,0.12);
    color: #a16207;
    font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.5px; text-transform: uppercase;
    padding: 3px 9px; border-radius: 999px;
    margin-bottom: 8px;
}
.help-tree-title {
    font-size: 0.95rem; font-weight: 700; color: var(--slate-900);
    margin-bottom: 6px;
}
.help-tree-question {
    font-size: 0.85rem; color: var(--slate-700);
    margin-bottom: 10px; line-height: 1.45;
}
.help-tree-choices {
    display: flex; flex-direction: column; gap: 6px;
}
.help-tree-choice {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.help-tree-choice:hover {
    background: var(--teal-50, #f0fdfa);
    border-color: var(--teal-600, #0d9488);
}
.help-tree-choice:active { transform: translateY(1px); }
.help-tree-choice-label {
    font-size: 0.85rem; color: var(--slate-800); font-weight: 500;
}

/* ── Chat Input Bar ────────────────────────────────────────── */
.help-chat-form {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; background: white;
    border-top: 1px solid var(--slate-200);
    flex-shrink: 0;
}
.help-chat-input {
    flex: 1; border: 1.5px solid var(--slate-200); border-radius: 22px;
    padding: 10px 16px; font-size: 0.9rem; font-family: var(--font-body);
    background: var(--slate-50); color: var(--slate-900);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.help-chat-input:focus {
    outline: none; border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}
.help-chat-input::placeholder { color: var(--slate-400); }
.help-chat-send {
    background: var(--teal-600); color: white; border: none;
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    font-size: 1.05rem; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; flex-shrink: 0;
}
.help-chat-send:hover { background: var(--teal-700); }

/* ═══════ HELP CHAT — RESPONSIVE ═══════ */

@media (min-width: 769px) {
    .help-chat-messages { padding: 24px 32px; }
    .help-chat-form { padding: 14px 32px; }
    .help-search-bar { padding: 14px 32px 8px; }
    .help-quick-links { padding: 2px 32px 12px; }
    .help-chat-msg { max-width: 700px; }
    .help-chat-bubble { max-width: 75%; }
    .help-chat-article-bubble { max-width: 85%; }
}

@media (max-width: 768px) {
    .help-chat-container {
        height: calc(100vh - 120px);
        height: calc(100dvh - 120px);
    }
    .help-chat-messages { padding: 14px 12px; }
    .help-chat-form { padding: 10px 12px; }
    .help-search-bar { padding: 10px 12px 6px; }
    .help-quick-links { padding: 2px 12px 10px; gap: 6px; }
    .help-quick-link { padding: 5px 12px; font-size: 0.78rem; }
    .help-chat-bubble { max-width: 88%; font-size: 0.88rem; }
    .help-chat-article-bubble { max-width: 95%; }
    .help-chat-input { padding: 9px 14px; font-size: 0.88rem; }
    .help-chat-suggestion { font-size: 0.78rem; padding: 5px 12px; }
}

@media (max-width: 380px) {
    .help-chat-bubble { max-width: 92%; }
    .help-chat-suggestion { font-size: 0.75rem; padding: 4px 10px; }
}

/* ═══════════════════════════════════════════════════════════════
   GDE-1.0: GUIDED TOUR OVERLAY SYSTEM
   Spotlight + tooltip components for milestone-triggered guides.
   ═══════════════════════════════════════════════════════════════ */

/* ── Overlay container ─────────────────────────────────────── */
.guide-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.guide-overlay.active {
    pointer-events: auto;
    opacity: 1;
}

/* ── Backdrop fill (dark overlay with cutout) ──────────────── */
.guide-backdrop-fill {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    transition: clip-path 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Spotlight ring around target element ──────────────────── */
.guide-spotlight {
    position: absolute;
    border: 2px solid var(--teal-400);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15), 0 0 24px rgba(13, 148, 136, 0.1);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}
.guide-spotlight::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid rgba(13, 148, 136, 0.25);
    border-radius: calc(var(--radius-sm) + 2px);
    animation: guide-pulse 2s ease-in-out infinite;
}
@keyframes guide-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.02); }
}

/* ── Tooltip card ──────────────────────────────────────────── */
.guide-tooltip {
    position: absolute;
    z-index: 10000;
    width: 370px;
    max-width: calc(100vw - 24px);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
    overflow: visible;
    transform: translateY(8px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.15s;
}
.guide-overlay.active .guide-tooltip {
    transform: translateY(0);
    opacity: 1;
}

/* ── Tooltip header ────────────────────────────────────────── */
.guide-tooltip-header {
    background: var(--gradient-header);
    color: white;
    padding: 14px 18px 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.guide-header-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.guide-header-icon svg { stroke: white; }
.guide-step-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    margin-bottom: 2px;
    font-family: var(--font-heading);
}
.guide-tooltip-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

/* ── Tooltip body ──────────────────────────────────────────── */
.guide-tooltip-body {
    padding: 16px 18px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--slate-600);
    max-height: 45vh;
    overflow-y: auto;
}
.guide-tooltip-body p { margin-bottom: 10px; }
.guide-tooltip-body p:last-child { margin-bottom: 0; }

/* ── Tip callout box ───────────────────────────────────────── */
.guide-tooltip-tip {
    background: var(--teal-50);
    border: 1px solid var(--teal-100);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.84rem;
    color: var(--teal-800);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-top: 8px;
}
.guide-tip-icon { flex-shrink: 0; font-size: 1rem; }

/* ── Tooltip footer ────────────────────────────────────────── */
.guide-tooltip-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Progress dots ─────────────────────────────────────────── */
.guide-dots { display: flex; gap: 6px; align-items: center; }
.guide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--slate-200);
    transition: all 0.25s;
}
.guide-dot.active {
    background: var(--teal-600);
    width: 20px;
    border-radius: 4px;
}
.guide-dot.completed { background: var(--teal-300); }

/* ── Action buttons ────────────────────────────────────────── */
.guide-tooltip-actions { display: flex; gap: 8px; align-items: center; }

.guide-btn-skip {
    background: none;
    border: none;
    color: var(--slate-400);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.guide-btn-skip:hover { color: var(--slate-600); background: var(--slate-50); }

.guide-btn-next {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
}
.guide-btn-next:hover { filter: brightness(1.05); transform: translateY(-1px); }

.guide-btn-done { gap: 6px; }

.guide-btn-back {
    background: white;
    color: var(--slate-600);
    border: 1px solid var(--slate-200);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s;
}
.guide-btn-back:hover { background: var(--slate-50); }

/* ── Arrow pointers ────────────────────────────────────────── */
.guide-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    transform: rotate(45deg);
    z-index: -1;
    display: none;
}
.guide-arrow-up {
    display: block;
    top: -7px;
    background: var(--teal-700);
    box-shadow: -2px -2px 4px rgba(0,0,0,0.04);
}
.guide-arrow-down {
    display: block;
    bottom: -7px;
    background: white;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.04);
}
.guide-arrow-left {
    display: block;
    left: -7px;
    background: white;
    box-shadow: -2px 2px 4px rgba(0,0,0,0.04);
}
.guide-arrow-right {
    display: block;
    right: -7px;
    background: white;
    box-shadow: 2px -2px 4px rgba(0,0,0,0.04);
}

/* ── Completion card ───────────────────────────────────────── */
.guide-complete-card {
    text-align: center;
    padding: 24px 18px 16px;
}
.guide-complete-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--teal-50);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.guide-complete-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0 0 6px;
}
.guide-complete-text {
    font-size: 0.88rem;
    color: var(--slate-500);
    line-height: 1.5;
    margin: 0;
}
.guide-complete-card .guide-tooltip-tip {
    margin-top: 14px;
    text-align: left;
}

/* ── Responsive: mobile adjustments ────────────────────────── */
@media (max-width: 600px) {
    .guide-tooltip { width: calc(100vw - 24px); max-width: none; }
    .guide-tooltip-header { padding: 12px 14px 10px; }
    .guide-tooltip-body { padding: 12px 14px; font-size: 0.86rem; }
    .guide-tooltip-footer { padding: 10px 14px; }
    .guide-btn-next { padding: 8px 14px; font-size: 0.84rem; }
    .guide-btn-back { padding: 8px 12px; font-size: 0.84rem; }
    .guide-complete-card { padding: 18px 14px 12px; }
}

/* ═══════════════════════════════════════════════════════════════
   GDE-1.1: Quick Tips Section (Help Tab)
   ═══════════════════════════════════════════════════════════════ */
.quick-tips-section {
    margin-bottom: 20px;
    padding: 0 4px;
}
.quick-tips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.quick-tips-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--slate-800);
    margin: 0;
}
.quick-tips-description {
    font-size: 0.85rem;
    color: var(--slate-500);
    margin: 0 0 14px 0;
    line-height: 1.4;
}
.quick-tips-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
/* HLP-2E.1: Quick-tips list rendered inside a chat bubble */
.help-chat-quicktips {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
}
.quick-tip-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.18s ease;
}
.quick-tip-card:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.08);
}
.quick-tip-card:active {
    transform: translateY(0);
}
.quick-tip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: var(--teal-50);
    color: var(--teal-600);
}
.quick-tip-info {
    flex: 1;
    min-width: 0;
}
.quick-tip-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--slate-800);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-tip-meta {
    font-size: 0.78rem;
    color: var(--slate-400);
    margin-top: 2px;
}
.quick-tip-status {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.quick-tip-status.completed {
    background: #dcfce7;
    color: #16a34a;
}
.quick-tip-status.pending {
    background: var(--teal-50);
    color: var(--teal-600);
}
.quick-tip-status.dismissed {
    background: #fef3c7;
    color: #d97706;
}
@media (max-width: 600px) {
    .quick-tips-section { padding: 0 2px; }
    .quick-tip-card { padding: 12px 14px; gap: 10px; }
    .quick-tip-icon { width: 32px; height: 32px; min-width: 32px; }
    .quick-tip-title { font-size: 0.88rem; }
}

/* ═══════ DASHBOARD HOME SCREEN (UX-6.0) ═══════ */
.dashboard-container {
    padding: 16px 0;
}
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 16px 20px;
}
.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: all 0.2s ease;
}
.dashboard-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--slate-300);
}
.dashboard-card-header {
    margin-bottom: 16px;
    border-bottom: 1px solid var(--slate-100);
    padding-bottom: 12px;
}
.dashboard-card-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--slate-800);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Dashboard Empty State ─── */
.dashboard-empty-state {
    text-align: center;
    padding: 20px 16px;
    color: var(--slate-500);
}
.dashboard-empty-state p {
    margin: 0 0 12px;
    font-size: 0.95rem;
}

/* ─── Today's Medications ─── */
.dashboard-compliance-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.dashboard-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--slate-200);
    border-radius: 4px;
    overflow: hidden;
}
.dashboard-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal-600), var(--teal-500));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.34,1.1,0.64,1);
}
.dashboard-progress-pct {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--teal-600);
    min-width: 40px;
    text-align: right;
}
.dashboard-med-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--slate-100);
    transition: background 0.2s ease;
}
.dashboard-med-row:last-child {
    border-bottom: none;
}
.dashboard-med-row.completed {
    background: rgba(16,185,129,0.04);
}
.dashboard-med-info {
    flex: 1;
}
.dashboard-med-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--slate-800);
    margin-bottom: 2px;
}
.dashboard-med-detail {
    display: block;
    font-size: 0.82rem;
    color: var(--slate-500);
}
.dashboard-doses {
    display: flex;
    gap: 6px;
    margin-left: 12px;
}
.dashboard-dose-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--slate-300);
    background: white;
    color: var(--slate-400);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dashboard-dose-btn:hover:not(.taken):not(.disabled) {
    border-color: var(--teal-400);
    color: var(--teal-600);
    transform: scale(1.08);
}
.dashboard-dose-btn.taken {
    background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
    border-color: var(--teal-500);
    color: white;
}
.dashboard-dose-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Upcoming Appointments ─── */
.dashboard-appt-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--slate-100);
    transition: background 0.2s ease;
}
.dashboard-appt-row:last-child {
    border-bottom: none;
}
.dashboard-appt-row:hover {
    background: var(--slate-50);
}
.dashboard-appt-date-box {
    min-width: 52px;
    text-align: center;
    background: var(--teal-50);
    border: 1px solid var(--teal-200);
    border-radius: var(--radius-sm);
    padding: 8px 6px;
    flex-shrink: 0;
}
.dashboard-appt-month {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--teal-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dashboard-appt-day {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--teal-700);
    line-height: 1;
}
.dashboard-appt-details {
    flex: 1;
}
.dashboard-appt-purpose {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--slate-800);
}
.dashboard-appt-meta {
    font-size: 0.82rem;
    color: var(--slate-500);
    margin-top: 2px;
}

/* ─── Latest Vitals Grid ─── */
.dashboard-vitals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.dashboard-vital-item {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    text-align: center;
    transition: all 0.2s ease;
}
.dashboard-vital-item:hover {
    border-color: var(--teal-300);
    background: var(--teal-50);
}
.dashboard-vital-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
}
.dashboard-vital-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 2px;
    word-break: break-word;
}
.dashboard-vital-label {
    font-size: 0.78rem;
    color: var(--slate-500);
    font-weight: 500;
}

/* ─── Getting Started Checklist ─── */
.dashboard-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dashboard-checklist-item {
    padding: 0;
}
.dashboard-checklist-btn {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    background: white;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-md);
    color: var(--slate-800);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    gap: 10px;
}
.dashboard-checklist-btn:hover {
    border-color: var(--teal-400);
    background: var(--teal-50);
    transform: translateX(2px);
}
.dashboard-checklist-btn:active {
    transform: translateX(0);
}

/* ─── Dashboard Summary Tiles ─── */
.dashboard-tiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.dashboard-tile {
    background: white;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.dashboard-tile:hover {
    border-color: var(--teal-400);
    background: var(--teal-50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.dashboard-tile:active {
    transform: translateY(0);
}
.dashboard-tile-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}
.dashboard-tile-count {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--teal-700);
    line-height: 1.1;
}
.dashboard-tile-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-top: 2px;
}
.dashboard-tile-subtitle {
    font-size: 0.75rem;
    color: var(--slate-500);
    margin-top: 4px;
    line-height: 1.3;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 600px) {
    .dashboard-content {
        padding: 0 12px 16px;
        gap: 12px;
    }
    .dashboard-card {
        padding: 16px;
        border-radius: var(--radius-md);
    }
    .dashboard-tiles-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .dashboard-tile {
        padding: 14px 10px;
    }
    .dashboard-tile-count {
        font-size: 1.6rem;
    }
}

/* ═══════ UX-8.0: MORE PANEL & CARE TEAM STYLES ═══════ */
.more-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 110;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.more-overlay.show {
    display: block;
    opacity: 1;
}

.more-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 12px 16px 20px;
    z-index: 111;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}
.more-panel.show {
    transform: translateY(0);
}

.more-handle {
    width: 36px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.more-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
}

.more-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid #f1f5f9;
    background: #f8fafc;
}
.more-item:active {
    background: #f0fdfa;
    border-color: #99f6e4;
}

.more-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.more-icon.teal {
    background: #ccfbf1;
}
.more-icon.blue {
    background: #dbeafe;
}
.more-icon.purple {
    background: #ede9fe;
}
.more-icon.amber {
    background: #fef3c7;
}
.more-icon.rose {
    background: #ffe4e6;
}
.more-icon.slate {
    background: #e2e8f0;
}

.more-item-text {
    flex: 1;
    min-width: 0;
}

.more-item-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
}

.more-item-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 1px;
}

.more-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}

/* More tab button active state */
.tab.more-active {
    color: var(--teal-700);
    border-top-color: var(--teal-600);
    font-weight: 600;
}

/* ═══════ CARE TEAM SECTION STYLES ═══════ */
.care-team-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding: 0 6px 4px;
}

.filter-tab {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-tab.active {
    background: var(--teal-700);
    color: white;
    border-color: var(--teal-700);
}
.filter-tab:not(.active):active {
    border-color: var(--teal-600);
    color: var(--teal-600);
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0 5px;
    background: #f0fdfa;
    color: var(--teal-700);
}
.filter-tab.active .filter-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.care-team-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.care-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.care-card:active {
    border-color: var(--teal-600);
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.08);
}

.care-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.care-icon-clinic {
    background: #dbeafe;
}
.care-icon-hospital {
    background: #fce7f3;
}
.care-icon-pharmacy {
    background: #d1fae5;
}
.care-icon-doctor {
    background: #ede9fe;
}
.care-icon-specialist {
    background: #fef3c7;
}

.care-info {
    flex: 1;
    min-width: 0;
}

.care-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 2px;
}

.care-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.care-badge-clinic {
    color: #3b82f6;
}
.care-badge-hospital {
    color: #ec4899;
}
.care-badge-pharmacy {
    color: #10b981;
}
.care-badge-doctor {
    color: #8b5cf6;
}
.care-badge-specialist {
    color: #f59e0b;
}

.care-detail {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.3;
}

.care-action {
    padding: 6px 10px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}
.care-action:active {
    background: #fecaca;
}

/* ===== VR-1.0: USER-CUSTOMIZABLE NORMAL RANGES ===== */

/* Slate dot inside assessment pills indicates the result was evaluated against
   a user-customized threshold. Color is medically neutral on purpose. */
.custom-range-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
    margin-right: 5px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* VR-1.1: Persistent legend below a vitals list when any visible reading carries
   the slate dot. Tappable; opens the Custom Ranges modal directly. */
.custom-dot-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.custom-dot-legend:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.custom-dot-legend:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}
.custom-dot-legend .custom-range-dot {
    margin-right: 2px;
}
.custom-dot-legend-text {
    flex: 1;
}
.custom-dot-legend-link {
    color: #0d9488;
    text-decoration: underline;
    font-weight: 500;
    margin-left: auto;
}

/* Profile entry row that opens the modal */
.custom-ranges-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
.custom-ranges-entry:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.custom-ranges-entry-text { display: flex; flex-direction: column; gap: 2px; }
.custom-ranges-entry-title { font-size: 0.95rem; font-weight: 500; color: #0f172a; }
.custom-ranges-entry-sub { font-size: 0.85rem; color: #64748b; }
.custom-ranges-entry-sub.cr-summary-active { color: #0d9488; font-weight: 500; }
.custom-ranges-entry-chevron { font-size: 1.25rem; color: #94a3b8; line-height: 1; }

/* Info banner inside the modal */
.custom-ranges-info {
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #0f766e;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

/* Card per vital */
.cr-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #fff;
}
.cr-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: #fff;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.cr-card-head:hover { background: #f8fafc; }
.cr-card-expanded > .cr-card-head { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.cr-card-head-text { display: flex; flex-direction: column; gap: 2px; }
.cr-card-title { font-size: 0.95rem; font-weight: 500; color: #0f172a; }
.cr-card-status { font-size: 0.8rem; color: #64748b; }
.cr-card-status-custom { color: #0d9488; }
.cr-card-chevron {
    font-size: 1.25rem;
    color: #94a3b8;
    line-height: 1;
    transition: transform 0.2s;
}
.cr-card-expanded .cr-card-chevron { transform: rotate(90deg); }

.cr-card-body { padding: 14px 16px; }

.cr-field-group { margin-bottom: 14px; }
.cr-field-group:last-of-type { margin-bottom: 0; }
.cr-field-group-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}
.cr-field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.cr-field { display: flex; flex-direction: column; }
.cr-field label {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
}
.cr-field input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
}
.cr-field input[type="number"]:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}
.cr-field small {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
}
.cr-field small.cr-field-custom { color: #0d9488; }

.cr-advanced-toggle {
    display: inline-block;
    margin-top: 4px;
    background: none;
    border: none;
    color: #0d9488;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
}
.cr-advanced-toggle:hover { color: #0f766e; }

.cr-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}
.cr-reset-link {
    background: none;
    border: none;
    color: #0d9488;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.cr-reset-link:hover { color: #0f766e; }
.cr-save-btn {
    padding: 8px 18px !important;
    font-size: 0.9rem !important;
    width: auto !important;
}

.cr-card-feedback {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.cr-card-feedback-success { background: #d1fae5; color: #065f46; }
.cr-card-feedback-error { background: #fee2e2; color: #991b1b; }

@media (max-width: 480px) {
    .cr-card-actions { flex-direction: column; align-items: stretch; }
    .cr-save-btn { width: 100% !important; }
    .cr-reset-link { text-align: center; }
}
