:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #162033;
    --muted: #667085;
    --line: #e4e7ec;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --warning-bg: #fff7ed;
    --warning-line: #fed7aa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #eef4ff 0%, var(--bg) 42%, #f8fafc 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: white;
    box-shadow: 0 20px 55px rgba(15, 23, 42, 0.10);
}

.login-card h1 {
    margin: 0 0 10px;
    font-size: clamp(28px, 5vw, 40px);
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.login-form label {
    display: grid;
    gap: 8px;
    font-weight: 800;
    color: var(--muted);
}

.login-form input {
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    font: inherit;
    color: var(--text);
}

.login-submit {
    width: 100%;
    border: 0;
    justify-content: center;
    cursor: pointer;
}

.error-box {
    margin-top: 18px;
    padding: 12px 14px;
    border: 1px solid #fecaca;
    border-radius: 16px;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 800;
}

.page {
    width: min(1600px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    letter-spacing: -0.04em;
}

.subtitle {
    margin: 10px 0 0;
    color: var(--muted);
}

.refresh {
    flex: 0 0 auto;
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.refresh:hover {
    background: var(--accent-dark);
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-link {
    background: #0f172a;
}

.admin-link:hover {
    background: #334155;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.checkbox-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.checkbox-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-control input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.auto-refresh-note {
    color: var(--muted);
    font-size: 13px;
}

.toolbar-right {
    width: min(100%, calc((100% - 28px) / 3));
    min-width: 280px;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.search-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-panel span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.search-panel input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    color: var(--text);
    font: inherit;
    outline: none;
}

.search-panel input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.hidden-column,
.hidden-row {
    display: none;
}

.card,
.stat-card,
.table-card,
.toolbar {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(8px);
}

.card,
.stat-card,
.toolbar {
    padding: 18px;
}

.settings-form {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.radio-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
    font-weight: 800;
    cursor: pointer;
}

.radio-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.stat-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.stat-card strong {
    font-size: 22px;
}

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

.warning code {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: white;
}

.table-card {
    overflow: hidden;
}

.table-wrap {
    max-height: calc(100vh - 235px);
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
    vertical-align: top;
}

th:last-child,
td:last-child {
    border-right: 0;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fbff;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.7);
}

tr:hover td {
    background: #eff6ff;
}

td.date-mismatch,
tr:nth-child(even) td.date-mismatch,
tr:hover td.date-mismatch {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 800;
}

.pdf-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.pdf-link:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

.admin-column {
    white-space: nowrap;
    background: rgba(255, 247, 237, 0.7);
}

.danger-zone h2 {
    margin-top: 0;
}

.confirm-input {
    width: min(420px, 100%);
    margin-right: 10px;
    padding: 12px 14px;
    border: 1px solid var(--warning-line);
    border-radius: 14px;
    font: inherit;
}

.danger-button {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: #dc2626;
    color: white;
    font-weight: 800;
    cursor: pointer;
}

.danger-button:hover {
    background: #b91c1c;
}

.danger-button.small {
    padding: 8px 12px;
    font-size: 12px;
}

.audit-list {
    padding-left: 20px;
}

.audit-list li {
    margin-bottom: 8px;
}

@media (max-width: 760px) {
    .hero {
        align-items: flex-start;
        flex-direction: column;
    }

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

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

    .toolbar-right {
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }

    .refresh {
        width: 100%;
        text-align: center;
    }
}
