:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #e4e7ec;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --shadow: 0 18px 45px rgba(23, 32, 51, .08);
    --radius: 20px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #e0ecff, transparent 32rem), var(--bg);
}

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

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

label {
    display: grid;
    gap: .45rem;
    color: var(--text);
    font-weight: 700;
    font-size: .92rem;
}

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

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-card {
    width: min(440px, 100%);
    background: var(--card);
    border-radius: 28px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.brand-mark, .logo {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #0f172a);
    color: #fff;
    font-weight: 900;
    letter-spacing: -.04em;
}

.logo { width: 48px; height: 48px; }

.stack { display: grid; gap: 1rem; }

.demo-box {
    margin-top: 1.2rem;
    border: 1px dashed #b6c3d5;
    border-radius: 16px;
    padding: 1rem;
    color: var(--muted);
    background: #f8fafc;
    font-size: .9rem;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem clamp(1rem, 4vw, 2rem);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(228, 231, 236, .85);
}

.nav {
    display: flex;
    align-items: center;
    gap: .9rem;
    color: var(--muted);
    font-weight: 700;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav a:hover { color: var(--primary); }

.container {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 2rem clamp(1rem, 4vw, 2rem) 4rem;
}

.hero {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

.hero h1, .auth-card h1 {
    margin: .2rem 0 .55rem;
    line-height: 1.05;
    letter-spacing: -.04em;
}

.eyebrow {
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .13em;
    font-weight: 900;
    font-size: .74rem;
    margin: 0;
}

.muted { color: var(--muted); }
.small { font-size: .88rem; }

.progress-card, .card-soft, .empty-state, .admin-card {
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(228, 231, 236, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.progress-card { padding: 1.2rem; }
.progress-number { font-size: 2.7rem; font-weight: 950; letter-spacing: -.06em; }
.progress-bar { height: 12px; border-radius: 999px; overflow: hidden; background: #e2e8f0; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); }

.filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    padding: 1rem;
    margin-bottom: 2rem;
}

.day-section { margin-top: 2rem; }
.day-section h2 { margin-bottom: 1rem; letter-spacing: -.03em; }
.exercise-grid { display: grid; gap: 1.1rem; }

.exercise-card {
    display: grid;
    grid-template-columns: 320px 1fr;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.exercise-card.is-done { border-color: rgba(22, 163, 74, .45); }

.exercise-image {
    position: relative;
    min-height: 260px;
    background: #e2e8f0;
}

.exercise-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.done-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    background: var(--success);
    color: #fff;
    border-radius: 999px;
    padding: .45rem .8rem;
    font-weight: 900;
}

.exercise-content { padding: 1.2rem; }
.exercise-title-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .7rem;
}
.exercise-title-row h3 { margin: 0; font-size: 1.35rem; letter-spacing: -.03em; }
.exercise-title-row p { margin: .25rem 0 0; }

.pill {
    white-space: nowrap;
    border-radius: 999px;
    padding: .55rem .8rem;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 900;
}

.meta-row {
    display: flex;
    gap: .55rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.meta-row span {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .45rem .7rem;
    color: #475467;
    font-size: .88rem;
    font-weight: 700;
}

.log-form {
    display: grid;
    gap: .9rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.check-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    font-weight: 900;
}
.check-row input { width: 20px; height: 20px; }

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .35rem;
    border: 0;
    border-radius: 14px;
    padding: .85rem 1rem;
    font-weight: 900;
    cursor: pointer;
    background: #e2e8f0;
    color: #172033;
}
.btn:hover { filter: brightness(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #f8fafc; border: 1px solid var(--line); }

.alert {
    padding: 1rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    font-weight: 800;
}
.alert-error { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; }
.alert-success { color: #166534; background: #dcfce7; border: 1px solid #bbf7d0; }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-weight: 800;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.admin-card { padding: 1.2rem; }
.admin-card h2 { margin-top: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 18px; overflow: hidden; }
th, td { padding: .85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #475467; font-size: .85rem; }
.admin-layout { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; align-items: start; }
.admin-form { display: grid; gap: .9rem; }
.inline-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (max-width: 860px) {
    .hero, .exercise-card, .admin-layout { grid-template-columns: 1fr; }
    .filters, .form-grid-3, .admin-grid { grid-template-columns: 1fr; }
    .exercise-image { min-height: 220px; }
    .topbar { align-items: start; }
}


.checkbox-list {
    display: grid;
    gap: .55rem;
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .8rem;
    background: #fff;
}

.checkbox-list .check-row {
    justify-content: flex-start;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: .5rem;
}

.checkbox-list .check-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
