:root {
    --bg: #efe3cf;
    --bg-soft: #f7f1e6;
    --panel: rgba(255, 250, 244, 0.88);
    --panel-strong: rgba(255, 250, 244, 0.96);
    --ink: #1d2630;
    --ink-soft: #55606d;
    --line: rgba(29, 38, 48, 0.12);
    --accent: #0f766e;
    --accent-strong: #0b4f49;
    --accent-soft: rgba(15, 118, 110, 0.12);
    --danger: #b45309;
    --shadow: 0 24px 60px rgba(38, 35, 28, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(180, 83, 9, 0.16), transparent 28%),
        linear-gradient(180deg, #f7f0e5 0%, #ebddc8 100%);
    color: var(--ink);
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

#stats-app {
    min-height: 100vh;
}

.stats-shell {
    min-height: 100vh;
    padding: 32px;
}

.stats-header,
.stats-layout,
.stats-sidebar,
.stats-content,
.content-panel,
.login-modal {
    backdrop-filter: blur(18px);
}

.stats-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding: 24px 28px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(255, 250, 244, 0.92), rgba(255, 246, 237, 0.74));
    box-shadow: var(--shadow);
}

.stats-kicker {
    margin: 0 0 8px;
    color: var(--accent-strong);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.stats-title {
    margin: 0;
    font-size: clamp(40px, 6vw, 68px);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.stats-auth-button,
.refresh-button,
.login-submit,
.union-item,
.stats-tab,
.day-tab {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.stats-auth-button,
.refresh-button,
.login-submit {
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    box-shadow: 0 16px 30px rgba(15, 118, 110, 0.22);
}

.stats-auth-button {
    padding: 14px 22px;
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stats-auth-button:hover,
.refresh-button:hover,
.login-submit:hover,
.union-item:hover,
.stats-tab:hover,
.day-tab:hover {
    transform: translateY(-1px);
}

.stats-error-banner {
    margin-bottom: 18px;
    padding: 16px 20px;
    border: 1px solid rgba(180, 83, 9, 0.18);
    border-radius: 18px;
    background: rgba(255, 245, 231, 0.92);
    color: var(--danger);
    box-shadow: 0 12px 28px rgba(180, 83, 9, 0.08);
}

.stats-layout {
    display: grid;
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
    gap: 24px;
}

.stats-sidebar,
.stats-content,
.content-panel {
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 28px;
    background: linear-gradient(135deg, var(--panel-strong), var(--panel));
    box-shadow: var(--shadow);
}

.stats-sidebar {
    display: flex;
    flex-direction: column;
    padding: 22px;
    min-height: calc(100vh - 174px);
}

.stats-content {
    padding: 22px;
}

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

.panel-heading h2 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.panel-heading span {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.panel-heading--wide {
    margin-bottom: 24px;
}

.panel-subtitle {
    margin: 6px 0 0;
    color: var(--ink-soft);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel-empty {
    border: 1px dashed var(--line);
    border-radius: 22px;
    padding: 24px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.42);
    text-align: center;
}

.panel-empty--large {
    min-height: 220px;
    display: grid;
    place-items: center;
}

.union-list {
    display: grid;
    gap: 12px;
    overflow-y: auto;
    padding-right: 6px;
}

.union-item {
    display: grid;
    gap: 6px;
    width: 100%;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.56);
    color: var(--ink);
    text-align: left;
}

.union-item--active {
    border-color: rgba(15, 118, 110, 0.34);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(15, 118, 110, 0.06));
    box-shadow: 0 18px 28px rgba(15, 118, 110, 0.12);
}

.union-item__abbr {
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.union-item__name {
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.4;
}

.stats-tabs,
.day-tabs,
.checkbox-row,
.filters-row,
.filters-grid,
.subnav-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stats-tabs {
    justify-content: flex-end;
}

.stats-tab,
.day-tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--ink-soft);
}

.stats-tab {
    padding: 10px 16px;
}

.stats-tab--active,
.day-tab--active {
    border-color: rgba(15, 118, 110, 0.35);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(15, 118, 110, 0.08));
    color: var(--accent-strong);
}

.content-panel {
    padding: 20px;
    min-height: 640px;
}

.filters-row {
    align-items: end;
    justify-content: space-between;
    margin-bottom: 18px;
}

.filters-row--stacked {
    align-items: stretch;
}

.filters-grid {
    align-items: end;
}

.filters-row label,
.week-select {
    display: grid;
    gap: 8px;
    color: var(--ink-soft);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filters-row input,
.week-select select {
    min-width: 168px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
}

.checkbox-row {
    align-items: center;
    color: var(--ink-soft);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.refresh-button,
.login-submit {
    padding: 12px 18px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.54);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.44);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.stats-table th,
.stats-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(29, 38, 48, 0.08);
    text-align: left;
}

.stats-table th {
    position: sticky;
    top: 0;
    background: rgba(247, 241, 230, 0.96);
    color: var(--accent-strong);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(29, 38, 48, 0.36);
}

.login-modal {
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(255, 250, 244, 0.96), rgba(250, 246, 238, 0.92));
    box-shadow: 0 28px 60px rgba(29, 38, 48, 0.22);
}

.login-modal__header {
    margin-bottom: 20px;
}

.login-modal__header h2 {
    margin: 0;
    font-size: 34px;
    letter-spacing: -0.05em;
}

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

.login-form label {
    display: grid;
    gap: 8px;
    color: var(--ink-soft);
    font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-form input {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
}

.login-error {
    margin: 0;
    color: var(--danger);
}

@media (max-width: 980px) {
    .stats-shell {
        padding: 18px;
    }

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

    .stats-sidebar {
        min-height: auto;
    }

    .stats-tabs {
        justify-content: flex-start;
    }

    .panel-heading--wide {
        flex-direction: column;
    }
}

