/* Fitko – tmavý režim, mobil first. Barvy převzaté z timetrackeru (petrolejový akcent). */
:root {
  --bg: #0f1114; --surface: #17191d; --raised: #1e2126; --hover: #262a30;
  --border: #2b2f36; --border-2: #3b4048;
  --text: #ecedef; --text-2: #a8adb5; --text-3: #7f858e;
  --accent: #0e8175; --accent-h: #0b6e64; --accent-t: #5eead4; --accent-bg: rgba(20,184,166,.14);
  --ok: #34d399; --ok-bg: rgba(16,185,129,.14); --warn: #fbbf24; --warn-bg: rgba(245,158,11,.13); --bad: #f87171; --bad-bg: rgba(239,68,68,.13);
  --r: 14px; --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; } /* bez přiblížení dvojitým klepnutím */
html, body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; max-width: 100%; }
body {
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss03', 'tnum'; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--text-2); } .dim { color: var(--text-3); } .small { font-size: 13px; } .xs { font-size: 12px; }
.ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .bad-t { color: var(--bad); } .acc-t { color: var(--accent-t); }
.row { display: flex; align-items: center; gap: 10px; } .row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 12px; } .stack-s > * + * { margin-top: 8px; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ── Kostra ──────────────────────────────────────────────────────────────── */
#app { max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(var(--nav-h) + var(--safe-b) + 24px); min-height: 100vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 16px; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.section-t { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 26px 2px 10px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: center; background: rgba(23,25,29,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.nav-in { display: flex; width: 100%; max-width: 560px; }
.nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--text-3); font-size: 11px; font-weight: 550;
}
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--accent-t); }
.nav button { position: relative; }
.nav .dot { position: absolute; top: 9px; left: calc(50% + 10px); width: 8px; height: 8px; border-radius: 9px; background: var(--ok); box-shadow: 0 0 0 2px var(--surface); }

/* ── Karty, tlačítka, pole ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.card.pad { padding: 16px; }
.card.tap { display: block; width: 100%; text-align: left; color: inherit; padding: 14px 16px; }
.card.tap:active { background: var(--raised); }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.list .li { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; background: none; border: 0; border-top: 1px solid var(--border); text-align: left; color: inherit; }
.list > .li:first-child { border-top: 0; }
.list > .sw { border-top: 1px solid var(--border); }
.list > .sw:first-child { border-top: 0; }
.list > .sw .li { border-top: 0; background: var(--surface); }

/* potažení doleva = smazat */
.sw { position: relative; overflow: hidden; }
.sw-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-right: 18px;
  background: #7f1d1d; color: #fecaca; font-size: 13.5px; font-weight: 600; transition: background .15s; }
.sw-bg svg { width: 18px; height: 18px; }
.sw.arm .sw-bg { background: #dc2626; color: #fff; }
.sw-fg { position: relative; transition: transform .22s ease; touch-action: pan-y; }
.ex-b .sw { border-radius: 11px; margin-bottom: 8px; }
.ex-b .sw .set { margin-bottom: 0; background: var(--surface); }
.list button.li:active { background: var(--raised); }
.chev { width: 16px; height: 16px; color: var(--text-3); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border-2); background: var(--raised); color: var(--text); font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:active { transform: scale(.98); background: var(--hover); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-h); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.danger { color: var(--bad); }
.btn.ok { background: var(--ok-bg); border-color: rgba(52,211,153,.35); color: var(--ok); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.big { height: 54px; font-size: 16px; border-radius: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); flex: none; }
.icon-btn:active { background: var(--hover); }
.icon-btn svg { width: 20px; height: 20px; }

.field { display: block; }
.field > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.ctl {
  width: 100%; height: 46px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--raised);
  color: var(--text); font-size: 16px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.ctl:focus { border-color: #2dd4bf; box-shadow: 0 0 0 3px rgba(20,184,166,.22); }
textarea.ctl { height: auto; min-height: 84px; padding: 11px 13px; line-height: 1.45; resize: vertical; }
select.ctl { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%237f858e' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid2 > *, .grid3 > * { min-width: 0; }
input[type="date"].ctl { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; display: flex; align-items: center; }
input[type="date"].ctl::-webkit-date-and-time-value { text-align: left; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--border-2); background: var(--raised); color: var(--text-2); font-size: 14px; font-weight: 550; }
.chip.on { background: var(--accent-bg); border-color: rgba(45,212,191,.5); color: var(--accent-t); }
.seg { display: flex; padding: 3px; gap: 3px; background: var(--raised); border: 1px solid var(--border); border-radius: 11px; }
.seg button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.seg button.on { background: var(--hover); color: var(--text); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--raised); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.acc { background: var(--accent-bg); color: var(--accent-t); border-color: transparent; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.alert { padding: 11px 13px; border-radius: 11px; background: var(--bad-bg); color: #fca5a5; font-size: 14px; }
.empty { text-align: center; padding: 28px 16px; color: var(--text-3); }

/* ── Dnes ────────────────────────────────────────────────────────────────── */
.hero { padding: 18px; border-radius: 18px; background: linear-gradient(160deg, rgba(14,129,117,.28), rgba(14,129,117,.06) 60%), var(--surface); border: 1px solid rgba(45,212,191,.22); }
.hero .kicker { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-t); }
.hero h2 { font-size: 21px; margin: 4px 0 4px; }
.hero .ex-preview { margin: 12px 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 92px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); text-align: left; color: inherit; }
.tile:active { background: var(--raised); }
.tile svg { width: 22px; height: 22px; color: var(--accent-t); }
.tile b { font-size: 14.5px; font-weight: 600; } .tile small { color: var(--text-3); font-size: 12.5px; margin-top: -6px; }

/* ── Probíhající trénink ─────────────────────────────────────────────────── */
.wo-head { position: sticky; top: 0; z-index: 20; margin: calc(-16px - var(--safe-t)) -16px 14px; padding: calc(12px + var(--safe-t)) 16px 12px;
  background: rgba(15,17,20,.9); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.wo-head h1 { font-size: 19px; }
.progress { height: 5px; border-radius: 9px; background: var(--raised); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: var(--accent-t); border-radius: 9px; transition: width .3s; }

.ex { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 10px; overflow: hidden; transition: border-color .2s, opacity .2s; }
.ex.current { border-color: rgba(45,212,191,.45); }
.ex-h { display: flex; align-items: center; gap: 12px; padding: 14px 10px 14px 16px; width: 100%; background: none; border: 0; text-align: left; color: inherit; }
.ex-h .num { width: 28px; height: 28px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--raised); color: var(--text-2); }
.ex.current .num { background: var(--accent-bg); color: var(--accent-t); }
.ex.done .num { background: var(--ok-bg); color: var(--ok); }
.ex.skipped .num { color: var(--text-3); }
.ex-h .num svg { width: 16px; height: 16px; }
.ex-name { font-weight: 600; font-size: 15.5px; }
.ex.skipped .ex-name { color: var(--text-3); text-decoration: line-through; }
.ex.done.collapsed, .ex.skipped.collapsed { opacity: .82; }
.ex-meta { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.ex-b { padding: 0 14px 14px; }
.ex-note { font-size: 13px; color: var(--text-2); background: var(--raised); border-radius: 10px; padding: 9px 11px; margin-bottom: 10px; }
.ex-last { font-size: 12.5px; color: var(--text-3); margin: -2px 2px 10px; }
.sets-h, .set { display: grid; grid-template-columns: 30px 1fr 1fr 52px; gap: 8px; align-items: center; }
.sets-h { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; padding: 0 0 6px; text-align: center; }
.set { margin-bottom: 8px; }
.set .no { text-align: center; font-weight: 700; color: var(--text-3); font-size: 14px; }
.set input { width: 100%; height: 48px; text-align: center; font-size: 18px; font-weight: 600; border-radius: 11px; border: 1px solid var(--border-2); background: var(--raised); color: var(--text); outline: none; padding: 0 4px; }
.set input:focus { border-color: #2dd4bf; }
.set.done input { background: var(--ok-bg); border-color: rgba(52,211,153,.3); color: #a7f3d0; }
.set .chk { height: 48px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--raised); color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.set .chk svg { width: 22px; height: 22px; }
.set.done .chk { background: var(--ok); border-color: var(--ok); color: #052e22; }
.ex-actions { display: flex; gap: 8px; margin-top: 4px; }
.ex-actions .btn { flex: 1; }
.ex-actions .btn.sq { flex: 0 0 40px; padding: 0; }
.ex-sum { font-size: 13px; color: var(--text-2); }

/* ── Spodní panel (sheet) ────────────────────────────────────────────────── */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(3,7,18,.68); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.sheet-bg.in { opacity: 1; }
.sheet { position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-2); border-bottom: 0; border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + var(--safe-b)); overflow-x: hidden; overscroll-behavior: contain; transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1); -webkit-overflow-scrolling: touch; }
.sheet.in { transform: none; }
.sheet .grab { width: 38px; height: 5px; border-radius: 9px; background: var(--border-2); margin: 2px auto 12px; position: relative; }
.sheet .grab::before { content: ''; position: absolute; inset: -14px -40px; } /* větší plocha pro prst */
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-foot { position: sticky; bottom: calc(-20px - var(--safe-b)); margin: 16px -16px calc(-20px - var(--safe-b)); padding: 12px 16px calc(14px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 10px; }
.sheet-foot .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
.sheet-foot .btn > :not(svg) { overflow: hidden; text-overflow: ellipsis; }
.sheet-foot .icon-btn { flex: none; }
.plan-ex, .plan-ex * { min-width: 0; overflow-wrap: anywhere; }
.ctl { min-width: 0; max-width: 100%; }

.plan-ex { padding: 10px 0; border-top: 1px solid var(--border); }
.plan-ex:first-child { border-top: 0; }
.plan-sets { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.plan-sets span { font-size: 12.5px; padding: 2px 8px; border-radius: 7px; background: var(--raised); color: var(--text-2); font-weight: 550; }

.toast { position: fixed; z-index: 60; left: 50%; top: calc(14px + var(--safe-t)); transform: translate(-50%, -20px); opacity: 0; transition: .2s;
  padding: 10px 16px; border-radius: 12px; background: var(--raised); border: 1px solid var(--border-2); font-size: 14px; font-weight: 550; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(248,113,113,.5); color: #fca5a5; }

.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--accent-t); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Grafy ───────────────────────────────────────────────────────────────── */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent-t); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#chartFill); }
.chart .pt { fill: var(--surface); stroke: var(--accent-t); stroke-width: 2; }
.chart .pt.last { fill: var(--accent-t); }
.chart .val { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart .bar { fill: var(--accent); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: var(--raised); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 18px; font-weight: 700; } .stat span { font-size: 11.5px; color: var(--text-3); }

/* ── Přihlášení ──────────────────────────────────────────────────────────── */
body.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box h1 { margin-top: 14px; } .login-box p { margin: 4px 0 22px; }
.login-box form { text-align: left; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; }
.brand-mark svg { width: 18px; height: 18px; }
.brand-mark.big { width: 56px; height: 56px; border-radius: 16px; } .brand-mark.big svg { width: 32px; height: 32px; }
