/* Sport PT: giao diện. Màu định nghĩa bằng biến ở :root, đổi theo chế độ sáng/tối. */
:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --surface-3: #e7e6e2;
  --border: #e4e3df;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #6f6e69;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0fc;
  --accent-text: #1c5cab;
  --series: #2a78d6;
  --series-soft: #9ec5f4;
  --grid: #e9e8e4;
  --body: #e4e3df;
  --m-idle: #d6d5d0;
  --good: #0ca30c;
  --good-text: #006300;
  --warning: #fab219;
  --warning-text: #8a5a00;
  --serious: #ec835a;
  --serious-text: #a0401c;
  --critical: #d03b3b;
  --critical-text: #b02a2a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 15, .05), 0 4px 16px rgba(20, 20, 15, .04);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --surface-3: #2e2e2b; --border: #30302d;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #9b9a92;
    --accent: #3987e5; --accent-hover: #5598e7; --accent-ink: #ffffff; --accent-soft: #17263a; --accent-text: #86b6ef;
    --series: #3987e5; --series-soft: #1c5cab; --grid: #2c2c29; --body: #2c2c29; --m-idle: #45453f;
    --good-text: #4cc94c; --warning-text: #fab219; --serious-text: #ec835a; --critical-text: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #242422; --surface-3: #2e2e2b; --border: #30302d;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #9b9a92;
  --accent: #3987e5; --accent-hover: #5598e7; --accent-ink: #ffffff; --accent-soft: #17263a; --accent-text: #86b6ef;
  --series: #3987e5; --series-soft: #1c5cab; --grid: #2c2c29; --body: #2c2c29; --m-idle: #45453f;
  --good-text: #4cc94c; --warning-text: #fab219; --serious-text: #ec835a; --critical-text: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; margin-top: 1.1rem; }
p { margin: 0 0 .6rem; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: .86rem; }
.center { text-align: center; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- Khung ---------- */
.shell { min-height: 100vh; }
.view { max-width: 880px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); outline: none; }
.boot { padding: 80px 0; text-align: center; color: var(--text-2); }
.sidebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.brand, .sidebar-foot { display: none; }
.nav { display: flex; height: var(--nav-h); }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.nav-item .ic { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent-text); }
.sync { position: fixed; top: 10px; right: 12px; z-index: 30; font-size: .75rem; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.sync-ok { display: none; }
.sync-warn { background: #fff4dc; color: var(--warning-text); }
:root[data-theme="dark"] .sync-warn { background: #3a2c08; }
body.in-session .sidebar { display: none; }
body.in-session .view { padding-bottom: 140px; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px 1fr; }
  .sidebar {
    position: sticky; top: 0; bottom: auto; height: 100vh; border-top: 0; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; padding: 20px 12px;
  }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; padding: 4px 10px 20px; }
  .nav { flex-direction: column; height: auto; gap: 2px; }
  .nav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .95rem; color: var(--text-2); }
  .nav-item:hover { background: var(--surface-2); }
  .nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
  .sidebar-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 0 6px; }
  .sync { position: static; display: inline-block; }
  .sync-ok { display: inline-block; background: transparent; padding-left: 0; }
  .view { padding: 32px 32px 64px; }
  body.in-session .sidebar { display: flex; }
}

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn-danger:hover { background: var(--critical-text); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger-text { color: var(--critical-text); }
.btn-danger-text:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: .88rem; border-radius: 10px; }
.btn-lg { min-height: 50px; padding: 10px 22px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--text); font-weight: 650; text-align: left; cursor: pointer; font-size: 1.02rem; }
.link-btn:hover { color: var(--accent-text); text-decoration: underline; }
.file-btn { cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.row-end { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* ---------- Trang & thẻ ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 8px 0 16px; }
.page-head p { margin: 0; }
.eyebrow { font-size: .8rem; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--text-2); text-decoration: none; font-size: .9rem; margin: 0 0 6px -4px; }
.back:hover { color: var(--accent-text); }
.back .ic { width: 18px; height: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card > h2:first-child { margin-bottom: .75rem; }
.card-accent { border-color: var(--accent); background: var(--accent-soft); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.section-title { margin: 22px 2px 10px; }
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); margin-bottom: 14px; }
.banner .ic { color: var(--accent-text); }
.banner span { flex: 1; min-width: 180px; }
.empty { text-align: center; padding: 32px 16px; color: var(--text-2); }
.empty h3 { color: var(--text); margin-top: 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 99px; background: var(--surface-2); font-size: .88rem; font-weight: 600; }
.progress { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; margin: 8px 0; }
.progress span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .3s; }
.progress-lg { height: 10px; }

/* Ô chỉ số */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--shadow); }
.tile-label { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.tile-value { font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; }
.tile-sub { font-size: .8rem; color: var(--text-2); }
.status { font-weight: 650; }
.status-good { color: var(--good-text); }
.status-warning { color: var(--warning-text); }
.status-serious { color: var(--serious-text); }
.status-critical { color: var(--critical-text); }

/* Nhãn */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: .76rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.chip-primary { background: var(--accent-soft); color: var(--accent-text); }
.level { display: inline-flex; gap: 3px; vertical-align: middle; }
.level i { width: 6px; height: 14px; border-radius: 3px; background: var(--surface-3); }
.level i.on { background: var(--accent); }

/* ---------- Trang Hôm nay ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.steps a:hover { background: var(--surface-3); }
.steps small { display: block; color: var(--text-2); }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; flex: none; }
.steps li.done .step-n { background: var(--accent); color: #fff; }
.steps li.done b { text-decoration: line-through; color: var(--text-2); }
.ic-end { margin-left: auto; color: var(--text-3); transition: transform .2s; }
.ic-end.rot { transform: rotate(90deg); }
.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.resume h2, .resume p { margin: 0; }
.today h2 { font-size: 1.4rem; margin-bottom: 2px; }
.meta-row { display: flex; gap: 16px; color: var(--text-2); font-size: .92rem; margin: 6px 0 4px; }
.meta-row span { display: inline-flex; align-items: center; gap: 6px; }
.meta-row .ic { width: 18px; height: 18px; }
.done-note { display: flex; align-items: center; gap: 8px; color: var(--good-text); font-weight: 650; margin-top: 12px; }
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin-bottom: 14px; }
.wd-name { display: block; font-size: .75rem; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.wd-dot { width: 38px; height: 38px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; font-weight: 600; color: var(--text-3); }
.wd-dot .ic { width: 18px; height: 18px; }
.wd.planned .wd-dot { border: 2px dashed var(--accent); color: var(--accent-text); }
.wd.did .wd-dot { background: var(--accent); color: #fff; }
.wd.today .wd-name { color: var(--accent-text); }
.wd.today .wd-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-3); }
.phase { padding-top: 12px; border-top: 1px solid var(--border); }
.phase-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.phase p { margin: 0; }

/* ---------- Biểu đồ ---------- */
.chart-box { margin-top: 12px; min-height: 120px; }
.chart-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { fill: var(--series); opacity: .1; }
.chart-svg .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart-svg .end-label { fill: var(--text); font-size: 12px; font-weight: 650; }
.chart-svg .crosshair { stroke: var(--text-3); stroke-width: 1; }
.viz-tip {
  position: fixed; z-index: 90; display: none; pointer-events: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-size: .82rem; box-shadow: 0 4px 16px rgba(0, 0, 0, .14); max-width: 240px;
}
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; font-size: .88rem; }
.hbar-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.hbar-fill { height: 14px; background: var(--series); border-radius: 0 4px 4px 0; min-width: 3px; }
.hbar-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.hbar:hover .hbar-fill { background: var(--accent-hover); }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 6px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.col-plot { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--grid); }
.col-value { font-size: .74rem; font-weight: 650; color: var(--text); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.col-fill { width: 100%; max-width: 24px; background: var(--series-soft); border-radius: 4px 4px 0 0; }
.col-fill.current { background: var(--series); }
.col:hover .col-fill { background: var(--accent-hover); }
.col-label { font-size: .7rem; color: var(--text-2); margin-top: 4px; white-space: nowrap; }

/* ---------- Biểu mẫu ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .86rem; font-weight: 600; color: var(--text-2); }
.field-full, .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 16px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form-error { color: var(--critical-text); font-weight: 600; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; max-width: 560px; }
.segmented label, .segmented button { position: relative; flex: 1 1 auto; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span, .segmented button {
  display: block; width: 100%; text-align: center; padding: 7px 8px; border-radius: 9px; font-weight: 600; font-size: .88rem;
  color: var(--text-2); border: 0; background: transparent; cursor: pointer; white-space: nowrap;
}
.segmented input:checked + span, .segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice > span { display: block; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--border); height: 100%; }
.choice small { display: block; color: var(--text-2); margin-top: 2px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.weekday-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 420px; }
.weekday-pick label { position: relative; }
.weekday-pick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.weekday-pick span { display: grid; place-items: center; height: 44px; border-radius: 12px; border: 2px solid var(--border); font-weight: 650; }
.weekday-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.weekday-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.builder input[type="date"] { max-width: 220px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters select { width: auto; flex: 1 1 140px; }
.search { position: relative; flex: 1 1 100%; }
.search .ic { position: absolute; left: 12px; top: 12px; color: var(--text-3); }
.search input { padding-left: 40px !important; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.feel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.feel label { position: relative; }
.feel input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.feel span { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; border-radius: 12px; border: 2px solid var(--border); font-size: .72rem; text-align: center; }
.feel i { font-style: normal; font-size: 1.5rem; }
.feel input:checked + span { border-color: var(--accent); background: var(--accent-soft); }

/* Bảng */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .78rem; color: var(--text-2); font-weight: 650; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.link-card { padding: 0; }
.link-card a { display: flex; align-items: center; gap: 12px; padding: 16px 18px; color: var(--text); text-decoration: none; }
.link-card small { display: block; color: var(--text-2); }

/* ---------- Dụng cụ ---------- */
.count-note { margin-bottom: 12px; color: var(--text-2); }
.count-note b { color: var(--text); font-size: 1.1rem; }
.equip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.equip {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; min-height: 112px;
  border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: left;
}
.equip:hover { border-color: var(--text-3); }
.equip.on { border-color: var(--accent); background: var(--accent-soft); }
.equip-icon { font-size: 1.6rem; line-height: 1; }
.equip-name { font-weight: 650; font-size: .92rem; }
.equip-sub { font-size: .78rem; color: var(--text-2); }
.equip-check { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; color: transparent; }
.equip-check .ic { width: 14px; height: 14px; }
.equip.on .equip-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.sticky-actions { margin-top: 18px; }

/* ---------- Thư viện ---------- */
.ex-list { display: grid; gap: 8px; }
.ex-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; text-align: left; width: 100%; cursor: pointer;
}
.ex-card:hover { border-color: var(--accent); }
.ex-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ex-main small { font-size: .8rem; }
.ex-side { display: flex; align-items: center; gap: 6px; color: var(--text-3); }

/* Hướng dẫn bài tập */
.guide-top { display: grid; gap: 16px; align-items: start; }
@media (min-width: 640px) { .guide-top { grid-template-columns: 1fr 260px; } }
.guide-facts p { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.guide-facts .muted { font-size: .8rem; font-weight: 600; }
.guide-steps { padding-left: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.guide-steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.guide-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.guide-list { padding-left: 0; list-style: none; display: grid; gap: 6px; }
.guide-list li { padding-left: 26px; position: relative; }
.guide-list li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.guide-list.good li::before { content: "✓"; color: var(--good-text); }
.guide-list.bad li::before { content: "✗"; color: var(--critical-text); }
.variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 14px; }
.variants > div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.variants p { margin: 2px 0 0; }
.bodymap { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bodymap-fig { margin: 0; text-align: center; }
.bodymap-fig svg { width: 100%; max-height: 220px; }
.bodymap-fig figcaption { font-size: .75rem; color: var(--text-2); }
.m-body { fill: var(--body); }
.m-idle { fill: var(--m-idle); }
.m-primary { fill: var(--series); }
.m-secondary { fill: var(--series-soft); }
.bodymap-legend { display: flex; justify-content: center; gap: 16px; font-size: .8rem; color: var(--text-2); margin-top: 4px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-primary { background: var(--series); }
.sw-secondary { background: var(--series-soft); }

/* ---------- Lộ trình ---------- */
.plan-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.phases { list-style: none; padding: 0; margin: 14px 0 4px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.phases li { padding: 8px; border-radius: 10px; background: var(--surface-2); text-align: center; font-size: .82rem; }
.phases li b { display: block; }
.phases li small { color: var(--text-2); }
.phases li.cur { background: var(--accent); color: #fff; }
.phases li.cur small { color: #fff; opacity: .85; }
.phases li.past { opacity: .6; }
.day-card { padding: 0; overflow: hidden; }
.day-card.is-today { border-color: var(--accent); }
.day-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.day-head:hover { background: var(--surface-2); }
.day-wd { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; flex: none; }
.day-title { display: flex; flex-direction: column; min-width: 0; }
.day-title small { font-size: .84rem; }
.day-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.plan-items { padding-left: 20px; margin: 0; display: grid; gap: 6px; }
.plan-items li { padding-left: 2px; }
.plan-items li span { display: block; }
.plan-items a { color: var(--text); font-weight: 600; text-decoration: none; }
.plan-items a:hover { color: var(--accent-text); text-decoration: underline; }

/* ---------- Buổi tập ---------- */
.session-head { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 8px 0; margin-top: 0; }
.clock { text-align: right; flex: none; }
.clock span { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.clock small { color: var(--text-2); font-size: .8rem; }
.ex-run { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.ex-run.complete { border-color: var(--good); }
.ex-run-head { display: flex; align-items: flex-start; gap: 12px; }
.ex-num { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; flex: none; font-size: .9rem; }
.ex-run.complete .ex-num { background: var(--good); color: #fff; }
.ex-run.complete .ex-num .ic { width: 16px; height: 16px; }
.ex-run-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.last-hint { font-size: .8rem; color: var(--text-2); margin: 8px 0 0 44px; }
.sets { display: grid; gap: 6px; margin-top: 10px; }
.set-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--surface-2); }
.set-row.done { background: var(--accent-soft); }
.set-n { font-size: .82rem; font-weight: 650; color: var(--text-2); min-width: 50px; }
.set-input { display: flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--text-2); }
.set-input input { width: 64px !important; min-height: 40px !important; text-align: center; padding: 4px !important; }
.check-btn {
  margin-left: auto; width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface);
  color: var(--text-3); display: grid; place-items: center; cursor: pointer; flex: none;
}
.check-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.set-row.done .check-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.session-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 24px; }
.session-actions .btn-lg { width: 100%; max-width: 420px; }
.timerbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 18px; overflow: hidden;
  background: var(--text); color: var(--bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .25); max-width: 560px; margin: 0 auto;
}
@media (min-width: 900px) { .timerbar { left: 264px; } }
.timer-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, .12); transition: width .2s linear; pointer-events: none; }
:root[data-theme="dark"] .timer-fill { background: rgba(0, 0, 0, .1); }
.timer-work { background: var(--accent); color: #fff; }
.timer-ready { background: var(--warning); color: #1a1200; }
.timer-text { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.timer-text b { font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.timer-text small { font-size: .78rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-text .muted { color: inherit; }
.timer-btns { position: relative; display: flex; gap: 6px; }
.timer-btns .btn { background: rgba(255, 255, 255, .16); border-color: transparent; color: inherit; }
.timerbar:not(.timer-work):not(.timer-ready) .timer-btns .btn { background: color-mix(in srgb, var(--bg) 18%, transparent); }

/* ---------- Lịch sử ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { margin: 0; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-wd { font-size: .74rem; color: var(--text-2); font-weight: 600; padding-bottom: 4px; }
.cal-day { aspect-ratio: 1; max-height: 48px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.cal-day:hover { background: var(--surface-2); }
.cal-day.has { background: var(--accent); color: #fff; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--text-3); }
.cal-day.sel { box-shadow: inset 0 0 0 3px var(--text); }
.list-head { margin-top: 22px; }
.list-head .section-title { margin: 0; }
.log-card { padding: 0; overflow: hidden; }
.log-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.log-head:hover { background: var(--surface-2); }
.log-date { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; flex: none; }
.log-date b { font-size: 1.15rem; }
.log-date small { font-size: .7rem; color: var(--text-2); }
.log-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.log-feel { font-size: 1.3rem; }
.log-body { padding: 4px 16px 14px; border-top: 1px solid var(--border); }
.note { background: var(--surface-2); padding: 8px 12px; border-radius: 10px; margin-top: 10px; font-size: .92rem; }
.log-items { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.log-items li { display: flex; flex-direction: column; }
.log-items a { color: var(--text); font-weight: 600; text-decoration: none; }

/* ---------- Thông báo & hộp thoại ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: opacity .3s, transform .3s; text-align: center; }
.toast-error { background: var(--critical); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10, 10, 8, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal {
  position: relative; background: var(--surface); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
}
.modal-wide { max-width: 760px; }
.modal h2 { padding-right: 40px; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.confirm-text { font-size: 1.02rem; margin: 8px 40px 8px 0; }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 20px; padding: 24px; }
}

/* ---------- Đăng nhập ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand img { border-radius: 14px; }
.login-brand h1 { margin: 10px 0 2px; }
.login-brand p { color: var(--text-2); margin: 0; }
.login-card { display: grid; gap: 14px; padding: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
