:root {
    --red-950: #620508;
    --red-900: #85070c;
    --red-800: #a90d12;
    --red-700: #c9161d;
    --red-600: #df3028;
    --gold-500: #f2bd4d;
    --gold-300: #ffe0a1;
    --paper: #fffaf2;
    --paper-strong: #fffdf8;
    --ink: #2b1713;
    --muted: #80645d;
    --line: rgba(139, 22, 18, 0.16);
    --blue-gray: #31566b;
    --shadow: 0 22px 56px rgba(91, 6, 9, 0.22);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
    color: var(--ink);
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
}

.red-body,
.login-body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(99, 5, 8, 0.26), rgba(99, 5, 8, 0.94) 430px, #f7efe4 431px),
        url("red-masthead-bg.png") top center / 100% 410px no-repeat,
        var(--red-900);
}

.red-shell {
    width: min(1280px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 42px;
}

.masthead {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 230px;
    padding: 30px 34px 26px;
    overflow: hidden;
    border: 1px solid rgba(255, 224, 161, 0.26);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(109, 5, 8, 0.92), rgba(184, 18, 20, 0.7) 48%, rgba(109, 5, 8, 0.42)),
        url("red-masthead-bg.png") center / cover no-repeat;
    color: #fff;
    box-shadow: var(--shadow);
}

.compact-masthead {
    min-height: 194px;
}

.masthead-content {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-right: 74px;
}

.brand-mark {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 68px;
    height: 68px;
    border: 2px solid rgba(255, 224, 161, 0.86);
    border-radius: 50%;
    background: linear-gradient(145deg, #f9d67b, #fff5cf 45%, #c7161d 46%, #8b070c);
    color: #fff8de;
    font-size: 30px;
    font-weight: 800;
    text-shadow: 0 2px 9px rgba(95, 8, 8, 0.42);
    box-shadow: 0 12px 28px rgba(85, 4, 8, 0.28);
}

.brand-copy {
    min-width: 0;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--gold-300);
    font-size: 13px;
    font-weight: 700;
}

.brand-copy h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.14;
    font-weight: 800;
    letter-spacing: 0;
    text-shadow: 0 4px 16px rgba(70, 3, 6, 0.38);
}

.brand-copy p:last-child {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 16px;
    line-height: 1.7;
}

.logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    background: #fff7df;
    color: var(--red-800);
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(81, 4, 7, 0.18);
}

.masthead-logout {
    position: absolute;
    top: 24px;
    right: 26px;
    z-index: 2;
}

.dashboard-card {
    border: 1px solid rgba(255, 238, 210, 0.92);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.96);
    box-shadow: 0 18px 42px rgba(117, 12, 14, 0.13);
}

.filter-card {
    margin-top: 18px;
    padding: 18px;
}

.dashboard-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(190px, 1fr)) minmax(230px, 1.2fr) 86px;
    gap: 14px;
    align-items: center;
}

.platform-filter {
    grid-template-columns: repeat(4, minmax(180px, 1fr)) 86px;
}

.filter-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.filter-label {
    flex: 0 0 auto;
}

.dashboard-filter input,
.dashboard-filter select {
    width: 100%;
    height: 36px;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid rgba(151, 39, 28, 0.26);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    outline: 0;
}

.dashboard-filter input:focus,
.dashboard-filter select:focus {
    border-color: var(--red-600);
    box-shadow: 0 0 0 3px rgba(223, 48, 40, 0.12);
}

.dashboard-filter > button {
    width: 86px;
    height: 36px;
    border: 0;
    border-radius: 6px;
    background: linear-gradient(180deg, #e53a30, #ae0e14);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 12px 24px rgba(174, 14, 20, 0.2);
}

.filter-error {
    margin: 12px 0 0;
    color: #b00020;
    font-size: 14px;
    font-weight: 700;
}

.chart-card {
    margin-top: 16px;
    padding: 22px 22px 24px;
}

.chart-summary {
    display: flex;
    justify-content: flex-end;
}

.chart-total {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 6px;
    background: #fff0c4;
    color: var(--red-800);
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
}

.table-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.table-titlebar h2 {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
    line-height: 1.25;
}

.table-titlebar strong {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 6px;
    background: #fff0c4;
    color: var(--red-800);
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
}

.bar-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(64px, 1fr);
    align-items: end;
    gap: 18px;
    min-height: 430px;
    margin-top: 12px;
    padding: 38px 10px 14px;
    overflow-x: auto;
    background:
        linear-gradient(to top, rgba(145, 46, 37, 0.12) 1px, transparent 1px) 0 43px / 100% 64px,
        linear-gradient(180deg, rgba(255, 250, 242, 0.72), rgba(255, 255, 255, 0));
}

.bar-item {
    display: grid;
    grid-template-rows: 26px 300px 28px;
    gap: 8px;
    min-width: 64px;
    align-items: end;
    justify-items: center;
}

.bar-value {
    color: var(--red-800);
    font-size: 13px;
    font-weight: 800;
    line-height: 20px;
    white-space: nowrap;
}

.bar-track {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 300px;
    border-radius: 6px;
}

.bar-fill {
    display: block;
    width: min(48px, 68%);
    height: var(--bar-percent);
    min-height: 2px;
    border: 1px solid rgba(136, 11, 15, 0.16);
    border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, var(--gold-300), #f1a43c 38%, var(--red-700));
    box-shadow: 0 10px 20px rgba(181, 18, 22, 0.2);
}

.bar-label {
    align-self: start;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 22px;
}

.empty-state {
    grid-column: 1 / -1;
    align-self: center;
    justify-self: center;
    color: var(--muted);
    font-size: 15px;
}

.table-card {
    margin-top: 16px;
    padding: 22px;
}

.table-wrap {
    margin-top: 18px;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-align: center;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    height: 46px;
    padding: 10px 12px;
    border-right: 1px solid rgba(139, 22, 18, 0.12);
    border-bottom: 1px solid rgba(139, 22, 18, 0.12);
}

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

.admin-table tr:last-child td {
    border-bottom: 0;
}

.admin-table thead th {
    background: linear-gradient(180deg, #bf151c, #8f090e);
    color: #fff8e6;
    font-weight: 800;
}

.admin-table tbody tr:nth-child(even) td {
    background: #fff8ed;
}

.admin-table tbody td {
    background: #fffdf9;
}

.admin-table .empty-row td {
    color: #b00020;
    font-weight: 800;
}

.month-col {
    width: 18%;
}

.school-col {
    width: 42%;
}

.data-col {
    width: 40%;
}

.serial-col {
    width: 9%;
}

.platform-school-col {
    width: 28%;
}

.month-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 132px;
    min-width: 132px;
}

.filter-field .month-picker input {
    padding-right: 34px;
}

.month-trigger {
    position: absolute;
    top: 9px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--red-700);
    font-size: 16px;
    line-height: 18px;
}

.month-panel {
    position: absolute;
    z-index: 30;
    top: 42px;
    left: 0;
    width: 280px;
    overflow: hidden;
    border: 1px solid rgba(139, 22, 18, 0.18);
    border-radius: 8px;
    background: #fffdf8;
    box-shadow: 0 18px 36px rgba(89, 9, 10, 0.22);
    color: var(--ink);
    font-size: 14px;
}

.month-panel-header {
    display: grid;
    grid-template-columns: 52px 1fr 52px;
    align-items: center;
    height: 44px;
    background: linear-gradient(180deg, #c9161d, #8f090e);
    color: #fff8e6;
    text-align: center;
}

.month-panel-header strong {
    font-weight: 800;
}

.month-nav {
    height: 44px;
    border: 0;
    background: transparent;
    color: #fff8e6;
    font-size: 28px;
    line-height: 44px;
}

.month-nav:disabled {
    color: rgba(255, 255, 255, 0.45);
    cursor: default;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 18px;
}

.month-cell {
    height: 34px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #fff8ed;
    color: var(--muted);
    font-size: 14px;
}

.month-cell:hover,
.month-cell.active {
    border-color: rgba(201, 22, 29, 0.24);
    background: #c9161d;
    color: #fff8e6;
}

.month-panel-footer {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 10px;
    border-top: 1px solid rgba(139, 22, 18, 0.12);
    background: #fff8ed;
}

.month-panel-footer span {
    flex: 1;
    color: var(--muted);
    font-size: 13px;
}

.month-panel-footer button {
    width: 48px;
    height: 28px;
    margin-left: 6px;
    border: 1px solid rgba(139, 22, 18, 0.18);
    border-radius: 6px;
    background: #fff;
    color: var(--red-800);
    font-size: 13px;
    font-weight: 700;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    padding: 34px 36px 30px;
    border: 1px solid rgba(255, 236, 190, 0.94);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.97);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-mark {
    margin: 0 auto 18px;
}

.login-card h1 {
    margin: 0;
    color: var(--red-900);
    font-size: 26px;
    line-height: 1.35;
    font-weight: 800;
}

.login-subtitle {
    margin: 8px 0 24px;
    color: var(--muted);
    font-size: 14px;
}

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

.login-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(151, 39, 28, 0.26);
    border-radius: 6px;
    background: #fff;
}

.login-form input:focus {
    border-color: var(--red-600);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(223, 48, 40, 0.12);
}

.login-form button {
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: linear-gradient(180deg, #e53a30, #ae0e14);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.login-error {
    padding: 9px 10px;
    border: 1px solid #d45252;
    border-radius: 6px;
    background: #fff0f0;
    color: #b00020;
    font-size: 13px;
}

.login-hint {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 980px) {
    .red-shell {
        width: min(100% - 24px, 760px);
        padding-top: 12px;
    }

    .masthead {
        min-height: 220px;
        padding: 24px 20px 22px;
    }

    .masthead-content {
        align-items: flex-start;
        padding-right: 0;
    }

    .masthead-logout {
        top: 16px;
        right: 16px;
    }

    .brand-mark {
        width: 54px;
        height: 54px;
        font-size: 24px;
    }

    .brand-copy h1 {
        padding-right: 68px;
        font-size: 30px;
    }

    .dashboard-filter,
    .platform-filter {
        grid-template-columns: 1fr;
    }

    .dashboard-filter > button {
        width: 100%;
    }

    .filter-field {
        justify-content: space-between;
        white-space: normal;
    }

    .filter-field .month-picker,
    .dashboard-filter input,
    .dashboard-filter select {
        width: min(260px, 58vw);
    }

    .table-titlebar {
        flex-direction: column;
        gap: 12px;
    }

    .bar-chart {
        grid-auto-columns: 62px;
        gap: 14px;
    }

}

@media (max-width: 560px) {
    .red-body,
    .login-body {
        background-size: auto 360px;
    }

    .masthead-content {
        gap: 12px;
    }

    .brand-copy h1 {
        font-size: 24px;
        line-height: 1.22;
    }

    .brand-copy p:last-child {
        font-size: 14px;
    }

    .bar-chart {
        min-height: 380px;
    }

    .bar-item {
        grid-template-rows: 26px 250px 28px;
    }

    .bar-track {
        height: 250px;
    }

    .login-card {
        padding: 28px 22px 24px;
    }
}
