:root {
    color-scheme: light;
    --bg: #f5f7f4;
    --panel: #ffffff;
    --text: #1d2520;
    --muted: #647067;
    --line: #dfe6df;
    --accent: #256f5c;
    --accent-dark: #174a3d;
    --warning: #a06018;
    --success: #277447;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-dark);
}

.topbar {
    align-items: center;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 32px;
}

.brand {
    color: var(--text);
    font-size: 20px;
    font-weight: 750;
}

.nav {
    align-items: center;
    display: flex;
    gap: 18px;
}

.nav form {
    margin: 0;
}

.nav button {
    background: transparent;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.page {
    margin: 0 auto;
    max-width: 1120px;
    padding: 32px;
}

.page-header,
.exercise-head,
.filter-bar {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.page-header {
    margin-bottom: 24px;
}

.eyebrow,
.date {
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 4px;
}

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

h1 {
    font-size: 34px;
    line-height: 1.1;
    margin-bottom: 8px;
}

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

.button {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 650;
    min-height: 40px;
    padding: 8px 14px;
}

.button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.button.ghost {
    background: transparent;
}

.layout {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr 280px;
}

.list,
.grid {
    display: grid;
    gap: 16px;
}

.grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card,
.exercise-card,
.side-panel,
.form-panel,
.auth-panel,
.empty {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

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

.card-main p:last-child,
.side-panel p:last-child,
.empty p:last-child {
    margin-bottom: 0;
}

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

.filter-bar {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    justify-content: flex-start;
    margin-bottom: 24px;
    padding: 16px;
}

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

.form div,
.form label {
    display: grid;
    gap: 6px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    padding: 10px 12px;
    width: 100%;
}

.form-panel,
.auth-panel {
    margin: 0 auto;
    max-width: 640px;
}

.auth-panel {
    max-width: 420px;
}

.badge {
    background: #eef2ee;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    padding: 6px 10px;
}

.badge.success {
    background: #e7f5eb;
    color: var(--success);
}

.badge.warning {
    background: #fff3df;
    color: var(--warning);
}

table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
}

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

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

.messages {
    background: #e7f5eb;
    border: 1px solid #b8dfc4;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 12px 16px;
}

.messages p {
    margin: 0;
}

@media (max-width: 760px) {
    .topbar,
    .page-header,
    .exercise-head,
    .card,
    .filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        padding: 16px;
    }

    .nav {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .page {
        padding: 20px;
    }

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