:root {
  --bg: #0f1115;
  --surface: #181b21;
  --surface-2: #22262e;
  --line: #2c313b;
  --text: #f2f3f5;
  --muted: #8b92a0;
  --accent: #c6f432;      /* ana vurgu */
  --accent-ink: #12160a;  /* vurgu üstündeki yazı */
  --up: #5fd38a;
  --down: #ff7a6b;
  --warm: #e0a84a;
  --radius: 16px;
  --tap: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}

body.locked { overflow: hidden; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 32px);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center-text { text-align: center; margin-top: 24px; }
.section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 20px 0 8px;
}
.card .section-label:first-child { margin-top: 0; }

/* ---------- Üst başlık ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.top .center { flex: 1; text-align: center; }
.top.sticky {
  position: sticky; top: 0; z-index: 5;
  margin: calc(-1 * env(safe-area-inset-top) - 12px) -16px 16px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--text); background: var(--surface);
}
.icon-btn.small { width: 36px; height: 36px; font-size: 20px; background: transparent; }
span.icon-btn { background: transparent; }

.pill-btn {
  height: 40px; padding: 0 18px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}

/* ---------- Ana sayfa ---------- */
.template-list { display: grid; gap: 10px; }

.big-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; padding: 18px 20px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.big-card:active { transform: scale(0.99); background: var(--surface-2); }
.big-title { font-size: 22px; font-weight: 700; }
.big-card.resume { border-color: var(--accent); margin-top: 8px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.cta { margin-top: 8px; font-weight: 700; color: var(--accent); }

.banner {
  width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px;
  border-radius: 12px; background: #2a2412; color: #f1d58a; font-size: 14px;
}

.week-box {
  margin-top: 24px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.week-box .section-label { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 24px; }
.stats span { font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- Hareket kartları ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; scroll-margin-top: 90px;
}
.card.focused { border-color: var(--accent); }
.card.complete:not(.focused) { opacity: 0.75; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.done-badge { color: var(--up); font-size: 16px; }

.prev { font-size: 14px; margin-top: 4px; }
.prev .warm, .set-row .warm { color: var(--warm); }

.machine {
  margin-top: 8px; padding: 6px 10px; border-radius: 8px;
  background: var(--surface-2); font-size: 13px; color: var(--text);
}
.machine.empty { color: var(--muted); background: transparent; border: 1px dashed var(--line); }

.sets { margin-top: 10px; display: grid; gap: 6px; }
.set-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2); text-align: left;
}
.set-no {
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); font-size: 13px; color: var(--muted);
}
.set-val { flex: 1; font-size: 17px; font-weight: 600; }
.check { color: var(--up); }

.trend { font-weight: 800; font-size: 15px; }
.trend.up { color: var(--up); }
.trend.down { color: var(--down); }
.trend.same { color: var(--muted); }
.trend.new { color: var(--accent); font-size: 12px; font-weight: 700; }

/* Aktif set girişi */
.active-set {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
}
.active-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 600; }

.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: var(--surface-2); color: var(--muted);
}
.chip.on { background: var(--warm); color: #1c1406; font-weight: 700; }

.steppers { display: grid; gap: 12px; }
.stepper { display: flex; flex-direction: column; gap: 6px; }
.stepper label { font-size: 13px; color: var(--muted); }
.stepper-row { display: flex; align-items: stretch; gap: 4px; }
.stepper-row.inline { align-items: center; gap: 12px; }
.step {
  width: 64px; min-height: var(--tap); border-radius: 12px; flex-shrink: 0;
  background: var(--surface-2); font-size: 24px; font-weight: 600;
}
.step:active { background: var(--line); }
.step-input {
  width: 100%; min-width: 0; min-height: var(--tap); border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface);
  text-align: center; font-size: 22px; font-weight: 700; /* 16px+ iOS'ta yakınlaştırmayı engeller */
}
.step-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.unit { font-size: 12px; color: var(--muted); text-align: center; }
.plain-val { font-size: 20px; font-weight: 700; min-width: 90px; text-align: center; }

.primary {
  min-height: var(--tap); padding: 0 20px; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 17px;
}
.primary:active { filter: brightness(0.9); }
.primary.wide { width: 100%; margin-top: 12px; }
.confirm { font-size: 18px; }

.rest { margin-top: 8px; }

.ghost-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 48px; margin-top: 10px; border-radius: 14px;
  border: 1px dashed var(--line); color: var(--text); background: transparent;
}
.text-btn { display: block; margin: 8px auto 0; padding: 8px 12px; color: var(--muted); font-size: 14px; }
.danger { color: var(--down) !important; }

.row-btn {
  display: block; width: 100%; text-align: left; padding: 14px 12px; margin-top: 6px;
  border-radius: 12px; background: var(--surface-2);
}

.cardio-section { margin-top: 8px; }

.highlight {
  padding: 12px 14px; margin-bottom: 12px; border-radius: 12px;
  background: rgba(95, 211, 138, 0.12); color: var(--up); font-weight: 600;
}
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sum-row:last-child { border-bottom: 0; }

/* ---------- Alt panel ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 560px; margin: 0 auto; max-height: 88vh; overflow-y: auto;
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 16px);
  background: var(--surface); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  animation: up 0.18s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { margin-bottom: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.field input:not([type="radio"]) {
  min-height: 48px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); font-size: 16px; color: var(--text);
}
.check-field { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.check-field input { width: 22px; height: 22px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio span {
  display: inline-block; padding: 10px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 14px;
}
.chip-radio input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chips.tight { gap: 6px; }
.chip-radio.num span { width: 40px; padding: 10px 0; text-align: center; }

.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions > * { flex: 1; margin-top: 0; }
.file-btn { cursor: pointer; }

.field .hint { font-size: 12px; color: var(--muted); }

.bw-chip {
  display: inline-block; margin: 0 0 12px; padding: 8px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--text);
}
.bw-chip.empty { color: var(--muted); border-style: dashed; }
.bw-line { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bw-compare { margin-top: 4px; font-size: 16px; }
.bw-diff { font-weight: 700; color: var(--text); }
.last-backup { margin: 4px 0 2px; font-size: 15px; }

/* Ayarlar: gün listeleri */
.tpl-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.tpl-name {
  flex: 1; min-width: 0; text-align: left; padding: 12px; border-radius: 12px; background: var(--surface-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini {
  width: 40px; height: 44px; flex-shrink: 0; border-radius: 10px;
  background: var(--surface-2); font-size: 16px; color: var(--text);
}
.mini:disabled { opacity: 0.3; cursor: default; }
.mini.remove { color: var(--down); }
.sheet-hint { margin: -6px 0 10px; }

/* ---------- Onay penceresi ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6);
  animation: fade 0.15s ease-out;
}
.dialog {
  position: fixed; z-index: 41; left: 50%; top: 50%;
  width: min(340px, calc(100% - 48px));
  transform: translate(-50%, -50%);
  padding: 24px 20px 16px; border-radius: 22px; text-align: center;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: pop 0.18s ease-out;
}
.dialog h3 { margin-bottom: 8px; }
.dialog p { color: var(--muted); font-size: 15px; }
.dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.dialog-actions button { flex: 1; min-height: 50px; border-radius: 14px; font-weight: 700; font-size: 16px; }
.dialog-cancel { background: var(--surface-2); }
.primary.danger-fill { background: var(--down); color: #1f0805; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- Alt sekmeler ---------- */
body.has-tabbar #app { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 12px calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(15, 17, 21, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent); }

.week-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.week-head .section-label { margin: 0; }
.link-btn { color: var(--accent); font-size: 14px; font-weight: 600; padding: 4px 0; }

/* ---------- Geçmiş ---------- */
.empty { margin: 24px 4px; }
.hist-card {
  display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left;
  padding: 14px 16px; margin-bottom: 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.hist-card:active { background: var(--surface-2); }
.hist-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hist-top b { font-size: 17px; }
.detail-meta { margin: -6px 0 14px; text-align: center; }
.best-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); padding: 2px 8px; border-radius: 99px; background: rgba(198, 244, 50, 0.12);
}
.edit-hint { color: var(--muted); font-size: 14px; }
.set-val.warm { color: var(--warm); }

/* ---------- Tür sekmeleri ---------- */
.chips-row {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip-tab {
  flex-shrink: 0; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.chip-tab.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.new-day { margin: 0 0 12px; }
.new-day .small { margin-left: 6px; }

/* Özet: hareket ilerleme satırları */
.progress-help { margin: 2px 0 6px; }
.prog-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.prog-row:last-child { border-bottom: 0; }
.prog-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.prog-name { font-size: 16px; }
.prog-val { white-space: nowrap; }
.prog-pct { margin-left: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.prog-pct.up { color: var(--up); }
.prog-pct.down { color: var(--down); }
.prog-row .small { margin-top: 2px; }

/* ---------- Özet ---------- */
.segmented { display: flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg { padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg.on { background: var(--surface-2); color: var(--text); }
.period-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.period-nav .icon-btn:disabled { opacity: 0.3; }
.period-label { font-size: 17px; font-weight: 700; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.tile b { font-size: 26px; line-height: 1.1; }
.tile span { font-size: 13px; color: var(--text); }
.tile em { font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 16px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; border-radius: 10px; font-size: 12px; color: var(--muted); }
.day.today { background: var(--surface-2); color: var(--text); }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); vertical-align: middle; }
.dot.s { background: var(--accent); border-color: var(--accent); }
.dot.c { border-color: #6fb8ff; }
.dot.s.c { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px #6fb8ff; }
.legend { margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; margin-left: 6px; }
.progress-head { margin-bottom: 4px; }

/* ---------- Bildirim ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600;
  width: max-content; max-width: calc(100% - 32px); text-align: center;
  transition: all 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
body.has-tabbar #toast { bottom: calc(env(safe-area-inset-bottom) + 84px); }
