:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-muted: #eef3f8;
    --text: #101926;
    --muted: #647184;
    --line: #dfe6ee;
    --navy: #00244c;
    --navy-soft: #e7edf5;
    --gold: #f0ca7f;
    --gold-strong: #d1b06f;
    --green: #00244c;
    --green-soft: #e7edf5;
    --amber: #9a6a20;
    --red: #b42318;
    --shadow: 0 18px 50px rgba(0, 36, 76, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(0, 36, 76, 0.08), rgba(240, 202, 127, 0.14)),
        var(--bg);
}

.auth-shell {
    width: min(100%, 440px);
}

.auth-panel,
.panel,
.metric-card,
.link-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-panel {
    padding: 32px;
}

.auth-panel h1 {
    margin: 18px 0 8px;
    font-size: 30px;
    line-height: 1.1;
    font-family: Lora, Georgia, serif;
}

.auth-panel p {
    margin: 0 0 24px;
    color: var(--muted);
    line-height: 1.5;
}

.brand-mark {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: var(--radius);
    background: var(--green);
    color: #fff;
    font-weight: 800;
}

.auth-logo {
    display: block;
    width: 96px;
    height: auto;
    max-height: 96px;
    object-fit: contain;
    margin-bottom: 10px;
}

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

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    padding: 12px 13px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.12);
}

small {
    color: var(--muted);
    font-weight: 500;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 9px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
}

.button-primary {
    background: var(--navy);
    color: #fff;
}

.button-ghost {
    border-color: var(--line);
    color: var(--green);
    background: #fff;
}

.alert {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 700;
}

.alert p {
    margin: 0;
}

.alert-error {
    border: 1px solid rgba(180, 35, 24, 0.25);
    background: #fff1f0;
    color: var(--red);
}

.alert-success {
    border: 1px solid rgba(15, 81, 50, 0.25);
    background: var(--green-soft);
    color: var(--green);
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    background: var(--navy);
    color: #fff;
}

.brand {
    display: grid;
    gap: 8px;
    padding: 0 8px 24px;
}

.brand small {
    color: var(--gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.sidebar-logo {
    display: block;
    width: 196px;
    max-width: 100%;
    height: auto;
}

.nav-list {
    display: grid;
    gap: 6px;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius);
    padding: 11px 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 750;
}

.nav-list a span {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 6px;
    background: rgba(240, 202, 127, 0.16);
    font-size: 12px;
}

.nav-list a.active,
.nav-list a:hover {
    background: rgba(240, 202, 127, 0.14);
    color: #fff;
}

.main-area {
    min-width: 0;
    padding: 24px;
}

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

.topbar h1,
.panel-heading h2 {
    margin: 0;
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.15;
    font-family: Lora, Georgia, serif;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
}

.user-box a {
    color: var(--navy);
}

.icon-button {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
}

.icon-button span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    background: var(--text);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    padding: 18px;
}

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

.metric-card strong {
    display: block;
    margin-top: 10px;
    font-size: 32px;
    line-height: 1;
    color: var(--navy);
}

.dashboard-grid,
.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 18px;
}

.panel {
    padding: 18px;
}

.panel-large {
    grid-row: span 2;
}

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

.panel-heading h2 {
    font-size: 18px;
    font-family: Lora, Georgia, serif;
}

.panel-heading a {
    color: var(--navy);
    font-size: 14px;
    font-weight: 800;
}

.list-stack {
    display: grid;
    gap: 10px;
}

.list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: #fff;
}

.list-item strong {
    display: block;
    margin-bottom: 5px;
}

.list-item p,
.empty-state {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.list-item time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.compact-list {
    display: grid;
    gap: 12px;
}

.compact-list div {
    display: grid;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.compact-list div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.compact-list span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.tag,
.badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    margin-bottom: 8px;
    background: var(--surface-muted);
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
}

.badge-open {
    background: #fff4db;
    color: var(--amber);
}

.badge-progress {
    background: #e8efff;
    color: #2451a6;
}

.badge-done {
    background: var(--green-soft);
    color: var(--green);
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline article {
    border-left: 3px solid var(--gold-strong);
    padding: 6px 0 6px 14px;
}

.timeline time {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.timeline strong {
    display: block;
    margin-top: 4px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.link-card {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.link-card strong {
    color: var(--navy);
}

.link-card span {
    color: var(--muted);
    line-height: 1.45;
}

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

    .sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .icon-button {
        display: inline-block;
    }

    .metrics-grid,
    .dashboard-grid,
    .split-grid,
    .links-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main-area {
        padding: 16px;
    }

    .topbar {
        align-items: flex-start;
    }

    .user-box {
        display: none;
    }

    .topbar h1 {
        font-size: 24px;
    }

    .list-item {
        display: grid;
    }

    .auth-panel {
        padding: 24px;
    }
}
