:root {
    color-scheme: light;
    --bg: #f5f7f4;
    --panel: #ffffff;
    --panel-soft: #eef4ef;
    --ink: #17211b;
    --muted: #617068;
    --line: #dce5df;
    --accent: #2f6f5e;
    --accent-strong: #1f5849;
    --accent-soft: #dceee8;
    --danger: #a33d3d;
    --danger-soft: #f7e4e4;
    --shadow: 0 18px 50px rgba(28, 45, 35, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

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

button {
    font: inherit;
}

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

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

.brand,
.topnav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand {
    font-weight: 760;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--ink);
    color: white;
    font-size: 13px;
    letter-spacing: 0;
}

.topnav {
    color: var(--muted);
    font-size: 14px;
}

.topnav a {
    color: var(--accent-strong);
    font-weight: 700;
}

.text-link,
.action-link {
    color: var(--accent-strong);
    font-weight: 800;
}

.text-link:hover,
.action-link:hover {
    text-decoration: underline;
}

.auth-view {
    display: grid;
    min-height: calc(100vh - 160px);
    align-items: center;
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    align-items: center;
    gap: 56px;
}

.auth-copy h1,
.dashboard-hero h1 {
    margin: 0;
    max-width: 760px;
    font-size: clamp(40px, 7vw, 86px);
    line-height: 0.95;
    letter-spacing: 0;
}

.auth-copy p:not(.eyebrow) {
    max-width: 520px;
    color: var(--muted);
    font-size: 18px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.form-card,
.entry-card {
    display: grid;
    gap: 18px;
    padding: 28px;
}

.form-card h2,
.entry-card h2,
.history h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0;
}

label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 720;
}

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

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfb;
    color: var(--ink);
    font: inherit;
    font-weight: 520;
    outline: none;
}

input:not([type="range"]),
textarea {
    padding: 12px 14px;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

input[type="range"] {
    accent-color: var(--accent);
}

output {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 32px;
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--accent-strong);
    font-weight: 800;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.button.primary {
    background: var(--accent);
    color: white;
}

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

.notice {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.notice-success {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.notice-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.dashboard-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.hero-stat {
    display: grid;
    min-width: 136px;
    gap: 2px;
    padding: 18px;
    border-radius: 8px;
    background: var(--ink);
    color: white;
    text-align: center;
}

.hero-stat span {
    font-size: 46px;
    font-weight: 850;
    line-height: 1;
}

.hero-stat small {
    color: #d7e2dc;
    font-weight: 720;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: 20px;
    align-items: start;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

.section-heading h2 {
    color: var(--ink);
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.metrics {
    display: grid;
    gap: 14px;
}

.metric-card {
    display: grid;
    gap: 6px;
    padding: 22px;
    box-shadow: none;
}

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

.metric-card strong {
    font-size: 30px;
    line-height: 1.1;
}

.history {
    margin-top: 20px;
    padding: 24px;
    overflow: hidden;
}

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

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

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

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

td {
    font-weight: 560;
}

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

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

.row-actions form {
    margin: 0;
}

.action-link {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.action-link.danger {
    color: var(--danger);
}

.empty-state {
    margin-top: 16px;
    padding: 28px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 840px) {
    .auth-panel,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .auth-copy h1,
    .dashboard-hero h1 {
        font-size: 46px;
    }

    .dashboard-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-stat {
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 14px;
    }

    .topbar,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .form-card,
    .entry-card,
    .history {
        padding: 18px;
    }
}
