:root {
    color-scheme: light;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --ink: #1f2937;
    --muted: #64748b;
    --line: #d8dee8;
    --primary: #116466;
    --primary-dark: #0b4d4f;
    --accent: #d29b2f;
    --danger-bg: #fff1f2;
    --danger-line: #fecdd3;
}

* {
    box-sizing: border-box;
}

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

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

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.1;
}

h2 {
    font-size: 22px;
}

.badge,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    padding: 6px 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.alert,
.filters,
.form-panel,
.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.alert {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
    border-color: var(--danger-line);
    background: var(--danger-bg);
    padding: 16px;
}

.alert small,
.alert span {
    color: var(--muted);
}

.filters {
    padding: 16px;
    margin-bottom: 18px;
}

.filters form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px) auto auto;
    gap: 12px;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

select,
input,
button,
.reset {
    min-height: 42px;
    border-radius: 6px;
    font: inherit;
}

select,
input {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 0 12px;
}

input:disabled {
    background: #eef3f6;
    color: var(--muted);
}

button,
.reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    padding: 0 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

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

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

button.danger {
    background: #b42318;
}

button.danger:hover {
    background: #8f1d15;
}

.reset {
    border-color: var(--line);
    color: var(--ink);
    background: #fff;
}

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

.menu-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.menu-bar a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    padding: 0 14px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.menu-bar a.active,
.menu-bar a:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.notice {
    margin-bottom: 16px;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #f0fdf4;
    padding: 14px 16px;
    color: #166534;
    font-weight: 700;
}

.form-panel {
    margin-bottom: 18px;
    padding: 16px;
}

.form-panel h2 {
    margin-bottom: 16px;
}

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

.progress-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wide {
    grid-column: 1 / -1;
}

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

.actions form {
    margin: 0;
}

.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 16px;
}

.metric span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    display: block;
    font-size: 22px;
    line-height: 1.2;
}

.table-wrap {
    overflow: hidden;
}

.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 16px;
}

.table-head span {
    color: var(--muted);
    font-size: 14px;
}

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

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

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #eef3f6;
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
}

.strong {
    font-weight: 700;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.bar {
    width: 120px;
    height: 8px;
    margin-bottom: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.bar span {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.bar.finance span {
    background: var(--accent);
}

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

.login-shell {
    width: min(100%, 420px);
}

.login-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 28px;
}

.login-panel h1 {
    margin-bottom: 22px;
    font-size: 32px;
}

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

.login-form button {
    width: 100%;
    margin-top: 4px;
}

.login-help {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
    color: var(--muted);
    font-size: 13px;
}

.login-help strong {
    color: var(--ink);
}

.compact {
    margin-bottom: 16px;
}

@media (max-width: 920px) {
    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filters form {
        grid-template-columns: 1fr 1fr;
    }

    .progress-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .page {
        width: min(100% - 20px, 1180px);
        padding: 20px 0;
    }

    .topbar {
        display: grid;
    }

    .user-box {
        justify-content: flex-start;
    }

    .filters form {
        grid-template-columns: 1fr;
    }

    .data-form,
    .progress-form {
        grid-template-columns: 1fr;
    }
}
