/* ===================================
   GLOBAL STYLES & RESET
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0b4da2;
    --primary-dark: #083a7a;
    --primary-light: #e8f0fb;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --accent: #d4a12a;
    --accent-dark: #b38822;
    --accent-light: #fdf3dc;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px -1px rgba(11, 77, 162, 0.1), 0 2px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 28px -4px rgba(11, 77, 162, 0.15), 0 4px 12px -4px rgba(0,0,0,0.08);
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --bg-subtle: #f0f4f8;

    /* Animation timing */
    --anim-fast: 0.15s;
    --anim-base: 0.28s;
    --anim-slow: 0.5s;
    --anim-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --anim-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Fuzio Brand Colors */
    --fuzio-blue: #0b4da2;
    --fuzio-blue-dark: #083a7a;
    --fuzio-blue-mid: #1560c0;
    --fuzio-gold: #d4a12a;
    --fuzio-gold-dark: #b38822;
    --fuzio-gold-light: #fdf3dc;
    --fuzio-gray: #64748b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

body.modal-open {
    overflow: hidden;
}

/* ===================================
   NAVIGATION
   =================================== */
.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(11, 77, 162, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    /* Gold accent bar at top */
    border-top: 3px solid var(--fuzio-gold);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--fuzio-blue);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-links a {
    padding: 0.5rem 0.875rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--anim-fast) var(--anim-ease);
    position: relative;
}

.nav-links a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-links a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0.5rem;
    right: 0.5rem;
    height: 2px;
    background: var(--fuzio-gold);
    border-radius: 1px;
}

.nav-signout {
    font-size: 0.8rem;
    opacity: 0.85;
}

.nav-signout:hover {
    opacity: 1;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.nav-role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-mid));
    color: white;
    vertical-align: middle;
    box-shadow: 0 1px 4px rgba(11, 77, 162, 0.3);
}

/* ===================================
   LAYOUT
   =================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===================================
   CARDS
   =================================== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin-bottom: 0;
}

/* ===================================
   METRICS GRID
   =================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--primary);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-left: 4px solid var(--primary);
    transition: transform var(--anim-base) var(--anim-ease), box-shadow var(--anim-base) var(--anim-ease);
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.metric-card.warning {
    border-left-color: var(--warning);
}

.metric-card.danger {
    border-left-color: var(--danger);
}

.metric-value {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-mid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    line-height: 1.2;
    word-break: break-all;
}

.metric-card.warning .metric-value {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
}

.metric-card.danger .metric-value {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

/* Metric progress bar */
.metric-progress {
    margin-top: 0.625rem;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.metric-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fuzio-blue), var(--fuzio-gold));
    border-radius: 2px;
    transition: width 0.6s var(--anim-ease);
}

.metric-progress-fill.warning {
    background: var(--warning);
}

/* Cycle status row */
.cycle-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cycle-status-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cycle-scheme-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.cycle-period {
    font-size: 0.875rem;
}

/* ===================================
   BUTTONS
   =================================== */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    /* transition defined in ANIMATIONS section */
}

.btn-primary {
    background: linear-gradient(135deg, var(--fuzio-blue-mid, #1560c0), var(--primary-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(11, 77, 162, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 4px 14px rgba(11, 77, 162, 0.35);
}

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

.btn-secondary:hover {
    background: #475569;
}

.btn-danger {
    background: linear-gradient(135deg, #f05252, #dc2626);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.btn-success {
    background: linear-gradient(135deg, #34d399, #059669);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #10b981, #047857);
}

/* Gold accent button */
.btn-accent {
    background: linear-gradient(135deg, var(--fuzio-gold), var(--fuzio-gold-dark));
    color: white;
    box-shadow: 0 2px 8px rgba(212, 161, 42, 0.25);
}

.btn-accent:hover {
    background: linear-gradient(135deg, var(--fuzio-gold-dark), #996f10);
    box-shadow: 0 4px 14px rgba(212, 161, 42, 0.35);
}

/* Outline style variant */
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-large {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.reading-photo-preview {
    display: block;
    max-width: 100%;
    max-height: 240px;
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: var(--bg-secondary);
}

.existing-photo-evidence {
    margin-top: 0.75rem;
}

/* ===================================
   FORMS
   =================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 77, 162, 0.12);
}

/* Subtle label float hint */
.form-group input,
.form-group select,
.form-group textarea {
    transition: border-color var(--anim-fast) var(--anim-ease), box-shadow var(--anim-fast) var(--anim-ease);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.info-box {
    background: var(--primary-light);
    border-left: 3px solid var(--fuzio-gold);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.transfer-import-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
}

.transfer-import-actions {
    margin-top: 0;
}

.transfer-result {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 0.875rem;
}

.transfer-result.success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.transfer-result.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* ===================================
   TABLES
   =================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: linear-gradient(to right, var(--bg-tertiary), var(--bg-secondary));
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    transition: background var(--anim-fast) var(--anim-ease);
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.table-wrapper {
    overflow-x: auto;
}

/* ===================================
   BADGES & STATUS
   =================================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: var(--fuzio-gold-light, #fdf3dc);
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-gold {
    background: var(--fuzio-gold-light);
    color: var(--fuzio-gold-dark);
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-right: 1rem;
}

.cycle-status {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.cycle-status.open .status-badge {
    background: var(--success);
    color: white;
}

.cycle-status.closed .status-badge {
    background: var(--secondary);
    color: white;
}

.cycle-list,
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cycle-list-item,
.schedule-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.cycle-list-item.selected {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.cycle-list-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.status-badge-inline {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.capture-cycle-selector {
    min-width: min(360px, 100%);
}

.capture-cycle-selector label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.schedule-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.schedule-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.schedule-toggle input {
    width: auto;
}

/* ===================================
   TABS
   =================================== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color var(--anim-fast) var(--anim-ease), border-color var(--anim-fast) var(--anim-ease);
    margin-bottom: -2px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--fuzio-gold);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===================================
   MODAL
   =================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1100;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.reading-modal {
    width: min(760px, 100%);
    max-height: min(88vh, 900px);
    overflow-y: auto;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg-tertiary);
}

.modal form {
    padding: 1.5rem;
}

/* ===================================
   FILTERS
   =================================== */
.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

/* ===================================
   EXPORT PAGE
   =================================== */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.export-buttons .btn {
    text-align: left;
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ===================================
   RESPONSIVE (MOBILE)
   =================================== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }

    .nav-links {
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .container {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

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

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }

    .cycle-list-item,
    .schedule-list-item,
    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .capture-cycle-selector {
        min-width: 100%;
    }

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

    .transfer-import-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .data-table {
        font-size: 0.75rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

/* ===================================
   ONBOARDING WIZARD
   =================================== */
.onboarding-wizard {
    max-width: 900px;
    margin: 0 auto;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 3rem;
}

.onboarding-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.onboarding-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.onboarding-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--bg-primary);
    border: 2px solid var(--border);
    transition: all 0.3s;
}

.onboarding-step.active {
    border-color: var(--primary);
    background: #eff6ff;
}

.onboarding-step.completed {
    border-color: var(--success);
    background: #f0fdf4;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.onboarding-step.active .step-number {
    background: var(--primary);
    color: white;
}

.onboarding-step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-info {
    text-align: center;
}

.step-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.step-description {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.onboarding-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    min-height: 400px;
    box-shadow: var(--shadow-md);
}

.step-content h2 {
    margin-bottom: 1rem;
}

.existing-items {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.existing-items h3 {
    font-size: 1rem;
    color: var(--success);
    margin-bottom: 0.5rem;
}

.existing-items ul {
    list-style: none;
    padding-left: 0;
}

.existing-items li {
    padding: 0.25rem 0;
    color: var(--text-primary);
}

.onboarding-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.readiness-summary {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.readiness-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.readiness-item.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.readiness-item.warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.readiness-icon {
    font-size: 2rem;
}

.readiness-details h3 {
    margin-bottom: 0.25rem;
}

.readiness-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.readiness-issue {
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.readiness-issue.success {
    background: #f0fdf4;
}

.readiness-issue.warning {
    background: #fef3c7;
}

.readiness-issue ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.onboarding-final-note {
    background: #eff6ff;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.onboarding-final-note h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.onboarding-final-note ul {
    list-style: none;
    padding-left: 0;
}

.onboarding-final-note li {
    padding: 0.25rem 0;
}

/* ===================================
   SETUP HEALTH PANEL
   =================================== */
.setup-health-panel {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.setup-health-panel.success {
    border-left: 4px solid var(--success);
}

.setup-health-panel.warning {
    border-left: 4px solid var(--warning);
}

.setup-health-panel.danger {
    border-left: 4px solid var(--danger);
}

.health-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.health-icon {
    font-size: 1.5rem;
}

.health-summary {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.health-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.health-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.health-item.issue {
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.health-item.warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.health-item.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.item-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.item-content {
    flex: 1;
}

.item-message {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.item-details {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.item-action {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.item-action:hover {
    text-decoration: underline;
}

.health-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.health-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.health-badge.warning,
.health-badge.critical {
    background: #fed7aa;
    color: #92400e;
}

/* ===================================
   FIRST-TIME CHECKLIST
   =================================== */
.first-time-checklist {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.checklist-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.checklist-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-text {
    font-weight: 600;
    font-size: 0.875rem;
}

.dismiss-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.2);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-bar-fill {
    background: white;
    height: 100%;
    transition: width 0.3s;
}

.checklist-items {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.checklist-item.completed {
    background: rgba(255, 255, 255, 0.15);
}

.item-status {
    flex-shrink: 0;
}

.status-icon {
    font-size: 1.25rem;
    display: block;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.item-title a {
    color: white;
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.5);
}

.item-title a:hover {
    border-bottom-style: solid;
}

.item-description {
    font-size: 0.875rem;
    opacity: 0.9;
}

.checklist-complete {
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.success-message {
    margin-bottom: 1rem;
    font-weight: 600;
}

.checklist-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* ===================================
   READING CAPTURE ENHANCED
   =================================== */
.reading-modal .meter-info-card {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meter-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.meter-location {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.last-reading-badge {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.expected-range-card {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.expected-range-card.no-history {
    background: #fef3c7;
    border-color: #fcd34d;
}

.range-icon {
    font-size: 2rem;
}

.range-title {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.range-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

.expected-reading-hint {
    background: #f0fdf4;
    border: 1px solid #86efac;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hint-icon {
    font-size: 1.25rem;
}

.validation-feedback {
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.feedback-message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.feedback-message.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.feedback-message.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.feedback-message.warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.feedback-message.error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.feedback-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.feedback-content {
    flex: 1;
}

.feedback-main {
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.feedback-context {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.reading-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
}

.status-icon {
    font-size: 0.75rem;
}

/* ===================================
   CYCLE CLOSE MODAL
   =================================== */
.cycle-close-modal {
    max-width: 600px;
}

.cycle-info-header {
    margin-bottom: 1.5rem;
}

.closure-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.closure-status.complete {
    background: #f0fdf4;
    border: 2px solid #86efac;
}

.closure-status.incomplete {
    background: #fef3c7;
    border: 2px solid #fcd34d;
}

.status-icon-large {
    font-size: 3rem;
}

.status-content h3 {
    margin-bottom: 0.25rem;
}

.closure-summary {
    margin-bottom: 1.5rem;
}

.closure-summary h4 {
    margin-bottom: 1rem;
}

.summary-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.summary-item.success {
    background: #f0fdf4;
}

.summary-item.warning {
    background: #fef3c7;
}

.summary-item.info {
    background: #eff6ff;
}

.summary-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.125rem;
}

.summary-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
    text-decoration: underline;
}

.expand-btn:hover {
    text-decoration: none;
}

.expandable-content {
    margin: 0.5rem 0 0 3rem;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-sm);
}

.expandable-content ul {
    margin-bottom: 0.5rem;
}

.closure-warnings {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.closure-warnings h4 {
    margin-bottom: 0.5rem;
}

.closure-warnings ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.closure-ready {
    background: #f0fdf4;
    border: 1px solid #86efac;
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.closure-ready h4 {
    color: var(--success);
    margin-bottom: 0.5rem;
}

.closure-confirmation {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.closure-confirmation ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

/* ===================================
   FUZIO BRANDING & READER INTERFACE
   =================================== */

/* Fuzio Brand Colors */
:root {
    --fuzio-blue: #0b4da2;
    --fuzio-blue-dark: #083a7a;
    --fuzio-gold: #d4a12a;
    --fuzio-gold-dark: #b38822;
    --fuzio-gray: #64748b;
}

/* Reader Body */
.reader-body {
    background: linear-gradient(135deg, var(--fuzio-blue) 0%, var(--fuzio-blue-dark) 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* Reader Header */
.reader-header {
    background: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-bottom: 4px solid var(--fuzio-gold);
}

.reader-header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.reader-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.reader-header h1 {
    color: var(--fuzio-blue);
    font-size: 1.75rem;
    margin: 0;
    font-weight: 700;
}

.reader-header .subtitle {
    color: var(--fuzio-gray);
    font-size: 0.9rem;
    margin: 0.25rem 0 0 0;
}

/* Reader Container */
.reader-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Reader Context Card */
.reader-context-card {
    background: white;
    border-left: 4px solid var(--fuzio-blue);
    margin-bottom: 1.5rem;
}

.context-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.reader-progress {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.reader-progress.bulk {
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-dark));
    color: white;
}

.reader-progress.unit {
    background: linear-gradient(135deg, var(--fuzio-gold), var(--fuzio-gold-dark));
    color: white;
}

/* Instructions Card */
.instructions-card {
    background: #f0f7ff;
    border-left: 4px solid var(--fuzio-blue);
}

.instructions-card h3 {
    color: var(--fuzio-blue);
    margin-top: 0;
}

.instructions-card ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
    line-height: 1.8;
}

.instruction-tip {
    margin-top: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--fuzio-gray);
}

/* Reader Input */
.reader-input-large {
    font-size: 1.5rem !important;
    padding: 1rem !important;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--fuzio-blue);
}

.reader-input-large:focus {
    border-color: var(--fuzio-gold);
    box-shadow: 0 0 0 3px rgba(212, 161, 42, 0.1);
}

.input-feedback {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-feedback.success {
    background: #ecfdf5;
    color: #059669;
    border-left: 3px solid #059669;
}

.input-feedback.warning {
    background: #fef3c7;
    color: #d97706;
    border-left: 3px solid #d97706;
}

.input-feedback.info {
    background: #dbeafe;
    color: #2563eb;
    border-left: 3px solid #2563eb;
}

/* Reader Submit Button */
.reader-submit {
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-dark)) !important;
    border: none !important;
    font-size: 1.1rem !important;
    padding: 1rem 2rem !important;
    font-weight: 600 !important;
}

.reader-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(11, 77, 162, 0.3);
}

/* Error and Success Cards */
.error-card,
.success-card {
    text-align: center;
    padding: 3rem 2rem;
}

.submission-identity-panel {
    max-width: 620px;
    margin: 1.5rem auto 0;
    text-align: left;
}

.submission-identity-panel .info-box {
    text-align: left;
}

.error-icon,
.completion-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-icon {
    color: var(--danger);
}

.completion-icon {
    display: inline-block;
    width: 80px;
    height: 80px;
    line-height: 80px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 50%;
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

/* ===================================
   ON-SITE MODE INTERFACE
   =================================== */

/* On-Site Capture Screen */
.onsite-capture-screen {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* On-Site Header */
.onsite-header {
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-dark));
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.onsite-scheme-name {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.onsite-progress-text {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Progress Bar */
.onsite-progress-container {
    background: white;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.onsite-progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.onsite-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fuzio-gold), var(--fuzio-gold-dark));
    transition: width 0.3s ease;
}

/* Meter Card */
.onsite-meter-card {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.onsite-building {
    font-size: 0.85rem;
    color: var(--fuzio-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.onsite-unit {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--fuzio-blue);
    margin-bottom: 0.5rem;
}

.onsite-meter-number {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.onsite-last-reading {
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* On-Site Form */
.onsite-form {
    padding: 1.5rem;
}

.onsite-input-large {
    width: 100%;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    padding: 1.25rem;
    border: 3px solid var(--fuzio-blue);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.onsite-input-large:focus {
    border-color: var(--fuzio-gold);
    box-shadow: 0 0 0 4px rgba(212, 161, 42, 0.15);
    outline: none;
}

.onsite-feedback {
    text-align: center;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 500;
}

.onsite-feedback.success {
    background: #ecfdf5;
    color: #059669;
}

.onsite-feedback.warning {
    background: #fef3c7;
    color: #d97706;
}

.onsite-feedback.error {
    background: #fee2e2;
    color: #dc2626;
}

/* On-Site Actions */
.onsite-actions-primary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.onsite-actions-primary .btn {
    flex: 1;
    font-size: 1.1rem;
    padding: 1rem;
    font-weight: 600;
}

.onsite-btn-submit {
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-dark)) !important;
    color: white !important;
    border: none !important;
}

.onsite-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(11, 77, 162, 0.3);
}

.onsite-btn-flag {
    background: white !important;
    color: var(--danger) !important;
    border: 2px solid var(--danger) !important;
}

.onsite-btn-flag:hover {
    background: var(--danger) !important;
    color: white !important;
}

.onsite-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 0 1.5rem 1.5rem;
}

/* Confirm/correct meter info disclosure */
.onsite-confirm-details {
    margin: 0 1.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.onsite-confirm-summary {
    cursor: pointer;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-subtle, #f8f9fa);
    user-select: none;
    list-style: none;
}
.onsite-confirm-summary::-webkit-details-marker { display: none; }
.onsite-confirm-summary::before { content: '▸ '; }
.onsite-confirm-details[open] .onsite-confirm-summary::before { content: '▾ '; }
.onsite-confirm-body {
    padding: 1rem;
    background: white;
    border-top: 1px solid var(--border);
}
.onsite-confirm-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

/* Meter type pill selector (on-site capture) */
.meter-type-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.375rem;
}

.meter-type-btn {
    padding: 0.35rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        border-color var(--anim-fast, 0.15s) ease,
        background-color var(--anim-fast, 0.15s) ease,
        color var(--anim-fast, 0.15s) ease;
}

.meter-type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: none; /* override global btn lift */
    box-shadow: none;
}

.meter-type-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Toast notification */
.onsite-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #2e7d32;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    z-index: 9999;
    white-space: nowrap;
    animation: toastIn 0.2s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.onsite-btn-pause {
    background: white !important;
    color: var(--fuzio-gray) !important;
    border: 1px solid var(--border) !important;
}

/* Issue Flagging Modal */
.onsite-issue-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.onsite-issue-content {
    background: white;
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.onsite-issue-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.onsite-issue-header h3 {
    margin: 0;
    color: var(--fuzio-blue);
}

.onsite-issue-body {
    padding: 1.5rem;
}

.issue-option {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.issue-option:hover {
    border-color: var(--fuzio-blue);
    background: #f8fafc;
}

.issue-option.selected {
    border-color: var(--fuzio-blue);
    background: #f0f7ff;
}

.issue-option strong {
    display: block;
    color: var(--fuzio-blue);
    margin-bottom: 0.25rem;
}

/* Completion Screen */
.onsite-completion-screen {
    text-align: center;
    padding: 3rem 2rem;
}

.onsite-completion-screen .completion-icon {
    margin-bottom: 1.5rem;
}

.onsite-completion-screen h2 {
    color: var(--fuzio-blue);
    margin-bottom: 1rem;
}

.completion-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.completion-stat {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.completion-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--fuzio-blue);
    margin-bottom: 0.25rem;
}

.completion-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.completion-buildings {
    text-align: left;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: var(--radius);
}

.completion-buildings h4 {
    color: var(--fuzio-blue);
    margin-bottom: 1rem;
}

.building-summary {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.building-summary:last-child {
    border-bottom: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .reader-header {
        padding: 1rem;
    }

    .reader-header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .reader-logo {
        height: 50px;
    }

    .reader-container {
        margin: 1rem auto;
    }

    .onsite-input-large {
        font-size: 1.5rem;
    }

    .onsite-unit {
        font-size: 1.5rem;
    }

    .onsite-progress-text {
        font-size: 1.25rem;
    }
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user span {
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===================================
   LOGIN PAGE
   =================================== */
.login-body {
    background: linear-gradient(135deg, var(--fuzio-blue), var(--fuzio-blue-dark));
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.guest-access-panel {
    margin-top: 1.5rem;
}

.guest-access-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.guest-access-divider::before,
.guest-access-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--fuzio-gold);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 80px;
    margin-bottom: 1.5rem;
}

.login-header h1 {
    color: var(--fuzio-blue);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-footer .text-muted {
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ===================================
   DEV CONSOLE
   =================================== */
.health-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.health-metric {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 2px solid var(--border);
}

.health-metric.health-good {
    border-color: var(--success);
    background: #f0fdf4;
}

.health-metric.health-issues {
    border-color: var(--warning);
    background: #fef3c7;
}

.health-icon {
    font-size: 2rem;
}

.health-info {
    flex: 1;
}

.health-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.health-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.health-issues-list {
    margin-top: 2rem;
}

.health-issues-list h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

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

.activity-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.activity-details {
    font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Issue sections styling */
.issue-section {
    margin-bottom: 1.5rem;
}

.issue-section h4 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    border-left: 4px solid;
    position: relative;
    padding-right: 2.5rem;
}

.alert-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    color: inherit;
    padding: 0;
}

.alert-close:hover {
    opacity: 1;
}

.alert-danger {
    background: #fee;
    border-color: #dc3545;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert strong {
    font-weight: 600;
}

.alert .text-muted {
    color: inherit;
    opacity: 0.7;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: block;
}

.health-issues-list {
    margin-top: 2rem;
}

.health-issues-list h3 {
    margin-bottom: 1rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.danger-zone {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.danger-zone .btn {
    flex: 1;
    min-width: 150px;
}

/* Collapsible danger zone on dashboard */
.danger-zone-details {
    border: 1px solid #fca5a5 !important;
    background: #fff5f5 !important;
}

.danger-zone-details[open] {
    border-color: var(--danger) !important;
}

.danger-zone-summary {
    font-weight: 600;
    color: var(--danger);
    cursor: pointer;
    padding: 0.25rem 0;
    list-style: none;
    user-select: none;
}

.danger-zone-summary::-webkit-details-marker { display: none; }

.danger-zone-summary::before {
    content: '▶ ';
    font-size: 0.7em;
    vertical-align: middle;
}

.danger-zone-details[open] .danger-zone-summary::before {
    content: '▼ ';
}

.danger-zone-body {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.danger-zone-body p {
    flex: 1;
    font-size: 0.875rem;
}

/* Focus rings */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ===================================
   ANIMATIONS
   =================================== */

/* Reduced-motion override — must come first */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Keyframes --- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-18px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

/* --- Page-load: navbar --- */
.navbar {
    animation: slideDown var(--anim-base) var(--anim-ease) both;
}

/* --- Page-load: page header --- */
.page-header {
    animation: fadeUp var(--anim-slow) var(--anim-ease) 0.05s both;
}

/* --- Metric cards stagger on page load --- */
.metrics-grid .metric-card:nth-child(1) { animation: fadeUp 0.42s var(--anim-ease) 0.08s both; }
.metrics-grid .metric-card:nth-child(2) { animation: fadeUp 0.42s var(--anim-ease) 0.16s both; }
.metrics-grid .metric-card:nth-child(3) { animation: fadeUp 0.42s var(--anim-ease) 0.24s both; }
.metrics-grid .metric-card:nth-child(4) { animation: fadeUp 0.42s var(--anim-ease) 0.32s both; }
.metrics-grid .metric-card:nth-child(5) { animation: fadeUp 0.42s var(--anim-ease) 0.40s both; }
.metrics-grid .metric-card:nth-child(6) { animation: fadeUp 0.42s var(--anim-ease) 0.48s both; }

/* --- Cards stagger in groups --- */
.card { animation: fadeUp 0.38s var(--anim-ease) 0.06s both; }
.card:nth-child(2) { animation-delay: 0.12s; }
.card:nth-child(3) { animation-delay: 0.18s; }
.card:nth-child(4) { animation-delay: 0.24s; }

/* --- Login card entrance --- */
.login-card {
    animation: scaleIn 0.38s var(--anim-spring) both;
}

/* --- Modal slide-up --- */
.modal-content {
    animation: fadeUp 0.28s var(--anim-ease) both;
}

/* --- Tab content fade-in --- */
.tab-content.active {
    animation: fadeIn var(--anim-fast) var(--anim-ease) both;
}

/* --- Button hover lift --- */
.btn {
    transition:
        transform var(--anim-fast) var(--anim-ease),
        box-shadow var(--anim-fast) var(--anim-ease),
        background-color var(--anim-fast) var(--anim-ease),
        color var(--anim-fast) var(--anim-ease),
        opacity var(--anim-fast) var(--anim-ease);
}
.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}
.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

/* --- Card hover lift (subtle) --- */
.card {
    transition: box-shadow var(--anim-base) var(--anim-ease), border-color var(--anim-base) var(--anim-ease);
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(11, 77, 162, 0.15);
}

/* --- Cycle list items --- */
.cycle-list-item,
.schedule-list-item {
    transition: border-color var(--anim-fast) var(--anim-ease), box-shadow var(--anim-fast) var(--anim-ease), background var(--anim-fast) var(--anim-ease);
}
.cycle-list-item:hover,
.schedule-list-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(11, 77, 162, 0.1);
    background: var(--primary-light);
}

/* --- Scroll-reveal utility --- */
/* Elements start invisible; JS adds .is-visible when in viewport */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition:
        opacity var(--anim-slow) var(--anim-ease),
        transform var(--anim-slow) var(--anim-ease);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-18px);
    transition:
        opacity var(--anim-slow) var(--anim-ease),
        transform var(--anim-slow) var(--anim-ease);
}
.reveal-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Stagger delays within a .reveal-group container */
.reveal-group > .reveal:nth-child(1),
.reveal-group > .reveal-left:nth-child(1) { transition-delay: 0s; }
.reveal-group > .reveal:nth-child(2),
.reveal-group > .reveal-left:nth-child(2) { transition-delay: 0.07s; }
.reveal-group > .reveal:nth-child(3),
.reveal-group > .reveal-left:nth-child(3) { transition-delay: 0.14s; }
.reveal-group > .reveal:nth-child(4),
.reveal-group > .reveal-left:nth-child(4) { transition-delay: 0.21s; }
.reveal-group > .reveal:nth-child(5),
.reveal-group > .reveal-left:nth-child(5) { transition-delay: 0.28s; }
.reveal-group > .reveal:nth-child(6),
.reveal-group > .reveal-left:nth-child(6) { transition-delay: 0.35s; }

/* ===================================
   CLOUD SYNC INDICATOR
   =================================== */
.cloud-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all var(--anim-fast) var(--anim-ease);
    user-select: none;
}
.cloud-sync-indicator:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.cloud-sync-indicator.syncing {
    color: var(--primary);
    border-color: var(--primary);
}
.cloud-sync-indicator.syncing .sync-dot {
    animation: syncPulse 1s var(--anim-ease) infinite;
}
.cloud-sync-indicator.error {
    color: var(--danger);
    border-color: var(--danger);
}
.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
@keyframes syncPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

/* ===================================
   WARNING BUTTON
   =================================== */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

/* ===================================
   COLLAPSIBLE SECTION
   =================================== */
.section-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0.125rem 0;
}
.section-toggle-header h2 { margin-bottom: 0; }
.toggle-chevron {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s var(--anim-ease);
    padding: 0.3rem;
    border-radius: 4px;
}
.section-toggle-header:hover .toggle-chevron { background: var(--bg-tertiary); color: var(--primary); }
.toggle-chevron.open { transform: rotate(180deg); }

.collapsible-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
}
.collapsible-body.open {
    max-height: 800px;
    opacity: 1;
}

/* ===================================
   EMPTY STATE
   =================================== */
.cycle-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.cycle-empty-state .empty-icon {
    font-size: 2.75rem;
    margin-bottom: 1rem;
    opacity: 0.55;
    display: block;
}
.cycle-empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}
.cycle-empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

/* ===================================
   SKELETON LOADERS
   =================================== */
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.skeleton-line {
    height: 0.875rem;
    margin-bottom: 0.625rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}
.skeleton-line.w-full { width: 100%; }
.skeleton-line.w-3-4 { width: 75%; }
.skeleton-line.w-1-2 { width: 52%; }
.skeleton-line.w-1-3 { width: 35%; }
.skeleton-line.tall { height: 1.25rem; }
.skeleton-block {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    animation: skeleton-pulse 1.6s ease-in-out infinite;
}
.skeleton-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.skeleton-card + .skeleton-card { animation-delay: 0.18s; }
.skeleton-card + .skeleton-card + .skeleton-card { animation-delay: 0.36s; }

/* ===================================
   READER HEADER SCROLL-SHRINK
   =================================== */
.reader-header {
    transition: padding 0.28s ease, box-shadow 0.28s ease;
}
.reader-header.scrolled {
    padding: 0.5rem 2rem;
    box-shadow: 0 4px 20px rgba(11, 77, 162, 0.22);
}
.reader-header.scrolled .reader-logo { height: 32px; transition: height 0.28s ease; }
.reader-header.scrolled h1 { font-size: 1.05rem; transition: font-size 0.28s ease; }
.reader-header.scrolled .subtitle { display: none; }

/* ===================================
   READING SUCCESS FLASH
   =================================== */
@keyframes flash-scale-in {
    0% { transform: scale(0.35); opacity: 0; }
    65% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
.reading-success-flash {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    background: rgba(16, 185, 129, 0.07);
    pointer-events: none;
}
.reading-success-flash .flash-check {
    width: 96px;
    height: 96px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.75rem;
    color: white;
    box-shadow: 0 8px 36px rgba(16, 185, 129, 0.5);
    animation: flash-scale-in 0.45s var(--anim-spring) forwards;
}

/* ===================================
   TAB SLIDE TRANSITION
   =================================== */
.tab-content.active {
    animation: tab-slide-in 0.22s ease forwards;
}
@keyframes tab-slide-in {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===================================
   READER PROGRESS BAR
   =================================== */
.reader-progress-wrap {
    padding: 0.75rem 1.5rem;
    background: var(--fuzio-blue-dark);
}
.reader-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}
.reader-progress-fill {
    height: 100%;
    background: var(--fuzio-gold);
    border-radius: 2px;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.reader-progress-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.35rem;
    text-align: right;
    letter-spacing: 0.04em;
}

/* ===================================
   CYCLE CONTROL BAR (Capture section header)
   =================================== */
.cycle-control-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.cycle-control-scheme {
    flex: 1;
    min-width: 200px;
}
.cycle-control-scheme label {
    display: block;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}
.cycle-control-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .navbar,
    .action-buttons,
    .form-actions,
    .btn {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border);
    }
}
