:root {
    color-scheme: light;
    --bg: #f7f5f0;
    --surface: #ffffff;
    --ink: #17211c;
    --muted: #66736c;
    --line: #dfe4de;
    --brand: #176b5b;
    --brand-strong: #0e493f;
    --accent: #d95f43;
    --focus: #1a73e8;
    --shadow: 0 12px 32px rgba(23, 33, 28, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

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

a {
    color: inherit;
}

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

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.app-shell,
.login-shell {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 20px;
}

.simple-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 8px;
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.simple-nav a,
.simple-nav button {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    color: var(--brand-strong);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.simple-nav form {
    margin: 0;
}

.simple-nav a:hover,
.simple-nav button:hover {
    background: #edf5f2;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.login-panel {
    width: min(100%, 420px);
    padding: 28px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.eyebrow,
.card-label {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: 2.35rem;
    line-height: 1;
}

.login-copy,
.welcome,
.metric-card p {
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.auth-form label {
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.auth-form button {
    min-height: 50px;
    margin-top: 10px;
    color: #fff;
    background: var(--brand);
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}

.auth-form button:hover {
    background: var(--brand-strong);
}

.alert {
    margin-top: 20px;
    padding: 12px 14px;
    color: #7a2418;
    background: #fff0ec;
    border: 1px solid #f0c4b8;
    border-radius: 8px;
}

.alert-success {
    color: var(--brand-strong);
    background: #edf7f3;
    border-color: #bddbd1;
}

.dashboard-header,
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0 28px;
}

.dashboard-header h1 {
    max-width: 8ch;
}

.logout-form {
    margin: 0;
}

.icon-link {
    flex: 0 0 auto;
    padding: 10px 12px;
    color: var(--brand-strong);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.card-grid {
    display: grid;
    gap: 14px;
}

.metric-card {
    min-height: 150px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(23, 33, 28, 0.06);
}

.metric-card strong {
    display: block;
    font-size: 1.35rem;
    line-height: 1.15;
}

.metric-card p {
    margin: 12px 0 0;
}

.summary-list {
    display: grid;
    gap: 4px;
    margin: 12px 0 0;
    padding: 0;
    color: var(--muted);
    list-style: none;
}

.card-action {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin-top: 16px;
    padding: 8px 12px;
    color: #fff;
    background: var(--brand);
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
}

.card-action:hover {
    background: var(--brand-strong);
}

.secondary-action {
    color: var(--brand-strong);
    background: #edf5f2;
}

.secondary-action:hover {
    color: #fff;
}

.action-card {
    border-color: rgba(23, 107, 91, 0.35);
}

.history-section {
    margin-top: 28px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.section-heading h2 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1.15;
}

.empty-state {
    color: var(--muted);
}

.wins-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.win-item {
    padding: 16px;
    background: #fff;
    border: 1px solid rgba(23, 107, 91, 0.2);
    border-left: 4px solid var(--brand);
    border-radius: 8px;
}

.win-item strong {
    display: block;
    font-size: 1.05rem;
}

.win-item p {
    margin: 8px 0 0;
    color: var(--text);
}

.win-item span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
}

.range-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.range-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--brand-strong);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
}

.range-nav a.is-active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.chart-grid {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

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

.chart-panel h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.chart-canvas {
    position: relative;
    height: 220px;
}

.chart-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.history-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.history-item {
    display: grid;
    gap: 8px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.history-item a {
    color: var(--brand-strong);
    font-weight: 800;
}

.history-item p {
    margin: 4px 0 0;
    color: var(--muted);
}

.notes-preview {
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.checkin-form {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

.form-section {
    display: grid;
    gap: 8px;
}

.checkin-form label {
    font-weight: 800;
}

.checkin-form input,
.checkin-form select,
.checkin-form textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.checkin-form textarea {
    min-height: 132px;
    resize: vertical;
}

.two-col,
.score-stack {
    display: grid;
    gap: 14px;
}

.score-stack {
    gap: 18px;
}

.score-field {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.score-field legend {
    padding: 0 4px;
    font-weight: 800;
}

.score-options {
    display: grid;
    gap: 8px;
}

.score-option {
    display: grid;
    grid-template-columns: 20px 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.score-option input {
    width: 18px;
    min-height: 18px;
    padding: 0;
}

.score-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 30px;
    color: #fff;
    background: var(--brand);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 800;
}

.score-copy {
    color: var(--muted);
    font-weight: 700;
}

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

.choice-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 800;
}

.choice-pill input {
    width: 18px;
    min-height: 18px;
    padding: 0;
}

.checkbox-stack {
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: 20px;
    min-height: 20px;
    padding: 0;
}

.field-error {
    margin: 0;
    color: #7a2418;
    font-size: 0.9rem;
}

.helper-text {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

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

.form-actions button {
    min-height: 50px;
    padding: 12px 18px;
    color: #fff;
    background: var(--brand);
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}

.form-actions button:hover {
    background: var(--brand-strong);
}

.form-actions a {
    color: var(--brand-strong);
    font-weight: 800;
}

@media (min-width: 680px) {
    .app-shell {
        padding: 36px;
    }

    .dashboard-header h1 {
        max-width: none;
    }

    h1 {
        font-size: 3rem;
    }

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

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

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

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

    .action-card {
        grid-column: 1 / -1;
    }
}

@media (min-width: 960px) {
    .card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
