/* ---- Dark theme (default) ---- */
:root, :root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-elev: #171b22;
  --bg-elev2: #1e242d;
  --line: #2a313c;
  --text: #e8edf4;
  --muted: #97a3b4;
  --accent: #4c8dff;
  --accent-dim: #2b4d8a;
  --green: #35c26b;
  --green-dim: #1c6c40;
  --amber: #f0a83a;
  --danger: #ff5c5c;
  /* semantic badge tokens (bg + text) so they adapt per theme */
  --soft-blue-bg: #2b4d8a;   --soft-blue-text: #cfe0ff;
  --soft-green-bg: #1c6c40;  --soft-green-text: #d8ffe8;
  --soft-amber-bg: #f0a83a;  --soft-amber-text: #241800;
  --soft-red-bg: #5c1d1d;    --soft-red-text: #ffd8d8;
  --accent-text: #ffffff;
  --shadow: 0 8px 30px rgba(0,0,0,.5);
}

/* ---- Light theme ---- */
:root[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-elev: #ffffff;
  --bg-elev2: #eaeef4;
  --line: #d5dbe4;
  --text: #161b22;
  --muted: #5c6673;
  --accent: #2f6fe0;
  --accent-dim: #dbe6fb;
  --green: #1f9d54;
  --green-dim: #d6f2e0;
  --amber: #b26a00;
  --danger: #d13b3b;
  --soft-blue-bg: #dbe6fb;   --soft-blue-text: #1b4ba8;
  --soft-green-bg: #d6f2e0;  --soft-green-text: #0f6b39;
  --soft-amber-bg: #fbecd0;  --soft-amber-text: #915200;
  --soft-red-bg: #fbdcdc;    --soft-red-text: #a12222;
  --accent-text: #ffffff;
  --shadow: 0 8px 30px rgba(60,70,90,.18);
}

/* Follow the OS setting when the user hasn't chosen explicitly */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f3f5f9;
    --bg-elev: #ffffff;
    --bg-elev2: #eaeef4;
    --line: #d5dbe4;
    --text: #161b22;
    --muted: #5c6673;
    --accent: #2f6fe0;
    --accent-dim: #dbe6fb;
    --green: #1f9d54;
    --green-dim: #d6f2e0;
    --amber: #b26a00;
    --danger: #d13b3b;
    --soft-blue-bg: #dbe6fb;   --soft-blue-text: #1b4ba8;
    --soft-green-bg: #d6f2e0;  --soft-green-text: #0f6b39;
    --soft-amber-bg: #fbecd0;  --soft-amber-text: #915200;
    --soft-red-bg: #fbdcdc;    --soft-red-text: #a12222;
    --shadow: 0 8px 30px rgba(60,70,90,.18);
  }
}

:root {
  --radius: 14px;
  --tap: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  overscroll-behavior-y: none;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.appbar h1 { font-size: 18px; margin: 0; font-weight: 700; flex: 1; }
.appbar .sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.backbtn {
  background: var(--bg-elev2);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 40px; min-width: 40px;
  padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600;
}
.saveind {
  font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
  background: var(--soft-green-bg); color: var(--soft-green-text);
  transition: opacity .3s;
}
.saveind.saving { background: var(--soft-amber-bg); color: var(--soft-amber-text); }
.saveind.error { background: var(--soft-red-bg); color: var(--soft-red-text); }

.themebtn {
  background: var(--bg-elev2);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 40px; width: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; flex: none;
}

.content { padding: 16px 16px calc(40px + var(--safe-bottom)); }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.daycard {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  min-height: 132px;
  display: flex; flex-direction: column;
  text-align: left;
  position: relative;
  transition: transform .06s ease, border-color .15s;
}
.daycard:active { transform: scale(0.98); }
.daycard .code { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.daycard .name { font-size: 16px; font-weight: 700; margin-top: 4px; }
.daycard .focus { font-size: 13px; color: var(--muted); margin-top: 6px; flex: 1; }
.daycard .resume {
  align-self: flex-start; margin-top: 10px;
  font-size: 12px; font-weight: 700;
  background: var(--soft-blue-bg); color: var(--soft-blue-text);
  padding: 4px 10px; border-radius: 999px;
}
.daycard .resume.done { background: var(--soft-green-bg); color: var(--soft-green-text); }
.home-foot { margin-top: 24px; text-align: center; }
.home-foot a { font-weight: 600; font-size: 15px; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; margin: 4px 2px 10px; }

/* ---------- Session ---------- */
.meta-row {
  display: flex; gap: 12px; align-items: stretch;
  margin-bottom: 18px;
}
.field {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; flex: 1;
}
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%; background: transparent; border: none; outline: none;
  font-size: 18px; font-weight: 600; padding: 0;
}
.field textarea { font-size: 15px; font-weight: 500; resize: none; min-height: 24px; }

.warmup {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 18px; overflow: hidden;
}
.warmup summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.warmup summary::-webkit-details-marker { display: none; }
.warmup summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.warmup[open] summary .chev { transform: rotate(90deg); }
.warmup .body { padding: 0 16px 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }

.block-label {
  font-size: 12px; font-weight: 800; letter-spacing: 1.5px;
  color: var(--accent); margin: 22px 4px 12px; text-transform: uppercase;
}

.exercise {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.exercise .ex-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.exercise .ex-name { font-size: 17px; font-weight: 700; }
.exercise .ex-target {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--bg-elev2); padding: 2px 8px; border-radius: 999px;
}
.exercise .ex-swapped {
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  background: var(--soft-blue-bg); color: var(--soft-blue-text);
  padding: 2px 8px; border-radius: 999px;
}
.exercise .ex-edit {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--bg-elev2); border: 1px solid var(--line); color: var(--muted);
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
}
.exercise .ex-edit:active { transform: scale(0.94); border-color: var(--accent); }
.exercise .ex-notes { font-size: 12px; color: var(--amber); margin-top: 2px; width: 100%; }
.lasttime {
  margin-top: 10px; font-size: 13px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.lasttime .lt-label { font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.lt-chip {
  background: var(--bg-elev2); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: baseline; gap: 8px;
}
.lt-chip:active { border-color: var(--accent); }
.lt-chip .lt-set { font-weight: 800; font-size: 15px; }
.lt-chip .lt-date { font-size: 12px; color: var(--muted); font-weight: 600; }

.setrow {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
}
.setrow .setno {
  width: 26px; flex: none; text-align: center;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.setrow .inp-wrap { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.setrow .inp-wrap .cap { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; padding-left: 2px; }
.setinput {
  width: 100%; height: var(--tap);
  background: var(--bg-elev2); border: 1px solid var(--line);
  border-radius: 10px; text-align: center;
  font-size: 19px; font-weight: 700; outline: none;
}
.setinput:focus { border-color: var(--accent); }
.setinput.filled { border-color: var(--accent-dim); }

.donebtn {
  flex: none; width: var(--tap); height: var(--tap);
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-elev2); color: var(--muted);
  font-size: 22px; display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s;
}
.donebtn.done { background: var(--soft-green-bg); border-color: var(--green); color: var(--soft-green-text); }
.donebtn:active { transform: scale(0.94); }

/* Effort metric input sits narrower than weight/reps */
.setrow .inp-wrap.narrow { flex: 0 0 62px; }
@media (max-width: 360px) { .setrow .inp-wrap.narrow { flex: 0 0 54px; } }

/* ---------- Session finish actions ---------- */
.session-actions {
  margin-top: 28px; display: flex; flex-direction: column; gap: 12px;
}
.act-btn {
  width: 100%; min-height: 54px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg-elev2); color: var(--text);
  font-size: 16px; font-weight: 700;
}
.act-btn:active { transform: scale(0.99); }
.act-btn.primary { background: var(--green); border-color: transparent; color: #fff; }
.completed-note {
  text-align: center; font-weight: 700; font-size: 14px;
  color: var(--soft-green-text); background: var(--soft-green-bg);
  padding: 10px; border-radius: 12px;
}

/* ---------- History ---------- */
.hist-item {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
}
.hist-item .h-day {
  font-weight: 800; font-size: 15px;
  background: var(--bg-elev2); border-radius: 8px;
  padding: 6px 10px; min-width: 44px; text-align: center;
}
.hist-item .h-main { flex: 1; }
.hist-item .h-name { font-weight: 700; }
.hist-item .h-date { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hist-item .h-count { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- Practices ---------- */
.prac-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 14px; overflow: hidden;
}
.prac-stat { padding: 14px 8px; text-align: center; }
.prac-stat + .prac-stat { border-left: 1px solid var(--line); }
.prac-stat-v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.prac-stat-l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }

.prac-search {
  display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 12px; cursor: text;
}
.prac-search:focus-within { border-color: var(--accent); }
.prac-search-ico { color: var(--muted); font-size: 20px; line-height: 1; }
.prac-search-input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none;
  color: var(--text); font-size: 16px; font-weight: 500;
}
.prac-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }

.prac-month {
  font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin: 18px 4px 8px;
}
.prac-item {
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 14px; padding: 14px 14px 12px; margin-bottom: 10px;
  transition: border-color .15s;
}
.prac-item.live, .prac-item.upcoming { border-left-color: var(--accent); }
.prac-item:hover { border-color: var(--accent-dim); }
.prac-item.live:hover, .prac-item.upcoming:hover { border-left-color: var(--accent); }
.prac-open {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer;
}
.prac-date {
  flex: none; width: 50px; padding: 6px 0; border-radius: 10px; text-align: center;
  background: var(--bg-elev2);
}
.prac-date-wd { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.prac-date-d { font-size: 21px; font-weight: 800; line-height: 1.1; }
.prac-main { flex: 1; min-width: 0; }
.prac-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prac-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.prac-pill {
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 6px; background: var(--bg-elev2); color: var(--text);
}
.prac-status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.prac-status.live { background: var(--soft-blue-bg); color: var(--soft-blue-text); }
.prac-status.upcoming { color: var(--accent); border: 1px solid var(--accent-dim); }
.prac-new { width: 100%; margin-bottom: 14px; }
.prac-chev { flex: none; color: var(--muted); font-size: 24px; line-height: 1; }

.prac-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-left: 64px; }
.modal .prac-tags { margin: 12px 0; padding-left: 0; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 4px 12px; border-radius: 999px;
  background: var(--bg-elev2); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer;
}
.tag-chip.on { background: var(--soft-blue-bg); color: var(--soft-blue-text); border-color: transparent; }
.tag-chip.static { min-height: 24px; padding: 2px 10px; font-size: 12px; cursor: default; background: var(--soft-blue-bg); color: var(--soft-blue-text); border-color: transparent; }
.tag-chip.add { min-height: 24px; padding: 2px 10px; font-size: 12px; background: none; border-style: dashed; color: var(--muted); }
.tag-chip.add:hover { color: var(--accent); border-color: var(--accent); }
.tag-chip .tag-n { font-size: 11px; color: var(--muted); font-weight: 700; }
.tag-chip.on .tag-n { color: inherit; opacity: .75; }
.tag-chip .tag-x { font-size: 15px; line-height: 1; opacity: .8; }
@media (max-width: 380px) { .prac-tags { padding-left: 0; } }

.readonly-set { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.readonly-set .rs-no { color: var(--muted); width: 40px; }
.readonly-set .rs-val { font-weight: 600; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 40px; margin-bottom: 12px; }

.spinner { text-align: center; padding: 60px; color: var(--muted); }

/* ---------- PIN gate ---------- */
.gate { padding: 80px 24px; text-align: center; max-width: 340px; margin: 0 auto; }
.gate h2 { font-size: 22px; }
.gate input {
  width: 100%; height: 56px; text-align: center; letter-spacing: 8px;
  font-size: 24px; margin: 20px 0; background: var(--bg-elev2);
  border: 1px solid var(--line); border-radius: 12px; outline: none;
}
.btn-primary {
  width: 100%; height: 52px; border: none; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 17px;
}
.gate .err { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---------- Modal / dialog ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
@media (min-width: 520px) { .modal-backdrop { align-items: center; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 18px 18px 0 0; width: 100%; max-width: 640px;
  padding: 22px 18px calc(20px + var(--safe-bottom));
  box-shadow: var(--shadow);
  animation: slideup .18s ease;
}
@media (min-width: 520px) { .modal { border-radius: 18px; margin: 0 16px; } }
@keyframes slideup { from { transform: translateY(24px); } to { transform: translateY(0); } }
.modal h3 { margin: 0 0 4px; font-size: 21px; }
.modal .msub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.modal .stack { display: flex; flex-direction: column; gap: 12px; }
.mbtn {
  width: 100%; min-height: 58px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg-elev2); color: var(--text);
  font-size: 16px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.mbtn:active { transform: scale(0.98); }
.mbtn .mbtn-sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.mbtn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.mbtn.primary .mbtn-sub { color: rgba(255,255,255,.85); }
.mbtn.danger { background: var(--soft-red-bg); color: var(--soft-red-text); border-color: transparent; }
.mdivider {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  margin: 18px 0;
}
.mdivider::before, .mdivider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mdate-row { display: flex; gap: 10px; }
.mdate-row input[type=date] {
  flex: 1; height: 58px; background: var(--bg-elev2);
  border: 1px solid var(--line); border-radius: 14px; color: var(--text);
  font-size: 16px; padding: 0 14px; outline: none;
}
.mdate-row .mbtn { width: auto; flex: none; padding: 0 22px; }
.mbtn.ghost-danger {
  margin-top: 12px; min-height: 50px;
  background: transparent; border: 1px solid var(--soft-red-bg); color: var(--danger);
}
.mcancel {
  width: 100%; margin-top: 12px; height: 48px;
  background: transparent; border: none; color: var(--muted);
  font-weight: 600; font-size: 15px;
}

/* ---------- Edit / swap movement sheet ---------- */
.medit-field { margin-bottom: 12px; }
.medit-field label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700; margin-bottom: 5px;
}
.medit-input {
  width: 100%; height: 50px; padding: 0 12px;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-size: 16px; font-weight: 600; outline: none;
  -webkit-appearance: none; appearance: none;
}
.medit-input:focus { border-color: var(--accent); }
select.medit-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='%2397a3b4' d='M4 6l4 4 4-4z'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
.medit-grid { display: flex; gap: 12px; }
.medit-grid .medit-field { flex: 1; }
.danger-link {
  display: block; width: 100%; margin-top: 32px; height: 52px;
  border-radius: 12px; border: 1px solid var(--soft-red-bg);
  background: transparent; color: var(--danger); font-weight: 700; font-size: 16px;
}

/* ---------- Home footer nav ---------- */
.home-foot .foot-sep { color: var(--muted); margin: 0 10px; }

/* ---------- Stats ---------- */
.stat-hero {
  display: flex; align-items: center; gap: 18px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 8px;
}
.ring-wrap { position: relative; flex: none; width: 120px; height: 120px; }
.ring { display: block; }
.ring-track { stroke: var(--bg-elev2); }
.ring-fill { stroke: var(--accent); transition: stroke-dashoffset .6s ease; }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.ring-num { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.ring-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin-top: 3px; }
.hero-side { flex: 1; }
.hero-title { font-size: 18px; font-weight: 800; }
.hero-sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.hero-totals { font-size: 12px; color: var(--muted); margin-top: 10px; font-weight: 600; }

.stat-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px;
}

.bar-row { margin: 12px 0; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.bar-label { font-size: 14px; font-weight: 700; }
.bar-val { font-size: 13px; font-weight: 700; color: var(--muted); }
.bar-track { height: 10px; background: var(--bg-elev2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s ease; }
.bar-fill.good { background: var(--green); }
.bar-fill.mid { background: var(--amber); }
.bar-fill.low { background: var(--danger); }
.bar-fill.accent { background: var(--accent); }
.dim-note { font-size: 11px; color: var(--muted); margin: -4px 0 4px; }

.kl-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kl-row:last-child { border-bottom: none; }
.kl-main { flex: 1; min-width: 0; }
.kl-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kl-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kl-e1rm { font-weight: 800; font-size: 18px; }
.kl-e1rm .kl-unit { font-size: 11px; color: var(--muted); font-weight: 700; margin-left: 2px; }
.kl-trend { font-size: 12px; font-weight: 700; min-width: 52px; text-align: right; color: var(--muted); }
.kl-trend.up { color: var(--green); }
.kl-trend.down { color: var(--danger); }

.vol-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.vol-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.vol-bar { width: 100%; max-width: 26px; background: var(--accent-dim); border-radius: 5px 5px 0 0; min-height: 4px; }
.vol-bar.latest { background: var(--accent); }
.vol-x { font-size: 9px; color: var(--muted); margin-top: 5px; font-weight: 600; }

.stat-foot { font-size: 11px; color: var(--muted); text-align: center; margin: 14px 6px 0; line-height: 1.5; }

/* ---------- Plan editor ---------- */
.plan-item {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
}
.plan-item .h-day {
  font-weight: 800; font-size: 15px;
  background: var(--bg-elev2); border-radius: 8px;
  padding: 6px 10px; min-width: 44px; text-align: center;
}
.plan-item .h-main { flex: 1; min-width: 0; }
.plan-item .h-name { font-weight: 700; }
.plan-item .h-date { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-item .h-count { font-size: 13px; color: var(--muted); font-weight: 600; }

.block-edit {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 14px;
}
.blk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.blk-code {
  flex: 1; height: 40px; padding: 0 12px; font-weight: 800; font-size: 15px;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--accent); outline: none; text-transform: uppercase;
}
.blk-tools { display: flex; gap: 6px; flex: none; }
.movebtn {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--bg-elev2); border: 1px solid var(--line); color: var(--muted);
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
}
.movebtn:active { transform: scale(0.94); }
.movebtn.del { color: var(--danger); border-color: var(--soft-red-bg); }

.ex-edit {
  background: var(--bg-elev2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; margin: 8px 0;
}
.ex-edit-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ex-edit-top .medit-input { flex: 1; }
.ex-edit-grid { display: flex; gap: 8px; margin-bottom: 8px; }
.ex-edit-grid .medit-field { flex: 1; }
.ex-edit .medit-field { margin-bottom: 0; }
.ex-edit .medit-field + .medit-field { margin-top: 0; }
.ex-edit > .medit-field { margin-top: 8px; }

.add-move {
  width: 100%; height: 44px; border-radius: 10px;
  background: transparent; border: 1px dashed var(--line); color: var(--accent);
  font-weight: 700; font-size: 14px; margin-top: 6px;
}
.add-move:active { transform: scale(0.99); }
.block-add { border-color: var(--accent-dim); margin-bottom: 8px; }

/* ---------- Profile ---------- */
.prof-hero { display: flex; gap: 10px; margin-bottom: 8px; }
.prof-stat {
  flex: 1; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 12px; text-align: center;
}
.ps-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.ps-big { font-size: 22px; font-weight: 800; margin: 4px 0 2px; letter-spacing: -.5px; }
.ps-sub { font-size: 11px; color: var(--muted); font-weight: 600; }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.sec-btn {
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; color: var(--accent);
}
.sec-btn:active { transform: scale(0.97); }
.prof-empty {
  background: var(--bg-elev); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 18px; color: var(--muted); font-size: 14px; text-align: center;
}

.goal-card { padding: 14px 16px; }
.goal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.goal-name { font-size: 16px; font-weight: 800; }
.goal-badge {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--soft-blue-bg); color: var(--soft-blue-text);
}
.goal-badge.decrease { background: var(--soft-amber-bg); color: var(--soft-amber-text); }
.goal-nums { display: flex; gap: 8px; margin-bottom: 12px; }
.goal-num { flex: 1; background: var(--bg-elev2); border-radius: 10px; padding: 8px; text-align: center; }
.gn-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.gn-val { font-size: 16px; font-weight: 800; margin-top: 2px; }

.meas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meas-cell {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; position: relative;
}
.meas-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.meas-val { font-size: 19px; font-weight: 800; margin-top: 3px; }
.meas-delta { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 700; }
.meas-delta.up { color: var(--green); }
.meas-delta.down { color: var(--danger); }
.meas-input-grid { flex-wrap: wrap; }
.meas-input-grid .medit-field { flex: 1 1 40%; min-width: 120px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--bg-elev2); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  z-index: 50; box-shadow: var(--shadow);
}

/* ---------- Swim ---------- */
.swimcard .code { font-size: 30px; letter-spacing: 0; }
.hist-item .h-day.swim { font-size: 18px; padding: 4px 10px; }
.swim-totals .ps-big { font-size: 24px; }
.seg { display: flex; gap: 6px; background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg-btn {
  flex: 1; height: 40px; border: none; border-radius: 9px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 15px;
}
.seg-btn.on { background: var(--accent); color: var(--accent-text); }
textarea.medit-input { height: auto; min-height: 50px; padding: 12px; resize: none; font-family: inherit; line-height: 1.4; }
.swim-help pre {
  background: var(--bg-elev2); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px;
  color: var(--text); font-size: 13px; white-space: pre-wrap;
}
.swim-block .blk-code { text-transform: uppercase; }
.swim-text {
  width: 100%; min-height: 84px; margin-top: 4px; padding: 12px;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); outline: none; resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; line-height: 1.55;
}
.swim-text:focus { border-color: var(--accent); }
.swim-blk-sum { margin: 8px 2px 0; font-size: 13px; font-weight: 700; color: var(--accent); }
.swim-bd-wrap summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 2px 0; }
.swim-bd { margin-top: 6px; }
.swim-bd-row {
  display: flex; gap: 10px; align-items: baseline; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.swim-bd-row:last-child { border-bottom: none; }
.swim-bd-l { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.swim-bd-r { flex: none; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.swim-bd-row.group .swim-bd-l { color: var(--accent); font-weight: 800; }
.swim-bd-row.nested { padding-left: 16px; border-left: 2px solid var(--accent-dim); margin-left: 4px; }
.swim-bd-row.note .swim-bd-l { color: var(--muted); font-style: italic; font-weight: 500; }
.swim-bd-row.desc { padding-left: 14px; }
.swim-bd-row.nested.desc { padding-left: 30px; }
.swim-bd-row.untimed .swim-bd-r { color: var(--amber); }
.swim-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.swim-view-label { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.swim-view-sum { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 700; font-size: 12px; }

/* ---------- Active swim (poolside) ---------- */
.swim-clock {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 17px;
  background: var(--soft-blue-bg); color: var(--soft-blue-text);
  padding: 6px 12px; border-radius: 999px; flex: none;
}
.swim-prog { position: sticky; top: calc(var(--safe-top) + 66px); z-index: 10; box-shadow: var(--shadow); }
.swim-prog .bar-head { margin-bottom: 8px; }
.swim-prog-dist { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.swim-prog-sub { font-size: 13px; font-weight: 700; color: var(--muted); }
.swim-act-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 8px;
}
.swim-act-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px;
  padding: 12px 14px; text-align: left; background: transparent;
  border: none; border-bottom: 1px solid var(--line); border-left: 4px solid transparent;
}
.swim-act-card > :last-child { border-bottom: none; }
.swim-act-row.nested { padding-left: 26px; }
.swim-act-check {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
}
.swim-act-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.swim-act-main { font-size: 20px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.swim-act-meta { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.swim-act-iv { flex: none; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.swim-act-row.rest .swim-act-iv { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.swim-act-row.current { background: color-mix(in srgb, var(--accent) 12%, transparent); border-left-color: var(--accent); }
.swim-act-row.current .swim-act-check { border-color: var(--accent); }
.swim-act-row.done { opacity: .5; }
.swim-act-row.done .swim-act-check { background: var(--green); border-color: var(--green); color: #fff; }
.swim-act-row.done .swim-act-main { text-decoration: line-through; text-decoration-thickness: 2px; }
.swim-act-row:active { transform: scale(0.99); }
.swim-act-round {
  padding: 10px 14px 6px; font-size: 12px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent); background: var(--bg-elev2);
  border-bottom: 1px solid var(--line);
}
.swim-act-note { padding: 10px 14px; color: var(--muted); font-style: italic; border-bottom: 1px solid var(--line); }
.swim-act-note.nested { padding-left: 26px; }
.swim-act-note.desc { font-size: 0.92em; padding-top: 4px; }
.swim-act-note.desc { padding-left: 26px; }
.swim-act-note.nested.desc { padding-left: 40px; }
.swim-start { font-size: 18px; }

.swim-banner {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--soft-blue-bg); color: var(--soft-blue-text);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
}
.swim-banner-dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  animation: swimpulse 1.4s ease-in-out infinite;
}
@keyframes swimpulse { 50% { opacity: .3; } }
.swim-banner-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.swim-banner-title { font-weight: 800; }
.swim-banner-sub { font-size: 13px; font-weight: 600; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swim-banner-go { flex: none; font-weight: 800; }
.hist-item .h-count.live { color: var(--accent); }

/* ---------- Swim print sheet ---------- */
/* Fixed black-on-white (not theme tokens) so dark mode never reaches paper. */
.print-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.print-toolbar .print-go { flex: 1; }
.print-hint { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.print-sheet {
  background: #fff; color: #111; border-radius: 6px; padding: 28px 26px;
  font-size: 14px; line-height: 1.45; box-shadow: var(--shadow);
}
.ps-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  margin-bottom: 3.5em; /* ~2.5 blank lines */
}
.ps-title { font-size: 22px; font-weight: 800; }
.ps-date { font-size: 13px; color: #555; margin-top: 2px; }
.ps-totals { text-align: right; flex: none; }
.ps-tot-big { font-size: 20px; font-weight: 800; }
.ps-tot-sub { font-size: 12px; color: #555; }
.ps-block { margin-bottom: 18px; break-inside: avoid; page-break-inside: avoid; }
.ps-block-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  border-bottom: 1px solid #bbb; padding-bottom: 3px; margin-bottom: 4px;
}
.ps-block-head span:last-child { letter-spacing: 0; text-transform: none; color: #555; font-weight: 700; }
.ps-line { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; }
.ps-l { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; overflow-wrap: anywhere; }
.ps-line.group .ps-l { font-weight: 800; }
.ps-line.nested { padding-left: 18px; }
.ps-line.note .ps-l { font-style: italic; color: #555; }
.ps-line.desc { padding-left: 18px; }
.ps-line.nested.desc { padding-left: 36px; }
.ps-line.desc .ps-l { font-family: inherit; font-size: 12.5px; }
.ps-notes { margin-top: 16px; padding-top: 8px; border-top: 1px solid #bbb; font-size: 13px; }
.ps-foot { margin-top: 10px; font-size: 11px; color: #777; }

@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; }
  .no-print, .appbar, .toast { display: none !important; }
  #app { max-width: none; }
  .content { padding: 0; }
  .print-sheet { box-shadow: none; padding: 0; border-radius: 0; }
}

/* ---------- Swim tabs + line chart ---------- */
.swim-tabs { margin-bottom: 14px; }
.seg.seg-sm { padding: 3px; gap: 4px; border-radius: 10px; }
.seg.seg-sm .seg-btn { white-space: nowrap; height: 30px; font-size: 13px; padding: 0 10px; border-radius: 7px; }
.lc-card { padding: 14px 14px 10px; margin-bottom: 14px; }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.lc-title { font-size: 15px; font-weight: 800; }
.lc-wrap { position: relative; width: 100%; min-height: 190px; touch-action: pan-y; }
.lc { display: block; max-width: 100%; height: auto; overflow: visible; }
.lc-grid { stroke: var(--line); stroke-width: 1; }
.lc-axis { fill: var(--muted); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lc-val { fill: var(--text); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-dot { fill: var(--accent); stroke: var(--bg-elev); stroke-width: 2; transition: r .1s; }
.lc-dot.hover, .lc-dot.on { r: 6.5; }
.lc-dot.on { fill: var(--bg-elev); stroke: var(--accent); stroke-width: 3; }
.lc-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.lc-tip {
  display: none; position: absolute; top: -6px; pointer-events: none; z-index: 2;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; box-shadow: var(--shadow); white-space: nowrap;
}
.lc-tip-h { font-size: 12px; font-weight: 700; color: var(--muted); }
.lc-tip-v { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lc-tip-l { font-size: 12px; color: var(--muted); }
.lc-foot { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.lc-single { padding: 10px 2px 4px; }
.lc-details { margin-top: 8px; font-size: 13px; }
.lc-details summary { color: var(--muted); font-weight: 700; cursor: pointer; }
.lc-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.lc-table th, .lc-table td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.lc-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }

/* ---------- Times ---------- */
.times-course { margin-bottom: 4px; }
.time-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 10px; overflow: hidden;
}
.time-card.open { border-color: var(--accent-dim); }
.time-card .lc-wrap { padding: 0 12px; box-sizing: border-box; }
.time-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.time-main { flex: 1; min-width: 0; }
.time-event { font-weight: 800; font-size: 16px; }
.time-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.time-right { text-align: right; }
.time-pb { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.time-drop { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.time-list { border-top: 1px solid var(--line); margin-top: 6px; }
.time-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.time-row:last-child { border-bottom: 0; }
.time-row:hover { background: var(--bg-elev2); }
.time-row-d { font-size: 14px; font-weight: 600; white-space: nowrap; }
.time-row-m { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-row-t { font-weight: 800; font-variant-numeric: tabular-nums; }
.prac-status.pb { background: var(--soft-green-bg); color: var(--soft-green-text); }
.time-ev-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Training blocks ---------- */
.tb-sec { margin-top: 18px; }
.tb-card {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
}
.tb-card.current { border-left-color: var(--accent); }
.tb-card.upcoming { border-left-color: var(--accent-dim); }
.tb-card:hover { border-color: var(--accent-dim); }
.tb-card.current:hover { border-left-color: var(--accent); }
.tb-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tb-card-name { font-weight: 800; font-size: 17px; }
.tb-card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tb-card-goal { font-size: 14px; margin-top: 6px; }
.tb-head .tb-card-goal { margin-top: 0; font-weight: 600; }
.tb-card-counts { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.tb-prog { margin-top: 10px; }
.tb-prog-l { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.tb-bar { height: 8px; background: var(--bg-elev2); border-radius: 999px; overflow: hidden; }
.tb-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.prac-status.tb-current { background: var(--soft-blue-bg); color: var(--soft-blue-text); white-space: nowrap; }
.prac-status.tb-upcoming { color: var(--accent); border: 1px solid var(--accent-dim); white-space: nowrap; }
.prac-status.tb-finished { background: var(--soft-amber-bg); color: var(--soft-amber-text); white-space: nowrap; }
.prac-status.tb-archived { color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tb-archive > summary { cursor: pointer; list-style: none; }
.tb-archive > summary::before { content: "▸ "; }
.tb-archive[open] > summary::before { content: "▾ "; }
.tb-notes { font-size: 14px; color: var(--muted); margin-top: 10px; white-space: pre-wrap; line-height: 1.45; }
.tb-summary { margin-top: 4px; }
.tb-len { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.tb-lifts { padding: 4px 14px; }
.tb-lift { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tb-lift:last-child { border-bottom: 0; }
.tb-lift-n { flex: 1; min-width: 0; font-weight: 700; }
.tb-lift-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-lift-c { width: 64px; text-align: right; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tb-times { padding: 0; overflow: hidden; }
.time-row.static { cursor: default; }
.time-row.static:hover { background: none; }
.tb-empty { margin: 0 4px 12px; }
.tb-plan { margin-top: 16px; }
.tb-plan-day { font-weight: 800; margin: 12px 0 4px; }
.tb-plan-ex { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; color: var(--muted); }
.tb-plan-ex span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-actions { display: flex; flex-direction: column; margin-top: 18px; gap: 8px; }
.tb-link { display: inline-block; font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; }
.tb-link-slot { margin: -4px 2px 12px; }
.tb-field { margin-bottom: 8px; }
.prac-block { margin-bottom: 0; }
.tb-banner {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--accent-dim); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px;
}
.tb-banner-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.tb-banner-name { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-banner-wk { flex: none; font-size: 13px; font-weight: 700; color: var(--accent); }
.tb-add-list { max-height: 55vh; overflow-y: auto; margin: 8px 0; }
.tb-add-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 6px; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer;
}
.tb-add-ico { flex: none; min-width: 40px; text-align: center; font-weight: 800; font-size: 13px; background: var(--bg-elev2); border-radius: 8px; padding: 4px 6px; }
.tb-add-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tb-add-name { font-weight: 700; }
.tb-add-sub { font-size: 12px; color: var(--muted); }
.tb-add-go { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--bg-elev2); }
.tb-add-row.added .tb-add-go { background: var(--accent); color: var(--accent-text); }

/* ---------- Home + hubs ---------- */
.home-hello { margin: 10px 2px 16px; }
.home-hello-h { font-size: 14px; font-weight: 700; color: var(--muted); }
.home-hello-q { font-size: 24px; font-weight: 800; letter-spacing: -.4px; margin-top: 2px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 190px;
  padding: 20px 18px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 20px;
  transition: border-color .15s, transform .1s;
}
.mode-card:hover { border-color: var(--accent); }
.mode-card:active { transform: scale(0.98); }
.mode-ico { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.mode-name { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.mode-line { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.35; }
.mode-line.live { color: var(--accent); }
.mode-line.done { color: var(--green); }
@media (max-width: 360px) { .mode-grid { grid-template-columns: 1fr; } .mode-card { min-height: 0; } }

.daycard.is-next { border-color: var(--accent); }
.daycard .resume.next { background: var(--accent); color: var(--accent-text); }
.hub-hint { display: flex; flex-direction: column; gap: 8px; padding: 16px; margin-bottom: 16px; }
.hub-hint-h { font-weight: 800; font-size: 16px; }
.hub-more { margin-top: 18px; }
.hub-more > summary { cursor: pointer; list-style: none; }
.hub-more > summary::before { content: "▸ "; }
.hub-more[open] > summary::before { content: "▾ "; }
.hub-sec { margin-top: 20px; }
.hub-empty { margin: 0 4px 12px; }
.hub-today { padding: 16px; margin-bottom: 4px; border-left: 4px solid var(--accent); }
.hub-today.done { border-left-color: var(--green); }
.hub-today.empty-today { border-left-color: var(--line); }
.hub-today-title { font-size: 18px; font-weight: 800; }
.hub-today-sub { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.hub-today-acts { display: flex; gap: 10px; margin-top: 14px; }
.hub-today-acts .act-btn { flex: 1; margin: 0; }
.hub-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 8px;
}
.hub-row:hover { border-color: var(--accent-dim); }
.hub-row-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px;
  background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.hub-reuse { flex: none; }
.hub-lib-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 24px; }
.hub-lib-head .tb-link { margin-right: 2px; }
.tb-days { margin-bottom: 12px; }
.tb-days-line { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 10px; }
.tb-link-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent); }
.link-btn {
  display: block; margin: -4px auto 8px; padding: 6px 10px; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--accent);
}
