/* ═══════════════════════════════════════════════════════════════════════
   TREINO VICTOR — PWA
   Estética: atlética-editorial · âmbar/grafite · dark · mobile-first
   ═══════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Cores */
  --bg: #0a0d0f;
  --bg-2: #12161a;
  --bg-3: #1a1f24;
  --line: #232a31;
  --line-2: #2c343c;
  --ink: #f5f5f4;
  --ink-2: #c4c4c2;
  --ink-3: #8a8a87;
  --ink-4: #4d524f;

  --accent: #f59e0b;
  --accent-bright: #fbbf24;
  --accent-deep: #b45309;
  --success: #34d399;
  --warning: #fb923c;
  --danger: #f87171;

  /* Tipografia */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Espaçamento */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);

  /* Curvas */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  overscroll-behavior: none;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

input:focus, textarea:focus, button:focus { outline: none; }

/* App container */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

/* ═════ HEADER ═════════════════════════════════════════════════════════ */
header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + 20px) 20px 18px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 80%, transparent 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.h-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.h-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.h-logo {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}
.h-logo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.15) 100%);
}

.h-name {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--ink);
}
.h-name b { color: var(--accent); }
.h-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 2px;
}

.h-week {
  text-align: right;
  font-family: var(--font-mono);
}
.h-week-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.h-week-lbl {
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Sync pill */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 10px;
  background: var(--bg-2);
  border-radius: 999px;
  width: fit-content;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.sync-bar.warn { color: var(--warning); border-color: rgba(251, 146, 60, 0.3); }
.sync-bar.warn .sync-dot { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.sync-bar.error { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); }
.sync-bar.error .sync-dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* ═════ SCREENS ═══════════════════════════════════════════════════════ */
.screen {
  display: none;
  padding: 0 20px 120px;
  animation: screenIn 0.3s var(--ease);
}
.screen.active { display: block; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section header */
.section {
  margin-top: 28px;
}
.section-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 2px;
}
.section-t {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.section-x {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ═════ HERO STATS ═══════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
  opacity: 0.08;
  filter: blur(40px);
}
.hero-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  position: relative;
}
.hero-col { text-align: center; position: relative; }
.hero-col + .hero-col::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 10%;
  height: 80%;
  width: 1px;
  background: var(--line-2);
}
.hero-val {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: 0.01em;
  color: var(--accent);
  line-height: 0.9;
  margin-bottom: 6px;
}
.hero-val.muted { color: var(--ink-3); }
.hero-lbl {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

/* Goal bar */
.goal {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
  position: relative;
}
.goal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
}
.goal-row b { color: var(--accent); font-weight: 700; }
.goal-track {
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent), var(--accent-bright));
  border-radius: 2px;
  transition: width 0.6s var(--ease);
}

/* ═════ DAY PICKER ═══════════════════════════════════════════════════ */
.days {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  text-align: left;
  color: var(--ink);
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.day:active { transform: scale(0.985); background: var(--bg-3); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 24px -8px rgba(245, 158, 11, 0.3); }
.day.disabled { opacity: 0.5; pointer-events: none; }

.day-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.04em;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  position: relative;
}
.day.strength .day-mark { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); color: var(--accent); }
.day.tennis .day-mark { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.3); color: var(--success); }
.day.rest .day-mark { color: var(--ink-3); }

.day-mark.done::after {
  content: '✓';
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--success);
  color: var(--bg);
  border-radius: 50%;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-2);
}

.day-info { min-width: 0; }
.day-day {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.day-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 1px 0 2px;
}
.day-desc {
  font-size: 12px;
  color: var(--ink-3);
}

.day-meta {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.day.today .day-meta { color: var(--accent); }

.today-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ═════ WORKOUT VIEW ═════════════════════════════════════════════════ */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 8px 0 16px;
  transition: all 0.15s;
}
.back:active { transform: translateX(-2px); }

.workout-hero {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.workout-hero::before {
  content: attr(data-letter);
  position: absolute;
  top: -20px;
  right: -10px;
  font-family: var(--font-display);
  font-size: 200px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.06;
  letter-spacing: -0.05em;
}
.workout-day {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 600;
}
.workout-name {
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 4px 0 2px;
  line-height: 1;
}
.workout-focus {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 18px;
}

.prog-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.prog-row b { color: var(--accent); font-weight: 700; }
.prog-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}

/* Exercise card */
.ex {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
  transition: all 0.3s var(--ease);
}
.ex.done {
  opacity: 0.55;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.04), var(--bg-2));
  border-color: rgba(52, 211, 153, 0.2);
}
.ex.star {
  border-left: 3px solid var(--accent);
}

.ex-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.ex-num {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  width: 28px;
}
.ex.done .ex-num { color: var(--success); }
.ex-body { flex: 1; min-width: 0; }
.ex-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 3px;
}
.ex.star .ex-name::after {
  content: '★';
  color: var(--accent);
  margin-left: 6px;
  font-size: 12px;
}
.ex-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.ex-why {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  font-style: italic;
  line-height: 1.4;
}

.ex-yt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--danger);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 10px;
  transition: all 0.15s;
}
.ex-yt:active { transform: scale(0.96); }
.ex-yt-icon {
  width: 14px;
  height: 10px;
  background: var(--danger);
  border-radius: 2px;
  position: relative;
  flex-shrink: 0;
}
.ex-yt-icon::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 5px solid var(--bg);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

/* Sets */
.sets {
  margin-top: 14px;
  display: grid;
  gap: 6px;
}
.sets-h {
  display: grid;
  grid-template-columns: 38px 1fr 1fr 44px;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-4);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0 2px;
}
.sets-h span:not(:first-child) { text-align: center; }

.set {
  display: grid;
  grid-template-columns: 38px 1fr 1fr 44px;
  gap: 6px;
  align-items: center;
}
.set-n {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  padding-left: 4px;
}
.set-input {
  width: 100%;
  padding: 10px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  -moz-appearance: textfield;
  transition: all 0.15s;
}
.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-input:focus { border-color: var(--accent); background: rgba(245, 158, 11, 0.05); }
.set-input::placeholder { color: var(--ink-4); font-weight: 400; }

.set-suffix { position: relative; }
.set-suffix::after {
  content: 'kg';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  pointer-events: none;
}
.set-suffix .set-input { padding-right: 24px; }

.set-check {
  width: 44px;
  height: 38px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  color: var(--ink-4);
  transition: all 0.15s var(--ease-spring);
}
.set-check:active { transform: scale(0.9); }
.set-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg);
}

.warmup-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: var(--bg);
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.warmup-btn:active { transform: scale(0.99); }
.warmup-btn.checked {
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.3);
  border-style: solid;
  color: var(--success);
}

/* Finish button */
.finish-btn {
  width: 100%;
  margin-top: 16px;
  padding: 18px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.finish-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  animation: shine 3s infinite;
}
@keyframes shine { to { transform: translateX(100%); } }
.finish-btn:active { transform: scale(0.98); background: var(--accent-bright); }

/* ═════ TIMER FAB ═════════════════════════════════════════════════════ */
.fab {
  position: fixed;
  bottom: calc(82px + var(--safe-bottom));
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 24px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px -4px rgba(245, 158, 11, 0.5);
  z-index: 25;
  transition: all 0.2s var(--ease);
}
.fab:active { transform: scale(0.9); }
.fab.running {
  animation: pulseFab 1.5s ease-in-out infinite;
  background: var(--danger);
  box-shadow: 0 8px 24px -4px rgba(248, 113, 113, 0.5);
}
@keyframes pulseFab {
  0%, 100% { box-shadow: 0 8px 24px -4px rgba(248, 113, 113, 0.5); }
  50% { box-shadow: 0 8px 32px 0 rgba(248, 113, 113, 0.9); }
}

/* ═════ MODAIS ════════════════════════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: flex-end;
  z-index: 100;
  animation: modalIn 0.25s var(--ease);
}
.modal.active { display: flex; }
@keyframes modalIn {
  from { background: rgba(10, 13, 15, 0); }
  to { background: rgba(10, 13, 15, 0.85); }
}

.sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-2);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 24px 20px calc(24px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  animation: sheetIn 0.3s var(--ease);
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  margin: -8px auto 16px;
}

/* Timer */
.timer-display {
  font-family: var(--font-display);
  font-size: 96px;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--accent);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}
.timer-display.warn {
  color: var(--danger);
  animation: tShake 0.5s infinite;
}
@keyframes tShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.timer-lbl {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 24px;
}
.timer-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.timer-preset {
  padding: 14px 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  transition: all 0.15s;
}
.timer-preset:active { transform: scale(0.95); }
.timer-preset.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: transform 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 10px; width: 100%; margin-top: 8px; }

/* RPE Modal */
.rpe-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.02em;
  text-align: center;
  margin-bottom: 4px;
}
.rpe-sub {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 20px;
}
.rpe-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.rpe {
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.02em;
  display: grid;
  place-items: center;
  transition: all 0.15s var(--ease-spring);
}
.rpe:active { transform: scale(0.9); }
.rpe[data-v="1"], .rpe[data-v="2"], .rpe[data-v="3"] { color: var(--success); }
.rpe[data-v="4"], .rpe[data-v="5"], .rpe[data-v="6"] { color: var(--accent); }
.rpe[data-v="7"], .rpe[data-v="8"] { color: var(--warning); }
.rpe[data-v="9"], .rpe[data-v="10"] { color: var(--danger); }
.rpe.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg) !important;
  transform: scale(1.05);
}
.rpe-key {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 10px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.rpe-key div {
  padding: 6px 8px;
  background: var(--bg);
  border-radius: 6px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.rpe-notes {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  resize: none;
  margin-bottom: 16px;
  color: var(--ink);
}
.rpe-notes::placeholder { color: var(--ink-4); }
.rpe-notes:focus { border-color: var(--accent); }

/* ═════ HISTORY ═══════════════════════════════════════════════════════ */
.hist {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.hist-date {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 0.9;
  text-align: center;
}
.hist-date small {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.15em;
  margin-top: 2px;
  font-weight: 600;
}
.hist-info { min-width: 0; }
.hist-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.hist-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.hist-rpe {
  font-family: var(--font-display);
  font-size: 20px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.hist-rpe.low { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.hist-rpe.mid { background: rgba(245, 158, 11, 0.15); color: var(--accent); }
.hist-rpe.high { background: rgba(248, 113, 113, 0.15); color: var(--danger); }

.hist-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
}
.hist-empty-i {
  font-family: var(--font-display);
  font-size: 64px;
  color: var(--line-2);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.hist-empty-t { font-size: 13px; }

/* ═════ SETTINGS ══════════════════════════════════════════════════════ */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 6px;
}
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }

.tip {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.tip b { color: var(--accent); }

.export-output {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  resize: vertical;
  margin-top: 8px;
  line-height: 1.4;
}

/* Pending sync banner */
.pending {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.12), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(251, 146, 60, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--warning);
  margin-bottom: 14px;
}
.pending b { color: var(--ink); font-weight: 700; }
.pending button {
  margin-left: auto;
  background: var(--warning);
  color: var(--bg);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ═════ BOTTOM NAV ════════════════════════════════════════════════════ */
nav.tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(10, 13, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 30;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px;
  color: var(--ink-4);
  transition: color 0.2s;
}
.tab.active { color: var(--accent); }
.tab-i { font-size: 20px; }
.tab-l {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  font-weight: 700;
  text-transform: uppercase;
}

/* ═════ TOAST ═════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(-200%);
  background: var(--bg-3);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  transition: transform 0.3s var(--ease-spring);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ═════ INSTALL HINT ══════════════════════════════════════════════════ */
.install-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), transparent);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  position: relative;
  margin-top: 24px;
}
.install-card b { color: var(--accent); }
.install-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 14px;
}

/* ═════ UTILS ═════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.dim { color: var(--ink-3); }
.mono { font-family: var(--font-mono); }
