:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e2ef;
    --primary: #0957a7;
    --primary-strong: #073f7a;
    --accent: #17a36b;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 18px 45px rgba(23, 32, 51, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

.login-body {
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(9, 87, 167, 0.92), rgba(23, 32, 51, 0.88)),
        url("login-bg.svg");
    background-size: cover;
}

.login-shell {
    width: min(92vw, 440px);
}

.login-panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.brand-block {
    display: grid;
    gap: 12px;
    margin-bottom: 28px;
}

.brand-logo {
    width: 132px;
    height: auto;
}

.brand-block p,
.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(9, 87, 167, 0.16);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 800;
}

.primary-button {
    background: var(--primary);
    color: #fff;
    padding: 0 18px;
}

.primary-button:hover {
    background: var(--primary-strong);
}

.danger-button {
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    background: #fee4e2;
    color: var(--danger);
    cursor: pointer;
    font-weight: 900;
    padding: 0 18px;
}

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

.secondary-button {
    background: #eef3f9;
    color: var(--ink);
    padding: 0 18px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.table-action {
    min-height: 34px;
    padding: 0 14px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.row-actions form {
    margin: 0;
}

.ghost-button {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.icon-button {
    width: 38px;
    min-height: 38px;
    background: #eef3f9;
    color: var(--ink);
}

.full-button {
    width: 100%;
}

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 270px 1fr;
}

.sidebar {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-direction: column;
    background: #172033;
    color: #fff;
    padding: 24px 18px;
}

.sidebar-brand {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    margin-bottom: 22px;
}

.sidebar-brand img {
    width: 142px;
    height: auto;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    display: flex;
    min-height: 42px;
    align-items: center;
    border-radius: 6px;
    color: #d7deea;
    padding: 0 12px;
    text-decoration: none;
    font-weight: 800;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar-footer {
    display: grid;
    gap: 8px;
    margin-top: auto;
    color: #d7deea;
    font-size: 0.88rem;
}

.sidebar-footer strong {
    color: #fff;
}

.main-content {
    display: grid;
    align-content: start;
    gap: 22px;
    padding: 34px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 2rem;
}

h2 {
    margin-bottom: 8px;
    font-size: 1.15rem;
}

.user-chip {
    display: grid;
    min-width: 190px;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 10px 14px;
}

.user-chip span {
    font-weight: 800;
}

.user-chip strong {
    color: var(--muted);
    font-size: 0.82rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.metric-card,
.content-band,
.table-shell {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.metric-card {
    display: grid;
    gap: 8px;
    padding: 22px;
}

.metric-card span {
    color: var(--muted);
    font-weight: 800;
}

.metric-card strong {
    font-size: 2.2rem;
}

.content-band {
    display: grid;
    gap: 20px;
    padding: 24px;
}

.content-band p {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.table-shell {
    overflow: auto;
}

.month-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start;
}

.year-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 6px;
}

.year-nav a,
.year-nav strong {
    display: inline-flex;
    min-width: 38px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
}

.year-nav a {
    background: #eef3f9;
}

.year-nav .year-current {
    min-width: 70px;
    color: var(--primary);
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.month-card {
    display: grid;
    min-height: 250px;
    align-content: space-between;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 18px;
}

.month-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.month-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.month-card h2 {
    margin: 0;
}

.load-list {
    display: grid;
    gap: 8px;
}

.load-state {
    display: grid;
    gap: 4px;
}

.load-list small,
.muted-copy {
    color: var(--muted);
}

.load-ok,
.load-pending {
    display: inline-flex;
    width: fit-content;
    min-height: 28px;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 0.82rem;
    font-weight: 900;
}

.load-ok {
    background: #dcfae6;
    color: var(--success);
}

.load-pending {
    background: #f2f4f7;
    color: #667085;
}

.upload-form {
    display: grid;
    max-width: 560px;
    gap: 16px;
}

.file-upload-list {
    display: grid;
    gap: 16px;
}

.file-upload-card {
    display: grid;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 22px;
    box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.file-upload-card p {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.upload-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.upload-summary div {
    display: grid;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.upload-summary span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.upload-summary strong {
    overflow-wrap: anywhere;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.file-actions form {
    margin: 0;
}

.header-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.header-preview span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #344054;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 800;
}

.timeline-panel {
    display: grid;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04);
}

.timeline-panel h2 {
    margin: 4px 0 0;
}

.timeline-list {
    display: grid;
    gap: 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 12px;
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 19px;
    bottom: 0;
    width: 2px;
    background: #e4eaf3;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 0 0 2px #d9e2ef;
    margin-top: 4px;
    z-index: 1;
}

.timeline-dot-success {
    background: var(--success);
}

.timeline-dot-danger {
    background: var(--danger);
}

.timeline-item p {
    margin-bottom: 4px;
    line-height: 1.35;
}

.timeline-item small {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 7px;
}

.timeline-item span:not(.timeline-dot) {
    display: block;
    color: #475467;
    font-size: 0.9rem;
    line-height: 1.45;
}

.timeline-empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 18px;
    line-height: 1.45;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

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

th {
    background: #f8fafc;
    color: #475467;
    font-size: 0.78rem;
    text-transform: uppercase;
}

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

.status-pill {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 0.78rem;
    font-weight: 900;
}

.status-active {
    background: #dcfae6;
    color: var(--success);
}

.status-muted {
    background: #f2f4f7;
    color: #667085;
}

.alert {
    border-radius: 6px;
    padding: 12px 14px;
    font-weight: 800;
}

.alert-danger {
    background: #fee4e2;
    color: var(--danger);
}

.alert-success {
    background: #dcfae6;
    color: var(--success);
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    place-items: center;
    background: rgba(16, 24, 40, 0.48);
    padding: 20px;
    z-index: 20;
}

.modal-backdrop.is-open {
    display: grid;
}

.modal {
    width: min(94vw, 520px);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

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

.modal-header h2 {
    margin: 0;
}

.modal-form {
    padding: 20px;
}

.assignment-edit-context {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
    line-height: 1.45;
    padding: 12px 14px;
    font-weight: 800;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.empty-state {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 32px;
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .main-content {
        padding: 22px;
    }

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

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

    .month-grid,
    .month-workspace,
    .upload-summary {
        grid-template-columns: 1fr;
    }

    .user-chip {
        width: 100%;
    }
}
