/* ==========================================================================
   Cheer Planner design tokens aligned to the calendar page
   ========================================================================== */
:root {
    --brand-primary: #7C2D45;
    --brand-light: #F7E6EB;
    --brand-dark: #5E2134;
    --brand-mid: #5E2134;
    --brand-border: #E3CBD2;

    --allstar: #7C2D45;
    --allstar-bg: #F7E6EB;
    --allstar-text: #3A3335;
    --allstar-sub: #5E2134;

    --school: #4A5A8A;
    --school-bg: #EEF2FB;
    --school-text: #2F3856;
    --school-sub: #3F4B74;

    --rec: #3E7C52;
    --rec-bg: #E4F0E8;
    --rec-text: #2D593A;
    --rec-sub: #336846;

    --life: #8A6D3B;
    --life-bg: #F5EBD8;
    --life-text: #5E4A27;
    --life-sub: #745927;

    --bg: #FBF7F2;
    --card: #FFFFFF;
    --border: #F0E2E7;
    --text-primary: #3A3335;
    --text-secondary: #6E6366;
    --text-muted: #7C7074;
    --text-disabled: #A99BA0;
    --surface: #FBF4F6;

    --success: #3E7C52;
    --success-bg: #E4F0E8;
    --success-text: #2D593A;
    --danger: #A83232;
    --danger-bg: #FCEBEB;
    --warning: #8A6D3B;
    --warning-bg: #F5EBD8;

    --radius-sm: 11px;
    --radius-md: 13px;
    --radius-lg: 15px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    --font: 'DM Sans', -apple-system, Segoe UI, sans-serif;
    --serif: 'DM Serif Display', Georgia, serif;
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 18px;
    --text-xl: 21px;
    --text-2xl: 28px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.cp-v11 {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

body.cp-v11 a {
    color: var(--brand-primary);
    text-decoration: none;
}

body.cp-v11 a:hover {
    color: var(--brand-mid);
    text-decoration: underline;
}

body.cp-v11 h1,
body.cp-v11 h2,
body.cp-v11 h3,
body.cp-v11 h4 {
    font-family: var(--serif);
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.15;
    margin: 0 0 12px;
}

body.cp-v11 p {
    margin: 0 0 12px;
    line-height: 1.6;
}

/* ---------- App Shell ---------- */
.app-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 24px 20px;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .app-container {
        padding: 28px 24px;
    }
}

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 13px 15px;
    margin-bottom: 8px;
    box-shadow: none;
}

.card-flush { padding: 0; }
.card-lg { padding: 18px; }
.card-xl { padding: 24px 18px; }

/* ---------- Typography ---------- */
.heading-xl,
.heading-lg,
.heading-md,
.heading-sm {
    font-family: var(--serif);
    font-weight: 400;
    color: var(--text-primary);
    margin: 0;
}

.heading-xl { font-size: 28px; line-height: 1.15; }
.heading-lg { font-size: 24px; line-height: 1.2; }
.heading-md { font-size: 21px; line-height: 1.2; }
.heading-sm { font-size: 18px; line-height: 1.25; }

.text-base { font-size: var(--text-base); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-brand { color: var(--brand-primary); }
.text-danger { color: var(--danger); }

.label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin: 0 0 6px;
}

/* ---------- Form Fields ---------- */
.field {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 10px 12px;
    font-size: var(--text-base);
    margin-bottom: 12px;
    color: var(--text-primary);
    width: 100%;
    min-height: 44px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(124, 45, 69, 0.12);
}

.field-placeholder { color: var(--text-disabled); }

/* ---------- Buttons ---------- */
.btn,
.btn-secondary,
.btn-danger,
.btn-amber,
.btn-dashed,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 13px;
    font-size: 15px;
    font-family: var(--font);
    font-weight: 700;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover,
.btn-outline:hover { background: var(--surface); }

.btn-primary {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
    font-weight: 700;
}

.btn-primary:hover {
    background: var(--brand-mid);
    border-color: var(--brand-mid);
    color: #fff;
}

.btn-secondary,
.btn-outline {
    background: #fff;
    color: var(--brand-primary);
    border-color: var(--brand-border);
}

.btn-secondary:hover,
.btn-outline:hover {
    background: var(--brand-light);
    color: var(--brand-dark);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
    font-weight: 700;
}

.btn-danger:hover { background: #922b2b; }

.btn-amber {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
    font-weight: 700;
}

.btn-full,
.btn-block {
    width: 100%;
    display: flex;
}

.btn-lg {
    min-height: 52px;
    padding: 0 18px;
    font-size: 15px;
}

/* Dashed "add" affordance — inherits accessible .btn sizing. */
.btn-dashed {
    border-style: dashed;
    background: #fff;
    color: var(--brand-dark);
}

.btn-dashed:hover { background: var(--brand-light); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    font-size: var(--text-xs);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-pink { background: var(--brand-primary); color: #fff; }
.badge-trial { background: var(--brand-primary); color: #fff; }
.badge-free { background: var(--surface); color: var(--text-secondary); }
.badge-pro { background: var(--brand-primary); color: #fff; }
.badge-amber { background: var(--life-bg); color: var(--life-text); }
.badge-green { background: var(--success-bg); color: var(--success-text); }
.badge-blue { background: var(--school-bg); color: var(--school-sub); }
.badge-blue-solid { background: var(--school); color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }

/* ---------- Toggle Switch ---------- */
.toggle {
    width: 38px;
    height: 22px;
    border-radius: 11px;
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle.on { background: var(--success); }
.toggle.off { background: #D3D1C7; }

.toggle-dot {
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    transition: all 0.2s;
}

.toggle.on .toggle-dot { right: 2px; }
.toggle.off .toggle-dot { left: 2px; }

/* ---------- Progress Bar (Onboarding) ---------- */
.progress-steps {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.progress-dot {
    flex: 1;
    height: 3px;
    border-radius: 2px;
}

.progress-dot.done { background: var(--brand-primary); }
.progress-dot.todo { background: var(--surface); }

/* ---------- Skip Link (shared across every onboarding step) ---------- */
.skip-link {
    display: inline-block;
    font-size: 15px;
    line-height: 1.3;
    color: var(--text-secondary);
    text-decoration: none;
    /* Pad the anchor so the tap target is at least 44px tall. */
    min-height: 44px;
    padding: 12px 16px;
    /* 16-20px below the primary button. */
    margin-top: 16px;
}

.skip-link:hover,
.skip-link:focus {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ---------- Tap Target (shared accessible hit area) ----------
   Guarantees a minimum 44x44px touch target with a readable label,
   for small links/buttons (skip links, month arrows, chips). Use
   `.tap-target` on any clickable that would otherwise be too small. */
.tap-target {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 15px;
    line-height: 1.3;
    text-decoration: none;
}

/* Month navigation arrows on the Calendar must stay easy to tap. */
.tap-target--arrow {
    font-size: 20px;
    padding: 8px 14px;
}

/* ---------- Trip Logistics section chips ----------
   Deep-link chips that scroll to each section anchor. Sized as accessible
   tap targets (>=44px tall via padding + line-height). */
.trip-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 16px;
    background: var(--brand-light);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--brand-border);
}

.trip-chip:hover,
.trip-chip:focus {
    background: var(--brand-primary);
    color: #fff;
}

/* Smooth-scroll so chip deep-links glide to their section. */
html { scroll-behavior: smooth; }

/* ---------- Grid Layouts ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 5px; }

.row { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Event Type Picker (4+2) ---------- */
.event-picker-section {
    margin-bottom: 4px;
}

.event-picker-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.event-picker-label.cheer { color: var(--brand-primary); }
.event-picker-label.life { color: var(--text-muted); }

.event-tile {
    display: block;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    border: 0.5px solid var(--border);
    font-size: var(--text-sm);
    text-align: center;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.event-tile .tile-icon { font-size: 22.5px; margin-bottom: 1px; }

.event-tile.selected-cheer {
    border: 2px solid var(--brand-primary);
    background: var(--brand-light);
    font-weight: 500;
    color: var(--brand-dark);
}

.event-tile.selected-life {
    border: 2px solid var(--life);
    background: var(--life-bg);
    font-weight: 500;
    color: var(--life-text);
}

.picker-divider {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
}

.picker-divider .line {
    flex: 1;
    height: 0.5px;
    background: rgba(0, 0, 0, 0.08);
}

.picker-divider .or {
    font-size: 10.5px;
    color: var(--text-disabled);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ---------- Program Selector ---------- */
.program-pill {
    flex: 1;
    display: block;
    padding: 8px 6px;
    border-radius: var(--radius-md);
    border: 0.5px solid var(--border);
    text-align: center;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.program-pill .pill-icon { font-size: 21px; margin-bottom: 2px; }
.program-pill .pill-name { font-size: var(--text-sm); }
.program-pill .pill-sub { font-size: 12px; margin-top: 1px; }

.program-pill.selected-allstar {
    border: 2px solid var(--allstar);
    background: var(--allstar-bg);
}
.program-pill.selected-allstar .pill-name { font-weight: 600; color: var(--allstar-text); }
.program-pill.selected-allstar .pill-sub { color: var(--allstar-sub); }

.program-pill.selected-school {
    border: 2px solid var(--school);
    background: var(--school-bg);
}
.program-pill.selected-school .pill-name { font-weight: 600; color: var(--school-text); }
.program-pill.selected-school .pill-sub { color: var(--school-sub); }

.program-pill.selected-rec {
    border: 2px solid var(--rec);
    background: var(--rec-bg);
}
.program-pill.selected-rec .pill-name { font-weight: 600; color: var(--rec-text); }
.program-pill.selected-rec .pill-sub { color: var(--rec-sub); }

/* ---------- Color Indicator ---------- */
.color-indicator {
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
}

.color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---------- Program Section Cards ---------- */
.program-section {
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.program-section.allstar {
    background: var(--allstar-bg);
    border: 1px solid var(--brand-border);
}

.program-section.school {
    background: var(--school-bg);
    border: 1px solid #B5D4F4;
}

.program-section.rec {
    background: var(--rec-bg);
    border: 1px solid #9FE1CB;
}

.program-section-header {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.program-section-label {
    font-size: 16.5px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.program-field-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 3px;
}

.program-field-value {
    background: #fff;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 18px;
}

/* ---------- Password Strength ---------- */
.password-strength {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--surface);
    transition: background 0.3s;
}

.strength-bar.filled { background: var(--success); }
.strength-bar.filled.weak { background: var(--danger); }
.strength-bar.filled.medium { background: var(--warning); }

/* ---------- Tab Switcher ---------- */
.tab-switcher {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: 16px;
}

.tab-switcher .tab {
    flex: 1;
    padding: 7px;
    text-align: center;
    font-size: 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    text-decoration: none;
}

.tab-switcher .tab.active {
    background: var(--card);
    font-weight: 500;
    color: var(--text-primary);
}

/* ---------- Divider ---------- */
.divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0;
}

.divider .line {
    flex: 1;
    height: 0.5px;
    background: var(--border);
}

.divider .text {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ---------- SSO Buttons ---------- */
.sso-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.sso-btn {
    padding: 10px;
    border-radius: var(--radius-md);
    border: 0.5px solid var(--border);
    background: var(--card);
    font-size: var(--text-base);
    text-align: center;
    cursor: pointer;
    font-family: var(--font);
}

.sso-btn:hover { background: var(--surface); }

/* ---------- Star Logo ---------- */
.app-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    background: var(--brand-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-logo.lg { width: 64px; height: 64px; }

/* ---------- Checkbox ---------- */
.check-row {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 16.5px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.check-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--success);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.check-icon.empty {
    background: transparent;
    border: 1.5px solid var(--border);
}

/* ---------- Celebration Gradient ---------- */
.celebration-card {
    background: linear-gradient(135deg, #FBF4F6 0%, #F7E6EB 55%, #F5EBD8 100%);
    border-radius: 14px;
    padding: 18px 16px;
    border: 1px solid var(--brand-border);
    text-align: center;
}

/* ---------- Season Picker ---------- */
.season-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 4px;
    margin-bottom: 14px;
}

.season-tile {
    padding: 7px 4px;
    border-radius: var(--radius-sm);
    border: 0.5px solid var(--border);
    font-size: var(--text-sm);
    text-align: center;
    cursor: pointer;
}

.season-tile.active {
    border: 2px solid var(--brand-primary);
    background: var(--brand-light);
    font-weight: 500;
    color: var(--brand-dark);
}

.season-tile .sub { font-size: 12px; color: var(--text-secondary); font-weight: 400; }

/* ---------- Info Boxes ---------- */
.info-box {
    border-radius: 7px;
    padding: 8px 10px;
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: 12px;
}

.info-box.pink { background: var(--brand-light); color: var(--brand-dark); }
.info-box.blue { background: var(--school-bg); color: var(--school-sub); }
.info-box.green { background: var(--success-bg); color: var(--success-text); }
.info-box.amber { background: var(--life-bg); color: var(--life-sub); }
.info-box.gray { background: var(--surface); color: var(--text-secondary); }

/* ---------- Crossover Section ---------- */
.crossover-section {
    background: linear-gradient(135deg, #FBF4F6, #F7E6EB);
    border-radius: 10px;
    padding: 14px;
    border: 1.5px solid var(--brand-primary);
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.flex { display: flex; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.dimmed { opacity: 0.45; }
.dimmed-55 { opacity: 0.55; }

/* ---------- Validation ---------- */
.validation-error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-top: -8px;
    margin-bottom: 8px;
}

.field.error {
    border-color: var(--danger);
}

/* ---------- Dashboard Grid ---------- */
/* Mobile default: single column. The sidebar (Season Snapshot, calendar,
   recent activity, Pro tip) stacks below the main content instead of being
   hidden, so the info stays reachable on small screens. */
.dash-grid { display: block; }
.dash-main { width: 100%; }
.dash-side { display: block; width: 100%; margin-top: 8px; }

/* ---------- Bottom Nav (mobile defaults) ---------- */
/* Desktop overrides live in the (min-width: 1024px) media query below. */
.bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    background: var(--card);
    border-radius: 10px;
    padding: 3px;
    border: 0.5px solid var(--border);
    margin-top: 8px;
    position: sticky;
    bottom: 8px;
}
.nav-tab {
    padding: 6px 2px;
    border-radius: 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}
.nav-tab.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    font-weight: 600;
}
.nav-tab-icon { font-size: 21px; line-height: 1; }

/* Brand row inside the nav. Hidden on mobile (BottomNav layout),
   shown only when the nav becomes the desktop sidebar. The logo/text
   sizing lives here (not inside the desktop media query) so the inline
   SVG never falls back to its intrinsic 512x512 dimensions during the
   brief moment the sidebar is laying out. */
.nav-brand { display: none; }
.nav-brand-logo {
    /* Scale to the two-line wordmark height. The PNG has a transparent
       background, so it sits directly on the sidebar gradient. */
    height: 2.2em;
    width: auto;
    max-width: 2.6em;
    object-fit: contain;
    flex: 0 0 auto;
    display: block;
}
.nav-brand-text {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.3px;
    color: #F0568F;
}
body.cp-v11 .nav-brand:hover,
body.cp-v11 .nav-brand:hover .nav-brand-text {
    text-decoration: none;
    color: #D9407A;
}

/* Sign out lives in the desktop sidebar only — no room in the mobile tab bar. */
.nav-signout { 
    display: flex !important; 
    flex-direction: column;
    align-items: center;
    grid-column: 1 / -1; 
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   Mobile-first design. Defaults work for phones (under 768px).
   These media queries enhance layout for larger screens.
   ============================================================ */

/* ---------- Tablets (portrait + landscape) ---------- */
@media (min-width: 768px) {
    /* Wider container on tablets — feels less cramped */
    .app-container {
        max-width: 600px;
        padding: 24px;
    }

    /* Bigger touch targets meet Apple's 44px minimum */
    .btn {
        padding: 13px 20px;
        font-size: var(--text-md);
    }
    .btn-primary { font-weight: 600; }

    .field {
        padding: 12px 14px;
        font-size: var(--text-md);
        min-height: 44px;
    }

    /* Cards get more breathing room */
    .card { padding: 18px; margin-bottom: 12px; }
    .card-lg { padding: 24px; }

    /* Headings already scale fluidly via the --text-* tokens;
       no per-breakpoint overrides needed here. */

    /* Bottom nav stays at bottom but gets more padding */
    .bottom-nav {
        padding: 6px;
        max-width: 600px;
    }
    .nav-tab, .nav-item {
        padding: 10px 4px;
        min-height: 44px;
    }
    .nav-tab-icon, .nav-icon { font-size: 27px; }

    /* Side-by-side fields stay 2-column */
    .grid-2 { gap: 12px; }
}

/* ---------- Desktop (1024px+) — sidebar layout ---------- */
@media (min-width: 1024px) {
    body.cp-v11 {
        background: var(--bg);
    }

    .app-container {
        max-width: 1100px;
        padding: 32px 24px 32px 280px; /* leave room for fixed sidebar */
        position: relative;
    }

    /* Bottom nav becomes a left sidebar on desktop */
    .bottom-nav {
        position: fixed !important;  /* Override .ascx sticky positioning */
        top: 0;
        left: 0;
        bottom: 0;
        width: 240px;
        max-width: 240px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 20px 14px;
        background: linear-gradient(180deg, #ffffff 0%, #FBF4F6 100%);
        border-right: 1px solid rgba(124, 45, 69, 0.12);
        box-shadow: 1px 0 0 rgba(0, 0, 0, 0.02);
        border-radius: 0;
        margin-top: 0;
        gap: 2px;
        grid-template-columns: none;  /* Override the grid layout from .ascx */
    }

    /* Brand row: logo + wordmark */
    .nav-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 4px 10px 16px;
        margin-bottom: 10px;
        border-bottom: 1px solid rgba(124, 45, 69, 0.14);
        text-decoration: none;
        color: var(--brand-primary);
        font-size: 28.5px; /* drives .nav-brand-logo em-based sizing */
        line-height: 1;
    }

    .nav-tab, .nav-item {
        position: relative;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding: 10px 12px;
        text-align: left;
        font-size: 21px;
        font-weight: 500;
        color: var(--text-secondary);
        border-radius: 10px;
        transition: background-color 0.15s ease, color 0.15s ease;
    }
    .nav-tab:hover, .nav-item:hover {
        background: rgba(124, 45, 69, 0.06);
        color: var(--brand-dark);
        text-decoration: none;
    }

    .nav-tab-icon, .nav-icon {
        width: 28px;
        height: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        line-height: 1;
        border-radius: 8px;
        background: rgba(124, 45, 69, 0.08);
        color: var(--brand-primary);
        flex: 0 0 28px;
    }

    .nav-tab.active, .nav-item.active {
        background: var(--brand-light);
        color: var(--brand-dark);
        font-weight: 600;
    }
    .nav-tab.active .nav-tab-icon,
    .nav-item.active .nav-icon {
        background: var(--brand-primary);
        color: #fff;
    }
    .nav-tab.active::before,
    .nav-item.active::before {
        content: '';
        position: absolute;
        left: 2px;
        top: 8px;
        bottom: 8px;
        width: 3px;
        border-radius: 3px;
        background: var(--brand-primary);
    }

    /* Hide trailing space below nav since it's now a sidebar */
    .bottom-nav-spacer { display: none; }

    /* Sign-out lives at the bottom of the sidebar with a divider above it. */
    .nav-signout {
        display: flex !important;
        margin-top: auto;       /* pushes to the very bottom of the flex column */
        padding-top: 12px;
        border-top: 1px solid rgba(124, 45, 69, 0.14);
        border-radius: 10px;
        color: var(--text-secondary);
        background: transparent;
        cursor: pointer;
    }
    .nav-signout:hover {
        background: rgba(163, 45, 45, 0.06);
        color: var(--danger);
    }
    .nav-signout .nav-tab-icon {
        background: rgba(163, 45, 45, 0.08);
        color: var(--danger);
    }
    .nav-signout:hover .nav-tab-icon {
        background: var(--danger);
        color: #fff;
    }

    /* On desktop, show 2-column dashboard layout where sensible */
    .desktop-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    /* Dashboard splits into main column + right sidebar */
    .dash-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 24px;
        align-items: start;
    }
    .dash-main { min-width: 0; }
    .dash-side {
        display: block;
        width: auto;
        margin-top: 0;
        position: sticky;
        top: 24px;
    }
    .dash-side .card {
        margin-bottom: 12px;
    }

    /* Cards have more polish on desktop */
    .card {
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        transition: box-shadow 0.2s;
    }
    .card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    }

    /* Headings already scale fluidly via the --text-* tokens. */
}

/* ---------- Wide desktop (1440px+) ---------- */
@media (min-width: 1440px) {
    .app-container {
        max-width: 1280px;
        padding: 32px 32px 32px 300px;
    }

    .bottom-nav {
        width: 260px;
        max-width: 260px;
    }
}

/* ---------- Small phones (under 360px — old iPhone SE) ---------- */
@media (max-width: 359px) {
    .app-container {
        padding: 12px;
    }

    .card { padding: 12px; }
    .card-lg { padding: 14px; }

    /* Headings already scale fluidly via the --text-* tokens. */

    /* Stack 2-column grids on tiny screens */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    /* Tighter button padding to fit narrow screens */
    .btn { padding: 10px 12px; font-size: var(--text-sm); }

    /* Filter chips wrap onto multiple lines */
    .pill {
        font-size: 13.5px;
        padding: 4px 8px;
    }
}

/* ---------- Landscape phones — short height ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .app-container {
        padding: 8px 16px;
    }

    /* Hide decorative spacing in onboarding flows */
    .onboarding-spacer { display: none; }

    /* Smaller logo in landscape */
    .star-logo { width: 32px; height: 32px; }
}

/* ---------- Touch target fixes (apply at all sizes for accessibility) ---------- */
@media (pointer: coarse) {
    /* Ensure all buttons/links meet 44px minimum tap target */
    .btn, .pill, .nav-item, button, [role="button"] {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Form inputs feel right on touch */
    input, select, textarea {
        min-height: 44px;
        font-size: 24px; /* Prevents iOS zoom on focus */
    }

    /* Increase spacing between checklist items for fat-finger accuracy */
    .check-item {
        padding: 12px 8px;
    }
}

/* ---------- Reduced motion (accessibility) ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
    /* For now, the app uses a warm cream background regardless of system theme.
       Dark mode is a future enhancement that would require updating every color
       variable in the design system. Leaving this hook in place so it's a
       trivial addition later. */
}

/* ---------- Print styles ---------- */
@media print {
    /* Hide navigation when printing checklists or timelines */
    .bottom-nav, .ad-banner, .tier-badge { display: none !important; }

    /* Cards print without shadows */
    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }

    /* Make sure pink brand colors print as readable black/gray */
    body { color: #000; background: #fff; }
}
