/* Calistenia — estilos (mobile-first, claro/escuro automático) */
:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #efefec;
  --border: #e0dfdb;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6d6c68;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefb;
  --good: #0f7a3d;
  --good-soft: #e3f4ea;
  --warn: #8a5a00;
  --warn-soft: #fdf1d8;
  --danger: #c22c2b;
  --danger-soft: #fbe6e6;
  /* gráficos */
  --series-1: #2a78d6;
  --grid: #e6e5e1;
  --axis: #6d6c68;
  --heat-0: #ecebe7;
  --heat-1: #b7d3f6;
  --heat-2: #5598e7;
  --heat-3: #1c5cab;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 2px 8px rgb(0 0 0 / 0.04);
  --tabbar-h: 64px;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif;
  line-height: 1.45;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #242422;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #a2a198;
    --accent: #3987e5;
    --accent-ink: #ffffff;
    --accent-soft: #1b2d44;
    --good: #4cc27c;
    --good-soft: #15291d;
    --warn: #e7b04a;
    --warn-soft: #2e2512;
    --danger: #ef6b6a;
    --danger-soft: #331a1a;
    --series-1: #3987e5;
    --grid: #2c2c29;
    --axis: #a2a198;
    --heat-0: #262624;
    --heat-1: #184f95;
    --heat-2: #2a78d6;
    --heat-3: #86b6ef;
    --shadow: none;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #242422;
  --border: #33332f;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #a2a198;
  --accent: #3987e5;
  --accent-soft: #1b2d44;
  --good: #4cc27c;
  --good-soft: #15291d;
  --warn: #e7b04a;
  --warn-soft: #2e2512;
  --danger: #ef6b6a;
  --danger-soft: #331a1a;
  --series-1: #3987e5;
  --grid: #2c2c29;
  --axis: #a2a198;
  --heat-0: #262624;
  --heat-1: #184f95;
  --heat-2: #2a78d6;
  --heat-3: #86b6ef;
  --shadow: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
a {
  color: var(--accent);
}
h1 {
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}
h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}
p {
  margin: 0.4rem 0;
}
img,
svg {
  max-width: 100%;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip:focus {
  left: 8px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
.shell {
  display: block;
}
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom));
  outline: none;
}
.sidebar {
  display: none;
}
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: none;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 20;
}
body.logged-in .tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}
.tabbar svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar a.active {
  color: var(--accent);
  font-weight: 600;
}

@media (min-width: 900px) {
  body.logged-in .shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
  }
  body.logged-in .sidebar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 20px 12px;
    border-right: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .sidebar a {
    color: var(--text-2);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 500;
  }
  .sidebar a:hover {
    background: var(--surface-2);
  }
  .sidebar a.active {
    background: var(--accent-soft);
    color: var(--accent);
  }
  .sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
  }
  .nav-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    font-size: 0.85rem;
    color: var(--muted);
  }
  body.logged-in .tabbar {
    display: none;
  }
  main {
    padding: 28px 32px 48px;
  }
}

/* ---------- componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin: 4px 0 14px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.right {
  text-align: right;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.row.end {
  justify-content: flex-end;
}
.row.small-gap {
  gap: 6px;
  margin-top: 6px;
}
.grid-2,
.grid-3 {
  display: grid;
  gap: 0 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}
.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.badge {
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  width: fit-content;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}
.btn:hover {
  filter: brightness(0.97);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.ghost {
  background: transparent;
}
.btn.danger {
  color: var(--danger);
}
.btn.primary.danger,
.modal .btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.875rem;
}
.btn.block {
  width: 100%;
}
.btn.icon {
  width: 48px;
  min-height: 48px;
  padding: 0;
  font-size: 1.2rem;
  border-radius: 12px;
}
.btn.icon.ok {
  background: var(--good);
  border-color: var(--good);
  color: #fff;
}

label {
  display: block;
  margin: 10px 0;
  font-weight: 500;
}
label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}
textarea {
  resize: vertical;
}
input[type='checkbox'] {
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 2px 0 0;
  flex: none;
}
.hint {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  margin-top: 4px;
}
.error {
  color: var(--danger);
  font-weight: 600;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
  background: var(--accent-soft);
  color: var(--text);
  border-left: 4px solid var(--accent);
}
.alert.warn {
  background: var(--warn-soft);
  border-left-color: var(--warn);
}
.alert.tip {
  background: var(--good-soft);
  border-left-color: var(--good);
}
.alert ul {
  margin: 0.4rem 0;
  padding-left: 1.2rem;
}
.note {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  opacity: 0;
  background: var(--text);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 12px;
  z-index: 60;
  transition: 0.2s;
  max-width: calc(100% - 32px);
  pointer-events: none;
  font-weight: 500;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error {
  background: var(--danger);
  color: #fff;
}
.toast.ok {
  background: var(--good);
  color: #fff;
}

.modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(520px, calc(100% - 32px));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.3);
}
.modal::backdrop {
  background: rgb(0 0 0 / 0.45);
}
.modal form {
  padding: 20px;
}
.modal-body {
  max-height: 60vh;
  overflow: auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---------- auth ---------- */
.auth {
  max-width: 420px;
  margin: 4vh auto 0;
}
.auth-hero {
  text-align: center;
  margin-bottom: 18px;
}
.auth-hero h1 {
  font-size: 2rem;
  margin-top: 8px;
}
.switch {
  text-align: center;
  margin-top: 14px;
}

/* ---------- home ---------- */
.week-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}
.week-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
}
.week-dots span.on {
  background: var(--accent);
  border-color: var(--accent);
}
.week-dots small {
  margin-left: 4px;
  color: var(--muted);
}
.next-session {
  border-top: 4px solid var(--accent);
}
.ns-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ns-params {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ns-params span {
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
}
.focus {
  color: var(--text-2);
  font-style: italic;
}
.ex-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}
.ex-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  column-gap: 10px;
}
.ex-list .ex-name {
  font-weight: 600;
}
.ex-list .ex-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.85rem;
}
.ex-list .ex-dose {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ladders {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ladders li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ladders li:last-child {
  border-bottom: 0;
}
.ladders li > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rungs {
  display: inline-flex;
  gap: 3px;
  flex: none;
}
.rung {
  width: 16px;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.rung.on {
  background: var(--series-1);
  border-color: var(--series-1);
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}
.stats > div:not(.row) {
  display: flex;
  flex-direction: column;
}
.stat {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat small {
  font-size: 0.9rem;
  color: var(--muted);
}
.blocks li {
  margin: 6px 0;
}

/* ---------- sessão ---------- */
.block .card-head h2 {
  margin: 0;
}
.rung-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.rung-pick select {
  width: auto;
  margin: 0;
  min-height: 36px;
  padding: 4px 8px;
}
.dose {
  margin: 6px 0;
}
.cues summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 6px 0;
}
.cues ul {
  margin: 4px 0;
  padding-left: 1.2rem;
}
.set-rows {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.set-row {
  display: grid;
  grid-template-columns: 70px 1fr auto 48px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.set-row input {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.set-row .set-no {
  color: var(--muted);
  font-size: 0.9rem;
}
.set-row .unit {
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 32px;
}
.set-row.done input {
  background: var(--good-soft);
  border-color: var(--good);
}
.rir {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.rir select {
  width: auto;
  margin: 0;
}
.finisher {
  border-style: dashed;
}

.rest-timer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom));
  z-index: 40;
  background: var(--text);
  color: var(--bg);
  border-radius: 16px;
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'label actions' 'time actions' 'bar bar';
  gap: 2px 12px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.25);
}
.rest-timer[hidden] {
  display: none;
}
.rt-label {
  grid-area: label;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
}
.rt-time {
  grid-area: time;
  font-size: 2.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rt-actions {
  grid-area: actions;
  display: flex;
  gap: 6px;
  align-items: center;
}
.rt-actions .btn:not(.primary) {
  background: transparent;
  color: var(--bg);
  border-color: color-mix(in srgb, var(--bg) 40%, transparent);
}
.rt-bar {
  grid-area: bar;
  height: 4px;
  background: color-mix(in srgb, var(--bg) 25%, transparent);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.rt-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width 0.25s linear;
}
.rest-timer.done {
  background: var(--good);
  color: #fff;
}
@media (min-width: 900px) {
  .rest-timer {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 360px;
  }
}
body:has(.rest-timer:not([hidden])) main {
  padding-bottom: calc(var(--tabbar-h) + 150px + env(safe-area-inset-bottom));
}

/* ---------- histórico ---------- */
.set-summary {
  list-style: none;
  padding: 0;
  margin: 6px 0;
}
.set-summary li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.set-summary strong {
  font-variant-numeric: tabular-nums;
}
.notes {
  white-space: pre-wrap;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 10px;
}
.empty {
  text-align: center;
}

/* ---------- progresso / gráficos ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 700px) {
  .tiles {
    grid-template-columns: repeat(4, 1fr);
  }
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.delta {
  display: block;
  font-weight: 600;
}
.delta.up,
td.up {
  color: var(--good);
}
.delta.down,
td.down {
  color: var(--danger);
}
.chart {
  position: relative;
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart .grid {
  stroke: var(--grid);
  stroke-width: 1;
}
.chart .baseline {
  stroke: var(--axis);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--axis);
  font-size: 11px;
}
.chart .line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .area {
  fill: var(--series-1);
  opacity: 0.1;
}
.chart .dot {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart .label-end {
  fill: var(--text);
  font-size: 13px;
  font-weight: 600;
}
/* o SVG (640 unidades) encolhe no telemóvel: texto maior em unidades do viewBox para ficar legível (~10–11px) */
@media (max-width: 600px) {
  .chart:not(.heatmap) .axis {
    font-size: 21px;
  }
  .chart .label-end {
    font-size: 23px;
  }
}
.chart .bar {
  fill: var(--series-1);
}
.chart .crosshair {
  stroke: var(--axis);
  stroke-width: 1;
}
.chart .hit {
  fill: transparent;
  cursor: pointer;
  outline: none;
}
.chart .hit.active,
.chart .hit:focus-visible {
  fill: var(--series-1);
  fill-opacity: 0.06;
}
.chart .tip {
  position: absolute;
  transform: translate(-50%, -100%);
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}
.chart-table summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}
.heatmap svg {
  max-width: 420px;
}
.heat {
  stroke: var(--surface);
  stroke-width: 1;
}
.heat.l0 {
  fill: var(--heat-0);
}
.heat.l1 {
  fill: var(--heat-1);
}
.heat.l2 {
  fill: var(--heat-2);
}
.heat.l3 {
  fill: var(--heat-3);
}
.heat-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
}
.heat-sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.heat-sw.l0 {
  background: var(--heat-0);
}
.heat-sw.l1 {
  background: var(--heat-1);
}
.heat-sw.l2 {
  background: var(--heat-2);
}
.heat-sw.l3 {
  background: var(--heat-3);
}
.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.tl {
  font-size: 0.72rem;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--text-2);
}
.tl.climb {
  background: var(--good-soft);
  color: var(--good);
}
.tl.drop {
  background: var(--warn-soft);
  color: var(--warn);
}
.ladder-progress {
  align-items: flex-start !important;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.logsheet td,
.logsheet th {
  white-space: nowrap;
}
.logsheet tr.current {
  background: var(--accent-soft);
}
.logsheet .r {
  color: var(--muted);
  font-size: 0.78rem;
}

/* ---------- skills / biblioteca / guia ---------- */
.pct {
  font-weight: 700;
  color: var(--accent);
}
.steps {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  counter-reset: s;
}
.steps li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.steps li.done .step-name {
  color: var(--good);
}
.steps li.now {
  font-weight: 600;
}
.steps li.next {
  color: var(--muted);
}
.step-goal {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
input[type='search'] {
  margin-bottom: 10px;
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.chip {
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 36px;
}
.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.ex-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .ex-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.ex-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ex-card:hover {
  border-color: var(--accent);
}
.toc ul {
  columns: 2;
  margin: 0;
  padding-left: 1.1rem;
}
@media (max-width: 500px) {
  .toc ul {
    columns: 1;
  }
}
dl dt {
  font-weight: 600;
  margin-top: 10px;
}
dl dd {
  margin: 2px 0 0;
  color: var(--text-2);
}
.source {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 10px;
}
.ladder-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 18px;
}
.ladder-tables ol {
  padding-left: 1.3rem;
  margin: 0 0 8px;
}
.menu {
  list-style: none;
  padding: 0;
}
.menu li a {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.menu li:last-child a {
  border-bottom: 0;
}
.body-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.body-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.test-field span small {
  font-weight: 400;
  color: var(--muted);
}

/* ---------- ilustrações dos exercícios ---------- */
.ex-visual {
  margin: 8px 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
}
.ex-visual img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
}
.ex-visual.drawn {
  background: #fff;
  padding: 6px;
} /* ilustração com cores próprias: fundo branco em ambos os temas */
.ex-visual .figure {
  display: block;
  height: 170px;
  width: auto;
  max-width: 100%;
}
.ex-visual.sm {
  margin: 0 0 8px;
}
.ex-visual.sm img {
  max-height: 110px;
}
.ex-visual.sm .figure {
  height: 140px;
}
.ex-visual.lg img {
  max-height: 280px;
}
.ex-visual.lg .figure {
  height: 220px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  .rung.on,
  .chart .bar,
  .heat.l3 {
    forced-color-adjust: none;
  }
}
.orig-art summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.875rem;
  margin: 4px 0 8px;
}
.orig-art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
}

/* ---------- login com Google ---------- */
.btn.google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #747775;
  gap: 10px;
  font-weight: 500;
}
.btn.google:hover {
  background: #f8f9fa;
  filter: none;
}
.center {
  text-align: center;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin: 16px 0 4px;
  font-size: 0.85rem;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
main:focus,
main:focus-visible {
  outline: none;
}

/* ---------- administração ---------- */
.admin-only {
  display: none !important;
}
body.is-admin .admin-only {
  display: block !important;
}
.admin-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.admin-user {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.admin-user:last-child {
  border-bottom: 0;
}
.au-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}
.au-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.ok {
  background: var(--good-soft);
  color: var(--good);
}
.pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
}
.verified {
  color: var(--good);
  font-weight: 600;
}
@media (min-width: 700px) {
  .admin-user {
    grid-template-columns: 1fr auto auto;
  }
  .au-actions {
    grid-column: auto;
  }
}

/* ---------- per-user device data (ADR-025) ---------- */
.offline-banner {
  width: calc(100% - 32px);
  max-width: calc(860px - 32px);
  margin: 12px auto 0;
}
a.badge {
  text-decoration: none;
}
.dead-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.dead-list li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.dead-list .dead-reason {
  display: block;
  margin-top: 2px;
  font-size: 0.875rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.dead-list .dead-reason.legacy {
  color: var(--warn);
}
@media (min-width: 900px) {
  .offline-banner {
    width: calc(100% - 64px);
    max-width: calc(860px - 64px);
  }
  /* The banner shares the main column of the logged-in grid; the sidebar spans both rows. */
  body.logged-in .shell:has(> .offline-banner:not([hidden])) {
    grid-template-rows: auto 1fr;
  }
  body.logged-in .shell:has(> .offline-banner:not([hidden])) > .sidebar {
    grid-row: 1 / span 2;
  }
  body.logged-in .offline-banner {
    grid-column: 2;
  }
  .sidebar a.badge,
  .sidebar a.badge:hover {
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--warn);
    background: var(--warn-soft);
  }
}

/* Language switcher (FR-016) */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lang-switch select {
  width: auto;
}
