/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #252525;
  --surface3: #2f2f2f;
  --border: #333;
  --primary: #6c63ff;
  --primary-dark: #5a52d5;
  --primary-glow: rgba(108, 99, 255, 0.25);
  --danger: #ff4d6d;
  --danger-dark: #e03558;
  --success: #4ade80;
  --warning: #facc15;
  --text: #f0f0f0;
  --text-muted: #aaa;
  --text-faint: #777;
  --nav-h: 68px;
  --top-h: 56px;
  --radius: 14px;
  --radius-sm: 8px;
  --kcal: #fb923c;
  --kcal-glow: rgba(251, 146, 60, 0.2);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.desktop-only { display: none !important; }

@media (min-width: 768px) {
  .desktop-only { display: flex; }
  .mobile-only { display: none; }
}

/* ===== APP LAYOUT ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
}

#sidebar {
  display: none;
}

#topbar {
  height: var(--top-h);
  background: var(--bg);
  border-bottom: 1px solid var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

#pages {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.main-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#bottom-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--surface2);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}

@media (min-width: 768px) {
  #app {
    max-width: none;
    display: flex;
    flex-direction: row;
    margin: 0;
  }
  
  #sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    padding: 2rem 0.75rem;
    border-right: 1px solid var(--surface2);
    z-index: 200;
    height: 100dvh;
  }
  
  .main-wrapper {
     flex: 1;
     display: flex;
     flex-direction: column;
     height: 100dvh;
     background: var(--bg);
     overflow: hidden;
  }

  #topbar {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--top-h);
    padding: 0 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--surface2);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  #pages {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
  }
  
  #bottom-nav { display: none !important; }
}

#topbar-title {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
}

.page {
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.page.active {
  display: block;
  opacity: 1;
}

.page-content {
  padding: 1rem 1rem calc(var(--nav-h) + 1rem);
}

/* ===== BOTTOM NAV ===== */
#bottom-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 500;
}

/* ===== SIDEBAR ===== */
#sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-direction: column;
  padding: 1.5rem 0;
  z-index: 200;
}

.sidebar-header {
  padding: 0 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo-icon { font-size: 1.8rem; }
.sidebar-logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.sidebar-nav .nav-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
}

.sidebar-nav .nav-btn.active {
  background: var(--primary-glow);
  color: var(--primary);
}

.sidebar-nav .nav-btn:hover:not(.active) {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-nav .nav-btn .nav-icon {
  font-size: 1.25rem;
}

.sidebar-nav .nav-btn .nav-label {
  font-weight: 500;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--surface2);
}

.sidebar-profile-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--surface2);
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-profile-btn:hover {
  background: var(--surface3);
}
.sidebar-profile-btn span { font-weight: 600; font-size: 0.95rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface3); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* ===== HOME PAGE ===== */
.greeting-card {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.1rem;
  margin-bottom: 1.5rem;
}

.greeting-sub {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}

.greeting-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.section-header {
  margin: 2rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--surface2);
}

.section-header h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.today-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.today-workout-name {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.today-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.week-summary-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
}

.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.week-day-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.week-day-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-faint);
}

.week-day-dot.has-workout {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

.week-day-dot.today {
  border-color: var(--success);
}

/* ===== TREINAR PAGE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 0.5rem;
}

.workout-header-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #1a1a2e 100%);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.workout-label {
  font-size: 0.78rem;
  color: #a78bfa;
  margin-bottom: 0.1rem;
}

.workout-timer {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

/* Exercise card in active workout */
.exercise-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.exercise-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.exercise-card-name {
  font-weight: 700;
  font-size: 1rem;
}

.exercise-card-muscle {
  font-size: 0.75rem;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  margin-left: 0.5rem;
}

.exercise-card-actions {
  display: flex;
  gap: 0.4rem;
}

/* Sets table */
.sets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.sets-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.5rem 1rem 0.4rem;
  background: var(--surface2);
}

.sets-table td {
  padding: 0.55rem 1rem;
  border-top: 1px solid var(--border);
}

.set-row {
  transition: background 0.1s;
}

.set-row:active { background: var(--surface2); }

.set-num {
  font-weight: 700;
  color: var(--primary);
  width: 28px;
}

.set-action-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: color 0.1s;
}

.set-action-btn:hover { color: var(--danger); }

.add-set-btn {
  width: 100%;
  background: none;
  border: none;
  border-top: 1px dashed var(--border);
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.7rem 1rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.add-set-btn:hover { background: var(--primary-glow); }

/* ===== HISTÓRICO PAGE ===== */
.history-item {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.history-item:hover {
  border-color: var(--primary);
  background: var(--surface2);
}

.history-item:active {
  transform: scale(0.99);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.4rem;
}

.history-item-name {
  font-weight: 700;
  font-size: 1rem;
}

.history-item-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-item-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.history-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.history-exercises-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== EXERCISE LIBRARY PAGE ===== */
.search-bar {
  margin-bottom: 0.75rem;
}

.search-bar input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input:focus { border-color: var(--primary); }

.filter-chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  margin-bottom: 0.75rem;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s;
}

.chip.active {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

.exercise-lib-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.15s;
}

.exercise-lib-item:hover { border-color: var(--primary); }

.exercise-lib-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.exercise-lib-muscle {
  font-size: 0.75rem;
  color: var(--primary);
  margin-top: 0.1rem;
}

.exercise-lib-custom {
  font-size: 0.7rem;
  color: var(--text-faint);
  background: var(--surface3);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  animation: slide-up 0.25s ease;
}

.modal-tall {
  max-height: 90dvh;
}

@keyframes slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  background: var(--surface2);
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* ===== FORMS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group textarea { resize: none; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Pick exercise modal */
#pick-search {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

#pick-search:focus { border-color: var(--primary); }

.pick-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 55dvh;
  overflow-y: auto;
}

.pick-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pick-item:hover {
  border-color: var(--primary);
  background: var(--surface3);
}

.pick-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.pick-item-muscle {
  font-size: 0.75rem;
  color: var(--primary);
  margin-top: 0.15rem;
}

/* Finish summary */
.finish-summary {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* Detail modal */
.detail-exercise {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.detail-exercise-header {
  padding: 0.75rem 1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-sets {
  padding: 0.5rem 0;
}

.detail-set-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 1rem;
  font-size: 0.88rem;
}

.detail-set-num {
  color: var(--primary);
  font-weight: 700;
  width: 24px;
}

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: var(--surface2);
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
}

.skeleton * { opacity: 0 !important; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.detail-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.kcal-badge {
  color: var(--kcal);
  background: var(--kcal-glow);
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  font-weight: 600;
}

.kcal-stat {
  color: var(--kcal) !important;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 0.75rem);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.65rem 1.25rem;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}

/* ===== UTILITIES ===== */
.hidden { display: none !important; }

.text-muted { color: var(--text-muted); }

.badge {
  display: inline-block;
  background: var(--primary-glow);
  color: var(--primary);
  border-radius: 20px;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
}

/* Scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== AUTH SCREEN ===== */
#auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1.5rem 1rem env(safe-area-inset-bottom);
}

.auth-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-logo {
  text-align: center;
  padding: 1rem 0 0.5rem;
}

.auth-logo-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

.auth-logo-text {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.auth-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0.25rem;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  padding: 0.6rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input {
  flex: 1;
  padding-right: 2.8rem !important;
}

.pw-toggle {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 0.3rem;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.pw-toggle:hover { opacity: 1; }

.auth-error {
  color: var(--danger);
  font-size: 0.83rem;
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

.auth-hint {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.75rem;
}

/* ===== TOPBAR AVATAR ===== */
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}

.topbar-avatar:hover { opacity: 0.85; }

/* ===== PROFILE MODAL ===== */
.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1rem;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.profile-email {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.profile-info {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}

.profile-info-row:last-child { border-bottom: none; }

/* ===== IMC ===== */
.imc-section {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.imc-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.imc-result {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  text-align: center;
}

.imc-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.imc-category {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.imc-result.imc-low      { background: rgba(96,165,250,0.15); color: #60a5fa; }
.imc-result.imc-normal   { background: rgba(74,222,128,0.15); color: #4ade80; }
.imc-result.imc-over     { background: rgba(250,204,21,0.15);  color: #facc15; }
.imc-result.imc-obese1   { background: rgba(251,146,60,0.15);  color: #fb923c; }
.imc-result.imc-obese2   { background: rgba(255,77,109,0.15);  color: #ff4d6d; }

/* ===== CORPO / BIOIMPEDÂNCIA ===== */
.bio-summary {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.bio-summary-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.bio-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.bio-stat {
  text-align: center;
}

.bio-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.bio-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.bio-stat-unit {
  font-size: 0.7rem;
  color: var(--text-faint);
}

/* Bio history card */
.bio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.bio-card:hover { border-color: var(--primary); }

.bio-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.bio-card-date {
  font-size: 0.85rem;
  font-weight: 600;
}

.bio-card-weight {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.bio-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.bio-metric {
  padding: 0.6rem 1rem;
  border-right: 1px solid var(--border);
  text-align: center;
}

.bio-metric:last-child { border-right: none; }

.bio-metric-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: block;
}

.bio-metric-value {
  font-size: 0.95rem;
  font-weight: 700;
}

/* Delta badges */
.bio-deltas {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}

.bio-delta {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
}

.bio-delta.good  { background: rgba(74,222,128,0.15); color: #4ade80; }
.bio-delta.bad   { background: rgba(255,77,109,0.15);  color: #ff4d6d; }
.bio-delta.neutral { background: var(--surface3); color: var(--text-muted); }

.bio-modal-section {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: -0.1rem;
}

.profile-info-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-info-value {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ===== RESPONSIVE - desktop viewing ===== */
@media (min-width: 480px) {
  #app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
  }

  .modal {
    border-radius: var(--radius);
    margin-bottom: 2rem;
    max-width: 440px;
  }

  .modal-overlay {
    align-items: center;
  }
}

/* ===== REST TIMER ===== */
.rest-timer-bar {
  position: fixed;
  bottom: calc(var(--nav-h) + 0.6rem);
  left: 1rem;
  right: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  background: #1a1535;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 5000;
  box-shadow: 0 4px 20px rgba(108,99,255,0.3);
  animation: slide-up 0.2s ease;
}

.rest-timer-progress {
  height: 3px;
  background: var(--primary);
  width: 100%;
  transition: width 1s linear, background 0.3s;
}

.rest-timer-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
}

@media (min-width: 768px) {
  .rest-timer-bar {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 480px;
    bottom: 1rem;
  }
}

/* ===== PROGRESSIVE OVERLOAD SUGGESTION ===== */
.set-suggestion {
  background: linear-gradient(135deg, rgba(108,99,255,0.12), rgba(108,99,255,0.06));
  border: 1px solid rgba(108,99,255,0.3);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  font-size: 0.83rem;
  color: var(--text);
  margin-bottom: 0.8rem;
}

/* ===== SET VALIDATION ===== */
.set-validation {
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}
.set-validation-warn {
  background: rgba(255,170,0,0.12);
  border: 1px solid rgba(255,170,0,0.4);
  color: #ffaa00;
}
.set-validation-hint {
  background: rgba(255,170,0,0.07);
  border: 1px solid rgba(255,170,0,0.25);
  color: var(--text-muted);
}
.set-validation-ok {
  background: rgba(72,199,142,0.1);
  border: 1px solid rgba(72,199,142,0.3);
  color: var(--success);
}
.set-validation-pr {
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.35);
  color: #f5a623;
}
.btn-warning {
  background: #ffaa00;
  color: #1a1a2e;
  border: none;
}
.btn-warning:hover { background: #e09500; }

/* ===== SET INLINE INPUT ===== */
.set-inline-input {
  width: 56px;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  text-align: center;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
.set-inline-input::-webkit-outer-spin-button,
.set-inline-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-inline-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface3, #2a2450);
}

/* ===== MÚSCULO MAIS TRABALHADO ===== */
.muscle-rank-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}
.muscle-rank-name {
  width: 68px;
  font-size: 0.8rem;
  color: var(--text);
  flex-shrink: 0;
}
.muscle-rank-bar-wrap {
  flex: 1;
  background: var(--surface);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}
.muscle-rank-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
  min-width: 4px;
}
.muscle-rank-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}
.muscle-neglected {
  margin-top: 0.8rem;
  padding: 0.5rem 0.7rem;
  background: rgba(255,100,100,0.08);
  border: 1px solid rgba(255,100,100,0.25);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--danger, #cf6679);
}
.muscle-neglected-ok {
  background: rgba(72,199,142,0.08);
  border-color: rgba(72,199,142,0.25);
  color: var(--success);
}

/* ===== COMPARATIVO DE TREINOS ===== */
.cmp-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-bottom: 1rem;
}
.cmp-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.cmp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.cmp-stat {
  background: var(--surface);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem;
  text-align: center;
}
.cmp-stat-label { font-size: 0.7rem; color: var(--text-muted); }
.cmp-stat-val { font-size: 0.95rem; font-weight: 700; margin: 0.1rem 0; }
.cmp-stat-diff { font-size: 0.75rem; }
.cmp-ex-list { display: flex; flex-direction: column; gap: 0.35rem; }
.cmp-ex-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.25rem 0;
  border-top: 1px solid var(--border);
}
.cmp-ex-name { flex: 1; color: var(--text); }
.cmp-ex-val { color: var(--text-muted); min-width: 48px; text-align: right; }
.cmp-ex-arrow { min-width: 60px; text-align: right; font-size: 0.78rem; }

/* ===== PR BADGE ===== */
.pr-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  background: linear-gradient(135deg, #f5a623, #e8860a);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border-radius: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  box-shadow: 0 1px 4px rgba(245,166,35,0.4);
}

.set-row-pr td:first-child {
  color: #f5a623;
}
