/* Reset and base styles */
:root {
    /* Brand / role tokens — named by use, not color, so the palette can be
       re-skinned in one place. Current values from doc/design.md. */
    --brand-color: #41766c; /* core brand UI: headings, links, active states, in-app primary (Turquoise) */
    --brand-hover: #365f57; /* brand darkened ~10% for hover */
    --brand-muted: #8ca4a0; /* muted brand accent (Seafoam) */
    --dark-surface: #203447; /* dark backgrounds: footer, hero (Navy) */
    --on-dark-color: #f7f3f0; /* text / icons on dark surfaces (Cream) */
    --text-strong: #203447; /* strong dark text on light & CTA fills (Navy) */
    --cta-color: var(--primary-color); /* highest-emphasis CTA fill (Coral) */
    --cta-hover: var(--primary-hover);
    --cta-secondary-color: #e6c79c; /* secondary CTA fill (Sand) */

    /* Typography — see doc/design.md */
    --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Inter Tight', 'Inter', 'Segoe UI', system-ui, sans-serif; /* large display headings */

    /* Colors */
    --primary-color: rgb(250 114 104);
    --primary-transparent: rgba(250, 114, 104, 0.1);
    --secondary-color: #333;
    --background-color: #fffaf6;
    --text-color: #333;
    --light-bg-color: #e9f4ff;
    --light-text-color: white;
    --text-secondary: #666;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;

    --tertiary-color: #17484e;
    --tertiary-light-bg: #e8f4f0;

    /* Form colors */
    --success-color: #4caf50;
    --success-hover: #45a049;
    --success-light-bg: #f0f9f0;
    --success-lighter-bg: #e8f5e9;
    --error-color: #f44336;
    --error-light-bg: #ffeeee;
    --warning-color: #ff9800;
    --warning-light-bg: #fff8e1;
    --warning-light-border: #ffe082;
    --warning-amber: #f59e0b;
    --warning-amber-bg: #fef3c7;
    --warning-amber-text: #92400e;
    --info-color: #2196f3;
    --info-light-bg: #e3f2fd;
    --info-text-color: #1565c0;

    /* Member-type badge tokens (Contact vs. Client indicator pills). */
    --badge-contact-bg: #e8f0fd;
    --badge-contact-text: #1a56db;
    --badge-client-bg: #def7ec;
    --badge-client-text: #046c4e;
    --external-contact-color: #64748b;
    --purple-color: #9c27b0;
    --indigo-color: #3f51b5;
    --indigo-light-bg: #e8eaf6;
    --border-color: #ddd;
    --form-bg: #f9f9f9;
    --readonly-bg: #f5f5f5;
    --surface-color: #fff;
    --background-light: #f8f9fa; /* subtle section/card fill on light pages */
    --background-alt: #f1f3f5; /* alternating rows, hover, neutral chips */
    --muted-text-color: #888;
    --tooltip-bg: #1e293b;

    /* Locked bill states */
    --locked-unpaid-bg: #fffbeb;
    --locked-unpaid-border: #f59e0b;
    --locked-unpaid-hover-bg: #fef3c7;
    --locked-unpaid-hover-border: #d97706;
    --locked-paid-bg: #f0fdf4;
    --locked-paid-border: #22c55e;
    --locked-paid-hover-bg: #dcfce7;
    --locked-paid-hover-border: #16a34a;
    --locked-badge-bg: #fef3c7;
    --locked-badge-text: #92400e;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;

    /* Admin colors */
    --admin-primary: #2196f3;
    --admin-success: #4caf50;
    --admin-danger: #f44336;
    --admin-warning: #ff9800;
    --admin-table-header: #f2f2f2;
    --admin-table-border: #ddd;
    --admin-table-hover: #f5f5f5;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Shadows */
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);

    /* Border radius */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 24px;
    --border-radius-pill: 999px;

    /* Provider avatar palette — lavender entry (no matching general-purpose variable) */
    --avatar-lavender-bg: #f0eef9;
    --avatar-lavender-color: #6b5ca5;

    /* Book-flow design tokens */
    --book-dark: #15202c;
    --book-muted: #15202c;
    --book-warm-border: #d8d0c6;
    --book-warm-accent: #f6e8d4;
    --book-warm-white: #fff8f7;
    --book-warm-surface: #f7f3f0;
    --book-muted-teal: #8ca4a0;
    --book-slate: #4a5560;
    --book-teal-border: #b1c0be;
    --primary-hover: #e86055;
    --brand-focus-shadow: rgba(54, 95, 87, 0.2);
    --error-light-border: #fed7d7;
    --otp-expired-bg: #f0f4ff;
    --otp-expired-border: #c7d2fe;
    --otp-expired-icon: #4f46e5;
    --otp-expired-text: #3730a3;
    --otp-expired-muted: #4338ca;

    /* Typography scale — see doc/design.md. Snap font-size declarations to the
       nearest step; use line-height tokens for leading. */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --leading-none: 1;
    --leading-tight: 1.2;
    --leading-snug: 1.4;
    --leading-normal: 1.5;
    --leading-relaxed: 1.6;
}

/* Typography utility classes — for migrating one-off inline font-size /
   line-height styles. Prefer component CSS for repeated patterns. */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.leading-none { line-height: var(--leading-none); }
.leading-tight { line-height: var(--leading-tight); }
.leading-snug { line-height: var(--leading-snug); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Default font */

body,
button,
input,
select,
textarea {
    font-family: var(--font-sans);
    font-weight: 400;
    font-style: normal;
    font-size: var(--text-md);
}

body {
    line-height: var(--leading-tight);
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Header styles */
header {
    background: var(--surface-color);
    color: var(--text-color);
    text-align: center;
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 200; /* Higher than side nav */
}

header h1 {
    font-size: var(--text-2xl);
    font-weight: 300;
    margin-bottom: 10px;
}

/* Navigation */
header nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 5px 0;
}

header nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 3px;
}

header nav a:hover,
header nav a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

header .logo-text {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: opacity 0.2s ease;
}

header .logo-text:hover {
    opacity: 0.7;
    text-decoration: none;
}

/* Main content */
main {
    padding: var(--spacing-xl) 0;
    min-height: calc(100vh - 200px);
}

.container {
    padding: var(--spacing-md);
}

h2 {
    color: var(--text-color);
    margin-bottom: var(--spacing-lg);
    font-size: var(--text-2xl);
    font-weight: normal;
}

h3 {
    color: var(--secondary-color);
    margin: var(--spacing-xl) 0 var(--spacing-md) 0;
    font-size: var(--text-xl);
}

p {
    margin-bottom: var(--spacing-lg);
    font-size: var(--text-md);
}

/* Features list */
.features ul {
    list-style: none;
    padding-left: 0;
}

.features li {
    background: var(--light-bg-color);
    margin: var(--spacing-sm) 0;
    padding: var(--spacing-md);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-size: var(--text-md);
}

.features li:before {
    content: '✓ ';
    color: var(--primary-color);
    font-weight: bold;
    margin-right: var(--spacing-sm);
}

/* Footer styles — minimal app footer (see doc/design.md) */
footer {
    background: var(--dark-surface);
    color: var(--on-dark-color);
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
    margin-top: var(--spacing-sm);
}

footer p {
    margin: 0;
    font-size: var(--text-sm);
}

.footer-version {
    margin-top: var(--spacing-xs);
    font-size: var(--text-xs);
    opacity: 0.7;
}

/* Responsive design */

@media (max-width: 768px) {
    header h1 {
        font-size: var(--text-2xl);
    }

    .container {
        margin: 0 var(--spacing-md);
        padding: var(--spacing-sm);
    }

    h2 {
        font-size: var(--text-xl);
    }

    .date-range-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Filter chip */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--info-light-bg);
    border: 1px solid var(--info-color);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: var(--text-sm);
}

.filter-chip-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--text-md);
    line-height: var(--leading-none);
    color: var(--text-muted);
}

/* Info banner */
.info-banner {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--info-light-bg);
    color: var(--info-text-color);
    border-radius: var(--border-radius-md);
    font-size: var(--text-sm);
}

.info-banner .material-symbols-outlined {
    font-size: var(--text-md);
    vertical-align: middle;
}
