:root {
  color-scheme: dark;
  --bg: #000000;
  --surface: #090909;
  --surface-2: #111111;
  --surface-3: #191919;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f8fc;
  --muted: #9eb0c9;
  --faint: #6f829e;
  --accent: #14b8a6;
  --accent-soft: rgba(20, 184, 166, 0.15);
  --accent-2: #5eead4;
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.14);
  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --max-width: 980px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(20, 184, 166, 0.18), transparent 32rem),
    radial-gradient(circle at 100% 5%, rgba(96, 165, 250, 0.1), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(94, 234, 212, 0.32);
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px max(18px, env(safe-area-inset-left)) 10px max(18px, env(safe-area-inset-right));
  background: rgba(0, 0, 0, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.brand img { border-radius: 10px; box-shadow: 0 6px 18px rgba(20, 184, 166, 0.2); }
.brand span { display: grid; min-width: 0; }
.brand strong { font-size: 0.98rem; letter-spacing: -0.01em; }
.brand small { color: var(--muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }

.content {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 20px 18px 42px;
}
.page { display: grid; gap: 20px; animation: fade-in 180ms ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.page-header h1, .hero h1 { margin: 3px 0 6px; font-size: clamp(1.65rem, 4.8vw, 2.45rem); line-height: 1.08; letter-spacing: -0.035em; }
.page-header p, .hero p { margin: 0; color: var(--muted); max-width: 60ch; }
.eyebrow {
  display: block;
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 4px; }
.section-title h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.015em; }
.section-title p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.stack { display: grid; gap: 12px; }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.82rem; }

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(94, 234, 212, 0.13);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(16, 32, 57, 0.74) 58%),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(94, 234, 212, 0.08);
  filter: blur(2px);
}
.hero > * { position: relative; z-index: 1; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 17, 31, 0.35);
}
.stat strong { display: block; font-size: 1.22rem; }
.stat span { color: var(--muted); font-size: 0.72rem; }

.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day-card {
  position: relative;
  min-height: 165px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(16, 32, 57, 0.94), rgba(11, 23, 40, 0.96));
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.day-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.day-card.is-today { border-color: rgba(94, 234, 212, 0.52); box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.12); }
.day-card.is-today::before {
  content: "Hoje";
  position: absolute;
  top: 11px;
  right: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}
.day-date { color: var(--faint); font-size: 0.7rem; }
.day-name { display: block; margin: 4px 0 13px; font-size: 0.96rem; }
.day-sessions { display: grid; gap: 7px; }
.day-session-line { display: flex; gap: 7px; align-items: flex-start; color: var(--muted); font-size: 0.72rem; line-height: 1.3; }
.type-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--accent); }
.type-dot.strength { background: var(--accent); }
.type-dot.jiujitsu { background: var(--blue); }
.type-dot.boxing { background: var(--orange); }
.type-dot.cardio { background: var(--violet); }
.type-dot.mobility { background: var(--success); }
.type-dot.other { background: var(--muted); }
.day-count { position: absolute; right: 12px; bottom: 10px; color: var(--faint); font-size: 0.65rem; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(11, 23, 40, 0.92);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}
.card-body { padding: 18px; }
.session-card { overflow: hidden; }
.session-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px; }
.session-title-row { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.type-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 900;
}
.type-icon.jiujitsu { background: var(--blue-soft); color: #93c5fd; }
.type-icon.boxing { background: var(--orange-soft); color: #fdba74; }
.type-icon.cardio { background: var(--violet-soft); color: #c4b5fd; }
.type-icon.mobility { background: var(--success-soft); color: #6ee7b7; }
.type-icon.other { background: rgba(158, 176, 201, 0.12); color: var(--muted); }
.session-card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.session-meta { display: flex; gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: 0.74rem; }
.session-objective { margin: 0; padding: 0 18px 16px; color: var(--muted); font-size: 0.86rem; }
.session-actions { display: flex; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--line); background: rgba(7, 17, 31, 0.32); }
.session-actions .button:first-child { flex: 1; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 760;
  font-size: 0.86rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, border-color 120ms ease;
}
.button:hover { filter: brightness(1.06); }
.button:active { transform: translateY(1px) scale(0.995); }
.button.primary { background: var(--accent); color: #031512; box-shadow: 0 8px 24px rgba(20, 184, 166, 0.18); }
.button.secondary { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.button.ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.button.danger { background: var(--danger); color: #24050b; }
.button.success { background: var(--success); color: #032016; }
.button.compact { min-height: 36px; padding: 7px 11px; border-radius: 10px; font-size: 0.75rem; }
.button.full { width: 100%; }
.button:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.back-button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 0.83rem; cursor: pointer; }
.chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 32, 57, 0.72);
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}
.badge.accent { border-color: rgba(94, 234, 212, 0.18); background: var(--accent-soft); color: var(--accent-2); }
.badge.optional { border-color: rgba(167, 139, 250, 0.2); background: var(--violet-soft); color: #c4b5fd; }
.badge.complete { border-color: rgba(52, 211, 153, 0.2); background: var(--success-soft); color: #6ee7b7; }

.exercise-list { display: grid; gap: 10px; }
.exercise-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(16, 32, 57, 0.5);
}
.exercise-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--surface-3); color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.exercise-row h4 { margin: 0 0 3px; font-size: 0.88rem; }
.exercise-row p { margin: 0; color: var(--muted); font-size: 0.73rem; }
.exercise-tools { display: flex; gap: 5px; }
.mini-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.mini-button:hover { color: var(--text); background: var(--surface-3); }
.mini-button.danger:hover { color: var(--danger); background: var(--danger-soft); }

.callout {
  display: flex;
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 16px;
  background: var(--accent-soft);
  color: #c7fff5;
}
.callout.warning { border-color: rgba(251, 146, 60, 0.18); background: var(--orange-soft); color: #ffdfc3; }
.callout-icon { flex: 0 0 auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); font-weight: 900; }
.callout strong { display: block; margin-bottom: 2px; font-size: 0.85rem; }
.callout p { margin: 0; font-size: 0.78rem; color: inherit; opacity: 0.86; }

.resume-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid rgba(94, 234, 212, 0.25); border-radius: var(--radius); background: linear-gradient(120deg, var(--accent-soft), rgba(16, 32, 57, 0.88)); }
.resume-card strong { display: block; margin-bottom: 2px; }
.resume-card p { margin: 0; color: var(--muted); font-size: 0.78rem; }

.workout-shell { display: grid; gap: 14px; }
.workout-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workout-progress-copy strong { display: block; font-size: 0.9rem; }
.workout-progress-copy span { color: var(--muted); font-size: 0.74rem; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 250ms ease; }
.exercise-focus {
  overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.14);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 32, 57, 0.98), rgba(11, 23, 40, 0.98));
  box-shadow: var(--shadow);
}
.exercise-focus-head { padding: 22px 20px 17px; border-bottom: 1px solid var(--line); }
.exercise-focus-head h1 { margin: 7px 0 8px; font-size: clamp(1.45rem, 5vw, 2.05rem); line-height: 1.12; letter-spacing: -0.03em; }
.exercise-focus-head p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.exercise-prescription { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.set-table { padding: 8px 14px 14px; }
.set-header, .set-row { display: grid; grid-template-columns: 42px minmax(70px, 1fr) minmax(70px, 1fr) 48px; gap: 8px; align-items: center; }
.set-header { padding: 8px 3px; color: var(--faint); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.set-row { padding: 9px 3px; border-top: 1px solid var(--line); }
.set-row.is-complete { opacity: 0.68; }
.set-index { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--surface-3); color: var(--muted); font-weight: 800; font-size: 0.78rem; }
.set-row.is-complete .set-index { background: var(--success-soft); color: #6ee7b7; }
.set-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(7, 17, 31, 0.68);
  color: var(--text);
  text-align: center;
}
.set-input::placeholder { color: #576b87; }
.set-check {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}
.set-check.is-complete { border-color: rgba(52, 211, 153, 0.3); background: var(--success); color: #032016; }
.last-performance { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 17px 15px; padding: 11px 12px; border-radius: 13px; background: rgba(96, 165, 250, 0.09); color: #b8d8ff; font-size: 0.75rem; }
.workout-actions { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; padding: 14px; border-top: 1px solid var(--line); background: rgba(7, 17, 31, 0.4); }
.exercise-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.exercise-strip::-webkit-scrollbar { display: none; }
.exercise-pill { flex: 0 0 auto; max-width: 180px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.exercise-pill.is-current { border-color: rgba(94, 234, 212, 0.35); background: var(--accent-soft); color: var(--accent-2); }
.exercise-pill.is-complete { color: #6ee7b7; }

.rest-timer {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 60;
  width: min(calc(100% - 24px), 520px);
  transform: translateX(-50%);
  padding: 8px 16px 14px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: 22px;
  background: rgba(11, 23, 40, 0.97);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(22px);
}
.timer-grabber { width: 36px; height: 4px; margin: 0 auto 8px; border-radius: 999px; background: var(--line-strong); }
.timer-copy { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: end; }
.timer-copy .eyebrow { grid-column: 1; }
.timer-copy strong { grid-column: 2; grid-row: 1 / span 2; font-variant-numeric: tabular-nums; font-size: 2rem; line-height: 1; }
.timer-copy > span:last-child { color: var(--muted); font-size: 0.75rem; }
.timer-progress { height: 5px; margin: 12px 0; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.timer-progress span { display: block; width: 100%; height: 100%; background: var(--accent); transition: width 1s linear; }
.timer-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }

.history-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric-card { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric-card strong { display: block; font-size: 1.35rem; }
.metric-card span { color: var(--muted); font-size: 0.72rem; }
.history-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.history-date { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 13px; background: var(--surface-3); text-align: center; line-height: 1.05; }
.history-date strong { font-size: 1rem; }
.history-date span { color: var(--muted); font-size: 0.58rem; text-transform: uppercase; }
.history-item h3 { margin: 0 0 4px; font-size: 0.9rem; }
.history-item p { margin: 0; color: var(--muted); font-size: 0.72rem; }
.history-volume { text-align: right; }
.history-volume strong { display: block; font-size: 0.88rem; }
.history-volume span { color: var(--faint); font-size: 0.65rem; }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 38px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); text-align: center; }
.empty-state-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; background: var(--surface-3); color: var(--accent-2); font-size: 1.4rem; }
.empty-state h3 { margin: 0; }
.empty-state p { max-width: 42ch; margin: 0; color: var(--muted); font-size: 0.82rem; }

.settings-section { overflow: hidden; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-top: 1px solid var(--line); }
.settings-row:first-child { border-top: 0; }
.settings-row h3 { margin: 0 0 3px; font-size: 0.88rem; }
.settings-row p { margin: 0; color: var(--muted); font-size: 0.72rem; }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { display: block; width: 100%; height: 100%; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); cursor: pointer; transition: background 160ms ease; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform 160ms ease, background 160ms ease; }
.switch input:checked + span { background: var(--accent-soft); border-color: rgba(94, 234, 212, 0.3); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--accent-2); }

.app-dialog, .confirm-dialog {
  width: min(calc(100% - 24px), 620px);
  max-height: min(88vh, 780px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.app-dialog::backdrop, .confirm-dialog::backdrop { background: rgba(2, 7, 15, 0.78); backdrop-filter: blur(5px); }
.app-dialog form { display: grid; max-height: inherit; overflow: auto; }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px; border-bottom: 1px solid var(--line); background: rgba(11, 23, 40, 0.96); backdrop-filter: blur(16px); }
.dialog-header h2 { margin: 3px 0 0; font-size: 1.28rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.field.span-2 { grid-column: span 2; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(7, 17, 31, 0.7);
  color: var(--text);
  resize: vertical;
}
.field textarea { min-height: 82px; }
.field input::placeholder, .field textarea::placeholder { color: #556a86; }
.checkbox-field { display: flex; align-items: center; align-self: end; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 17, 31, 0.35); }
.checkbox-field input { width: 18px; min-height: auto; accent-color: var(--accent); }
.input-suffix { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(7, 17, 31, 0.7); overflow: hidden; }
.input-suffix input { border: 0; background: transparent; }
.input-suffix span { padding-right: 12px; color: var(--faint); }
.dialog-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 20px calc(15px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(7, 17, 31, 0.36); }
.confirm-dialog { width: min(calc(100% - 32px), 420px); text-align: center; }
.confirm-dialog form { padding: 24px; }
.confirm-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 13px; border-radius: 15px; background: var(--danger-soft); color: var(--danger); font-size: 1.2rem; font-weight: 900; }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 1.2rem; }
.confirm-dialog p { margin: 0 0 18px; color: var(--muted); font-size: 0.84rem; }
.confirm-dialog .dialog-footer { padding: 0; border: 0; background: transparent; }
.confirm-dialog .button { flex: 1; }

.toast-region { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(calc(100% - 28px), 430px); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(16, 32, 57, 0.97); box-shadow: var(--shadow); color: var(--text); font-size: 0.8rem; animation: toast-in 180ms ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(calc(100% - 24px), 500px);
  transform: translateX(-50%);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: rgba(11, 23, 40, 0.92);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
}
.nav-item { display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 7px 10px; border: 0; border-radius: 15px; background: transparent; color: var(--faint); font-size: 0.64rem; cursor: pointer; }
.nav-icon { font-size: 1.05rem; line-height: 1; }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-2); }

@media (max-width: 860px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-card { min-height: 145px; }
}
@media (max-width: 560px) {
  .content { padding: 16px 13px 38px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .hero { padding: 20px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .stat { padding: 10px; }
  .stat strong { font-size: 1.05rem; }
  .week-grid { grid-template-columns: 1fr; }
  .day-card { min-height: 0; padding-right: 68px; }
  .day-name { margin-bottom: 9px; }
  .page-header { align-items: flex-start; }
  .page-header .button { min-height: 38px; padding: 7px 10px; }
  .history-grid { grid-template-columns: 1fr 1fr; }
  .history-grid .metric-card:last-child { grid-column: span 2; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .session-card-top { padding: 15px; }
  .session-objective { padding-left: 15px; padding-right: 15px; }
  .session-actions { padding: 12px 15px; }
  .exercise-row { grid-template-columns: 34px minmax(0, 1fr); }
  .exercise-tools { grid-column: 2; }
  .workout-actions { grid-template-columns: 46px minmax(0, 1fr) 46px; }
  .workout-actions .button { padding-left: 8px; padding-right: 8px; }
  .set-header, .set-row { grid-template-columns: 37px minmax(58px, 1fr) minmax(58px, 1fr) 44px; gap: 6px; }
  .set-table { padding-left: 9px; padding-right: 9px; }
  .set-input { padding-left: 5px; padding-right: 5px; }
  .timer-actions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
  .brand strong { font-size: 0.88rem; }
  .hero-stats { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 42px minmax(0, 1fr); }
  .history-volume { grid-column: 2; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Mantém notificações acima do painel de descanso. */
.rest-timer:not([hidden]) ~ .toast-region {
  bottom: calc(292px + env(safe-area-inset-bottom));
}
.content:focus { outline: none; }

/* Personal Ed. Leme - versão 2 */
:root {
  --accent: #ef4444;
  --accent-soft: rgba(239, 68, 68, 0.14);
  --accent-2: #fda4af;
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.13);
}

body {
  background:
    radial-gradient(circle at 10% -8%, rgba(239, 68, 68, 0.16), transparent 32rem),
    radial-gradient(circle at 100% 10%, rgba(96, 165, 250, 0.08), transparent 28rem),
    var(--bg);
}

.avatar-photo {
  width: 40px;
  height: 40px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(253, 164, 175, 0.42);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.16);
}
.avatar-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 21%; }
.brand img { object-fit: cover; }
.symbol-icon { display: block; width: 100%; height: 100%; }

.bottom-nav {
  grid-template-columns: repeat(5, 1fr);
  width: min(calc(100% - 24px), 640px);
}
.nav-item { padding-left: 5px; padding-right: 5px; }
.nav-icon { font-size: 1rem; }

.personal-hero {
  grid-template-columns: minmax(0, 1.18fr) minmax(220px, 0.82fr);
  align-items: stretch;
  padding: 0;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(16, 32, 57, 0.78) 62%), var(--surface);
}
.personal-hero::after { right: 20%; bottom: -140px; background: rgba(239, 68, 68, 0.08); }
.hero-copy { display: grid; align-content: center; gap: 10px; padding: 30px 10px 24px 28px; }
.hero-copy h1 { margin-top: 0; }
.hero-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 8px; }
.hero-portrait { position: relative; min-height: 335px; margin: 0; overflow: hidden; }
.hero-portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--surface) 0%, transparent 28%), linear-gradient(0deg, rgba(7,17,31,.86), transparent 42%); pointer-events: none; }
.hero-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 16%; }
.hero-portrait figcaption { position: absolute; right: 18px; bottom: 18px; z-index: 2; max-width: 180px; color: rgba(255,255,255,.9); font-size: .74rem; font-weight: 750; text-align: right; }
.personal-hero .hero-stats { grid-column: 1 / -1; margin: 0 20px 20px; }
.hero-stats-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.day-card { padding-bottom: 55px; }
.day-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.day-type-icons { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.day-type-icon { display: grid; place-items: center; width: 26px; height: 26px; padding: 5px; border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.day-type-icon.strength { color: var(--accent-2); background: var(--accent-soft); }
.day-type-icon.jiujitsu { color: #dbeafe; background: var(--blue-soft); }
.day-type-icon.boxing { color: #fdba74; background: var(--orange-soft); }
.day-type-icon.cardio, .day-type-icon.mobility { color: #6ee7b7; background: var(--success-soft); }
.day-micro-stats { position: absolute; left: 13px; right: 13px; bottom: 25px; display: flex; gap: 5px; flex-wrap: wrap; }
.day-micro-stats span { padding: 3px 6px; border-radius: 7px; background: rgba(255,255,255,.045); color: var(--faint); font-size: .56rem; }
.day-count { bottom: 8px; }

.type-icon { padding: 9px; }
.session-badges { display: grid; gap: 6px; justify-items: end; }
.badge.calories { color: #fecdd3; background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.18); }

.daily-dashboard { padding: 18px; }
.daily-dashboard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.daily-dashboard-head h2 { margin: 3px 0 0; font-size: 1.12rem; }
.daily-dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.daily-metric { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(7,17,31,.32); }
.metric-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 8px; border-radius: 13px; color: var(--accent-2); background: var(--accent-soft); font-weight: 900; }
.metric-icon.food { color: #fde68a; background: var(--gold-soft); }
.daily-metric strong { display: block; font-size: 1.08rem; }
.daily-metric span { color: var(--muted); font-size: .72rem; }
.daily-metric p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .7rem; }
.mini-progress { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #93c5fd); }
.mini-progress.nutrition span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.quick-buttons { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.quick-buttons button, .water-actions button { min-height: 32px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: .68rem; cursor: pointer; }
.quick-buttons button:hover, .water-actions button:hover { color: var(--text); border-color: var(--line-strong); }

.phase-heading { display: flex; align-items: center; gap: 10px; margin: 17px 0 4px; color: var(--accent-2); font-size: .67rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.phase-heading::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(253,164,175,.28), transparent); }
.exercise-row.enhanced { grid-template-columns: 58px 34px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.exercise-row-copy { min-width: 0; }
.exercise-art { display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(7,17,31,.52)); color: var(--muted); }
.exercise-art.sm { width: 52px; height: 52px; padding: 8px; }
.exercise-art.lg { width: 116px; height: 116px; padding: 18px; border-radius: 28px; }
.exercise-art img { width: 100%; height: 100%; object-fit: cover; }
.exercise-art svg { width: 100%; height: 100%; }
.art-warmup { color: #93c5fd; background: var(--blue-soft); }
.art-legs { color: #c4b5fd; background: var(--violet-soft); }
.art-push { color: #fda4af; background: var(--accent-soft); }
.art-pull { color: #7dd3fc; background: rgba(56,189,248,.1); }
.art-shoulder { color: #fde68a; background: var(--gold-soft); }
.art-arms { color: #fdba74; background: var(--orange-soft); }
.art-core { color: #6ee7b7; background: var(--success-soft); }
.art-combat { color: #f9a8d4; background: rgba(244,114,182,.12); }
.art-cardio { color: #fb7185; background: var(--danger-soft); }
.art-mobility { color: #a7f3d0; background: rgba(52,211,153,.1); }
.record-inline { display: inline-flex; align-items: center; gap: 7px; margin-top: 5px; color: #fde68a; font-size: .67rem; }
.record-inline span { color: var(--muted); }
.record-empty { color: var(--faint); font-size: .69rem; }
.record-card { display: flex; align-items: center; gap: 13px; margin: 0 17px 14px; padding: 13px; border: 1px solid rgba(251,191,36,.22); border-radius: 15px; background: var(--gold-soft); }
.record-trophy { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 14px; background: rgba(251,191,36,.16); color: var(--gold); font-size: .8rem; font-weight: 950; }
.record-card strong { display: block; color: #fde68a; font-size: 1.18rem; }
.record-card p { margin: 2px 0 0; color: #e5d6aa; font-size: .69rem; }
.record-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.mini-record { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid rgba(251,191,36,.15); border-radius: 15px; background: rgba(251,191,36,.07); }
.mini-record > span { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: var(--gold-soft); color: var(--gold); font-size: .65rem; font-weight: 950; }
.mini-record strong { display: block; font-size: .78rem; }
.mini-record p { margin: 2px 0 0; color: var(--muted); font-size: .66rem; }

.exercise-focus { display: grid; grid-template-columns: 150px minmax(0, 1fr); }
.exercise-focus-visual { display: grid; place-items: center; padding: 22px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(7,17,31,.32); }
.exercise-focus-head { border-bottom: 1px solid var(--line); }
.exercise-focus > .record-card, .exercise-focus > .last-performance, .exercise-focus > .set-table, .exercise-focus > .workout-actions { grid-column: 1 / -1; }
.workout-progress-copy { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.workout-progress-copy > div span { display: block; margin-top: 2px; color: var(--accent-2); }
.set-row { position: relative; }
.set-estimate { grid-column: 2 / 4; margin-top: -5px; color: var(--faint); font-size: .61rem; text-align: right; }
.set-input.static { display: grid; place-items: center; color: var(--muted); }

/* Nutrição */
.date-navigator { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; text-align: center; }
.date-navigator h1 { margin: 3px 0 0; font-size: clamp(1.45rem,4vw,2rem); text-transform: capitalize; }
.nutrition-overview { display: grid; grid-template-columns: minmax(250px,.72fr) minmax(0,1.28fr); gap: 14px; }
.water-card, .calorie-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.water-card { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 20px; }
.water-card-copy strong { display: block; margin: 3px 0; font-size: 2rem; }
.water-card-copy > span:last-child { color: var(--muted); font-size: .73rem; }
.water-orb { --progress: 0; position: relative; display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: conic-gradient(#60a5fa calc(var(--progress) * 1%), var(--surface-3) 0); }
.water-orb::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.water-orb span { position: relative; z-index: 1; font-weight: 900; color: #bfdbfe; }
.water-actions { grid-column: 1 / -1; display: flex; gap: 7px; flex-wrap: wrap; }
.water-manual { grid-column: 1 / -1; }
.calorie-card { padding: 20px; }
.calorie-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.calorie-card-head strong { display: block; margin-top: 3px; font-size: 1.75rem; }
.calorie-card-head small { color: var(--muted); font-size: .76rem; font-weight: 650; }
.calorie-remaining { padding: 5px 8px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-2); font-size: .68rem; }
.macro-progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.macro-progress.large { height: 9px; margin: 14px 0 17px; }
.macro-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.macro-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.macro-metric { padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,17,31,.32); }
.macro-metric > div:first-child { display: flex; align-items: center; gap: 7px; }
.macro-letter { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--surface-3); color: var(--accent-2); font-size: .65rem; font-weight: 900; }
.macro-metric strong { font-size: .88rem; }
.macro-metric > span { display: block; min-height: 32px; margin: 5px 0 7px; color: var(--muted); font-size: .62rem; }
.macro-note { margin: 13px 0 0; color: var(--faint); font-size: .66rem; }
.meal-stack { display: grid; gap: 12px; }
.meal-card { overflow: hidden; }
.meal-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 17px 18px 13px; }
.meal-card-head h3 { margin: 3px 0 2px; }
.meal-card-head p { margin: 0; color: var(--muted); font-size: .7rem; }
.meal-totals { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(7,17,31,.26); }
.meal-totals strong { font-size: .82rem; }
.meal-totals span { color: var(--muted); font-size: .68rem; }
.meal-foods { display: grid; }
.meal-empty { padding: 16px 18px; color: var(--faint); font-size: .72rem; }
.food-row { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.food-row:first-child { border-top: 0; }
.food-thumb, .food-result-thumb { display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: var(--surface-3); color: var(--faint); font-weight: 900; }
.food-thumb { width: 44px; height: 44px; }
.food-thumb img, .food-result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.food-row strong { display: block; font-size: .8rem; }
.food-row p { margin: 2px 0; color: var(--muted); font-size: .66rem; }
.food-row div > span { color: var(--faint); font-size: .62rem; }
.food-dialog { width: min(calc(100% - 24px), 760px); }
.food-search-panel { display: grid; grid-template-columns: minmax(0,1fr) 170px auto; gap: 10px; align-items: end; padding: 20px 20px 10px; }
.compact-field { min-width: 0; }
.food-search-button { margin-bottom: 0; white-space: nowrap; }
.source-note { margin: 0; padding: 0 20px 12px; color: var(--faint); font-size: .65rem; }
.food-search-status { margin: 0 20px 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7,17,31,.35); color: var(--muted); font-size: .74rem; }
.food-search-status.is-loading { color: #bfdbfe; border-color: rgba(96,165,250,.2); }
.food-search-status.is-error { color: #fecaca; border-color: rgba(239,68,68,.22); }
.food-search-results { display: grid; gap: 8px; max-height: 330px; overflow: auto; padding: 0 20px 16px; }
.food-result { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7,17,31,.32); }
.food-result-thumb { width: 52px; height: 52px; }
.food-result-copy strong { display: block; font-size: .79rem; }
.food-result-copy p { margin: 2px 0; color: var(--muted); font-size: .65rem; }
.food-result-copy span { color: var(--faint); font-size: .62rem; }
.manual-food-panel { margin: 0 20px 18px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.manual-food-panel summary { padding: 12px 14px; cursor: pointer; color: var(--muted); font-size: .76rem; font-weight: 800; }
.manual-food-grid { padding-top: 4px; }
.field small { color: var(--faint); font-size: .62rem; font-weight: 500; }

/* Evolução */
.progress-hero { display: grid; grid-template-columns: minmax(230px,.7fr) minmax(0,1.3fr); overflow: hidden; }
.progress-hero > img { width: 100%; height: 360px; object-fit: cover; object-position: center 18%; }
.progress-hero > div { display: grid; align-content: center; gap: 10px; padding: 28px; background: linear-gradient(135deg, rgba(239,68,68,.11), transparent); }
.progress-hero h1 { margin: 2px 0; font-size: clamp(1.7rem,4vw,2.5rem); line-height: 1.08; letter-spacing: -.035em; }
.progress-hero p { margin: 0 0 8px; color: var(--muted); }
.progress-hero .button { justify-self: start; }
.progress-metrics { grid-template-columns: repeat(3,1fr); }
.photo-gallery { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.progress-photo-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.progress-photo-button { display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0; background: var(--surface-3); cursor: zoom-in; }
.progress-photo-button img { width: 100%; height: 100%; object-fit: cover; }
.progress-photo-copy { padding: 12px 13px 14px; }
.progress-photo-copy span { color: var(--accent-2); font-size: .63rem; font-weight: 800; text-transform: uppercase; }
.progress-photo-copy strong { display: block; margin-top: 2px; font-size: .88rem; }
.progress-photo-copy p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: .68rem; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.progress-photo-delete { position: absolute; top: 9px; right: 9px; background: rgba(7,17,31,.82); backdrop-filter: blur(8px); }
.progress-upload-layout { display: grid; grid-template-columns: minmax(210px,.75fr) minmax(0,1.25fr); gap: 16px; padding: 20px; }
.progress-upload-layout .form-grid { padding: 0; }
.photo-dropzone { display: grid; place-items: center; min-height: 310px; overflow: hidden; border: 1px dashed var(--line-strong); border-radius: 18px; background: rgba(7,17,31,.42); color: var(--muted); text-align: center; cursor: pointer; }
.photo-dropzone img { width: 100%; height: 100%; max-height: 410px; object-fit: cover; }
.photo-dropzone span { padding: 20px; font-size: .8rem; }
.photo-viewer { position: relative; width: min(calc(100% - 24px), 920px); max-height: 92vh; padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 22px; background: #03070d; color: var(--text); }
.photo-viewer::backdrop { background: rgba(0,0,0,.88); backdrop-filter: blur(6px); }
.photo-viewer img { display: block; width: 100%; max-height: 78vh; object-fit: contain; background: #020408; }
.photo-viewer-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(7,17,31,.78); }
#photo-viewer-caption { padding: 14px 18px 18px; }
#photo-viewer-caption p { margin: 5px 0 0; color: var(--muted); font-size: .76rem; }

/* Configurações e histórico */
.profile-settings { padding-bottom: 16px; }
.profile-settings-photo { display: flex; align-items: center; gap: 13px; padding: 18px; border-bottom: 1px solid var(--line); }
.profile-settings-photo img { width: 66px; height: 66px; object-fit: cover; object-position: 50% 18%; border-radius: 18px; }
.profile-settings-photo strong { display: block; }
.profile-settings-photo span { color: var(--muted); font-size: .72rem; }
.settings-form-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 16px 18px 0; }
.nutrition-target-grid { grid-template-columns: repeat(4,minmax(0,1fr)); padding-bottom: 16px; }
.settings-footnote { margin: 12px 18px 0; color: var(--faint); font-size: .66rem; }
.history-grid-four { grid-template-columns: repeat(4,1fr); }
.history-item { grid-template-columns: 42px 48px minmax(0,1fr) auto; }
.history-type { display: grid; place-items: center; width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--surface-3); color: var(--muted); }
.history-type.strength { color: var(--accent-2); background: var(--accent-soft); }
.history-type.jiujitsu { color: #dbeafe; background: var(--blue-soft); }
.history-type.boxing { color: #fdba74; background: var(--orange-soft); }
.history-type.cardio, .history-type.mobility { color: #6ee7b7; background: var(--success-soft); }
.summary-row { grid-template-columns: 58px 34px minmax(0,1fr) auto; }

@media (max-width: 860px) {
  .personal-hero { grid-template-columns: 1fr 300px; }
  .nutrition-overview { grid-template-columns: 1fr; }
  .photo-gallery { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .food-search-panel { grid-template-columns: 1fr 150px; }
  .food-search-button { grid-column: 1 / -1; }
  .settings-form-grid, .nutrition-target-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .history-grid-four { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 680px) {
  .personal-hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 23px 20px 8px; }
  .hero-portrait { min-height: 310px; }
  .hero-portrait::after { background: linear-gradient(0deg, rgba(7,17,31,.9), transparent 46%); }
  .personal-hero .hero-stats { margin: 0 14px 14px; }
  .hero-stats-four { grid-template-columns: repeat(2,1fr); }
  .daily-dashboard-grid { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: 1fr; }
  .exercise-focus { grid-template-columns: 1fr; }
  .exercise-focus-visual { border-right: 0; }
  .exercise-art.lg { width: 104px; height: 104px; }
  .macro-grid { grid-template-columns: 1fr; }
  .macro-metric > span { min-height: 0; }
  .progress-hero { grid-template-columns: 1fr; }
  .progress-hero > img { height: 330px; }
  .progress-upload-layout { grid-template-columns: 1fr; }
  .photo-dropzone { min-height: 280px; }
}

@media (max-width: 560px) {
  .app-shell { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .bottom-nav { width: calc(100% - 12px); bottom: max(5px, env(safe-area-inset-bottom)); border-radius: 18px; }
  .nav-item { min-height: 54px; padding: 7px 2px; font-size: .56rem; }
  .nav-icon { font-size: .95rem; }
  .rest-timer { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .personal-hero .hero-stats { grid-template-columns: repeat(2,1fr); }
  .hero-portrait { min-height: 360px; }
  .day-card { padding-right: 14px; }
  .day-card.is-today::before { top: 43px; }
  .day-type-icons { padding-right: 0; }
  .daily-dashboard { padding: 14px; }
  .daily-dashboard-head { align-items: center; }
  .exercise-row.enhanced, .summary-row { grid-template-columns: 48px 30px minmax(0,1fr); }
  .exercise-art.sm { width: 46px; height: 46px; }
  .exercise-tools { grid-column: 3; }
  .exercise-row.enhanced > .badge { grid-column: 3; justify-self: start; }
  .record-card { margin-left: 12px; margin-right: 12px; }
  .set-estimate { grid-column: 2 / 4; }
  .water-card { grid-template-columns: 1fr auto; padding: 16px; }
  .water-orb { width: 78px; height: 78px; }
  .calorie-card { padding: 16px; }
  .meal-card-head { align-items: center; }
  .food-row { padding-left: 13px; padding-right: 13px; }
  .food-search-panel { grid-template-columns: 1fr; }
  .food-search-button { grid-column: auto; }
  .food-result { grid-template-columns: 46px minmax(0,1fr); }
  .food-result-thumb { width: 44px; height: 44px; }
  .food-result .button { grid-column: 2; justify-self: start; }
  .photo-gallery { grid-template-columns: 1fr 1fr; gap: 9px; }
  .progress-photo-copy { padding: 10px; }
  .settings-form-grid, .nutrition-target-grid { grid-template-columns: 1fr; }
  .history-item { grid-template-columns: 38px 44px minmax(0,1fr); }
  .history-volume { grid-column: 3; text-align: left; }
  .history-grid-four { grid-template-columns: 1fr 1fr; }
  .history-grid-four .metric-card:last-child { grid-column: auto; }
  .session-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 380px) {
  .nav-item span:last-child { font-size: .52rem; }
  .hero-stats-four { grid-template-columns: 1fr 1fr; }
  .photo-gallery { grid-template-columns: 1fr; }
  .date-navigator h1 { font-size: 1.2rem; }
  .calorie-card-head { display: grid; }
  .history-type { display: none; }
  .history-item { grid-template-columns: 44px minmax(0,1fr); }
  .history-volume { grid-column: 2; }
}

.daily-water-input {
  display: grid;
  grid-template-columns: auto minmax(116px, 1fr);
  align-items: center;
  gap: .65rem;
  margin-top: .7rem;
  color: var(--muted);
  font-size: .78rem;
}

.daily-water-input .input-suffix {
  min-width: 0;
}

.daily-water-input input {
  min-width: 0;
}

@media (max-width: 560px) {
  .timer-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .timer-actions .button {
    min-height: 38px;
    padding: 7px 3px;
    font-size: .68rem;
  }

  .rest-timer {
    padding: 7px 13px 12px;
  }

  .rest-timer:not([hidden]) ~ .toast-region {
    bottom: calc(218px + env(safe-area-inset-bottom));
  }
}


/* v3 - Brazilian nutrition sources */
.food-provider-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 18px 20px 0; }
.provider-field { min-width: min(340px, 100%); }
.food-provider-hint { display: inline-flex; align-items: center; min-height: 30px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(7,17,31,.35); font-size: .65rem; font-weight: 800; white-space: nowrap; }
.food-provider-hint.ready { color: #a7f3d0; border-color: rgba(52,211,153,.25); background: rgba(52,211,153,.08); }
.food-search-status.is-warning { color: #fde68a; border-color: rgba(251,191,36,.25); background: rgba(251,191,36,.07); }
.food-result-title { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.food-result-title strong { flex: 1 1 180px; }
.food-source-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 3px 7px; border-radius: 999px; font-size: .52rem !important; line-height: 1.1; font-weight: 900; letter-spacing: .02em; border: 1px solid var(--line); color: var(--muted) !important; }
.food-source-badge.source-taco, .food-result-thumb.source-taco { color: #86efac !important; background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.22); }
.food-source-badge.source-fatsecret, .food-result-thumb.source-fatsecret { color: #fca5a5 !important; background: rgba(239,68,68,.11); border-color: rgba(239,68,68,.22); }
.food-source-badge.source-myfitnesspal, .food-source-badge.source-myfitnesspal-import, .food-result-thumb.source-myfitnesspal, .food-result-thumb.source-myfitnesspal-import { color: #93c5fd !important; background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.22); }
.food-source-settings { overflow: visible; }
.food-source-row { align-items: flex-start; }
.food-source-copy { flex: 1 1 330px; min-width: 0; }
.source-heading { display: flex; align-items: flex-start; gap: 11px; }
.source-heading h3 { margin-top: 2px; }
.source-logo { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-3); font-size: .67rem; font-weight: 950; letter-spacing: -.03em; }
.source-logo.taco { color: #86efac; background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.23); }
.source-logo.fatsecret { color: #fca5a5; background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.23); }
.source-logo.myfitnesspal { color: #93c5fd; background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.23); }
.integration-status { display: inline-flex; margin: 9px 0 0 49px; padding: 4px 8px; border-radius: 999px; color: #fde68a; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.2); font-size: .58rem; font-weight: 850; }
.integration-status.ready { color: #a7f3d0; background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.22); }
.integration-controls { display: flex; align-items: end; gap: 8px; flex: 0 1 430px; width: min(430px, 100%); }
.integration-controls.vertical { flex-direction: column; align-items: stretch; }
.compact-integration-field { flex: 1 1 auto; min-width: 220px; }
.integration-buttons { justify-content: flex-end; flex-wrap: wrap; }
.food-source-disclaimer { padding: 13px 18px; border-top: 1px solid var(--line); color: var(--muted); background: rgba(7,17,31,.25); font-size: .68rem; }

@media (max-width: 760px) {
  .food-provider-toolbar { align-items: stretch; flex-direction: column; gap: 8px; }
  .food-provider-hint { align-self: flex-start; }
  .food-source-row.stacked-mobile { flex-direction: column; }
  .food-source-row .food-source-copy { flex: 0 1 auto; width: 100%; }
  .integration-controls { width: 100%; flex-basis: auto; }
  .compact-integration-field { min-width: 0; }
}

@media (max-width: 520px) {
  .food-provider-toolbar { padding: 16px 14px 0; }
  .food-source-row { flex-direction: column; }
  .integration-controls { flex-direction: column; align-items: stretch; }
  .integration-controls .button { width: 100%; }
  .integration-buttons { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .integration-buttons .button { width: 100%; }
}


.food-row-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.food-row-title > strong { min-width: 0; }
.food-row-title .food-source-badge { max-width: min(330px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* v4 - tema claro/escuro, hábitos, referências visuais e segundo plano */
.theme-toggle { font-size: 1.05rem; font-weight: 900; }
.theme-choice { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.theme-option { min-height: 34px; padding: 7px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 850; cursor: pointer; }
.theme-option.is-active { background: var(--surface); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.12); }

.daily-quote { position: relative; margin: 0; padding: 18px 20px 17px 22px; overflow: hidden; border: 1px solid rgba(251,191,36,.18); border-radius: var(--radius); background: linear-gradient(115deg, rgba(251,191,36,.10), rgba(239,68,68,.07)), var(--surface); }
.daily-quote::before { content: "“"; position: absolute; right: 18px; top: -19px; color: rgba(251,191,36,.12); font-family: Georgia, serif; font-size: 7rem; line-height: 1; }
.daily-quote > * { position: relative; z-index: 1; }
.daily-quote > span { color: var(--gold); font-size: .64rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.daily-quote p { max-width: 68ch; margin: 7px 0 5px; font-family: Georgia, Cambria, serif; font-size: clamp(.96rem, 2.8vw, 1.12rem); line-height: 1.45; }
.daily-quote cite { color: var(--muted); font-size: .7rem; font-style: normal; }

.habit-checklist { display: grid; grid-template-columns: minmax(170px,.85fr) minmax(0,1.65fr); gap: 14px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.habit-checklist.compact { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.habit-copy strong { display: block; margin-top: 3px; font-size: .83rem; }
.habit-items { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.habit-item { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: .7rem; font-weight: 760; cursor: pointer; transition: border-color 150ms ease, background 150ms ease, color 150ms ease; }
.habit-item input { position: absolute; opacity: 0; pointer-events: none; }
.habit-check { display: grid; place-items: center; flex: 0 0 23px; width: 23px; height: 23px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: #fff; font-size: .75rem; font-weight: 950; }
.habit-item.is-checked { border-color: rgba(52,211,153,.32); background: var(--success-soft); color: var(--text); }
.habit-item.is-checked .habit-check { border-color: transparent; background: var(--success); color: #fff; }

.exercise-reference-link { display: inline-flex; align-items: center; gap: 5px; width: fit-content; margin-top: 8px; color: #93c5fd; font-size: .72rem; font-weight: 760; text-decoration: none; }
.exercise-reference-link:hover { color: #dbeafe; text-decoration: underline; }
.exercise-reference-link.compact { font-size: .65rem; }
.background-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--muted); font-size: .68rem; }
.setting-status { display: inline-block; margin-top: 5px; color: var(--faint); font-size: .62rem; font-weight: 750; }

.frequent-food-panel { display: grid; gap: 9px; padding: 16px 20px 0; }
.frequent-food-panel strong { display: block; margin-top: 2px; font-size: .82rem; }
.frequent-food-buttons { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
.frequent-food-chip { flex: 0 0 auto; max-width: 225px; min-height: 34px; padding: 6px 10px; overflow: hidden; border: 1px solid rgba(251,191,36,.20); border-radius: 999px; background: var(--gold-soft); color: #fde68a; font-size: .64rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.frequent-food-chip:hover { border-color: rgba(251,191,36,.4); filter: brightness(1.08); }
.favorite-star { color: var(--gold); }
.food-source-badge.source-frequent, .food-result-thumb.source-frequent { color: #fde68a !important; background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.24); }
.source-logo.usda { color: #bfdbfe; background: rgba(59,130,246,.10); border-color: rgba(59,130,246,.23); }
.usda-missing-note { flex: 0 1 340px; padding: 10px 12px; border: 1px solid rgba(251,191,36,.18); border-radius: 12px; background: rgba(251,191,36,.07); color: var(--muted); font-size: .66rem; }
.usda-missing-note code { color: #fde68a; }

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --surface-3: #e2eaf3;
  --line: rgba(15,23,42,.10);
  --line-strong: rgba(15,23,42,.18);
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --accent: #dc2626;
  --accent-soft: rgba(220,38,38,.09);
  --accent-2: #b91c1c;
  --blue: #2563eb;
  --blue-soft: rgba(37,99,235,.09);
  --orange: #c2410c;
  --orange-soft: rgba(194,65,12,.09);
  --violet: #6d28d9;
  --violet-soft: rgba(109,40,217,.09);
  --danger: #be123c;
  --danger-soft: rgba(190,18,60,.09);
  --success: #059669;
  --success-soft: rgba(5,150,105,.10);
  --gold: #b45309;
  --gold-soft: rgba(180,83,9,.10);
  --shadow: 0 22px 55px rgba(15,23,42,.12);
}
html[data-theme="light"] body { background: radial-gradient(circle at 10% -8%, rgba(220,38,38,.08), transparent 32rem), radial-gradient(circle at 100% 8%, rgba(37,99,235,.06), transparent 28rem), var(--bg); }
html[data-theme="light"] .topbar { background: rgba(255,255,255,.90); }
html[data-theme="light"] .hero { background: linear-gradient(135deg, rgba(220,38,38,.07), rgba(238,243,248,.75) 58%), var(--surface); border-color: rgba(220,38,38,.13); }
html[data-theme="light"] .personal-hero { background: linear-gradient(135deg, rgba(220,38,38,.07), rgba(238,243,248,.78) 62%), var(--surface); }
html[data-theme="light"] .stat { background: rgba(255,255,255,.72); }
html[data-theme="light"] .day-card { background: linear-gradient(180deg,#ffffff,#f8fafc); }
html[data-theme="light"] .card { background: rgba(255,255,255,.96); }
html[data-theme="light"] .session-actions,
html[data-theme="light"] .workout-actions,
html[data-theme="light"] .dialog-footer,
html[data-theme="light"] .food-source-disclaimer { background: rgba(238,243,248,.72); }
html[data-theme="light"] .chip,
html[data-theme="light"] .badge,
html[data-theme="light"] .exercise-row { background: rgba(238,243,248,.8); }
html[data-theme="light"] .callout { color: #065f46; }
html[data-theme="light"] .callout.warning { color: #9a3412; }
html[data-theme="light"] .resume-card { background: linear-gradient(120deg,var(--accent-soft),#fff); }
html[data-theme="light"] .exercise-focus { background: linear-gradient(180deg,#ffffff,#f8fafc); }
html[data-theme="light"] .set-input,
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea,
html[data-theme="light"] .input-suffix { background: #ffffff; }
html[data-theme="light"] .checkbox-field,
html[data-theme="light"] .daily-metric,
html[data-theme="light"] .food-provider-hint { background: rgba(238,243,248,.72); }
html[data-theme="light"] .dialog-header { background: rgba(255,255,255,.96); }
html[data-theme="light"] .toast { background: rgba(255,255,255,.98); }
html[data-theme="light"] .bottom-nav,
html[data-theme="light"] .rest-timer { background: rgba(255,255,255,.94); box-shadow: 0 18px 50px rgba(15,23,42,.16); }
html[data-theme="light"] .last-performance { color: #1d4ed8; }
html[data-theme="light"] .record-inline,
html[data-theme="light"] .record-card strong,
html[data-theme="light"] .frequent-food-chip,
html[data-theme="light"] .usda-missing-note code { color: #92400e; }
html[data-theme="light"] .record-card p { color: #785d28; }
html[data-theme="light"] .exercise-reference-link { color: #1d4ed8; }
html[data-theme="light"] .exercise-reference-link:hover { color: #1e3a8a; }
html[data-theme="light"] .day-type-icon { background: rgba(15,23,42,.035); }
html[data-theme="light"] .day-type-icon.jiujitsu,
html[data-theme="light"] .history-type.jiujitsu { color: #1d4ed8; }
html[data-theme="light"] .day-type-icon.boxing,
html[data-theme="light"] .history-type.boxing { color: #c2410c; }
html[data-theme="light"] .day-type-icon.cardio,
html[data-theme="light"] .day-type-icon.mobility,
html[data-theme="light"] .history-type.cardio,
html[data-theme="light"] .history-type.mobility { color: #047857; }
html[data-theme="light"] .hero-portrait::after { background: linear-gradient(90deg,var(--surface) 0%,transparent 28%),linear-gradient(0deg,rgba(15,23,42,.42),transparent 42%); }
html[data-theme="light"] .app-dialog::backdrop,
html[data-theme="light"] .confirm-dialog::backdrop { background: rgba(15,23,42,.42); }
html[data-theme="light"] .field input::placeholder,
html[data-theme="light"] .field textarea::placeholder,
html[data-theme="light"] .set-input::placeholder { color: #94a3b8; }

@media (max-width: 700px) {
  .habit-checklist { grid-template-columns: 1fr; }
  .habit-items { grid-template-columns: 1fr; }
  .background-status { align-items: flex-start; flex-direction: column; }
  .background-status .button { width: 100%; }
  .theme-choice { width: 100%; }
  .settings-row:has(.theme-choice) { align-items: stretch; flex-direction: column; }
  .usda-missing-note { width: 100%; flex-basis: auto; }
}

@media (max-width: 520px) {
  .frequent-food-panel { padding: 14px 14px 0; }
  .daily-quote { padding: 16px; }
}
