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

:root {
    color-scheme: light;
    --fc-surface: #faf8f5;
    --fc-surface-elevated: #ffffff;
    --fc-foreground: #1c1917;
    --fc-foreground-muted: #6b645c;
    --fc-foreground-subtle: #948c82;
    --fc-border: #e6dfd5;
    --fc-border-muted: #f0eae1;
    --fc-brand: #b93b3b;
    --fc-brand-muted: rgba(185, 59, 59, 0.12);
    --fc-success: #2b7d5a;
    --fc-success-muted: rgba(43, 125, 90, 0.14);
    --fc-warning: #c28723;
    --fc-warning-muted: rgba(194, 135, 35, 0.14);
    --fc-info: #2d6fa8;
    --fc-info-muted: rgba(45, 111, 168, 0.14);
    --fc-highlight: #178998;
    --fc-highlight-muted: rgba(23, 137, 152, 0.14);
    --fc-destructive: #b93b3b;
    --fc-destructive-muted: rgba(185, 59, 59, 0.14);
    --fc-overlay: rgba(28, 25, 23, 0.4);
    --fc-brand-badge: #8c2525;
    --fc-brand-badge-bg: #fbe6e4;
    --fc-info-badge: #1d3e66;
    --fc-info-badge-bg: #dbe7f6;
    --fc-warning-badge: #73531a;
    --fc-warning-badge-bg: #faedd2;
    --fc-success-badge: #195034;
    --fc-success-badge-bg: #d6f0e2;
    --fc-highlight-badge: #164a50;
    --fc-highlight-badge-bg: #d2eaee;
    --fc-destructive-badge: #7a2525;
    --fc-destructive-badge-bg: #f8d7d7;
    --fc-neutral-badge: #4a443b;
    --fc-neutral-badge-bg: #f2ece5;
    --fc-star: #d9911e;
    --fc-star-muted: #d0c7ba;
    --lightningcss-light: initial;
    --lightningcss-dark: ;

    --bg: var(--fc-surface);
    --card: var(--fc-surface-elevated);
    --border: var(--fc-border);
    --text: var(--fc-foreground);
    --muted: var(--fc-foreground-muted);
    --muted-dark: var(--fc-foreground-subtle);

    --registration: var(--fc-foreground);
    --checkin: var(--fc-brand);
}

body {
    min-height: 100vh;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #faf8f5;
    color: var(--text);
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================================
            HEADER
        ========================================================= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
}

.title-section h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.7px;
}

.title-section p {
    margin-top: 8px;
    color: var(--muted);
    font-size: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* =========================================================
            DATE SELECTOR & CONTROLS
        ========================================================= */
.date-control {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--fc-surface-elevated);
    border: 1px solid var(--border);
}

.date-control label {
    color: var(--muted);
    font-size: 12px;
}

.date-control input {
    border: none;
    outline: none;
    color: var(--fc-foreground);
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    color-scheme: light;
}

.date-control input::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.mode-switch {
    display: flex;
    padding: 3px;
    border-radius: 10px;
    background: var(--fc-surface-elevated);
    border: 1px solid var(--border);
}

.mode-button {
    border: none;
    outline: none;
    padding: 7px 11px;
    border-radius: 7px;
    background: transparent;
    color: var(--fc-foreground-subtle);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-button.active {
    background: var(--fc-border-muted);
    color: var(--fc-foreground);
}

.live-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 30px;
    background: var(--fc-surface-elevated);
    border: 1px solid var(--border);
    color: var(--fc-foreground-muted);
    font-size: 12px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fc-success);
    box-shadow: 0 0 10px var(--fc-success-muted);
    animation: pulse 1.8s infinite;
}

.live-dot.error {
    background: var(--fc-destructive);
    box-shadow: 0 0 10px var(--fc-destructive-muted);
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.45;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.report-button {
    text-decoration: none;
    border: none;
    outline: none;
    line-height: 1.1;
    padding: 10px 16px;
    border-radius: 30px;
    background: var(--fc-brand);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(185, 59, 59, 0.2);
}

.report-button:hover {
    background: #9e2e2e;
    transform: translateY(-1px);
}

/* =========================================================
            REPORT MODAL
        ========================================================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--fc-overlay);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--fc-surface-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    margin-bottom: 25px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.form-group input[type="date"] {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    background: var(--fc-surface);
    border: 1px solid var(--border);
    color: var(--fc-foreground);
    color-scheme: dark;
    font-family: inherit;
}

.checkbox-group {
    display: flex;
    gap: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input {
    accent-color: var(--checkin);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-cancel:hover {
    background: var(--fc-border-muted);
}

/* =========================================================
            CHART CARDS
        ========================================================= */

.chart-card {
    padding: 28px;
    margin-bottom: 20px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(40, 30, 20, 0.04);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding: 12px 20px;
    background: #fbf9f6;
    border-radius: 12px;
    border: 1px solid var(--fc-border-muted);
}

.chart-header>div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    gap: 30px;
}

.chart-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.chart-info {
    color: var(--fc-foreground-subtle);
    font-size: 12px;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 360px;
}

.error-message {
    display: none;
    padding: 14px 16px;
    margin-bottom: 20px;
    border-radius: 10px;
    background: var(--fc-destructive-muted);
    border: 1px solid var(--fc-destructive);
    color: var(--fc-destructive);
    font-size: 14px;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    color: var(--muted-dark);
    font-size: 13px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.refresh-button {
    visibility: hidden;
    border: none;
    outline: none;
    padding: 10px 17px;
    border-radius: 10px;
    background: var(--fc-surface-elevated);
    border: 1px solid var(--fc-border);
    color: var(--fc-foreground-muted);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.refresh-button:hover {
    background: var(--fc-border-muted);
}

.refresh-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

@media (max-width: 850px) {
    body {
        padding: 25px 15px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: flex-start;
    }


    .chart-header {
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .title-section h1 {
        font-size: 26px;
    }

    .header-right {
        flex-direction: column;
        align-items: stretch;
    }

    .date-control {
        justify-content: space-between;
    }

    .mode-switch {
        width: 100%;
    }

    .mode-button {
        flex: 1;
    }

    .live-status {
        width: fit-content;
    }


    .stat-value {
        font-size: 48px;
    }

    .chart-card {
        padding: 20px;
    }

    .chart-wrapper {
        height: 300px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
    }
}