/* FIT APP — 1.0 RC25 | Application styles */
:root {
  color-scheme: dark;
  --bg: #101012;
  --card: #1b1b20;
  --line: #39383e;
  --muted: #b3b1b8;
  --text: #f1f0f3;
  --accent: #ff9100;
  --secondary: #c45bff;
  --on-accent: #17100a;
  --danger: #ff9999;
  font: 15px/1.45 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,input,select {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
}
button:hover {
  border-color: var(--accent);
}
button:disabled {
  opacity: .45;
  cursor: default;
}
button:focus-visible,input:focus-visible,select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input,select {
  background: #111115;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 11px 10px;
  width: 100%;
  min-width: 0;
}
input[type=checkbox] {
  width: 19px;
  height: 19px;
  accent-color: var(--secondary);
  padding: 0;
  cursor: pointer;
}
header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.shell {
  max-width: 680px;
  margin: auto;
}
.head {
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-size: 18px;
  letter-spacing: 2px;
  font-weight: 850;
}
.build {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .7px;
}
.status {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
}
main {
  padding: 22px 16px calc(100px + env(safe-area-inset-bottom));
  min-height: 75vh;
}
h1,h2,h3,p {
  margin: 0;
}
h1 {
  font-size: 29px;
  line-height: 1.15;
  letter-spacing: -.8px;
  font-weight: 780;
}
h2 {
  font-size: 17px;
  font-weight: 700;
}
h3 {
  font-size: 15px;
}
p {
  color: var(--muted);
}
.eyebrow {
  font-size: 11px;
  color: var(--accent);
  font-weight: 750;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.subtitle {
  margin-top: 7px;
  font-size: 13px;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px;
}
.accent {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  border-color: var(--accent);
}
.wide {
  width: 100%;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.danger {
  color: var(--danger);
}
.flat {
  border: none;
  background: none;
  padding: 5px 8px;
  font-size: 13px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
  margin-top: 16px;
}
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 10px;
}
.metric b {
  display: block;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.metric span {
  font-size: 11px;
  color: var(--muted);
}
.empty {
  text-align: center;
  padding: 24px 14px;
}
.empty h2 {
  margin-bottom: 7px;
}
.empty p {
  font-size: 13px;
  max-width: 310px;
  margin: auto auto 15px;
}
.section-title {
  margin-top: 23px;
  margin-bottom: 9px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.setgrid {
  display: grid;
  grid-template-columns: 25px minmax(0,1fr) 54px minmax(0,1fr) 38px 23px;
  align-items: center;
  gap: 6px;
  margin: 9px 0;
}
.setgrid.labels {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 13px;
}
.setgrid input {
  padding: 10px 6px;
  text-align: center;
}
.setgrid select {
  padding: 10px 3px;
  font-size: 12px;
  text-align: center;
}
.setgrid .n {
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.setgrid .check {
  display: grid;
  place-items: center;
}
.setgrid .rm {
  padding: 3px;
  border: none;
  background: none;
  color: var(--muted);
}
.setgrid.done input:not([type=checkbox]) {
  border-color: var(--secondary);
}
.group {
  color: var(--accent);
  font-size: 12px;
  margin-top: 4px;
}
.tag {
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  white-space: nowrap;
}
.catalog {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}
.exercise {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding: 12px 14px;
}
.exercise span {
  display: block;
}
.plus {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 12px 0;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filters button {
  white-space: nowrap;
  padding: 7px 11px;
  font-size: 12px;
  border-radius: 999px;
}
.filters .selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 750;
}
.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}
.measuregrid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  align-items: stretch;
}
.measuregrid > * { min-width: 0; }
.measuregrid .field:first-child {
  grid-column: 1/-1;
}
.latest {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.latest b {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}
.datefield {
  max-width: 170px;
  flex: 0 1 170px;
}
.nav {
  position: fixed;
  z-index: 4;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--line);
  background: #151519;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.nav-inner {
  max-width: 680px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 3px;
}
.nav [data-tab] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px 2px;
  color: var(--muted);
  font-size: 10px;
}
.nav [data-tab].active {
  background: #2c1b38;
  color: var(--secondary);
  font-weight: 700;
}
.nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
dialog {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  max-width: 500px;
  width: calc(100% - 26px);
  max-height: 85dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #000b;
}
.historydetails {
  margin-top: 11px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.historydetails div+div {
  margin-top: 8px;
}
.note {
  background: #21172b;
  color: var(--secondary);
  border: 1px solid #51305e;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12px;
  margin-top: 12px;
}
.warning {
  color: var(--danger);
  font-size: 12px;
  padding: 9px 16px;
  display: none;
}
.hidden {
  display: none!important;
}
.measure-history {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 8px;
  font-size: 13px;
  margin-top: 10px;
}
.measure-history span {
  color: var(--muted);
}
.search {
  margin-top: 15px;
}
.toast {
  position: fixed;
  z-index: 8;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: 0 4px 24px #0008;
}
.historybuttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.historybuttons button {
  font-size: 13px;
}
@media (min-width:700px) {
  main {
    padding-left: 24px;
    padding-right: 24px;
  }
  .nav-inner {
    max-width: 640px;
  }
}
@media (max-width:350px) {
  .nav [data-tab] {
    font-size: 9px;
  }
  .setgrid {
    grid-template-columns: 20px minmax(0,1fr) 48px minmax(0,1fr) 30px 20px;
  }
  .card {
    padding: 12px;
  }
  .measuregrid {
    gap: 8px;
  }
}
.backup-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.backup-tools button {
  flex: 1;
  min-width: 135px;
  font-size: 13px;
  padding: 10px 9px;
}
.save-status {
  font-size: 11px;
  color: var(--muted);
}
.backup-note {
  margin-top: 9px;
}
.storage-alert {
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
}
.nav-inner {
  grid-template-columns: repeat(5,minmax(0,1fr));
}
.history-open {
  display: block;
  text-align: left;
  width: 100%;
  padding: 14px;
  border-radius: 13px;
}
.history-open .row h3 {
  font-size: 16px;
}
.history-open .row span {
  color: var(--accent);
  font-size: 22px;
}
.history-open .small {
  margin-top: 6px;
}
.history-dialog {
  max-width: 650px;
}
.edit-set {
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) 55px minmax(0,1fr) 30px;
  align-items: center;
  gap: 5px;
  margin: 7px 0;
}
.edit-set input,.edit-set select {
  padding: 9px 5px;
  text-align: center;
}
.edit-set.labels {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.edit-arrows {
  display: flex;
  gap: 5px;
  margin: 10px 0;
}
.edit-arrows button {
  padding: 5px 8px;
  font-size: 12px;
}
.history-editor-actions {
  position: sticky;
  bottom: -18px;
  background: var(--bg);
  padding: 12px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  z-index: 2;
}
.history-dialog .field {
  display: block;
  margin: 12px 0;
}
.history-dialog .stack {
  margin-top: 12px;
}
.edit-exercise .flat {
  padding: 4px;
}
.head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  min-width: 0;
}
.language-control {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.lang-picker {
  position: relative;
}
.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  min-height: 40px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
}
.lang-button:hover,.lang-button:focus-visible {
  border-color: var(--accent);
}
.lang-globe {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--muted);
}
.lang-flag, .lang-option .flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 18px;
  flex: 0 0 auto;
}
.lang-flag svg, .lang-option .flag svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 184px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.lang-option {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  background: transparent;
}
.lang-option.active {
  border-color: var(--secondary);
  background: #21172b;
  color: var(--secondary);
}
.lang-option .label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}
.visually-hidden {
  position: absolute!important;
  width: 1px!important;
  height: 1px!important;
  padding: 0!important;
  margin: -1px!important;
  overflow: hidden!important;
  clip: rect(0,0,0,0)!important;
  white-space: nowrap!important;
  border: 0!important;
}
.head {
  gap: 10px;
}
.nav [data-tab] {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.metric span {
  overflow-wrap: anywhere;
}
.backup-tools button {
  min-width: 0;
  overflow-wrap: anywhere;
}
.setgrid.labels {
  font-size: 10px;
}
.head .build {
  overflow-wrap: anywhere;
}
.report-kpi span {
  overflow-wrap: anywhere;
}

/* Statistics and report styles */
.report-body {
  --report-card: var(--card,#fff);
  --report-border: var(--line,#dedce1);
  --report-muted: var(--muted,#5a565f);
  --report-accent: var(--accent,#a44800);
  --report-text: var(--text,#1d1b20);
  color: var(--report-text);
  margin-top: 22px;
  font: 14px/1.5 system-ui,sans-serif;
}
.report-body * {
  box-sizing: border-box;
}
.report-body h2,.report-body h3,.report-body h4,.report-body p {
  margin: 0;
}
.report-top {
  padding: 22px 18px;
  border: 1px solid var(--report-border);
  border-radius: 16px;
  background: var(--report-card);
  margin-bottom: 12px;
}
.report-top h2 {
  font-size: clamp(23px,5vw,34px);
  letter-spacing: -.7px;
  line-height: 1.12;
  margin: 8px 0;
}
.report-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.25px;
  color: var(--report-accent);
  text-transform: uppercase;
}
.report-muted {
  font-size: 12px;
  color: var(--report-muted);
  overflow-wrap: anywhere;
}
.report-kpis,.report-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
}
.report-kpis {
  grid-template-columns: repeat(3,minmax(0,1fr));
}
.report-card {
  min-width: 0;
  border: 1px solid var(--report-border);
  background: var(--report-card);
  border-radius: 12px;
  padding: 14px;
}
.report-kpi strong {
  display: block;
  font-size: clamp(17px,4vw,26px);
  font-weight: 800;
  letter-spacing: -.5px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.report-kpi span {
  font-size: 11px;
  color: var(--report-muted);
}
.report-method {
  margin-top: 10px!important;
}
.report-section {
  margin-top: 26px;
}
.report-section>h3 {
  font-size: 16px;
  letter-spacing: .15px;
  color: var(--report-accent);
  margin-bottom: 10px;
}
.report-section>.report-card+.report-card,.report-section>.report-grid+.report-card,.report-section>.report-card+.report-grid {
  margin-top: 10px;
}
.report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.report-tag {
  font-size: 11px;
  border: 1px solid var(--report-border);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--report-muted);
}
.month-row {
  display: grid;
  grid-template-columns: 7.5em minmax(0,1fr) 4ch;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}
.month-track {
  height: 10px;
  border-radius: 6px;
  background: var(--report-border);
  overflow: hidden;
}
.month-track div {
  background: var(--report-accent);
  height: 100%;
  border-radius: 6px;
}
.month-label { white-space: nowrap; }
.report-measure-weight { grid-column: 1 / -1; }
.spark-plot {
  display: grid;
  grid-template-columns: max-content minmax(0,1fr);
  gap: 8px;
  min-width: 0;
  height: 146px;
  margin: 10px 0 4px;
  color: var(--report-muted);
}
.spark-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.spark-series { min-width: 0; min-height: 0; margin: 7px 0; }
.spark-series > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.report-measure-weight .spark-plot { height: clamp(146px,30vw,220px); }

.chart-labels {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  font-size: 10px;
  color: var(--report-muted);
  font-variant-numeric: tabular-nums;
}
.report-measure-value {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -.5px;
}
.report-table-wrap {
  overflow: auto;
  max-width: 100%;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.report-table th,.report-table td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--report-border);
  vertical-align: top;
}
.report-table th {
  color: var(--report-muted);
  font-weight: 650;
}
.report-table td:not(:first-child) {
  white-space: nowrap;
}
.report-table tbody tr:last-child td {
  border-bottom: 0;
}
.report-ex-detail {
  margin-top: 13px;
}
.report-ex-detail h4 {
  font-size: 13px;
}
.report-footer {
  color: var(--report-muted);
  font-size: 11px;
  margin-top: 24px!important;
}
.report-workout {
  margin-bottom: 10px;
}
.report-workout>h3 {
  font-size: 15px;
}
@media (max-width:440px) {
  .report-grid {
    grid-template-columns: 1fr;
  }
  .report-card {
    padding: 11px;
  }
  .report-kpi {
    padding: 9px;
  }
  .report-kpi strong {
    font-size: 18px;
  }
}
@media print {
  .report-body {
    --report-card: #fff;
    --report-border: #dedce1;
    --report-muted: #5a565f;
    --report-accent: #a44800;
    --report-text: #1d1b20;
    color: #1d1b20;
  }
  .report-card,.report-top {
    break-inside: avoid;
  }
  .report-workout {
    break-inside: auto;
  }
  .report-ex-detail {
    break-inside: avoid;
  }
  .report-section>h3 {
    break-after: avoid;
  }
  .report-table-wrap {
    overflow: visible;
  }
  .report-table {
    font-size: 10px;
  }
  .report-table td:not(:first-child) {
    white-space: normal;
  }
  .report-table thead {
    display: table-header-group;
  }
  .report-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .report-kpis {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  @page {
    size: A4;
    margin: 12mm;
  }
}

/* Workout cards: title tap folds the body; title drag sorts the entire card. */
.exercise-card {
  min-width: 0;
}
.exercise-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.exercise-heading {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.exercise-title {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
}
.exercise-title-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.exercise-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}
.exercise-title .group {
  font-weight: 400;
}
.exercise-chevron {
  width: 9px;
  height: 9px;
  margin: 0 4px 4px 0;
  border: solid var(--muted);
  border-width: 0 1.7px 1.7px 0;
  transform: rotate(45deg);
  flex: 0 0 auto;
}
.is-collapsed .exercise-chevron {
  transform: rotate(-45deg);
  margin-bottom: 0;
}
.exercise-remove {
  flex: 0 0 auto;
  min-width: 32px;
  min-height: 44px;
}
/* A completed hold highlights the card before any movement. */
.exercise-card.is-armed {
  border-color: var(--secondary);
  box-shadow: 0 0 0 1px var(--secondary);
  background: #2b1c36;
}
.exercise-card.is-armed .exercise-name {
  color: var(--secondary);
}
.exercise-card.is-armed .exercise-title,
.exercise-card.is-dragging .exercise-title {
  cursor: grabbing;
}
.exercise-card.is-dragging {
  opacity: .46;
  border-color: var(--secondary);
  box-shadow: 0 0 0 1px var(--secondary);
}
.exercise-drag-preview {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  background: var(--card);
  border: 1px solid var(--secondary);
  border-radius: 13px;
  padding: 12px 15px;
  box-shadow: 0 8px 30px #0008;
  user-select: none;
}

/* Live workout timing, directly below the workout heading. */
.workout-timers {
  margin-top: 12px;
}
.workout-timer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  background: var(--card);
}
.timer-readouts {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.timer-main, .timer-phase {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  min-width: 0;
  justify-items: start;
}
.timer-main span, .timer-phase span {
  display: block;
  font-size: 11px;
  line-height: 14px;
  min-height: 14px;
  color: var(--muted);
  overflow-wrap: break-word;
  width: 100%;
}
.timer-main b, .timer-phase b, .set-time b {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timer-main b { font-size: 23px; line-height: 1.2; color: var(--accent); }
.timer-phase b { font-size: 15px; line-height: 1.2; color: var(--muted); }
.timer-phase.is-working b { color: var(--accent); }
.timer-phase.is-rest b { color: var(--secondary); }
.workout-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 8px;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
@media (max-width: 360px) {
  .timer-main span { min-height: 28px; }
}
.setgrid {
  grid-template-columns: 20px minmax(0,1fr) 48px minmax(0,1fr) 54px 25px;
  gap: 5px;
}
.setgrid.labels span { overflow-wrap: anywhere; }
.set-time {
  display: grid;
  gap: 2px;
  place-items: center;
  min-width: 0;
  text-align: center;
}
.set-timer-button {
  width: 42px;
  min-height: 40px;
  padding: 4px;
  font-size: 16px;
  color: var(--accent);
}
.set-timer-button.is-running { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.setgrid.is-timing input { border-color: var(--accent); }
.set-time b { font-size: 11px; color: var(--secondary); }
.set-time:has(.is-running) b { color: var(--accent); }
.timing-needs-values { font-size: 9px; color: var(--danger); overflow-wrap: anywhere; }
.timing-summary, .history-set-timing { margin: 4px 0; color: var(--muted); }
.history-set-timing { padding: 0 6px 5px; }
@media (max-width: 350px) {
  .workout-timer-panel { padding: 8px; gap: 8px; }
  .workout-toggle { font-size: 13px; }
  .timer-main b { font-size: 20px; }
  .setgrid { grid-template-columns: 16px minmax(0,1fr) 42px minmax(0,1fr) 48px 20px; gap: 3px; }
  .set-timer-button { width: 40px; }
  .setgrid input { padding: 9px 2px; }
  .set-time b { font-size: 10px; }
}

/* A zero hint is not an entered number. */
.setgrid input[type="number"]::placeholder,
.edit-set input[type="number"]::placeholder {
  color: #8c8a92;
  opacity: 1;
}

/* Exercise removal: non-modal, independent five-second undo windows. */
.undo-tray {
  position: fixed;
  z-index: 9;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(648px, calc(100% - 24px));
  max-height: 36dvh;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 2px;
}
.undo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 30px;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  padding: 9px 10px 9px 12px;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 4px 16px #0007;
}
.undo-message { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.undo-message small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.undo-button { color: var(--accent); font-size: 16px; font-weight: 800; padding: 10px 14px; min-height: 48px; min-width: 84px; }
.undo-seconds {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--secondary);
  border-radius: 50%;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 750;
}
.undo-tray:not(.hidden) ~ .toast { bottom: auto; top: calc(84px + env(safe-area-inset-top)); }
@media (max-width: 350px) {
  .undo-row { gap: 5px; padding: 8px; }
  .undo-button { padding: 9px 10px; }
}

/* Workout backup controls remain available, but are secondary to training. */
#app > .backup-tools {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
/* Workout completion dialog, consistent with the graphite/orange palette. */
.finish-workout-dialog {
  max-width: 400px;
  padding: 22px;
  background: var(--card);
  border-color: var(--line);
  box-shadow: 0 16px 60px #0009;
}
.finish-workout-dialog::backdrop { background: #000b; }
.finish-workout-form { display: grid; gap: 12px; }
.finish-workout-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid #70430f;
  border-radius: 13px;
  background: #352516;
  color: var(--accent);
}
.finish-workout-icon svg { width: 28px; height: 28px; }
.finish-workout-form h2 { font-size: 21px; line-height: 1.25; }
.finish-workout-form p { font-size: 14px; overflow-wrap: anywhere; }
.finish-workout-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.finish-workout-actions button {
  min-height: 46px;
  padding: 10px;
  overflow-wrap: anywhere;
}
@media (max-width: 350px) {
  .finish-workout-dialog { padding: 16px; }
  .finish-workout-actions button { padding: 8px 6px; font-size: 13px; }
}

/* Keep the workout date on the same row as the main title. */
.workout-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.workout-heading h1 {
  min-width: 0;
  font-size: clamp(20px, 6vw, 29px);
  overflow-wrap: anywhere;
}
.workout-heading .datefield {
  flex: 0 0 auto;
  width: clamp(132px, 36vw, 160px);
  min-height: 44px;
  font-size: 14px;
}

/* RC10: shared date presentation and aligned measurement fields.
   Keep the native picker interactive but take its intrinsic size out of layout. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.date-control {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 48px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.25;
  background: #111115;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.date-control-face {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 0 10px;
  pointer-events: none;
}
.date-control-value {
  min-width: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.date-control-face svg { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted); }
.date-control .date-control-native {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  min-width: 0; max-width: 100%;
  min-height: 0; max-height: 100%;
  margin: 0; padding: 0; border: 0;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.date-control-native::-webkit-date-and-time-value { min-width: 0; margin: 0; }
.date-control-native::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  margin: 0; padding: 0;
  cursor: pointer;
}
.date-control:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.workout-heading .date-control { height: 44px; }
.measure-form { grid-template-columns: minmax(0,1fr); width: 100%; min-width: 0; }
.measure-form-grid, .measure-latest-grid { width: 100%; min-width: 0; }
.measure-form .field { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.measure-form .label, .measure-latest-grid .measure-name { overflow-wrap: break-word; }
.measure-form-grid .field > input[type="number"] {
  display: block;
  width: 100%; min-width: 0; max-width: 100%;
  height: 48px; min-height: 48px; max-height: 48px;
  margin: auto 0 0; padding: 0 10px;
  font-size: 16px;
  line-height: normal;
  -webkit-appearance: none;
  appearance: textfield;
}
.measure-form-grid input[type="number"]::-webkit-inner-spin-button,
.measure-form-grid input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.measure-latest-grid .latest b { margin-top: auto; overflow-wrap: break-word; }
.latest-date { min-height: 1.45em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.latest-date.is-empty { visibility: hidden; }
.measure-history { grid-template-columns: repeat(2,minmax(0,1fr)); }
.measure-history > div { min-width: 0; overflow-wrap: break-word; }
.nav [data-tab] > span { display: block; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* RC11: History calendar and date-scoped workout list. */
.history-calendar { margin-top: 14px; min-width: 0; padding: 12px; }
.calendar-toolbar { display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; gap: 5px; align-items: center; }
.calendar-arrow { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 42px; padding: 6px; background: #111115; }
.calendar-arrow svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }



.calendar-swipe-area { margin-top: 10px; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; align-items: center; }
.calendar-weekday { text-align: center; font-size: 11px; color: var(--muted); padding: 5px 0; }
.calendar-day, .calendar-blank { min-width: 0; width: 100%; height: 40px; }
.calendar-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; font-variant-numeric: tabular-nums; background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 4px 0; line-height: 1.1; }
.calendar-day.has-workout { color: var(--accent); font-weight: 800; background: #392815; border-color: #70430f; }
.calendar-day.has-workout i, .calendar-legend i { display: block; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.calendar-day.is-today { border-color: var(--muted); }
.calendar-day.is-selected { border-color: var(--secondary); box-shadow: inset 0 0 0 1px var(--secondary); background: #2c1b38; color: var(--secondary); font-weight: 800; }
.calendar-day:focus-visible { outline-offset: 0; }
.calendar-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px; margin-top: 9px; }
.calendar-legend { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.calendar-current { font-size: 12px; color: var(--accent); min-height: 36px; }
.calendar-jump { display: grid; grid-template-columns: minmax(0,1fr) clamp(72px,22vw,108px); gap: 5px; min-width: 0; }
.calendar-jump > div { min-width: 0; }

.history-period { margin-top: 20px; }
.history-period h2 { font-size: 15px; min-width: 0; overflow-wrap: break-word; text-transform: capitalize; }
.history-period button { color: var(--accent); flex: 0 0 auto; }
.history-workout-list { margin-top: 10px; min-width: 0; }
.history-workout-list .empty p:last-child { margin-bottom: 0; }
.history-workout-list article { min-width: 0; }
.history-workout-details { margin: 0 12px 5px; padding: 8px 0; border-top: 1px solid var(--line); }
.history-workout-details summary { cursor: pointer; color: var(--accent); padding: 6px 0; font-size: 13px; }
.history-detail-exercise { padding: 8px 0; }
.history-detail-exercise h3 { font-size: 13px; color: var(--text); overflow-wrap: break-word; }
.history-detail-table-wrap { max-width: 100%; overflow-x: auto; }
.history-detail-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; text-align: left; }
.history-detail-table th, .history-detail-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.history-detail-table th { font-size: 10px; color: var(--muted); font-weight: 600; }
.history-detail-table td { white-space: nowrap; }
@media (max-width:350px) {
  .history-calendar { padding: 9px; }
  .calendar-grid { gap: 2px; }
  .calendar-day, .calendar-blank { height: 36px; }

  .calendar-weekday { font-size: 10px; }
}


/* RC14: compact in-app dropdowns, not OS-native popup menus. */
.select-source { display: none !important; }
.select-field { min-width: 0; }
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  text-align: left;
  background: #111115;
  border-radius: 9px;
}
.select-trigger[aria-expanded="true"] { border-color: var(--secondary); }
.select-value { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select-trigger svg { flex: 0 0 12px; width: 12px; height: 12px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* Centre the unit in the space to the left of the fixed chevron. */
.setgrid .select-trigger, .edit-set .select-trigger { min-height: 40px; padding: 8px 4px; font-size: 12px; gap: 2px; }
.setgrid .select-value, .edit-set .select-value { flex: 1 1 0; text-align: center; }
.setgrid .select-trigger svg, .edit-set .select-trigger svg { flex-basis: 9px; width: 9px; height: 9px; }
.calendar-jump .select-trigger { font-size: clamp(13px,3.5vw,16px); min-height: 42px; height: 42px; padding: 6px 7px; font-weight: 700; gap: 3px; }
.calendar-month-field .select-value { text-transform: capitalize; }
.calendar-year-field .select-value { font-variant-numeric: tabular-nums; }
@media (max-width:350px) {
  .calendar-toolbar { grid-template-columns: 29px minmax(0,1fr) 29px; gap: 4px; }
  .calendar-jump { grid-template-columns: minmax(0,1fr) 70px; gap: 4px; }
  .calendar-jump .select-trigger { padding: 6px 5px; font-size: 13px; gap: 2px; }
  .calendar-jump .select-trigger svg { flex-basis: 10px; width: 10px; height: 10px; }
}
.select-popover {
  position: fixed;
  z-index: 40;
  max-width: 50vw;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 4px;
  border: 1px solid rgba(190,185,200,.26);
  border-radius: 14px;
  background: rgba(36,35,42,.94);
  box-shadow: 0 10px 32px #0009;
  scrollbar-width: thin;
}
@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .select-popover {
    background: rgba(36,35,42,.78);
    -webkit-backdrop-filter: blur(16px) saturate(125%);
    backdrop-filter: blur(16px) saturate(125%);
  }
}
.select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  text-align: left;
}
.select-option > span:first-child { min-width: 0; overflow-wrap: break-word; }
.select-option[aria-selected="true"] { color: var(--accent); background: rgba(255,145,0,.12); font-weight: 700; }
.select-option:focus-visible { outline: 2px solid var(--secondary); outline-offset: -2px; }
.select-option + .select-option { border-top: 1px solid rgba(190,185,200,.11); }
.select-check { flex: 0 0 auto; color: var(--accent); font-weight: 800; }

/* Shared date picker for workout, measurements and history editing. */
.workout-date-control .date-calendar-trigger {
  pointer-events: auto;
  background: transparent;
  border: 0;
  border-radius: inherit;
  font-size: 14px;
  color: var(--text);
}
.workout-date-control .date-control-native { display: none !important; }
.workout-date-dialog {
  width: calc(100% - 32px);
  max-width: 632px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: var(--card);
  box-shadow: 0 16px 60px #0009;
  overflow-x: hidden;
  overflow-y: auto;
}
.workout-date-dialog .history-calendar { margin-top: 0; }
.workout-date-dialog::backdrop { background: rgba(0,0,0,.65); }
.workout-date-cancel {
  display: block;
  width: calc(100% - 24px);
  min-height: 44px;
  margin: 0 12px 12px;
  background: #111115;
}

/* RC16: finger-tracked calendar pager, shared by both calendar views. */
.calendar-swipe-area {
  position: relative;
  overflow: hidden;
  overscroll-behavior-x: contain;
}
.calendar-track { position: relative; width: 100%; }
.calendar-track.is-sliding { will-change: transform; }
.calendar-neighbor {
  position: absolute;
  top: 0;
  width: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.calendar-before { right: 100%; }
.calendar-after { left: 100%; }

/* RC17: a mobile-first statistics dashboard, separate from the print report. */
.stats-screen {
  min-width: 0;
  --report-border: var(--line);
  --report-muted: var(--muted);
  --report-accent: var(--accent);
  --report-text: var(--text);
  font-variant-numeric: tabular-nums;
}
.stats-period { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.stats-overview {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
  margin: 14px 0 15px;
}
.stats-kpi {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 76px;
  gap: 8px;
  padding: 11px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.stats-kpi > span { color: var(--muted); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.stats-kpi > strong { font-size: clamp(22px,6vw,30px); font-weight: 760; line-height: 1.15; letter-spacing: -.6px; overflow-wrap: anywhere; }
.stats-kpi-volume > strong { color: var(--accent); }
.stats-sections { display: grid; grid-template-columns: minmax(0,1fr); gap: 9px; }
.stats-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.stats-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 53px;
  padding: 12px 14px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.stats-panel > summary::-webkit-details-marker { display: none; }
.stats-panel > summary::marker { content: ''; }
.stats-panel > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 13px; }
.stats-panel-name { flex: 1 1 auto; min-width: 0; font-weight: 680; line-height: 1.35; overflow-wrap: anywhere; }
.stats-panel-name > small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 4px; }
.stats-panel-meta { flex: 0 1 auto; max-width: 42%; min-width: 0; color: var(--accent); font-size: 13px; line-height: 1.3; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.stats-chevron { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 160ms ease; }
.stats-panel[open] > summary > .stats-chevron { transform: rotate(180deg); }
.stats-panel[open] > summary { border-bottom: 1px solid var(--line); }
.stats-panel-body { display: grid; grid-template-columns: minmax(0,1fr); gap: 9px; min-width: 0; padding: 12px; }
.stats-nested { background: #151519; border-radius: 11px; }
.stats-nested > summary { min-height: 48px; padding: 11px 10px; gap: 7px; font-size: 14px; }
.stats-nested > .stats-panel-body { padding: 10px; }
.stats-nested .stats-panel-meta { font-size: 12px; }
.stats-empty { padding: 13px 4px; text-align: center; font-size: 13px; color: var(--muted); }
.stats-note { font-size: 12px; line-height: 1.55; color: var(--muted); overflow-wrap: break-word; }
.stats-facts { margin: 0; min-width: 0; display: grid; gap: 0; }
.stats-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stats-facts > div:last-child { border-bottom: 0; }
.stats-facts dt { min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.stats-facts dd { flex: 0 1 auto; min-width: 0; margin: 0; text-align: right; font-size: 14px; font-weight: 680; overflow-wrap: anywhere; }
.stats-chart { --chart-color: var(--accent); padding: 12px 0 7px; min-width: 0; }
.stats-chart-secondary { --chart-color: var(--secondary); }
.stats-chart-head { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 3px 8px; margin: 0 2px 8px; min-width: 0; }
.stats-chart-label { grid-column: 1/-1; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.stats-chart-head strong { color: var(--chart-color); font-size: 27px; font-weight: 760; line-height: 1.2; letter-spacing: -.5px; overflow-wrap: anywhere; }
.stats-chart-date { text-align: right; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.stats-plot { display: block; width: 100%; height: auto; max-width: 540px; margin-inline: auto; overflow: visible; cursor: crosshair; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stats-plot:focus-visible { outline: 1px solid var(--chart-color); outline-offset: 2px; border-radius: 4px; }
.stats-gridline { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.stats-axis-number { fill: var(--muted); font: 10px system-ui,sans-serif; }
.stats-bar { fill: var(--chart-color); opacity: .42; }
.stats-bar.is-active { opacity: 1; }
.stats-line { stroke: var(--chart-color); stroke-width: 2.25; fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.stats-area { fill: var(--chart-color); opacity: .075; }
.stats-dot { fill: var(--chart-color); opacity: .75; }
.stats-marker { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; vector-effect: non-scaling-stroke; pointer-events: none; }
.stats-point { fill: var(--chart-color); stroke: var(--card); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.stats-axis { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; max-width: 540px; margin: 0 auto; padding: 0 2px; color: var(--muted); font-size: 10px; }
.stats-axis > span { min-width: 0; overflow-wrap: anywhere; }
.stats-axis > span+span { text-align: right; }
.stats-range { margin-top: 5px; }
.stats-set-group { min-width: 0; padding: 5px 0; }
.stats-set-group + .stats-set-group { border-top: 1px solid var(--line); padding-top: 12px; }
.stats-set-group h4 { margin: 0 0 7px; color: var(--text); font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.stats-set-row { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 6px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stats-set-row:last-child { border-bottom: 0; }
.stats-set-number { color: var(--muted); font-size: 12px; padding-top: 2px; }
.stats-set-main { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 3px 9px; }
.stats-set-main > strong { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.stats-set-main > span { color: var(--muted); font-size: 11px; min-width: 0; overflow-wrap: anywhere; }
.stats-set-times { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.stats-screen .report-table-wrap { min-width: 0; -webkit-overflow-scrolling: touch; }
.stats-screen .report-table { color: var(--text); }
.stats-screen .report-table td:first-child { overflow-wrap: break-word; }
.stats-export { display: grid; gap: 8px; grid-template-columns: minmax(0,1fr); }
.stats-export button { min-height: 44px; overflow-wrap: anywhere; }
@media (max-width: 350px) {
  .stats-kpi { padding: 11px 10px; min-height: 74px; }
  .stats-panel > summary { padding: 11px 10px; gap: 7px; }
  .stats-panel-body, .stats-nested > .stats-panel-body { padding: 9px; }
  .stats-axis { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .stats-chevron { transition: none; } }

/* RC19: date-scoped statistics, using the shared in-app calendar. */
.stats-filter { display:grid; gap:8px; margin-top:14px; min-width:0; }
.stats-period-select { display:grid; grid-template-columns:minmax(0,auto) minmax(0,1fr); align-items:center; gap:10px; }
.stats-period-select > .label { margin:0; overflow-wrap:anywhere; }
.stats-period-select > .select-trigger { background:var(--card); min-height:44px; }
.stats-date-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.stats-date-button { min-width:0; min-height:54px; padding:8px 11px; display:flex; align-items:center; justify-content:space-between; gap:5px; text-align:left; }
.stats-date-button > span { display:grid; min-width:0; gap:2px; }
.stats-date-button small { font-size:11px; color:var(--muted); }
.stats-date-button strong { font-size:14px; font-weight:650; white-space:nowrap; font-variant-numeric:tabular-nums; }
.stats-date-button svg { flex:0 0 18px; width:18px; height:18px; color:var(--muted); }
.stats-period-empty { margin-top:10px; }
.stats-date-dialog > h2 { padding:12px 12px 0; font-size:14px; color:var(--muted); font-weight:650; }
.stats-date-dialog .history-calendar { border:0; }
@media(max-width:350px) { .stats-date-button { padding:8px; } .stats-date-button strong { font-size:13px; } .stats-date-button svg { flex-basis:16px; width:16px; height:16px; } }

/* RC20: one activity chart across the selected period, without a duplicate table. */
.stats-activity-pager { display:grid; grid-template-columns:15% minmax(0,1fr); max-width:540px; margin:0 auto; min-width:0; }
.stats-fixed-axis { display:block; width:100%; height:auto; align-self:start; overflow:visible; }
.stats-activity-scroll { min-width:0; overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; scrollbar-width:thin; touch-action:pan-x pan-y pinch-zoom; }
.stats-activity-scroll .stats-plot { max-width:none; margin:0; touch-action:pan-x pan-y pinch-zoom; }
.stats-activity-scroll .stats-plot:focus-visible { outline-offset:-1px; }
.stats-scroll-hint { justify-content:center; text-align:center; margin:3px auto; }

/* RC25: real page links retain the original navigation design. */
.nav a[data-tab] { text-decoration: none; cursor: pointer; }
.nav a[data-tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
