:root {
  --paper: #f3efe7;
  --ink: #1f1a17;
  --accent: #0e6b64;
  --accent-ink: #ffffff;
  --card: #fffdf8;
  --line: #e4dccd;
  --bad: #8c2f2f;
  --bad-bg: #f8e8e4;
  --ok: #1d6b3a;
  --muted: #5c564f;
  --shadow: 0 1px 0 rgba(31, 26, 23, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.45 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; }

.wrap { max-width: 40rem; margin: 0 auto; padding: 1rem 1rem 5rem; }
.wrap.wide { max-width: 64rem; }

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.brand { font-weight: 700; text-decoration: none; color: var(--ink); }

nav { display: flex; flex-wrap: wrap; gap: 0.75rem; }
nav a { text-decoration: none; }

.card, .exercise {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin: 0 0 1rem;
  box-shadow: var(--shadow);
}

.narrow { max-width: 28rem; }

.hero h1 { margin-top: 0.2rem; }

.eyebrow, .muted, .fine { color: var(--muted); }
.fine { font-size: 0.9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.78rem; margin: 0; }

.note {
  background: #e7f3f1;
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.banner {
  background: #fff4d8;
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.banner.bad { background: var(--bad-bg); color: var(--bad); }

label { display: block; margin: 0.8rem 0 0.25rem; font-weight: 600; }

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

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
}

textarea { min-height: 6rem; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  margin-top: 0.8rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  cursor: pointer;
}

button.ghost, a.ghost, .button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button.danger { background: var(--bad); }

.check, .choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  min-height: 48px;
}

.check input, .choice input { width: 1.25rem; min-height: 1.25rem; }

.checks { display: grid; grid-template-columns: 1fr; gap: 0.15rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.choices.compact .choice { min-height: 44px; }

.set {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.4rem 0.6rem;
  align-items: end;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.set > span { grid-column: 1 / -1; font-weight: 700; }
.set label { margin: 0; font-weight: 500; }
.set label:not(.check) { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.set small { grid-column: 1 / -1; color: var(--muted); }
.set .check { grid-column: 1 / -1; }

.dial { display: flex; align-items: center; gap: 0.15rem; width: 100%; min-width: 0; touch-action: pan-y; }
.dial .dial-step {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  min-height: 64px;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  touch-action: manipulation;
}
.dial input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding-inline: 0.15rem;
  min-height: 64px;
  text-align: center;
  font-weight: 700;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  touch-action: pan-y;
  user-select: none;
  caret-color: transparent;
}

.split, .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.row-actions form { margin: 0; }
.row-actions button, .row-actions .button { margin-top: 0; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: 16px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 0.85rem; color: var(--muted); }

.dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 0.25rem;
}
.dot.al_dia { background: var(--ok); }
.dot.pendiente { background: #a57900; }
.dot.revisar { background: var(--bad); }
.dot.sin_plan, .dot.inactiva { background: var(--muted); }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  background: var(--line);
  font-size: 0.85rem;
}
.pill.ok { background: #e5f4ea; color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

ul.plain { list-style: none; padding: 0; }
ul.plain li { margin: 0.4rem 0; }
ul.cards li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem; }
ul.pick { list-style: none; padding: 0; }
ul.pick li { display: flex; gap: 0.6rem; align-items: center; margin: 0.35rem 0; }
ul.pick form { display: flex; gap: 0.6rem; align-items: center; margin: 0; }
ul.pick button { margin-top: 0; }

.filters { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.filters button { margin-top: 0; }

.linkbox {
  overflow-wrap: anywhere;
  background: white;
  border-radius: 12px;
  padding: 0.8rem;
  border: 1px dashed var(--accent);
}

.prose h2 { margin-top: 1.4rem; }

details { border-top: 1px solid var(--line); padding: 0.6rem 0; }
summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; }

.block { margin-top: 0.8rem; }

.timer {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--ink);
  color: white;
  border-radius: 16px;
  padding: 0.8rem 1rem;
  z-index: 3;
}
.timer[hidden] { display: none; }
.timer strong { font-size: 1.8rem; }
.timer .eyebrow { color: #d9ece9; }
.timer button { margin: 0; background: white; color: var(--ink); }
.timer.done { background: var(--accent); }

footer { margin-top: 2rem; }

@media (min-width: 800px) {
  .checks { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1.4fr 1fr 1fr 1fr auto; align-items: end; }
  .set { grid-template-columns: 5rem 1fr 1fr auto; }
  .set > span, .set .check, .set small { grid-column: auto; }
}

/* Muscle picker on the exercise form: looks like a select, opens a searchable list. */
.picker { margin: 0.9rem 0 0.4rem; }
.picker-title { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.picker details { border: 0; padding: 0; position: relative; }
.picker summary {
  list-style: none;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  -webkit-tap-highlight-color: transparent;
}
.picker summary:focus { outline: none; }
.picker summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.picker summary::-webkit-details-marker { display: none; }
.picker details[open] summary { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.picker-caret { color: var(--muted); flex: 0 0 auto; width: 22px; height: 22px; transition: transform 0.15s; }
.picker details[open] .picker-caret { transform: rotate(180deg); }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; min-width: 0; }
.chip {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #e3f0ee;
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1.5;
}
.picker-panel {
  border: 1px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: white;
  padding: 0.6rem 0.75rem 0.4rem;
}
.picker-search { margin-bottom: 0.4rem; }
.picker-options { max-height: 18rem; overflow-y: auto; overscroll-behavior: contain; }
.picker-group { border: 0; margin: 0; padding: 0.2rem 0 0.4rem; }
.picker-group legend { padding: 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.picker-group .check { min-height: 40px; }
.picker [hidden], .picker-note[hidden] { display: none !important; }
.picker-note { margin: 0.3rem 0 0; font-size: 0.95rem; }
@media (min-width: 800px) {
  .picker-options { columns: 2; column-gap: 1.5rem; }
  .picker-group { break-inside: avoid; }
}

/* Exercise lists that filter as you type. */
[data-search][hidden], [data-live-empty][hidden], .filters button[hidden] { display: none !important; }
.live-count { margin: 0.4rem 0 0.6rem; font-size: 0.95rem; }
.picker-note .note-action { margin: 0.4rem 0 0; min-height: 40px; padding: 0.3rem 0.9rem; font-size: 0.95rem; }

/* Workout: exercises as collapsible rows with a status. */
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.block-head h2 { margin-bottom: 0.4rem; }
.block-progress { font-size: 0.9rem; color: var(--muted); }
.workout-block.block-done .block-progress { color: var(--ok); font-weight: 600; }
details.exercise { padding: 0; margin: 0.6rem 0 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
details.exercise > summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 60px;
  padding: 0.6rem 0.8rem;
  -webkit-tap-highlight-color: transparent;
}
details.exercise > summary::-webkit-details-marker { display: none; }
details.exercise > summary:focus { outline: none; }
details.exercise > summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 14px; }
details.exercise[open] { border-color: var(--accent); }
details.exercise[open] > summary { border-bottom: 1px solid var(--line); }
.exercise-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.exercise-title strong { overflow-wrap: anywhere; }
.exercise-title .muted { font-size: 0.9rem; margin-top: 0.15rem; }
.status-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 999px;
  font-weight: 700; font-size: 1.05rem;
  color: var(--muted); background: #efe9df;
}
.status-text { font-size: 0.85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
details.exercise[data-status="pending"] .status-icon { background: transparent; box-shadow: inset 0 0 0 3px #d8cfc1; }
details.exercise[data-status="partial"] .status-icon {
  background: conic-gradient(#c97a12 var(--done, 34%), #fbe8c8 0);
  -webkit-mask: radial-gradient(circle, transparent 0 0.42rem, #000 0.45rem);
          mask: radial-gradient(circle, transparent 0 0.42rem, #000 0.45rem);
}
details.exercise[data-status="partial"] .status-text { color: #8a4b00; }
details.exercise[data-status="done"] .status-icon { color: #ffffff; background: var(--ok); }
details.exercise[data-status="done"] .status-text { color: var(--ok); }
details.exercise[data-status="done"]:not([open]) { background: #f1f8f3; border-color: #cfe5d6; }
.exercise-body { padding: 0.2rem 0.8rem 0.8rem; }
