/* ===== Motyw D – Czarny pas ===== */
:root {
  --bg: #FAF7F0;      /* tło – krem */
  --card: #FFFFFF;    /* karty */
  --ink: #16130F;     /* tekst i przyciski */
  --muted: #6E6658;   /* tekst pomocniczy */
  --line: #E2DACA;    /* ramki */
  --gold: #C9A23C;    /* akcent */
  --gold-soft: #FBF3DC;
  --red: #B3261E;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 Inter, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 20px 110px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1, h2 {
  font-family: Oswald, Inter, sans-serif;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin: 0;
}
h1 { font-size: 30px; }
h2 { font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }

/* Karty */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card.accent { border: 1.5px solid var(--ink); border-left: 6px solid var(--gold); }

/* Formularze */
label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
input, select, textarea {
  font: inherit;
  font-size: 16px; /* 16px = iPhone nie przybliża ekranu przy pisaniu */
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }

/* Przyciski */
.btn {
  font: 700 15px Inter, sans-serif;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn:disabled { opacity: .5; }
.link { background: none; border: none; color: var(--muted); font: 600 14px Inter, sans-serif; text-decoration: underline; padding: 8px 0; cursor: pointer; align-self: flex-start; }

.msg { font-size: 13px; padding: 10px 12px; border-radius: 10px; }
.msg.err { background: #FCE8E6; color: var(--red); }
.msg.ok { background: var(--gold-soft); color: #7A5E12; }

/* Pas z węzłem */
.belt { width: 100%; height: 40px; }

/* Dolne menu */
#nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
}
#nav[hidden] { display: none; }
#nav a {
  min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
  border-top: 3px solid transparent;
}
#nav a.active { color: var(--ink); font-weight: 800; border-top-color: var(--gold); }
#nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Etap 2: grupy ===== */
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row .btn { flex: 1; }
.between { display: flex; justify-content: space-between; align-items: baseline; }
.col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.big { font-family: Oswald, Inter, sans-serif; font-size: 30px; font-weight: 700; text-transform: uppercase; line-height: 1; }
.gold-text { color: #7A5E12; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.back { color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; padding: 6px 0; align-self: flex-start; }

.row-link { flex-direction: row; justify-content: space-between; align-items: center; text-decoration: none; color: var(--ink); padding: 14px 16px; }
.chev { font-size: 22px; color: var(--muted); }

.info { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.info:last-child { border-bottom: none; padding-bottom: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two input { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 44px; padding: 0 10px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-weight: 700; color: var(--ink); background: #fff;
}
.chip input:checked + span { background: var(--gold-soft); border-color: var(--ink); }

/* ===== Etap 3: ćwiczenia ===== */
.m0 { margin: 0; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; }
input[type="search"] { width: 100%; }
.pill {
  font: 700 13px Inter, sans-serif; height: 38px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 19px; background: #fff; color: var(--ink); cursor: pointer;
}
.pill.on { background: var(--gold-soft); border-color: var(--ink); }
details.ex summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; }
details.ex summary::-webkit-details-marker { display: none; }
details.ex[open] .chev { transform: rotate(180deg); }
details.ex[open] summary { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tag { background: var(--gold-soft); color: #7A5E12; padding: 1px 6px; border-radius: 5px; font-weight: 700; }
select { width: 100%; }

/* ===== Etap 4: edytor treningu ===== */
label.inline { flex-direction: row; align-items: center; gap: 10px; }
label.inline input { padding: 8px 10px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  font: inherit; text-align: left; cursor: pointer; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 2px; min-height: 92px;
}
.tile b { font-size: 13px; line-height: 1.2; }
.tile .muted { font-size: 11px; }
.tile.on { background: var(--gold-soft); border: 2px solid var(--ink); }
.tnum { font-family: Oswald, sans-serif; font-weight: 700; font-size: 18px; color: #7A5E12; }
.item { flex-direction: row; justify-content: space-between; align-items: center; padding: 12px; }
.mins { flex-direction: row; align-items: center; gap: 6px; font-weight: 600; }
.mins input { width: 64px; padding: 6px 8px; }
.acts { display: flex; gap: 4px; flex: none; }
.ib { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: 700 18px Inter, sans-serif; cursor: pointer; }
.ib:disabled { opacity: .3; }
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
}
.bar .over { color: var(--red); }
.sheet { position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto; padding: calc(16px + env(safe-area-inset-top)) 16px 40px; }
.sheet[hidden] { display: none; }
.sheet-head { position: sticky; top: calc(-16px - env(safe-area-inset-top)); background: var(--bg); padding: 8px 0 10px; display: flex; flex-direction: column; gap: 10px; z-index: 1; }
.sheet-list { max-width: 480px; margin: 0 auto; }
body.noscroll { overflow: hidden; }

/* ===== Etap 4b: cofanie ===== */
.toast {
  position: fixed; left: 12px; right: 12px; z-index: 6;
  bottom: calc(80px + env(safe-area-inset-bottom));
  max-width: 456px; margin: 0 auto;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 10px 10px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px;
}
.toast button { background: var(--gold); color: var(--ink); border: none; border-radius: 8px; height: 40px; padding: 0 14px; font: 800 14px Inter, sans-serif; cursor: pointer; }

/* ===== Etap 5: kalendarz ===== */
.center { align-items: center; text-align: center; }
.center-y { align-items: center; }
.remind { background: var(--gold-soft); border-color: var(--gold); }
.weeknav { display: flex; justify-content: space-between; align-items: center; }
a.ib { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.day { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; }
.daycol { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 6px; }
.dnum { width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.dnum.today { background: var(--gold); }
.sess { padding: 12px; gap: 6px; }
.sess.dim { opacity: .7; }
a.plain { text-decoration: none; color: var(--ink); }
.strike { text-decoration: line-through; }
.chipst { flex: none; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.st-plan { background: #DCE7F8; color: #1F4A8F; }
.st-empty { background: var(--gold-soft); color: #7A5E12; border: 1px solid var(--gold); }
.st-done { background: #E6F2E8; color: #2E6B3A; }
.st-off { background: #EFEBE2; color: var(--muted); }
.small-link { font-size: 12px; padding: 2px 0; }
.dnote { font-size: 12px; font-weight: 700; color: #7A5E12; }
.red { color: var(--red) !important; }
.pad { padding-top: 12px; display: block; }
.dates { padding: 4px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.ib.sm { width: 36px; height: 36px; font-size: 16px; }
label.inline input[type="checkbox"] { width: 20px; height: 20px; }

/* ===== Etap 6: zastępstwa ===== */
.code { font-family: Oswald, Inter, sans-serif; font-size: 34px; font-weight: 700; letter-spacing: 3px; user-select: all; }

/* ===== Etap 7: podgląd ułożonego planu ===== */
.seg-head { display: flex; align-items: baseline; gap: 8px; padding-top: 6px; border-bottom: 2px solid var(--gold); padding-bottom: 4px; }
.seg-head h2 { flex: 1; font-size: 18px; }
.ex-plain { flex-direction: row; justify-content: space-between; align-items: center; }
details.ex .chev { transition: transform .2s; flex: none; }

/* ===== Etap 8: dni w kalendarzu + ulubione ===== */
.days { display: flex; flex-direction: column; }
.day { padding: 14px 0; border-top: 2px solid var(--line); }
.day:first-child { border-top: none; }
.day .daycol .muted { font-weight: 800; text-transform: uppercase; color: var(--ink); }
.day.is-today { background: var(--gold-soft); border: 1.5px solid var(--gold); border-radius: 14px; padding: 12px 8px; margin: 6px 0; }
.day.is-today + .day { border-top: none; }
.star { flex: none; width: 40px; height: 40px; border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.star.on { color: var(--gold); }
