/* Прокачка — admin panel. Light, dense, readable; the brand orange marks actions. */
:root {
  --bg: #f4f2ef;
  --card: #ffffff;
  --ink: #1d1a18;
  --muted: #6f6761;
  --line: #e5e0da;
  --soft: #f8f6f3;
  --accent: #e5461a;
  --accent-soft: #fdebe4;
  --good: #1f8a5b;
  --good-soft: #e3f4ec;
  --warn: #9a6200;
  --warn-soft: #fdf1dc;
  --bad: #c62f2f;
  --bad-soft: #fbe6e6;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--ink); color: #fff; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; font-size: 15px; }
.brand .muted { color: #b9b1aa; font-weight: 500; }
.bolt { color: #ff8a3c; }
.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: #d9d2cb; }
.top nav a.active, .top nav a:hover { background: #3a3431; color: #fff; }
.top .btn-ghost { color: #d9d2cb; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 12.5px; }

.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; padding: 7px 13px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #cf3c13; }
.btn-danger { color: var(--bad); border-color: #efc4c4; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); font-size: 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--soft); font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfbf9; }
td.actions { white-space: nowrap; text-align: right; }
tr.link { cursor: pointer; }
tr.dim td { color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.active { background: var(--good-soft); color: var(--good); }
.badge.upcoming { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.base { background: var(--warn-soft); color: var(--warn); }

/* Results grid: one row per day, one editable cell per exercise */
.grid-input { width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.grid-input.saving { border-color: #e7b45c; }
.grid-input.saved { border-color: var(--good); background: var(--good-soft); }
.grid-input.error { border-color: var(--bad); background: var(--bad-soft); }
.over { color: var(--bad); font-weight: 700; }

.notice { border-radius: 10px; padding: 10px 12px; background: var(--soft); }
.notice.warn { background: var(--warn-soft); color: #6d4700; }
.notice.bad { background: var(--bad-soft); color: #8d1f1f; }
.danger-zone { border-color: #efc4c4; }

.login { max-width: 360px; margin: 12vh auto 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); }
#toast.bad { background: var(--bad); }
dialog { border: 0; border-radius: 14px; padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
dialog::backdrop { background: rgba(20, 16, 14, 0.45); }
