:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-2: #21252e;
  --text: #eef0f4;
  --text-dim: #9aa2b1;
  --accent: #5b8def;
  --accent-2: #34d399;
  --danger: #f0616d;
  --warn: #f5a623;
  --border: #2a2e38;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 76px;
  min-height: 100vh;
}

.hidden { display: none !important; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-sm { width: 15px; height: 15px; stroke-width: 2; }
.icon-lg { width: 30px; height: 30px; stroke-width: 1.5; }
.icon-xl { width: 42px; height: 42px; stroke-width: 1.4; }
.icon-btn {
  background: var(--card-2);
  border: none;
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.app-header {
  padding: 18px 16px 10px;
  text-align: center;
}
.app-header h1 {
  font-size: 19px;
  margin: 0;
  font-weight: 700;
}

main { padding: 0 14px 20px; max-width: 560px; margin: 0 auto; }

.tab-panel { animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.plan-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.plan-desc { font-size: 14px; color: var(--text-dim); line-height: 1.4; }

.today-day-name { font-size: 20px; font-weight: 700; margin-bottom: 12px; }

.progress-bar {
  height: 8px;
  border-radius: 6px;
  background: var(--card-2);
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width .3s ease;
}
.progress-text { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:active { opacity: .8; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn-accept { background: var(--accent-2); color: #06281c; }
.btn-decline { background: var(--card-2); color: var(--text-dim); }

.settings-btn { margin-top: 6px; }

.week-strip { display: flex; gap: 6px; justify-content: space-between; }
.week-day {
  flex: 1;
  text-align: center;
  padding: 8px 2px;
  border-radius: 8px;
  background: var(--card-2);
  font-size: 11px;
  cursor: pointer;
  border: 2px solid transparent;
}
.week-day .wd-label { color: var(--text-dim); margin-bottom: 3px; }
.week-day .wd-date { font-size: 10px; color: var(--text-dim); opacity: .8; margin-bottom: 3px; }
.week-day.today { border-color: var(--accent); }
.week-day.selected { background: rgba(91,141,239,.22); box-shadow: 0 0 0 2px var(--text); }
.week-day.done { background: rgba(52,211,153,.18); }
.week-day.rest { opacity: .45; }
.week-day .wd-dot { display: flex; justify-content: center; color: var(--text-dim); }
.week-day.done .wd-dot { color: var(--accent-2); }
.week-day .wd-dot .icon { width: 14px; height: 14px; }

.workout-daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.workout-daynav .week-strip { flex: 1; }
.workout-daynav .week-day { padding: 6px 2px; }

.day-plan-switch { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.day-plan-switch-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.day-plan-switch select {
  flex: 1;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
}

.empty-state { text-align: center; color: var(--text-dim); padding: 30px 10px; line-height: 1.6; }

.exercise-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.exercise-card.completed { border-color: rgba(52,211,153,.4); }
.ex-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  cursor: pointer;
}
.ex-name { font-weight: 700; font-size: 15px; }
.ex-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; font-weight: 600; }
.ex-meta .ziel-label { font-weight: 400; opacity: .8; }
.notes-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-bottom: 10px;
}
.notes-row-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }
.notes-row input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 0;
}
.notes-row input::placeholder { color: var(--text-dim); opacity: .6; }
.ex-weight-badge {
  background: var(--card-2);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.set-row {
  display: grid;
  grid-template-columns: 26px 1fr 1fr 32px 26px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.set-num { font-size: 12px; color: var(--text-dim); text-align: center; }
.set-row-header { margin-bottom: 4px; }
.col-label {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .03em;
  opacity: .75;
}
.add-set-btn {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  margin-top: 2px;
}
.add-set-btn:active { background: var(--card-2); }
.set-row.extra-set .set-num { color: var(--accent); }
.set-input {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 6px;
  font-size: 14px;
  width: 100%;
  text-align: center;
}
.set-note-btn {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.set-note-btn .icon { width: 15px; height: 15px; }
.set-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: transparent;
  display: flex; align-items: center; justify-content: center;
}
.set-check .icon { width: 15px; height: 15px; stroke-width: 2.4; }
.set-check.checked {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #06281c;
}
.set-note-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 8px;
}
.set-note-input {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px;
  font-size: 13px;
}
.set-delete-btn {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--danger);
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.set-delete-btn .icon { width: 15px; height: 15px; }

.suggestion-box {
  margin-top: 8px;
  padding: 10px;
  background: rgba(91,141,239,.12);
  border: 1px solid rgba(91,141,239,.35);
  border-radius: 10px;
  font-size: 13px;
}
.suggestion-actions { display: flex; gap: 8px; margin-top: 8px; }
.suggestion-actions .btn { flex: 1; }

.db-toolbar { margin: 10px 0 12px; }
#db-search {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.db-category { font-size: 12px; text-transform: uppercase; color: var(--text-dim); margin: 16px 0 6px; }
.db-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.db-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.db-item-name { font-weight: 600; font-size: 14px; }
.db-item-weight {
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-weight-input {
  width: 64px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 700;
  text-align: center;
  padding: 6px 4px;
}

.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0) + 6px);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  font-size: 11px;
  border-radius: 10px;
}
.tab-btn.active { color: var(--accent); }
.tab-icon { margin-bottom: 1px; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.modal-content {
  background: var(--card);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 16px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 16px;
}
.modal-close {
  background: var(--card-2);
  border: none;
  color: var(--text);
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-close .icon { width: 15px; height: 15px; }

.calendar-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 10px; }
.calendar-nav button { background: var(--card-2); border: none; color: var(--text); width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-cell { aspect-ratio: 1; border-radius: 8px; background: var(--card-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; border: 2px solid transparent; gap: 4px; }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell:active:not(.empty) { opacity: .7; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.cal-dot.planned { background: var(--text); opacity: .55; }
.cal-dot.done { background: var(--accent-2); opacity: 1; }
.calendar-hint { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 12px; }

.pr-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.pr-card {
  background: var(--card);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  border: 1px solid rgba(245,166,35,.4);
}
.pr-emoji { font-size: 44px; margin-bottom: 8px; }
.pr-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.pr-detail { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }

#toast-container {
  position: fixed;
  top: 12px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label { display: block; font-size: 12px; color: var(--text-dim); margin: 10px 0 4px; }
.form-input {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
textarea.form-input { resize: vertical; }

.np-day-card { background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.np-day-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.np-day-head .form-input { flex: 1; }
.np-day-desc { margin-bottom: 10px; }
.np-exercises { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.np-exercise-row { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.np-ex-line1 { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.np-ex-line1 input, .np-ex-line2 input {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px;
  font-size: 12px;
  text-align: center;
}
.np-ex-line1 .np-ex-name { flex: 1; min-width: 0; text-align: left; }
.np-ex-line1 input[type=number] { width: 52px; flex-shrink: 0; }
.np-ex-remove { background: transparent; border: none; color: var(--text-dim); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.np-ex-line2 { display: flex; gap: 6px; align-items: center; }
.np-ex-line2 .np-ex-category { flex: 1; min-width: 0; text-align: left; }
.np-ex-line2 .np-ex-weight { width: 68px; }
.np-ex-line2 .np-ex-unit { width: 44px; }
.np-ex-bw { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.np-ex-line3 {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
}
.np-ex-line3 .notes-row-label { font-size: 11px; }
.np-ex-notes {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
  font-size: 12px;
  text-align: left;
}
.np-activate-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 16px 0; }

.export-range { display: flex; gap: 16px; margin-bottom: 10px; font-size: 13px; }
.export-range label { display: flex; align-items: center; gap: 6px; }
.export-dates { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.export-dates input {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 8px;
  font-size: 13px;
}
#export-result textarea {
  width: 100%;
  min-height: 120px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px;
  font-size: 11px;
  font-family: monospace;
  margin: 10px 0;
}

.settings-section { margin-bottom: 18px; }
.settings-section h3 { font-size: 13px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.schedule-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.schedule-row select {
  background: var(--card-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; font-size: 13px;
}
.plan-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
