:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #efefec;
  --border: #dcdcd7;
  --text: #16181c;
  --text-2: #52514e;
  --muted: #7a7973;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: #e3eefb;
  --good: #1a7f37;
  --good-soft: #dcf2e3;
  --danger: #c93a39;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e6e6e1;
  --radius: 14px;
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16181c;
    --surface: #1f2226;
    --surface-2: #2a2e33;
    --border: #363b41;
    --text: #f3f3f1;
    --text-2: #c3c2b7;
    --muted: #8e8d86;
    --accent: #3987e5;
    --accent-ink: #ffffff;
    --accent-soft: #1d3350;
    --good: #3fb865;
    --good-soft: #1b3a26;
    --danger: #e66767;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #2c3035;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16181c;
  --surface: #1f2226;
  --surface-2: #2a2e33;
  --border: #363b41;
  --text: #f3f3f1;
  --text-2: #c3c2b7;
  --muted: #8e8d86;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --accent-soft: #1d3350;
  --good: #3fb865;
  --good-soft: #1b3a26;
  --danger: #e66767;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #2c3035;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-tap-highlight-color: transparent;
}
body.no-tabs { padding-bottom: 24px; }

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg);
  border-bottom: 1px solid var(--border); min-height: 56px;
}
.topbar h1 { font-size: 19px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topActions { display: flex; gap: 6px; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 500;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--accent); }

h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 24px 0 10px; font-weight: 600; }
h2:first-child { margin-top: 4px; }
h3 { margin: 0 0 4px; font-size: 17px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
}
a.card, button.card { display: block; width: 100%; text-align: left; color: inherit; text-decoration: none; font: inherit; cursor: pointer; }
a.card:active, button.card:active { background: var(--surface-2); }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title h3 { flex: 1; }
.chev { color: var(--muted); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; font: inherit;
}
.icon-btn:active { background: var(--surface-2); }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 8px 0; cursor: pointer; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* Ohjelman näkymä */
.day-block { margin-bottom: 18px; }
.ex-list { list-style: none; padding: 0; margin: 0; }
.ex-list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.ex-list li:first-child { border-top: 0; }
.ex-list .ex-name { flex: 1; font-weight: 600; }
.ex-list .ex-dose { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.ex-list .ex-note { font-size: 13.5px; color: var(--muted); font-weight: 400; }

/* Editori */
.editor-day { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px; margin-bottom: 14px; }
.editor-day > .row input { font-weight: 600; }
.editor-ex { border-top: 1px dashed var(--border); padding: 12px 0 4px; }
.editor-ex .grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.editor-ex .grid label span { font-size: 12px; color: var(--muted); display: block; margin-bottom: 2px; }
.editor-ex .grid input { padding: 8px; text-align: center; }
.editor-ex .note { margin-top: 8px; }

/* Treenin kirjaus */
.log-ex { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 8px; margin-bottom: 14px; }
.log-ex-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.log-ex-head h3 { flex: 1; }
.target { font-size: 14px; color: var(--text-2); }
.prev { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.set-grid { display: grid; grid-template-columns: 34px 1fr 1fr 52px; gap: 8px; align-items: center; }
.set-grid .hdr { font-size: 12px; color: var(--muted); text-align: center; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.set-grid .no { text-align: center; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.set-grid input { text-align: center; font-size: 18px; font-weight: 600; padding: 8px 4px; font-variant-numeric: tabular-nums; }
.set-grid .done-btn {
  height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.set-grid .done-btn.on { background: var(--good); border-color: var(--good); color: #fff; }
input.set-row-done { background: var(--good-soft); border-color: transparent; }
.log-actions { display: flex; gap: 8px; margin-top: 8px; }

.rest-timer {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  z-index: 30; max-width: 688px; margin: 0 auto; background: var(--text); color: var(--bg);
  border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
body.no-tabs .rest-timer { bottom: 16px; }
.rest-timer .time { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; flex: 1; }
.rest-timer button { background: transparent; border: 1px solid currentColor; color: inherit; border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 600; cursor: pointer; }

/* Historia */
.hist-sets { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.hist-sets div { display: flex; gap: 8px; }
.hist-sets b { font-weight: 600; color: var(--text); min-width: 0; flex: 1; }

/* Raportit */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.tile .v { white-space: nowrap; font-size: clamp(20px, 6.5vw, 26px); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px;
  padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; display: none;
}
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); margin: 4px 0 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; padding: 7px 4px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12.5px; }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .btn { margin-top: 14px; }

.auth-wrap { max-width: 380px; margin: 8vh auto 0; }
.auth-logo { width: 72px; height: 72px; border-radius: 18px; display: block; margin: 0 auto 12px; }
.auth-wrap h1 { text-align: center; font-size: 26px; margin: 0 0 4px; }
.auth-wrap .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.error { color: var(--danger); font-size: 14px; margin: 4px 0 10px; min-height: 1em; }

#toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translateX(-50%) translateY(-120%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600;
  transition: transform .25s; z-index: 50; max-width: calc(100% - 32px);
}
#toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .editor-ex .grid { grid-template-columns: 1fr 1fr; }
}

/* Vahvistusikkuna */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.dialog {
  background: var(--surface); color: var(--text); border-radius: 18px; padding: 20px;
  width: 100%; max-width: 420px; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.dialog p { font-size: 17px; margin: 0 0 18px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (min-width: 600px) { .dialog-backdrop { align-items: center; } }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

/* Profiilipainike yläpalkissa */
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 15px; text-decoration: none; border: 1px solid var(--border);
}
.avatar-btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Kytkin */
.switch-row { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.switch-row > span { flex: 1; }
input.switch {
  appearance: none; -webkit-appearance: none; width: 50px; min-width: 50px; height: 30px; min-height: 0; padding: 0;
  border-radius: 99px; background: var(--border); border: 0; position: relative; cursor: pointer; transition: background .15s;
}
input.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s;
}
input.switch:checked { background: var(--good); }
input.switch:checked::after { transform: translateX(20px); }

/* Ylläpito */
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.user-info { flex: 1; min-width: 0; }
.user-info h3 { font-size: 16px; margin: 0; overflow-wrap: anywhere; }

/* Top 10 */
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; font-weight: 600;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.seg-small button { font-size: 13px; padding: 5px 4px; }
.rank-list { list-style: none; margin: 0 0 12px; padding: 4px 12px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border); }
.rank-row:first-child { border-top: 0; }
.rank-row.me { background: var(--accent-soft); margin: 0 -8px; padding: 10px 12px; border-radius: 10px; border-top-color: transparent; }
.rank-row.me + .rank-row { border-top-color: transparent; }
.rank-no {
  width: 30px; height: 30px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; background: var(--surface-2);
}
.rank-no.r1 { background: #e0ae2a; color: #2b2105; }
.rank-no.r2 { background: #b7bfc8; color: #1f2429; }
.rank-no.r3 { background: #c07a45; color: #fff; }
.rank-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.rank-detail { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.rank-val { font-weight: 700; font-size: 17px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-val small { font-size: 12px; font-weight: 500; color: var(--muted); }
.rank-gap { text-align: center; color: var(--muted); margin: -6px 0 6px; letter-spacing: .2em; }

/* Kehonpaino */
.bw-card .row input { font-size: 18px; font-weight: 600; text-align: center; }
.bw-line { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; }
.bw-line b { font-size: 22px; font-variant-numeric: tabular-nums; }

/* Ylläpitäjän raportit */
.tiles-2 { grid-template-columns: 1fr 1fr; }
.tile-of { font-size: 15px; color: var(--muted); font-weight: 600; }
.card.highlight { background: var(--accent-soft); border-color: transparent; }
.hl-name { font-size: 24px; font-weight: 700; margin: 2px 0 4px; }
.table-wrap { overflow-x: auto; padding-left: 10px; padding-right: 10px; }

/* Liikevalitsin */
.ex-pick {
  flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.ex-pick .chev-down { color: var(--muted); display: flex; flex: none; }
body.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; height: 88vh; height: 88dvh; border-radius: 18px 18px 0 0;
  display: flex; flex-direction: column; padding: 14px 16px 0; box-shadow: 0 -8px 30px rgba(0,0,0,.3);
}
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sheet-head h3 { flex: 1; margin: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sheet-list { overflow-y: auto; flex: 1; padding-bottom: calc(16px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.pick-group { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 14px 4px 6px; }
.pick-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 12px; text-align: left;
  background: var(--surface); color: var(--text); border: 0; border-bottom: 1px solid var(--border); font: inherit; cursor: pointer;
}
.pick-row span { flex: 1; }
.pick-row small { color: var(--muted); }
.pick-row:active { background: var(--surface-2); }
.pick-custom { color: var(--accent); border: 1px dashed var(--accent); border-radius: 10px; margin: 4px 0 8px; }
.pick-custom b { color: var(--text); }
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; height: 80vh; } }

/* Kielivalinta kirjautumissivulla */
.lang-switch { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.lang-switch button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.lang-switch button.on { color: var(--text); font-weight: 700; background: var(--surface-2); }

/* Ryhmät */
.invite { text-align: center; }
.invite-code { font-size: 34px; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.invite-link { overflow-wrap: anywhere; }
.invite .row { justify-content: center; }
.member-list { padding: 4px 14px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.member-row:first-child { border-top: 0; }
.group-avatar svg { width: 20px; height: 20px; }
.rank-link { color: inherit; text-decoration: none; }
.rank-link:hover { text-decoration: underline; }
a.user-info h3 { color: var(--text); }

/* Ryhmän jaetut harjoitukset */
.gw-card .card-title { gap: 10px; }
.gw-badge { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.gw-badge svg { width: 18px; height: 18px; }
.gw-ex { color: var(--text-2); margin-top: 4px; }

/* painonpudotusryhmät */
.badge.wl { background: var(--good-soft); color: var(--good); margin-right: 6px; }
.wl-card { border-color: var(--good); }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

/* ryhmän tiedotteet */
.ann-list { padding-top: 6px; padding-bottom: 6px; }
.ann { position: relative; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ann:last-of-type { border-bottom: 0; }
.ann-meta a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ann-text { margin-top: 2px; overflow-wrap: anywhere; }
.ann:has(.ann-del) { padding-right: 40px; }
.ann-del { position: absolute; top: 6px; right: -6px; }
#annText { width: 100%; resize: vertical; min-height: 60px; }
.admin-avatar svg { width: 20px; height: 20px; }

/* Android-sovelluksen lataus */
.apk-help { margin-top: 12px; }
.apk-help summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.apk-help ol { margin: 8px 0 0; padding-left: 20px; }
.apk-help li { margin: 4px 0; }

/* ohjelmakirjasto */
.lib-link { border-color: var(--accent); }
.lib-desc { margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
.warn-card { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.lib-maxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lib-maxes label span { font-size: 13px; color: var(--muted); display: block; margin-bottom: 3px; }
details.day-block > summary { list-style: none; cursor: pointer; }
details.day-block > summary::-webkit-details-marker { display: none; }
details.day-block > summary::after { content: '▾'; color: var(--text-2); margin-left: auto; }
details.day-block[open] > summary::after { content: '▴'; }

/* ryhmän harjoituksen voimassaolo */
.gw-card.gw-expired { opacity: .6; }
.gw-card.gw-upcoming { border-style: dashed; }
.gw-validity { padding-top: 12px; padding-bottom: 12px; }

.ex-list .ex-dose { max-width: 60%; white-space: normal; overflow-wrap: anywhere; }
.ex-list .ex-name { min-width: 0; }
.ex-sw { display: block; white-space: normal; overflow-wrap: anywhere; font-size: 13px; color: var(--text-2); }
.gw-validity .row > label { min-width: 0; }
.gw-validity input[type=date] { width: 100%; min-width: 0; }

/* kestävyysliikunta */
.cardio-row { gap: 8px; }
.cardio-row select { flex: 1.3; min-width: 0; }
.cardio-row input { flex: 1; min-width: 0; text-align: center; }
.cardio-row .btn { flex: none; }
.cardio-one { flex: 1.3; font-weight: 600; align-self: center; }

/* profiilikuvat */
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; vertical-align: middle; }
.av img, .user-avatar img, .avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.av-sm { width: 24px; height: 24px; font-size: 12px; margin-right: 8px; position: relative; top: -1px; }
.av-xs { width: 16px; height: 16px; font-size: 9px; margin-right: 4px; position: relative; top: -1px; }
.av-lg { width: 72px; height: 72px; font-size: 28px; }
.profile-card { display: flex; gap: 14px; align-items: center; }
.user-avatar.has-img, .avatar-btn.has-img { padding: 0; overflow: hidden; background: none; }
.avatar-btn { overflow: hidden; }
.avatar-btn.has-img.active { box-shadow: 0 0 0 2px var(--accent); }
