/* Box Miles - Deep Petrol Design System */

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    /* Deep Petrol Palette (OKLCH) */
    --teal: oklch(0.52 0.1 200);
    --teal-hover: oklch(0.46 0.1 200);
    --teal-light: oklch(0.62 0.08 200);
    --teal-subtle: oklch(0.96 0.02 200);
    --teal-wash: oklch(0.975 0.012 200);
    --teal-board: oklch(0.935 0.022 200);

    /* Neutral Scale (tinted toward hue 210) */
    --white: oklch(0.995 0.003 210);
    --off-white: oklch(0.97 0.005 210);
    --gray-50: oklch(0.97 0.004 210);
    --gray-100: oklch(0.95 0.005 210);
    --gray-200: oklch(0.92 0.006 205);
    --gray-300: oklch(0.86 0.008 205);
    --gray-400: oklch(0.68 0.01 210);
    --gray-500: oklch(0.56 0.012 210);
    --gray-600: oklch(0.45 0.012 210);
    --gray-700: oklch(0.36 0.015 210);
    --gray-800: oklch(0.28 0.018 210);
    --gray-900: oklch(0.22 0.015 210);

    /* Semantic Colors (harmonized with Deep Petrol) */
    --success: oklch(0.55 0.14 155);
    --success-bg: oklch(0.96 0.03 155);
    --warning: oklch(0.62 0.15 75);
    --warning-bg: oklch(0.96 0.03 75);
    --error: oklch(0.55 0.18 25);
    --error-bg: oklch(0.96 0.03 25);

    /* Status Colors (re-tinted to Deep Petrol family) */
    --status-pearl: oklch(0.92 0.006 210);
    --status-pearl-text: oklch(0.50 0.012 210);
    --status-silver: oklch(0.65 0.04 210);
    --status-gold: oklch(0.65 0.15 75);
    --status-platinum: oklch(0.55 0.12 280);
    --status-million: oklch(0.52 0.1 200);

    /* Sidebar (light) */
    --sidebar-bg: oklch(0.97 0.005 210);
    --sidebar-border: oklch(0.92 0.006 205);
    --sidebar-text: oklch(0.28 0.018 210);
    --sidebar-text-dim: oklch(0.50 0.012 210);
    --sidebar-active-bg: oklch(0.94 0.025 200);
    --sidebar-active-text: oklch(0.42 0.08 200);

    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', monospace;

    /* Font Sizes (rem, ~1.25 ratio) */
    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --text-3xl: 2.5rem;
    --text-4xl: 3rem;

    /* Spacing (4pt base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Layout */
    --sidebar-width: 240px;
    --content-max-width: 880px;
    --border-color: var(--gray-200);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
    --transition-fast: 0.1s var(--ease-out);
    --transition-base: 0.15s var(--ease-out);
    --transition-slow: 0.25s var(--ease-out);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 17px;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-kerning: normal;
    font-optical-sizing: auto;
    color: var(--gray-900);
    background: var(--white);
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   LAYOUT - SIDEBAR + CONTENT
   ============================================ */
.app-container {
    min-height: 100vh;
    display: flex;
}

/* Sidebar (light) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
}

.sidebar.open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
    }
}

.sidebar-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--sidebar-border);
}

.logo {
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--gray-900);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border-radius: var(--radius-sm);
}

.logo:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    background: var(--teal);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.logo-icon svg {
    width: 16px;
    height: 16px;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    padding: var(--space-2) 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.nav-section {
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--sidebar-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 6px var(--space-3);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 34px;
    padding: 6px var(--space-3);
    color: var(--sidebar-text-dim);
    font-size: var(--text-base);
    font-weight: 500;
    line-height: 1.35;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.nav-link:hover {
    color: var(--sidebar-text);
    background: var(--gray-100);
}

.nav-link:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.nav-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--sidebar-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--white);
    background: var(--teal);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: var(--text-xs);
    color: var(--sidebar-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Mobile Header */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 50;
}

@media (min-width: 1024px) {
    .mobile-header {
        display: none;
    }
}

.menu-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--gray-600);
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    color: var(--gray-800);
    background: var(--gray-100);
}

.menu-toggle:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: oklch(0.15 0.02 210 / 0.4);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 1024px) {
    .sidebar-overlay {
        display: none;
    }
}

/* Main Content */
.main-wrapper {
    flex: 1;
    min-width: 0;
}

@media (min-width: 1024px) {
    .main-wrapper {
        margin-left: var(--sidebar-width);
    }
}

.public-shell {
    display: block;
}

.public-shell .main-wrapper {
    margin-left: 0;
}

.public-top-nav {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: oklch(0.995 0.003 210 / 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
}

.public-nav-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--gray-600);
}

.public-nav-links a:hover {
    color: var(--teal);
}

.language-selector select {
    min-height: 36px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-700);
    font: inherit;
}

.public-language-selector {
    flex: 0 0 auto;
}

.public-language-selector select {
    min-height: 32px;
    padding: var(--space-1) var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-500);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base), color var(--transition-base);
}

.public-language-selector select:hover {
    border-color: var(--border-color);
    background: var(--white);
    color: var(--gray-700);
}

.public-language-selector select:focus-visible {
    border-color: var(--teal-light);
    background: var(--white);
    color: var(--gray-700);
    outline: none;
}

.profile-notice-stack {
    display: grid;
    gap: var(--space-2);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 640px) {
    .public-top-nav {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: var(--space-2) var(--space-3);
    }

    .public-top-nav .logo {
        grid-column: 1;
    }

    .public-language-selector {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .public-nav-links {
        grid-column: 1 / -1;
        justify-content: flex-start;
        gap: var(--space-3);
    }
}

.main-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5);
}

@media (min-width: 640px) {
    .main-content {
        padding: var(--space-10) var(--space-8);
    }
}

/* Wide layout for data-dense pages */
.main-content:has(> .page-wide) {
    max-width: 1080px;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--gray-900);
    margin-bottom: var(--space-8);
}

.section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin-bottom: var(--space-4);
}

.section-heading {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--gray-800);
    margin-bottom: var(--space-5);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.text-muted {
    color: var(--gray-500);
}

.text-small {
    font-size: var(--text-sm);
}

.text-xs {
    font-size: var(--text-xs);
}

.label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
}

/* ============================================
   MILES DISPLAY
   ============================================ */
.miles-hero {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    margin-bottom: var(--space-8);
}

.miles-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
    margin-bottom: var(--space-2);
}

.miles-value {
    font-size: var(--text-4xl);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.miles-unit {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-top: var(--space-2);
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-section {
    padding: 0 var(--space-5) var(--space-6);
    margin-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.progress-label {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.progress-value {
    font-size: var(--text-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.progress-context {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3);
    margin: calc(var(--space-2) * -1) 0 var(--space-3);
    color: var(--gray-500);
    font-size: var(--text-xs);
}

.progress-bar {
    height: 3px;
    background: var(--gray-200);
    border-radius: 2px;
    position: relative;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--teal);
    border-radius: 2px;
    transition: width 0.3s var(--ease-out);
}

/* Thicker variant */
.progress-bar.thick {
    height: 6px;
    border-radius: 3px;
}

.progress-bar.thick .progress-fill {
    border-radius: 3px;
}

/* ============================================
   SECTIONS & CARDS
   ============================================ */
.section {
    margin-bottom: var(--space-10);
}

.section-lg {
    margin-bottom: var(--space-16);
}

.card {
    background: var(--teal-wash);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-3);
}

.card-bordered {
    border: 1px solid var(--border-color);
    background: var(--white);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

/* ============================================
   HABIT ITEMS
   ============================================ */
.habit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-color);
}

.habit-item:last-child {
    border-bottom: none;
}

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

.habit-name {
    font-size: var(--text-base);
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.habit-meta {
    font-size: var(--text-sm);
    color: var(--gray-400);
}

.habit-progress {
    margin-top: var(--space-2);
    max-width: 200px;
}

.habit-formula-preview {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    background: var(--off-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.habit-formula-cue {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.45;
}

.habit-formula-behavior {
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.35;
}

.habit-formula-meta {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.habit-actions {
    display: flex;
    gap: var(--space-2);
}

.habit-action {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    color: var(--gray-500);
}

.habit-action:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.habit-action:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.habit-action.active {
    background: var(--teal);
    border-color: var(--teal);
    color: var(--white);
}

.habit-action svg {
    width: 18px;
    height: 18px;
}

/* Quick log buttons */
.quick-log-btns {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

/* ============================================
   ROUTE ITEMS
   ============================================ */
.route-item {
    background: var(--off-white);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-3);
}

.route-path {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.route-airport {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* Inline IATA code treatment */
.iata {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.route-line {
    flex: 1;
    height: 1px;
    background: var(--gray-300);
    position: relative;
}

.route-line::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--gray-400);
    border-radius: 50%;
}

.route-details {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.compact-section {
    padding-top: 0;
    padding-bottom: var(--space-3);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.pagination-info {
    color: var(--gray-500);
    font-size: var(--text-sm);
}

/* Route miles */
.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.route-miles {
    text-align: right;
}

.miles-cost {
    font-weight: 600;
    font-size: var(--text-base);
}

.early-bird {
    font-size: var(--text-xs);
    color: var(--success);
}

.route-cities {
    font-size: var(--text-lg);
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.route-code {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.route-meta {
    text-align: right;
}

.route-seats {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.destination-button {
    width: 100%;
    border: 0;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    display: block;
    color: inherit;
}

.destination-button:hover {
    background: var(--teal-subtle);
}

.destination-button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.flight-option {
    background: var(--off-white);
    border-radius: var(--radius-md);
}

.flight-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: flex-end;
}

.line-through {
    text-decoration: line-through;
}

.flight-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--white);
    border: 1px dashed oklch(0.52 0.1 200 / 0.35);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.03em;
}

.reservation-segments {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.segment-list {
    display: grid;
    gap: var(--space-2);
    margin: var(--space-3) 0;
}

.segment-row,
.layover-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.layover-row {
    color: var(--gray-500);
    padding-left: var(--space-4);
}

.timetable-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 1fr) auto;
    gap: var(--space-3);
    align-items: end;
}

.segmented-control {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.timetable-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-4);
    align-items: center;
    border: 1px solid transparent;
    transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

.timetable-row:hover {
    background: var(--teal-subtle);
    border-color: oklch(0.52 0.1 200 / 0.16);
    box-shadow: 0 1px 5px oklch(0.15 0.02 210 / 0.05);
}

.timetable-route {
    min-width: 0;
}

.timetable-route-main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.timetable-route-main .route-line {
    min-width: 24px;
}

.timetable-route-main .route-line::after {
    right: -1px;
    width: 6px;
    height: 6px;
    background: transparent;
    border-top: 1px solid var(--gray-400);
    border-right: 1px solid var(--gray-400);
    border-radius: 0;
    transform: translateY(-50%) rotate(45deg);
}

.timetable-row:hover .timetable-route-main .route-line {
    background: var(--teal-light);
}

.timetable-row:hover .timetable-route-main .route-line::after {
    border-color: var(--teal);
}

.timetable-endpoint {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    flex: 0 0 auto;
    white-space: nowrap;
}

.timetable-time {
    font-size: var(--text-xl);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.timetable-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
    color: var(--gray-500);
    font-size: var(--text-sm);
}

.timetable-status {
    display: flex;
    justify-content: flex-end;
}

.country-filter-summary {
    margin-bottom: var(--space-3);
}

.country-filter-toggle {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 34px;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--off-white);
    color: var(--gray-700);
    font-size: var(--text-sm);
    font-weight: 500;
    text-align: left;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.country-filter-toggle:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.country-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.country-tag {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-700);
    font-size: var(--text-sm);
    font-weight: 500;
    text-align: left;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.country-tag:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.country-tag:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.country-tag.active {
    border-color: var(--teal);
    background: var(--teal-subtle);
    color: var(--teal);
}

.tabs {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.challenge-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px 88px;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-color);
}

.challenge-row:last-child {
    border-bottom: none;
}

.challenge-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.challenge-meta {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    color: var(--gray-500);
    font-size: var(--text-sm);
}

.challenge-progress {
    min-width: 0;
}

.challenge-category-tabs {
    margin-bottom: var(--space-4);
}

.challenge-explanation {
    margin-top: var(--space-2);
    color: var(--gray-500);
    font-size: var(--text-sm);
    line-height: 1.45;
}

.challenge-collection {
    display: grid;
    gap: var(--space-4);
}

.collection-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.collection-summary > div {
    min-width: 96px;
}

.collection-summary-value {
    display: block;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.collection-summary-label {
    color: var(--gray-500);
    font-size: var(--text-xs);
}

.collection-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
    margin-bottom: var(--space-4);
}

.collection-chip {
    border: 1px solid var(--border-color);
    background: var(--gray-50);
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background var(--transition-base), border-color var(--transition-base), color var(--transition-base);
}

.collection-chip:hover,
.collection-chip:focus-visible {
    background: var(--teal-subtle);
    border-color: var(--teal-light);
    color: var(--gray-700);
}

.collection-chip.active {
    background: var(--teal);
    border-color: var(--teal);
    color: var(--white);
}

.collection-chip.has-progress {
    border-color: oklch(0.82 0.04 200);
    color: var(--gray-700);
    background: oklch(0.97 0.012 200);
}

/* Region boxes grid */
.region-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.region-box {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    cursor: pointer;
    transition: border-color var(--transition-base), background var(--transition-base), box-shadow var(--transition-base);
    user-select: none;
}

.region-box:hover {
    border-color: var(--teal-light);
    background: var(--teal-subtle);
}

.region-box.selected {
    border-color: var(--teal);
    background: oklch(0.97 0.015 200);
    box-shadow: 0 0 0 1px var(--teal);
}

.region-box-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.region-box.selected .region-box-name {
    color: var(--teal-hover);
}

.region-box-count {
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
    margin-bottom: 6px;
}

.region-box-bar {
    width: 100%;
    height: 3px;
    background: var(--gray-100);
    border-radius: 2px;
    overflow: hidden;
}

.region-box-bar-fill {
    height: 100%;
    background: var(--teal);
    border-radius: 2px;
    transition: width var(--transition-slow);
}

.region-prefix-area {
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    background: var(--gray-50);
}

.region-prefix-heading {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.region-prefix-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
}

.collection-flight-row .timetable-meta .flight-chip {
    border-style: solid;
    border-color: var(--gray-200);
    background: var(--gray-50);
}

.collection-flight-row .timetable-meta > span + span::before {
    content: "\00b7";
    margin-right: var(--space-2);
    color: var(--gray-300);
}

.collection-flight-list {
    display: grid;
    gap: var(--space-2);
}

.collection-flight-status {
    display: flex;
    justify-content: flex-end;
}

.status-pill.neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

.collection-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.collection-filters .form-label {
    margin-bottom: 0;
}

.collection-result-count {
    margin: calc(-1 * var(--space-2)) 0 var(--space-4);
    color: var(--gray-500);
    font-size: var(--text-sm);
}

.collection-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.collection-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.collection-table th,
.collection-table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.collection-table th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
}

.collection-table tr:last-child td {
    border-bottom: none;
}

.collection-airport-cell {
    display: grid;
    gap: var(--space-1);
}

.challenge-category {
    margin-bottom: var(--space-6);
}

.challenge-category:last-child {
    margin-bottom: 0;
}

.challenge-category-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.content-page {
    display: grid;
    gap: var(--space-6);
}

.content-page p,
.content-page li {
    color: var(--gray-600);
    line-height: 1.65;
}

.content-page ul {
    display: grid;
    gap: var(--space-2);
    padding-left: var(--space-5);
}

.content-page h3 {
    font-size: var(--text-base);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.content-page a,
.checkbox-row a {
    color: var(--teal);
    font-weight: 600;
}

.content-page a:hover,
.checkbox-row a:hover {
    color: var(--teal-hover);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
    color: var(--gray-600);
}

.checkbox-row input {
    margin-top: 3px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .challenge-row {
        grid-template-columns: 1fr;
    }

    .collection-filters {
        grid-template-columns: 1fr;
    }

    .collection-flight-row {
        grid-template-columns: 1fr;
    }

    .collection-flight-status {
        justify-content: flex-start;
    }

    /* Challenge top tabs: horizontal scroll instead of chaotic wrapping */
    .challenge-top-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: var(--space-1);
    }

    .challenge-top-tabs::-webkit-scrollbar {
        display: none;
    }

    .challenge-top-tabs .btn {
        flex-shrink: 0;
    }

    /* Category sub-tabs: horizontal scroll */
    .challenge-category-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .challenge-category-tabs::-webkit-scrollbar {
        display: none;
    }

    .challenge-category-tabs .help-tab {
        flex-shrink: 0;
    }

    /* Region boxes: 2-column on mobile */
    .region-boxes {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Airport summary: 2x2 grid */
    .collection-summary {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .collection-summary > div {
        min-width: 0;
    }

    /* Airports table: card layout on mobile */
    .collection-table {
        min-width: 0;
    }

    .collection-table thead {
        display: none;
    }

    .collection-table tbody,
    .collection-table tr {
        display: block;
    }

    .collection-table tr {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        padding: var(--space-3);
        border-bottom: 1px solid var(--border-color);
    }

    .collection-table tr:last-child {
        border-bottom: none;
    }

    .collection-table td {
        display: block;
        padding: 0;
        border-bottom: none;
    }

    /* Airport cell: IATA code prominent, city/name as secondary */
    .collection-table td:nth-child(3) {
        order: -1;
        width: 100%;
        margin-bottom: var(--space-1);
    }

    .collection-airport-cell {
        display: flex;
        align-items: baseline;
        gap: var(--space-2);
    }

    .collection-airport-cell .route-airport {
        font-size: var(--text-base);
    }

    .collection-airport-cell > span:last-child {
        color: var(--gray-500);
        font-size: var(--text-sm);
    }

    /* Region & country inline, status as badge */
    .collection-table td:nth-child(1),
    .collection-table td:nth-child(2) {
        display: inline;
        font-size: var(--text-xs);
        color: var(--gray-500);
    }

    .collection-table td:nth-child(1)::after {
        content: " · ";
    }

    .collection-table td:nth-child(4) {
        margin-left: auto;
    }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.btn-primary {
    background: var(--teal);
    color: var(--white);
    border-color: var(--teal);
}

.btn-primary:hover {
    background: var(--teal-hover);
    border-color: var(--teal-hover);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.btn-ghost {
    background: transparent;
    color: var(--teal);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--teal-subtle);
}

.btn:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: 600;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    transition: border-color var(--transition-base);
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px oklch(0.52 0.1 200 / 0.12);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:disabled {
    background: var(--gray-50);
    color: var(--gray-400);
    cursor: not-allowed;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
}

/* Status badges */
.status-badge {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.status-pearl { background: var(--status-pearl); color: var(--status-pearl-text); }
.status-silver { background: oklch(0.92 0.015 210); color: var(--status-silver); }
.status-gold { background: oklch(0.94 0.04 75); color: oklch(0.50 0.12 75); }
.status-platinum { background: oklch(0.94 0.03 280); color: var(--status-platinum); }
.status-million_miler { background: var(--teal-subtle); color: var(--teal); }

/* ============================================
   ALERTS (no side-stripe borders)
   ============================================ */
.alert {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
}

.alert-info {
    background: var(--teal-subtle);
    color: var(--teal-hover);
}

.alert-warning {
    background: var(--warning-bg);
    color: oklch(0.45 0.12 75);
}

.alert-error {
    background: var(--error-bg);
    color: oklch(0.45 0.15 25);
}

.alert-success {
    background: var(--success-bg);
    color: oklch(0.42 0.12 155);
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    padding: var(--space-5);
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: var(--space-1);
}

/* Stat row - inline stats without card borders */
.stat-row {
    display: flex;
    gap: var(--space-8);
}

.stat-item .stat-value {
    font-size: var(--text-xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
}

.stat-item .stat-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Stats panel - shared background, no individual borders */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    padding: var(--space-6);
    background: var(--off-white);
    border-radius: var(--radius-md);
}

@media (min-width: 640px) {
    .stats-panel {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   MEMBERSHIP CARD
   ============================================ */
.membership-card {
    background: var(--off-white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
}

.member-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-6);
}

.member-name {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.member-status {
    display: inline-block;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--white);
    background: var(--teal);
}

/* ============================================
   LANDING PAGE
   ============================================ */
/* Landing: Split Horizon layout */
.landing-split {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: var(--space-12);
    align-items: center;
    padding: var(--space-16) 0 var(--space-12);
}

.landing-hero {
    padding: 0;
}

.landing-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin-bottom: var(--space-4);
    color: var(--gray-900);
    text-wrap: balance;
}

.landing-subtitle {
    font-size: var(--text-lg);
    color: var(--gray-500);
    margin-bottom: var(--space-8);
    line-height: 1.6;
    max-width: 38ch;
}

/* Landing video frame */
.landing-video-wrap {
    position: relative;
}

.landing-video-frame {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--gray-900);
    box-shadow:
        0 2px 4px oklch(0.22 0.015 210 / 0.06),
        0 12px 32px oklch(0.22 0.015 210 / 0.1),
        0 32px 64px oklch(0.22 0.015 210 / 0.06);
}

.landing-video-frame video {
    display: block;
    width: 100%;
    border-radius: var(--radius-lg);
}

/* Flight data overlay */
.landing-flight-data {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    gap: 16px;
    z-index: 2;
}

.landing-fd-item {
    display: flex;
    flex-direction: column;
}

.landing-fd-label {
    font-family: var(--font-mono);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: oklch(0.995 0.003 210 / 0.4);
}

.landing-fd-value {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: oklch(0.995 0.003 210 / 0.7);
    letter-spacing: 0.06em;
}

/* Altitude scale */
.landing-altitude-scale {
    position: absolute;
    right: -40px;
    top: 12px;
    bottom: 12px;
    width: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
}

.landing-alt-tick {
    display: flex;
    align-items: center;
    gap: 4px;
}

.landing-alt-tick::before {
    content: '';
    width: 8px;
    height: 1px;
    background: var(--gray-300);
}

.landing-alt-label {
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    color: var(--gray-400);
    letter-spacing: 0.04em;
}

/* Horizon line */
.landing-horizon-line {
    position: absolute;
    bottom: -20px;
    left: 0;
    right: -40px;
    height: 1px;
    background: linear-gradient(
        90deg,
        var(--teal) 0%,
        oklch(0.52 0.1 200 / 0.3) 60%,
        transparent 100%
    );
}

/* Mobile: stack vertically */
@media (max-width: 800px) {
    .landing-split {
        grid-template-columns: 1fr;
        gap: var(--space-8);
        padding: var(--space-10) 0 var(--space-8);
    }
    .landing-hero {
        text-align: center;
    }
    .landing-subtitle {
        max-width: none;
    }
    .landing-altitude-scale {
        display: none;
    }
    .landing-horizon-line {
        right: 0;
    }
}

/* ============================================
   MAP
   ============================================ */
#map {
    height: 400px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    background:
        linear-gradient(0deg, oklch(0.52 0.1 200 / 0.04), oklch(0.52 0.1 200 / 0.04)),
        oklch(0.95 0.018 220);
}

#map.map-tiles-unavailable {
    background:
        linear-gradient(90deg, oklch(0.68 0.01 210 / 0.12) 1px, transparent 1px),
        linear-gradient(0deg, oklch(0.68 0.01 210 / 0.12) 1px, transparent 1px),
        oklch(0.95 0.018 220);
    background-size: 96px 96px;
}

@media (min-width: 640px) {
    #map {
        height: 500px;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { justify-content: center; align-items: center; }
.items-center { align-items: center; }
.gap-sm { gap: var(--space-2); }
.gap-md { gap: var(--space-4); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.mt-sm { margin-top: var(--space-2); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }
.mb-sm { margin-bottom: var(--space-2); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }

.hidden { display: none; }

/* Mono input (UUID fields) */
.form-input-mono {
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
    font-size: var(--text-xs);
}

/* Link accent (inline link color) */
.link-accent {
    color: var(--teal);
}

.link-accent:hover {
    color: var(--teal-hover);
}

/* Selected card state */
.card-selected {
    border: 2px solid var(--teal);
}

/* Logout button styling */
.btn-logout {
    background: var(--white);
    color: var(--error);
    border-color: var(--border-color);
}

.btn-logout:hover {
    border-color: var(--error);
}

/* Landing "How it works" step */
.landing-steps {
    display: grid;
    gap: var(--space-3);
}

.landing-step {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--off-white);
    border-radius: var(--radius-md);
}

.landing-step-num {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
}

.landing-step h4 {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.landing-step p {
    color: var(--gray-500);
    font-size: var(--text-sm);
}

/* Checkbox row (onboarding) */
.checkbox-row-inline {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

/* Miles hero compact (inline in cards) */
.miles-hero-compact {
    text-align: center;
    padding: 0;
    margin: 0;
}

/* Mobile header spacer */
.mobile-header-spacer {
    width: 40px;
}

/* Scrollable list container */
.scroll-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Ranking number */
.rank-num {
    font-size: var(--text-lg);
    font-weight: 700;
    width: 30px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
}

.leader-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Route card (list view) */
.route-card {
    background: var(--off-white);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.route-card:hover {
    background: var(--gray-100);
}

.route-info {
    flex: 1;
}

/* Selected flights panel */
.selection-panel {
    border: 2px solid var(--teal);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-top: var(--space-6);
}

/* Done button - circular checkmark */
.btn-done {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s var(--ease-out), background 0.15s var(--ease-out);
    flex-shrink: 0;
}

.btn-done:hover {
    background: var(--teal-hover);
    transform: scale(1.05);
}

.btn-done:active {
    transform: scale(0.95);
}

.btn-done:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: oklch(0.15 0.02 210 / 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px oklch(0.15 0.02 210 / 0.2);
}

.habit-log-modal {
    max-width: 920px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
}

.modal-sm {
    max-width: 300px;
}

.modal-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal-subtitle {
    margin-top: var(--space-1);
    color: var(--gray-500);
    font-size: var(--text-xs);
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: var(--radius-sm);
    transition: color var(--transition-base);
}

.btn-close:hover {
    color: var(--gray-700);
}

.btn-close:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.modal-body {
    padding: var(--space-4);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* Log entries */
.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-color);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-minutes {
    font-weight: 500;
}

.log-meta {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
}

.btn-danger:hover {
    background: oklch(0.48 0.18 25);
}

/* Practice log board */
.habit-log-board {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.habit-log-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--gray-50);
}

.habit-log-filter span {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--gray-600);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.habit-log-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
}

.habit-log-stat {
    min-height: 84px;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
}

.habit-log-stat-value {
    display: block;
    color: var(--teal);
    font-size: var(--text-lg);
    font-weight: 700;
    line-height: 1.2;
}

.habit-log-stat-label {
    display: block;
    margin-top: var(--space-1);
    color: var(--gray-500);
    font-size: var(--text-xs);
}

.habit-log-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
    gap: var(--space-4);
    align-items: start;
}

.habit-log-panel {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    overflow: hidden;
}

.habit-log-panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.habit-log-panel-header h4 {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 600;
}

.habit-log-panel-header span {
    color: var(--gray-500);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.habit-heatmap {
    display: grid;
    grid-template-columns: repeat(7, 28px);
    grid-auto-rows: 28px;
    gap: var(--space-2);
    width: max-content;
    padding: var(--space-4);
}

.habit-heatmap-weekday {
    display: grid;
    place-items: center;
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 700;
}

.habit-heatmap-day {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--gray-100);
}

.habit-heatmap-day[data-level="1"] {
    background: var(--teal-board);
    border-color: var(--teal-board);
}

.habit-heatmap-day[data-level="2"] {
    background: var(--teal-light);
    border-color: var(--teal-light);
}

.habit-heatmap-day[data-level="3"] {
    background: var(--teal);
    border-color: var(--teal);
}

.habit-heatmap-day[data-level="4"] {
    background: var(--teal-hover);
    border-color: var(--teal-hover);
}

.habit-heatmap-day.empty-month {
    opacity: 0.25;
}

.habit-heatmap-day.today {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.habit-heatmap-legend {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0 var(--space-4) var(--space-4);
    color: var(--gray-500);
    font-size: var(--text-xs);
}

.habit-heatmap-legend-box {
    width: 13px;
    height: 13px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--gray-100);
}

.habit-heatmap-legend-box.level-1 {
    background: var(--teal-board);
}

.habit-heatmap-legend-box.level-2 {
    background: var(--teal-light);
}

.habit-heatmap-legend-box.level-3 {
    background: var(--teal);
}

.habit-heatmap-legend-box.level-4 {
    background: var(--teal-hover);
}

.habit-log-timeline {
    max-height: 420px;
    overflow: auto;
}

.habit-log-date {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: var(--space-3) var(--space-4) var(--space-1);
    background: var(--white);
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.habit-log-hour-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.habit-log-hour {
    color: var(--gray-700);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 700;
}

.habit-log-times {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    min-width: 0;
}

.habit-log-time-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--gray-500);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    cursor: default;
}

.habit-log-time-chip.undoable {
    cursor: pointer;
}

.habit-log-time-chip.undoable:hover {
    border-color: var(--error);
    color: var(--error);
}

.habit-log-time-chip:disabled {
    opacity: 1;
}

.habit-log-miles {
    display: inline-flex;
    justify-content: center;
    min-width: 82px;
    padding: 2px var(--space-2);
    border-radius: 999px;
    background: var(--teal-subtle);
    color: var(--teal-hover);
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
}

.habit-log-empty {
    padding: var(--space-6) var(--space-4);
}

@media (max-width: 720px) {
    .habit-log-modal {
        width: calc(100% - var(--space-4));
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
    }

    .habit-log-filters,
    .habit-log-stats,
    .habit-log-grid {
        grid-template-columns: 1fr;
    }

    .habit-log-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .habit-heatmap {
        grid-template-columns: repeat(7, 32px);
        grid-auto-rows: 32px;
        gap: 5px;
    }

    .habit-heatmap-day {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 420px) {
    .habit-log-stats {
        grid-template-columns: 1fr;
    }

    .habit-log-hour-row {
        grid-template-columns: 34px minmax(0, 1fr) auto;
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .habit-log-panel-header,
    .habit-log-date {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }

    .habit-heatmap,
    .habit-heatmap-legend {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }
}

/* Reservation banner */
.reservation-banner {
    background: var(--warning-bg);
    border: 1px solid oklch(0.72 0.12 75);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.reservation-title {
    font-weight: 600;
    color: oklch(0.40 0.10 75);
}

.reservation-detail {
    font-size: var(--text-sm);
    color: oklch(0.50 0.10 75);
    margin-top: var(--space-1);
}

.reservation-actions {
    display: flex;
    gap: var(--space-2);
}

.route-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

/* Transit route badges */
.route-badges {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.route-badge {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
}

.badge-direct {
    background: var(--teal-subtle);
    color: var(--teal);
}

.badge-transit {
    background: var(--warning-bg);
    color: oklch(0.50 0.12 75);
}

.badge-savings {
    background: var(--success-bg);
    color: var(--success);
}

.badge-campaign {
    background: oklch(0.95 0.04 280);
    color: oklch(0.45 0.12 280);
}

.badge-early-bird {
    background: var(--success-bg);
    color: var(--success);
}

.badge-full {
    background: var(--error-bg);
    color: var(--error);
}

.route-path-multi {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-wrap: wrap;
    line-height: 1.4;
}

.route-leg {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.route-connector {
    color: var(--gray-400);
}

.transit-miles {
    color: var(--success);
    font-weight: 600;
}

/* Route type indicators (background tint, not side-stripe) */
.route-direct {
    background: var(--teal-subtle);
}

.route-transit {
    background: var(--warning-bg);
}

.auth-centered-panel {
    width: min(500px, 100%);
    min-height: calc(100vh - 96px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ticket-type-control {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.segmented-btn {
    min-width: 92px;
    padding: var(--space-2) var(--space-4);
    border: 0;
    background: var(--white);
    color: var(--gray-600);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-base);
}

.segmented-btn:hover:not(.active) {
    background: var(--gray-50);
    color: var(--gray-800);
}

.segmented-btn:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.segmented-btn.active {
    background: var(--teal);
    color: var(--white);
}

.badge-full,
.status-pill.full {
    background: var(--error-bg);
    color: var(--error);
}

.status-pill {
    display: inline-flex;
    margin-top: var(--space-1);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
}

.status-pill.available {
    background: var(--success-bg);
    color: var(--success);
}

.airport-picker {
    position: relative;
}

.airport-picker-menu {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 340px;
    overflow: auto;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px oklch(0.15 0.02 210 / 0.12);
}

.airport-picker-country {
    position: sticky;
    top: 0;
    padding: var(--space-2) var(--space-3);
    background: var(--gray-50);
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 600;
}

.airport-picker-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 0;
    background: var(--white);
    text-align: left;
    transition: background var(--transition-base);
}

.airport-picker-option:hover {
    background: var(--teal-subtle);
}

.airport-picker-option:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: -2px;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-3);
    color: var(--gray-600);
    font-size: var(--text-sm);
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.legend-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    flex-shrink: 0;
}

.legend-dot.current-base {
    width: 13px;
    height: 13px;
    background: #315CB8;
    border-color: #E6EDF8;
    box-shadow: 0 0 0 2px #E6EDF8;
}

.legend-dot.base {
    width: 12px;
    height: 12px;
    background: #7062C8;
    border-color: #EEEAFB;
    box-shadow: 0 0 0 1px #EEEAFB;
}

.legend-dot.visited {
    background: #0F766E;
    border-color: #F3F8F7;
}

.legend-dot.transited {
    background: #B7791F;
    border-color: #FFF5DE;
}

.legend-dot.reachable {
    background: #3D4650;
    border-color: #F5F7F8;
}

.legend-dot.unreachable {
    background: #D8DEE4;
    border-color: #6B7680;
}

/* ============================================
   TIERS PAGE
   ============================================ */

/* Tier color tokens */
.tiers-page {
    --tier-pearl: oklch(0.88 0.01 80);
    --tier-pearl-text: oklch(0.45 0.03 80);
    --tier-pearl-bg: oklch(0.97 0.008 80);
    --tier-pearl-accent: oklch(0.82 0.02 80);

    --tier-silver: oklch(0.72 0.02 240);
    --tier-silver-text: oklch(0.40 0.04 240);
    --tier-silver-bg: oklch(0.96 0.008 240);
    --tier-silver-accent: oklch(0.82 0.03 240);

    --tier-gold: oklch(0.72 0.14 75);
    --tier-gold-text: oklch(0.42 0.1 75);
    --tier-gold-bg: oklch(0.96 0.03 75);
    --tier-gold-accent: oklch(0.82 0.08 75);

    --tier-platinum: oklch(0.62 0.08 280);
    --tier-platinum-text: oklch(0.38 0.08 280);
    --tier-platinum-bg: oklch(0.96 0.015 280);
    --tier-platinum-accent: oklch(0.80 0.05 280);

    --tier-million: var(--teal);
    --tier-million-text: oklch(0.30 0.06 200);
    --tier-million-bg: var(--teal-subtle);
    --tier-million-accent: var(--teal-light);

    display: grid;
    gap: var(--space-8);
}

/* Hero section */
.tier-hero {
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-6);
    position: relative;
    overflow: hidden;
}

.tier-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background: repeating-linear-gradient(
        135deg,
        currentColor 0px,
        currentColor 1px,
        transparent 1px,
        transparent 12px
    );
    pointer-events: none;
}

.tier-hero-pearl { background: var(--tier-pearl-bg); color: var(--tier-pearl-text); }
.tier-hero-silver { background: var(--tier-silver-bg); color: var(--tier-silver-text); }
.tier-hero-gold { background: var(--tier-gold-bg); color: var(--tier-gold-text); }
.tier-hero-platinum { background: var(--tier-platinum-bg); color: var(--tier-platinum-text); }
.tier-hero-million_miler { background: var(--tier-million-bg); color: var(--tier-million-text); }

.tier-hero-inner {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
    position: relative;
}

.tier-hero-badge {
    flex-shrink: 0;
}

.tier-hero-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tier-hero-icon svg {
    width: 100%;
    height: 100%;
}

.tier-hero-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: var(--space-1);
}

.tier-hero-name {
    font-size: var(--text-2xl);
    font-weight: 700;
    line-height: 1.1;
}

.tier-hero-callsign {
    font-size: var(--text-sm);
    opacity: 0.6;
    margin-top: var(--space-1);
}

/* Progress bar */
.tier-progress-section {
    position: relative;
}

.tier-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
    font-variant-numeric: tabular-nums;
}

.tier-progress-miles {
    font-weight: 600;
}

.tier-progress-target {
    opacity: 0.6;
}

.tier-progress-bar {
    height: 8px;
    border-radius: 4px;
    background: oklch(0 0 0 / 0.08);
    overflow: hidden;
}

.tier-progress-fill {
    height: 100%;
    border-radius: 4px;
    background: currentColor;
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    min-width: 2px;
}

.tier-progress-remaining {
    font-size: var(--text-sm);
    margin-top: var(--space-2);
    font-weight: 600;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

.tier-hero-permanent {
    font-size: var(--text-lg);
    font-weight: 600;
    opacity: 0.8;
}

/* Tier ladder */
.tier-ladder {
    display: grid;
    gap: 0;
}

.tier-ladder-title {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-5);
    color: var(--gray-800);
}

.tier-ladder-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: var(--space-4);
    min-height: 0;
}

.tier-item-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 6px;
}

.tier-item-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--gray-300);
    background: var(--white);
}

.tier-item-line {
    width: 2px;
    flex-grow: 1;
    background: var(--gray-200);
    margin-top: 4px;
}

.tier-item-content {
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.tier-ladder-item:last-child .tier-item-content {
    border-bottom: none;
    padding-bottom: 0;
}

.tier-item-header {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.tier-item-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-800);
}

.tier-item-qual {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.tier-item-benefits {
    padding-left: var(--space-5);
    color: var(--gray-600);
    font-size: var(--text-sm);
    line-height: 1.65;
    display: grid;
    gap: var(--space-1);
}

/* Per-tier dot colors */
.tier-item-pearl .tier-item-dot { border-color: var(--tier-pearl); background: var(--tier-pearl-bg); }
.tier-item-silver .tier-item-dot { border-color: var(--tier-silver); background: var(--tier-silver-bg); }
.tier-item-gold .tier-item-dot { border-color: var(--tier-gold); background: var(--tier-gold-bg); }
.tier-item-platinum .tier-item-dot { border-color: var(--tier-platinum); background: var(--tier-platinum-bg); }
.tier-item-million .tier-item-dot { border-color: var(--tier-million); background: var(--tier-million-bg); }

/* Current tier emphasis */
.tier-item-current .tier-item-dot {
    width: 16px;
    height: 16px;
    box-shadow: 0 0 0 3px var(--white), 0 0 0 5px currentColor;
}

.tier-item-current.tier-item-pearl .tier-item-dot { border-color: var(--tier-pearl-text); background: var(--tier-pearl); color: var(--tier-pearl-text); }
.tier-item-current.tier-item-silver .tier-item-dot { border-color: var(--tier-silver-text); background: var(--tier-silver); color: var(--tier-silver-text); }
.tier-item-current.tier-item-gold .tier-item-dot { border-color: var(--tier-gold-text); background: var(--tier-gold); color: var(--tier-gold-text); }
.tier-item-current.tier-item-platinum .tier-item-dot { border-color: var(--tier-platinum-text); background: var(--tier-platinum); color: var(--tier-platinum-text); }
.tier-item-current.tier-item-million .tier-item-dot { border-color: var(--tier-million-text); background: var(--tier-million); color: var(--tier-million-text); }

.tier-item-current .tier-item-name {
    font-size: var(--text-xl);
}

.tier-item-current .tier-item-content {
    background: var(--off-white);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    border-bottom: none;
    margin-bottom: var(--space-2);
}

/* Achieved tiers */
.tier-item-achieved .tier-item-dot {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.tier-item-achieved .tier-item-name {
    color: var(--gray-500);
}

.tier-item-achieved .tier-item-line {
    background: var(--gray-300);
}

/* Tier note */
.tier-note {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.6;
    padding: var(--space-4);
    background: var(--off-white);
    border-radius: var(--radius-md);
}

/* ============================================
   HELP PAGE
   ============================================ */

.help-page {
    display: grid;
    gap: var(--space-6);
}

/* Hero */
.help-hero {
    text-align: center;
    padding: var(--space-8) var(--space-4) var(--space-4);
}

.help-hero-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-4);
    color: var(--teal);
}

.help-hero-icon svg {
    width: 100%;
    height: 100%;
}

.help-hero-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.help-hero-subtitle {
    font-size: var(--text-base);
    color: var(--gray-500);
    max-width: 48ch;
    margin: 0 auto;
    line-height: 1.6;
}

/* Core loop boxes */
.help-loop-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.help-loop-box {
    padding: var(--space-5) var(--space-4);
    background: var(--off-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.help-loop-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--teal);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

.help-loop-box-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--gray-900);
}

.help-loop-box-desc {
    font-size: var(--text-sm);
    color: var(--gray-600);
    line-height: 1.5;
}

@media (max-width: 639px) {
    .help-loop-boxes {
        grid-template-columns: 1fr;
    }
}

/* Tab navigation */
.help-tabs {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
    padding: var(--space-1);
    background: var(--off-white);
    border-radius: var(--radius-md);
}

.help-tab {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    white-space: nowrap;
}

.help-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.help-tab:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.help-tab-active {
    background: var(--white);
    color: var(--teal);
    box-shadow: 0 1px 3px oklch(0.15 0.02 210 / 0.08);
}

.help-tab-active:hover {
    background: var(--white);
    color: var(--teal);
}

/* Tab panels */
.help-panel {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: grid;
    gap: var(--space-4);
}

.help-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.help-panel-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.help-panel-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-800);
}

/* Accent colors per topic */
.help-accent-teal { color: var(--teal); }
.help-accent-green { color: oklch(0.52 0.12 155); }
.help-accent-blue { color: oklch(0.50 0.12 240); }
.help-accent-amber { color: oklch(0.58 0.14 75); }
.help-accent-indigo { color: oklch(0.48 0.12 280); }
.help-accent-rose { color: oklch(0.52 0.14 15); }
.help-accent-cyan { color: oklch(0.52 0.10 210); }
.help-accent-slate { color: oklch(0.45 0.04 240); }

.help-panel-header .help-panel-title {
    color: var(--gray-800);
}

.help-panel-list {
    padding-left: var(--space-5);
    display: grid;
    gap: var(--space-2);
    color: var(--gray-600);
    line-height: 1.65;
    list-style-type: '\2713  ';
}

.help-panel-list li::marker {
    color: var(--teal);
}

.help-panel-subtitle {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--gray-700);
}

.help-panel-text {
    color: var(--gray-600);
    line-height: 1.65;
}

.help-panel-text code {
    background: var(--gray-100);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

.help-qa {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-color);
}

.help-qa:first-of-type {
    padding-top: 0;
}

.help-qa:last-of-type {
    border-bottom: none;
}

.help-qa-question {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 var(--space-2) 0;
    line-height: 1.4;
}

.help-qa-answer {
    font-size: var(--text-sm);
    color: var(--gray-600);
    line-height: 1.65;
    margin: 0;
}

.help-screenshot {
    margin-top: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--off-white);
}

.help-screenshot picture,
.help-screenshot img {
    display: block;
}

.help-screenshot img {
    width: 100%;
    height: auto;
}

.help-screenshot figcaption {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-color);
    color: var(--gray-600);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.help-panel-steps {
    padding-left: var(--space-5);
    color: var(--gray-600);
    line-height: 1.65;
    display: grid;
    gap: var(--space-1);
}

/* Install grid */
.help-install-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.help-install-card {
    background: var(--off-white);
    padding: var(--space-4);
    border-radius: var(--radius-md);
}

.help-install-card .help-panel-subtitle {
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
}

/* Anonymous note */
.help-anon-note {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.6;
    padding: var(--space-4);
    background: var(--off-white);
    border-radius: var(--radius-md);
}

/* ============================================
   CONTENT PAGES (Privacy, Terms) - Enhanced
   ============================================ */

.content-page-enhanced {
    display: grid;
    gap: var(--space-6);
}

.content-page-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.content-page-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    color: var(--teal);
}

.content-page-icon svg {
    width: 100%;
    height: 100%;
}

.content-page-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-900);
}

.content-section {
    padding: var(--space-4);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.content-section-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--space-3);
}

.content-section p,
.content-section li {
    color: var(--gray-600);
    line-height: 1.65;
}

.content-section p + p {
    margin-top: var(--space-3);
}

.content-section ul {
    padding-left: var(--space-5);
    display: grid;
    gap: var(--space-2);
}

.content-section code {
    background: var(--gray-100);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}

@media (max-width: 639px) {
    .route-header,
    .route-details,
    .reservation-banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .route-miles {
        text-align: left;
    }

    .button-group {
        justify-content: flex-start;
    }

    .timetable-controls,
    .timetable-row {
        grid-template-columns: 1fr;
    }

    .timetable-row {
        gap: var(--space-2);
    }

    .timetable-route-main {
        gap: var(--space-2);
    }

    .timetable-route-main .route-line {
        min-width: 12px;
    }

    .timetable-time {
        font-size: var(--text-lg);
    }

    .timetable-status {
        justify-content: flex-start;
    }

    .segmented-control {
        margin-bottom: 0;
    }
}

/* ============================================
   DELIGHT: MICRO-INTERACTIONS
   ============================================ */

/* Logo plane lift on hover */
.logo-icon {
    display: inline-flex;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.logo:hover .logo-icon {
    transform: translateY(-2px) rotate(-3deg);
}

/* Checkmark success flash */
.btn-done.success {
    background: var(--success);
    transform: scale(1.1);
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), background 0.15s;
}

.btn-done.success svg {
    animation: checkDraw 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes checkDraw {
    0% { stroke-dashoffset: 24; opacity: 0.5; }
    100% { stroke-dashoffset: 0; opacity: 1; }
}

/* Progress bar entrance */
.progress-fill {
    animation: progressGrow 0.6s cubic-bezier(0.25, 1, 0.5, 1) both;
    animation-delay: 0.15s;
}

@keyframes progressGrow {
    from { max-width: 0; }
    to { max-width: 100%; }
}

/* Miles count-up (JS-driven, this just ensures smooth tabular rendering) */
.miles-value[data-target] {
    font-variant-numeric: tabular-nums;
}

/* Toast stack system */
.toast-stack {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-2);
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}

.toast-item {
    pointer-events: auto;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: 0 8px 24px oklch(0.15 0.02 210 / 0.15);
    animation: toastIn 0.25s cubic-bezier(0.25, 1, 0.5, 1) both;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toast-item.toast-success {
    background: var(--success);
    color: var(--white);
}

.toast-item.toast-error {
    background: var(--error);
    color: var(--white);
}

.toast-item.toast-info {
    background: var(--gray-800);
    color: var(--white);
}

.toast-item.leaving {
    animation: toastOut 0.2s cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-4px) scale(0.96);
    }
}

/* Greeting label transition */
.miles-greeting {
    font-size: var(--text-sm);
    color: var(--gray-500);
    margin-bottom: var(--space-1);
}

/* ============================================
   DELIGHT: Route arc (dashboard recent flight)
   ============================================ */
.route-arc {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-6);
    color: inherit;
    text-decoration: none;
}

.reservation-arc:hover .route-arc-code,
.reservation-arc:focus-visible .route-arc-code {
    color: var(--teal);
}

.route-arc-path {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
}

.route-arc-path-part {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.route-arc-code {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--gray-800);
}

.route-arc-arrow {
    color: var(--gray-300);
}

.route-arc-main {
    display: grid;
    justify-items: center;
    gap: var(--space-1);
}

.route-arc-svg {
    width: 120px;
    height: 32px;
    color: var(--teal);
    flex-shrink: 0;
}

.route-arc-detail {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-1);
    margin-top: var(--space-1);
    max-width: min(420px, 86vw);
}

.route-arc-countdown {
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* ============================================
   DELIGHT: Empty state personality
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-6) var(--space-4);
}

.empty-state-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto var(--space-3);
    color: var(--gray-300);
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state-text {
    color: var(--gray-500);
    font-size: var(--text-sm);
}

/* ============================================
   MILES HERO: Flight-line decoration
   ============================================ */
.miles-flight-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: var(--space-3);
    margin-bottom: var(--space-1);
}

.miles-flight-bar {
    width: 40px;
    height: 1px;
    background: var(--gray-300);
}

.miles-flight-plane {
    width: 14px;
    height: 14px;
    color: var(--teal);
    opacity: 0.5;
}

/* ============================================
   STATS STRIP (dashboard inline stats)
   ============================================ */
.stats-strip {
    display: flex;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.stats-strip-item {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.stats-strip-value {
    font-size: var(--text-lg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--gray-900);
}

.stats-strip-label {
    font-size: var(--text-xs);
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

/* ============================================
   HABIT BOARD (dashboard departure board)
   ============================================ */
.habit-board {
    display: grid;
    gap: 1px;
    background: var(--teal-board);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 1px 3px oklch(0.52 0.1 200 / 0.06);
}

.habit-board-item {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--white);
}

/* Circular progress ring */
.progress-ring {
    width: 44px;
    height: 44px;
    position: relative;
}

.progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: oklch(0.92 0.015 200);
    stroke-width: 3;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--teal);
    stroke-width: 3;
    stroke-linecap: round;
}

.progress-ring-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--gray-600);
}

.habit-board-info {
    min-width: 0;
}

.habit-board-cue {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.habit-board-name {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--gray-900);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.habit-board-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.habit-board-meta-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .habit-board-item {
        grid-template-columns: 40px 1fr 44px;
        gap: 10px;
        padding: var(--space-3);
    }

    .progress-ring {
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   PRACTICE TIMER: Play button (replaces checkmark)
   ============================================ */
.btn-timer {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--teal);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-base);
}

.btn-timer:hover { transform: scale(1.05); }
.btn-timer:active { transform: scale(0.95); }
.btn-timer:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn-timer:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-timer:disabled:hover { transform: none; }

/* Dimmed habit rows during active session */
.habit-board-item.dimmed {
    opacity: 0.35;
    pointer-events: none;
}

/* ============================================
   PRACTICE TIMER: Session takeover panel
   ============================================ */
.session-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px oklch(0.52 0.1 200 / 0.06);
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.session-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--teal-subtle);
    border-bottom: 1px solid var(--border-color);
}

.session-header-left {
    min-width: 0;
}

.session-cue {
    font-size: var(--text-xs);
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-name {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.session-help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    font-size: 9px;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
}

.session-panel-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-6) var(--space-5) var(--space-5);
    gap: var(--space-5);
}

/* Timer ring */
.session-timer {
    width: 140px;
    height: 140px;
    position: relative;
}

.session-timer svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.session-timer-bg {
    fill: none;
    stroke: oklch(0.92 0.015 200);
    stroke-width: 7;
}

.session-timer-fill {
    fill: none;
    stroke: var(--teal);
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.session-timer-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.session-timer-digits {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}

.session-timer-sub {
    font-size: var(--text-xs);
    color: var(--gray-400);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.session-timer.complete .session-timer-digits {
    color: var(--teal);
}

.session-timer.complete .session-timer-sub {
    color: var(--teal);
}

/* Flight path */
.session-flight-path {
    width: 100%;
    max-width: 280px;
}

.session-flight-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.session-flight-code {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--gray-600);
}

.session-flight-code.dest { color: var(--gray-400); }
.session-flight-code.dest.arrived { color: var(--teal); }

.session-flight-track {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
}

.session-flight-line {
    width: 100%;
    height: 2px;
    background: var(--gray-200);
    border-radius: 1px;
    position: relative;
}

.session-flight-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--teal);
    border-radius: 1px;
    transition: width 1s linear;
}

.session-flight-plane {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateX(-50%);
    width: 18px;
    height: 18px;
    color: var(--teal);
    filter: drop-shadow(0 1px 2px oklch(0.3 0.05 200 / 0.3));
    transition: left 1s linear;
}

/* Session status */
.session-status {
    text-align: center;
}

.session-status-primary {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
}

.session-status-secondary {
    font-size: var(--text-xs);
    color: var(--gray-400);
    margin-top: 2px;
}

/* Session actions */
.session-panel-footer {
    display: flex;
    gap: var(--space-2);
    padding: 0 var(--space-4) var(--space-4);
}

.session-btn-abandon {
    flex: 1;
    padding: 11px var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-500);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base);
}

.session-btn-abandon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.session-btn-harvest {
    flex: 2;
    padding: 11px var(--space-4);
    border-radius: var(--radius-md);
    border: none;
    background: var(--teal);
    color: var(--white);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background var(--transition-base), transform var(--transition-fast);
}

.session-btn-harvest:hover { background: var(--teal-hover); }
.session-btn-harvest:active { transform: scale(0.98); }
.session-btn-harvest:disabled { background: var(--gray-300); cursor: not-allowed; }
.session-btn-harvest:disabled:hover { background: var(--gray-300); }

@media (max-width: 480px) {
    .session-timer {
        width: 120px;
        height: 120px;
    }

    .session-timer-digits {
        font-size: 24px;
    }
}

/* ============================================
   HABIT CARD v2 (habits page)
   ============================================ */
.habit-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.habit-card-identity {
    min-width: 0;
    flex: 1;
}

.habit-card-budget {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--gray-400);
    letter-spacing: 0.02em;
    margin-top: var(--space-2);
}

/* Route-style progress indicator */
.route-progress {
    margin-bottom: var(--space-4);
}

.route-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-2);
}

.route-progress-current {
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gray-700);
}

.route-progress-target {
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
}

.route-progress-track-wrap {
    display: grid;
    grid-template-columns: 8px 1fr 8px;
    gap: 0;
    align-items: center;
}

.route-endpoint-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.route-endpoint-dot.origin {
    background: var(--teal);
}

.route-endpoint-dot.dest {
    background: var(--gray-300);
}

.route-progress-track {
    position: relative;
    height: 4px;
    background: oklch(0.92 0.015 200);
}

.route-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--teal);
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.route-progress-plane {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    color: var(--teal);
    filter: drop-shadow(0 1px 2px oklch(0.52 0.1 200 / 0.3));
}

.route-milestone {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--white);
    border: 1.5px solid oklch(0.82 0.025 200);
}

.route-milestone.achieved {
    border-color: var(--teal);
    background: var(--teal-subtle);
}

.route-progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-2);
}

.route-progress-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-400);
}

.route-progress-label.current {
    color: var(--teal);
}

@media (max-width: 480px) {
    .habit-card .habit-formula-behavior {
        font-size: var(--text-base);
    }

    .habit-card .habit-actions {
        flex-wrap: wrap;
    }
}

/* ============================================
   DELIGHT: Challenge completion shimmer
   ============================================ */
.challenge-row .progress-fill.just-completed {
    position: relative;
    overflow: hidden;
}

.challenge-row .progress-fill.just-completed::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        oklch(1 0 0 / 0.4) 50%,
        transparent 100%
    );
    animation: shimmerSweep 0.8s cubic-bezier(0.25, 1, 0.5, 1) 0.3s both;
}

@keyframes shimmerSweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

/* ============================================
   BOARDING PASS
   ============================================ */

.boarding-pass {
    --bp-bg: oklch(0.985 0.006 65);
    --bp-border: oklch(0.89 0.01 65);
    --bp-perf: oklch(0.83 0.012 65);
    --bp-dashed: oklch(0.85 0.01 65);
    --bp-stub-w: 108px;
    --bp-perf-w: 22px;
    --bp-notch-d: 22px;
    width: 100%;
    background: var(--bp-bg);
    border: 1px solid var(--bp-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow:
        0 1px 3px oklch(0.4 0.01 210 / 0.06),
        0 6px 20px oklch(0.4 0.01 210 / 0.035);
    margin-bottom: var(--space-3);
}

.bp-notch {
    position: absolute;
    width: var(--bp-notch-d);
    height: var(--bp-notch-d);
    border-radius: 50%;
    background: var(--white);
    z-index: 10;
    right: calc(var(--bp-stub-w) + var(--bp-perf-w) / 2 - var(--bp-notch-d) / 2);
}

.bp-notch-top { top: calc(38px - var(--bp-notch-d) / 2); }

.bp-header {
    background: var(--teal);
    padding: 10px var(--space-5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.bp-brand {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: oklch(0.97 0.01 200);
}

.bp-type {
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: oklch(0.80 0.04 200);
}

.bp-body {
    display: flex;
    position: relative;
    z-index: 2;
}

.bp-main {
    flex: 1;
    padding: var(--space-5) var(--space-6) var(--space-4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3) var(--space-8);
}

.bp-label {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gray-500);
    line-height: 1;
}

.bp-val {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--gray-900);
    line-height: 1.2;
    margin-top: 5px;
}

.bp-val-code {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    margin-top: 4px;
}

.bp-perf {
    width: var(--bp-perf-w);
    flex-shrink: 0;
    position: relative;
    z-index: 8;
}

.bp-perf::before {
    content: '';
    position: absolute;
    inset: 14px 0;
    background-image: radial-gradient(circle, var(--bp-perf) 1.5px, transparent 1.5px);
    background-size: 3px 9px;
    background-position: center top;
    background-repeat: repeat-y;
}

.bp-stub {
    width: var(--bp-stub-w);
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.bp-route-block { text-align: center; }

.bp-plane {
    display: inline-block;
    color: var(--teal);
    font-size: 0.875rem;
    line-height: 1;
    margin: 4px 0 2px;
    transform: rotate(90deg);
}

.bp-ticket {
    padding: var(--space-3) var(--space-6) var(--space-5);
    border-top: 1px dashed var(--bp-dashed);
    position: relative;
    z-index: 2;
}

.bp-ticket-inner {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    margin-top: 2px;
}

.bp-barcode-wrap {
    flex: 1;
    min-width: 0;
}

.bp-barcode-svg {
    display: block;
    width: 100%;
    height: 48px;
    margin-top: 7px;
}

.bp-qr-wrap {
    display: none;
    margin-top: 7px;
}

.bp-qr-wrap svg {
    display: block;
    max-width: 96px;
    height: auto;
}

.bp-uuid {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--gray-500);
    letter-spacing: 0.03em;
    margin-top: var(--space-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bp-copy {
    flex-shrink: 0;
    padding: 7px var(--space-4);
    background: var(--teal);
    color: oklch(0.97 0.01 200);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transition-base);
}

.bp-copy:hover { background: var(--teal-hover); }

@media (max-width: 420px) {
    .boarding-pass {
        --bp-stub-w: 90px;
        --bp-perf-w: 18px;
        --bp-notch-d: 18px;
    }
    .bp-main {
        gap: var(--space-3) var(--space-5);
        padding: var(--space-4);
    }
    .bp-val { font-size: 1rem; }
    .bp-val-code { font-size: 1.25rem; }
    .bp-ticket { padding: var(--space-3) var(--space-4) var(--space-4); }
    .bp-stub { padding: var(--space-3) var(--space-3) var(--space-3) var(--space-2); }
    .bp-barcode-svg { display: none; }
    .bp-qr-wrap { display: block; }
}

/* ============================================
   DELIGHT: Miles pulse on redemption
   ============================================ */
.miles-value.pulse {
    animation: milesPulse 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes milesPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* ============================================
   PUBLIC PROFILE
   ============================================ */

/* Hero */
.profile-hero {
    padding: var(--space-10) 0 var(--space-8);
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-10);
}
.profile-callsign {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}
.profile-summary {
    display: flex;
    gap: var(--space-8);
    margin-top: var(--space-6);
    font-size: var(--text-sm);
    color: var(--gray-500);
}
.profile-summary strong {
    font-weight: 600;
    color: var(--gray-800);
    font-variant-numeric: tabular-nums;
}

/* Base note */
.base-note {
    font-size: var(--text-xs);
    color: var(--gray-400);
    margin-top: var(--space-3);
}

/* Airport tags (bases) */
.airport-tag {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--off-white);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1.6;
}
.airport-tag-iata {
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--gray-800);
}
.airport-tag-city {
    color: var(--gray-400);
    font-size: var(--text-xs);
}

/* Airport heatmap */
.heatmap-legend {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    font-size: var(--text-xs);
    color: var(--gray-500);
}
.heatmap-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.heatmap-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.heatmap-legend-swatch.swatch-visited { background: var(--teal); }
.heatmap-legend-swatch.swatch-transited { background: oklch(0.78 0.06 200); }
.heatmap-legend-swatch.swatch-unvisited { background: var(--gray-100); }

.heatmap-regions {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}
.heatmap-region {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}
.heatmap-region-label {
    flex-shrink: 0;
    width: 80px;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--gray-400);
    padding-top: 1px;
    text-align: right;
}
.heatmap-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}
.heatmap-block {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    position: relative;
    cursor: default;
}
.heatmap-block.hm-unvisited { background: var(--gray-100); }
.heatmap-block.hm-visited { background: var(--teal); }
.heatmap-block.hm-transited { background: oklch(0.78 0.06 200); }
.heatmap-block.bm-earned { background: oklch(0.62 0.14 55); }
.heatmap-block.bm-unearned { background: var(--gray-100); }
.heatmap-legend-swatch.swatch-badge-earned { background: oklch(0.62 0.14 55); }
.heatmap-legend-swatch.swatch-badge-unearned { background: var(--gray-100); }

.heatmap-block .heatmap-tip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    padding: var(--space-1) var(--space-2);
    background: var(--gray-800);
    color: var(--white);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    pointer-events: none;
    z-index: 10;
}
.heatmap-block .heatmap-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--gray-800);
}
.heatmap-block:hover .heatmap-tip {
    display: block;
}

/* Badge grid */
.pub-badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}
.pub-badge-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    background: var(--off-white);
    border-radius: var(--radius-md);
    min-width: 180px;
    flex: 1 1 180px;
    max-width: 280px;
}
.pub-badge-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-800);
}
.pub-badge-desc {
    font-size: var(--text-xs);
    color: var(--gray-500);
    line-height: 1.4;
}
.pub-badge-difficulty {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--teal);
}

/* Year chips */
.year-chips {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
}
.year-chip {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    background: var(--off-white);
    color: var(--gray-500);
    border: none;
    cursor: pointer;
    transition: all 0.1s var(--ease-out);
}
.year-chip:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}
.year-chip.active {
    background: var(--teal);
    color: var(--white);
}

/* Flight journal */
.journal-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}
.journal-count {
    font-size: var(--text-xs);
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
}
.journal-entry {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: var(--space-5);
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--gray-100);
}
.journal-entry:last-child { border-bottom: none; }

.journal-date { text-align: right; padding-top: 2px; }
.journal-date-day {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.journal-date-month {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.journal-flight { min-width: 0; }
.journal-route {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
    flex-wrap: wrap;
}
.journal-iata {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--gray-900);
}
.journal-arrow {
    color: var(--gray-300);
    font-size: var(--text-sm);
}
.journal-cities {
    font-size: var(--text-sm);
    color: var(--gray-400);
    flex-basis: 100%;
    margin-top: -2px;
}
.journal-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}
.journal-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--gray-600);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}
.journal-chip-time {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-500);
}
.journal-bullet {
    color: var(--gray-300);
    font-size: var(--text-xs);
    user-select: none;
}
.journal-meta {
    font-size: var(--text-xs);
    color: var(--gray-500);
}
.journal-badge {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px var(--space-2);
    border-radius: var(--radius-sm);
}
.journal-badge-return {
    background: var(--teal-subtle);
    color: var(--teal);
}
.journal-badge-oneway {
    background: var(--gray-100);
    color: var(--gray-500);
}
.journal-badge-positioning {
    background: var(--warning-bg);
    color: oklch(0.50 0.12 75);
}

.journal-segments {
    margin-top: var(--space-3);
    padding-left: var(--space-4);
    border-left: 2px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.journal-segment {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--gray-600);
}
.journal-segment-code {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--gray-700);
    min-width: 56px;
}
.journal-segment-route {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}
.journal-segment-time {
    color: var(--gray-400);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
    .profile-callsign { font-size: var(--text-xl); }
    .profile-summary { gap: var(--space-5); flex-wrap: wrap; }
    .journal-entry { grid-template-columns: 56px 1fr; gap: var(--space-3); }
    .journal-iata { font-size: var(--text-base); }
    .heatmap-region-label { width: 64px; font-size: 0.625rem; }
    .heatmap-block { width: 9px; height: 9px; }
    .pub-badge-item { min-width: 140px; }
}

/* ============================================
   GLOBAL STATS (OPS CENTER)
   ============================================ */
.ops-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-900);
}
.ops-header h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.ops-header .ops-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-400);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ops-section-header {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-200);
}

/* Anchor stats quadrant */
.anchor-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 36px;
}
.anchor-stat {
    padding: 16px 20px;
}
.anchor-stat:nth-child(1) { border-bottom: 1px solid var(--gray-200); border-right: 1px solid var(--gray-200); }
.anchor-stat:nth-child(2) { border-bottom: 1px solid var(--gray-200); }
.anchor-stat:nth-child(3) { border-right: 1px solid var(--gray-200); }
.anchor-stat .anchor-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-400);
    margin-bottom: 4px;
}
.anchor-stat .anchor-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--gray-900);
    line-height: 1;
}
.anchor-stat:first-child .anchor-value { color: var(--teal); }

/* Horizontal bar destinations */
.dest-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 36px;
}
.dest-bar-row {
    display: grid;
    grid-template-columns: 48px 1fr 64px;
    gap: 10px;
    align-items: center;
    padding: 3px 0;
}
.dest-iata {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--gray-800);
}
.dest-bar-track {
    height: 22px;
    background: var(--off-white);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.dest-bar-fill {
    height: 100%;
    background: var(--teal-subtle);
    border-radius: 3px;
    position: relative;
    min-width: 2px;
}
.dest-bar-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--teal);
    border-radius: 0 3px 3px 0;
}
.dest-bar-city {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6875rem;
    color: var(--gray-600);
    white-space: nowrap;
    z-index: 1;
}
.dest-count {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Flight log table */
.log-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 36px;
}
.log-table th {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-400);
    text-align: left;
    padding: 0 6px 8px;
    border-bottom: 1px solid var(--gray-200);
}
.log-table th:last-child { text-align: right; }
.log-table td {
    padding: 8px 6px;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}
.log-table tr:last-child td { border-bottom: none; }
.log-table .td-callsign { font-weight: 600; }
.log-table .td-callsign a { color: var(--gray-800); text-decoration: none; }
.log-table .td-callsign a:hover { color: var(--teal); }
.log-table .td-route {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--gray-600);
}
.log-table .td-codes { font-size: 0.6875rem; color: var(--gray-400); }
.log-table .td-type { font-size: 0.6875rem; color: var(--gray-500); }
.log-table .td-time {
    font-size: 0.6875rem;
    color: var(--gray-400);
    text-align: right;
    white-space: nowrap;
}
.badge-pos {
    display: inline-block;
    font-size: 0.5625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--warning-bg);
    color: oklch(0.50 0.12 75);
    margin-left: 4px;
    vertical-align: 1px;
}

/* Crew roster (leaderboard) */
.crew-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2px;
}
.crew-member {
    background: var(--off-white);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.crew-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.crew-rank {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--gray-400);
    width: 20px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.crew-rank.top { color: var(--teal); }
.crew-name { font-weight: 600; font-size: var(--text-sm); }
.crew-name a { color: var(--gray-800); text-decoration: none; }
.crew-name a:hover { color: var(--teal); }
.crew-miles {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .anchor-stats { grid-template-columns: 1fr; }
    .anchor-stat { border-right: none !important; border-bottom: 1px solid var(--gray-200); }
    .anchor-stat:last-child { border-bottom: none; }
    .anchor-stat .anchor-value { font-size: var(--text-xl); }
    .dest-bar-row { grid-template-columns: 40px 1fr 52px; gap: 6px; }
    .log-table th:nth-child(3),
    .log-table td:nth-child(3) { display: none; }
    .crew-roster { grid-template-columns: 1fr; }
    .ops-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* Reduced motion: disable all delight animations */
@media (prefers-reduced-motion: reduce) {
    .logo-icon,
    .btn-done,
    .btn-done.success,
    .progress-fill,
    .toast-item,
    .miles-value.pulse,
    .challenge-row .progress-fill.just-completed::after {
        animation: none !important;
        transition: none !important;
    }
}
