:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1f2430;
    --text: #eef2f8;
    --muted: #9aa4b2;
    --line: #2b3240;
    --accent: #8fb4ff;
    --accent-2: #b7f7c1;
    --danger: #ff7b7b;
    --warn: #ffe29a;
    --shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

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

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    background: var(--accent);
    color: #07111f;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.05);
}

button:disabled,
input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.small-btn {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 13px;
}

.ghost-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}

.danger-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(255, 123, 123, 0.35);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 24px;
    background: rgba(15, 17, 21, 0.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

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

.timer-box {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.timer-label {
    color: var(--muted);
    font-size: 13px;
}

.timer-value {
    min-width: 72px;
    font-variant-numeric: tabular-nums;
    font-size: 24px;
    font-weight: 800;
}

.hidden {
    display: none !important;
}

.layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    max-width: 1440px;
    margin: 0 auto;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel {
    background: rgba(23, 26, 33, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.panel h2,
.panel h3,
.panel h4 {
    margin-top: 0;
}

.compact ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.compact li {
    margin: 8px 0;
}

.day-list {
    display: grid;
    gap: 8px;
}

.day-button {
    width: 100%;
    text-align: left;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    display: grid;
    gap: 4px;
}

.day-button.active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.day-button .title {
    font-weight: 800;
}

.day-button .sub {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.summary {
    color: var(--muted);
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.summary strong {
    color: var(--text);
}

.sidebar .panel button {
    width: 100%;
    margin-top: 8px;
}

.content {
    min-width: 0;
}

.day-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    font-weight: 800;
}

.day-header h2 {
    margin: 5px 0 6px;
    font-size: 28px;
}

.day-header p {
    margin: 0;
    color: var(--muted);
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

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

.block-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.block-title {
    margin-bottom: 5px;
}

.block-note {
    margin: 0;
    color: var(--muted);
}

.block-type {
    white-space: nowrap;
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--accent-2);
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 800;
}

.exercise {
    padding: 12px 0;
    border-bottom: 1px solid rgba(43, 50, 64, 0.65);
}

.exercise:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.exercise-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.exercise-title {
    margin-bottom: 4px;
    font-size: 17px;
}

.exercise-meta,
.exercise-note,
.last-result {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.exercise-note {
    margin-top: 3px;
}

.last-result {
    margin-top: 6px;
    color: var(--warn);
}

.exercise-progress {
    min-width: 70px;
    text-align: right;
    color: var(--accent-2);
    font-weight: 800;
}

.sets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 8px;
}

.set-row {
    display: grid;
    grid-template-columns: auto minmax(74px, 1fr) 70px 70px auto;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 10px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.set-row.done {
    opacity: 0.58;
}

.set-row.done .set-title {
    text-decoration: line-through;
}

.set-check {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-2);
}

.set-title {
    font-weight: 700;
}

.weight-input,
.reps-input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 9px;
    background: #10131a;
    color: var(--text);
}

.rest-chip {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.collapsed-done .set-row.done {
    display: none;
}

.history-panel {
    margin-top: 14px;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-run {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-2);
}

.history-run-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
}

.history-run-title {
    color: var(--text);
    font-weight: 800;
}

.history-exercises {
    display: grid;
    gap: 5px;
}

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

.history-exercise strong {
    color: var(--text);
}

.empty-state {
    color: var(--muted);
    padding: 10px 0;
}

@media (max-width: 920px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .topbar,
    .day-header {
        flex-direction: column;
        align-items: stretch;
    }

    .timer-box {
        grid-template-columns: 1fr auto auto;
    }
}

@media (max-width: 520px) {
    .layout,
    .topbar {
        padding-left: 12px;
        padding-right: 12px;
    }

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

    .set-row {
        grid-template-columns: auto minmax(60px, 1fr) 62px 62px;
    }

    .rest-chip {
        grid-column: 2 / -1;
    }

    .block-head,
    .exercise-head,
    .history-run-head {
        flex-direction: column;
    }

    .exercise-progress {
        text-align: left;
    }
}
