/* ============================================================
   ROTINA PREMIUM — ELEGANT FEMININE THEME
   Paleta: Rosé escuro + Blush + Nude + Dourado suave
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Cores base */
  --bg:           #0e0a0d;
  --bg-soft:      #140f12;
  --card:         rgba(28, 18, 24, 0.92);
  --card-solid:   #1c1218;
  --text:         #f5eef0;
  --muted:        #9e8a91;
  --subtle:       #6b5560;

  /* Acento principal — rosé */
  --accent:       #d4748a;
  --accent-dark:  #b85570;
  --accent-light: #f0a8b8;
  --accent-glow:  rgba(212, 116, 138, 0.18);

  /* Dourado suave */
  --gold:         #c9a96e;
  --gold-light:   #e8d5b0;

  /* Bordas e linhas */
  --border:       rgba(212, 116, 138, 0.18);
  --line:         rgba(255, 255, 255, 0.06);

  /* Sombras */
  --shadow:       0 16px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm:    0 4px 16px rgba(0, 0, 0, 0.28);
  --glow:         0 0 24px rgba(212, 116, 138, 0.14);

  /* Tipografia */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Raios */
  --radius:       20px;
  --radius-sm:    12px;
  --radius-xs:    8px;

  /* Água */
  --water-accent: #7ab8e8;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
  min-height: 100dvh;
  min-height: 100vh; /* fallback */
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212,116,138,.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(201,169,110,.05), transparent),
    linear-gradient(180deg, #120d10 0%, #0e0a0d 100%);
  background-attachment: fixed;
}

/* Textura sutil */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.012'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: .4;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.hidden { display: none !important; }

/* ── Animações ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.fade-in { animation: fadeInUp .4s cubic-bezier(.22,.68,0,1.2); }

/* ── Glass card ── */
.glass {
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow), var(--glow);
}

/* ── Layout shell ── */
.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 16px 14px 32px;
  position: relative;
  z-index: 1;
}

.page-shell { padding-bottom: 32px; }

/* ── Topbar / Header ── */
.simple-topbar,
.page-header {
  display: grid;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius);
}

.simple-topbar {
  grid-template-columns: 1fr auto;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: transparent;
  border: none;
}

.page-header {
  grid-template-columns: 44px 1fr auto;
  padding: 12px 14px;
  position: sticky;
  top: 10px;
  z-index: 20;
  margin-bottom: 16px;
  background: rgba(18, 12, 16, 0.85);
  border: 1px solid var(--line);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.page-header h1 {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: .04em;
  color: var(--text);
}

.topbar-actions,
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Brand ── */
.brand-top,
.brand-inline {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-top { margin-bottom: 24px; }

.brand-top h1,
.brand-inline h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: .04em;
  color: var(--text);
}

.brand-top p,
.brand-inline p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 4px 18px rgba(212,116,138,.3);
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.brand-icon.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: .95rem;
}

/* ── Auth ── */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  border-radius: 28px;
  padding: 28px 24px;
}

.auth-switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ── Page content ── */
.page-content {
  display: grid;
  gap: 14px;
}

.card {
  border-radius: var(--radius);
  padding: 18px;
}

.compact-card { min-height: 110px; }

.stats-two-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Tipografia ── */
.section-title,
.section-title-row,
.section-label {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}

.section-title,
.section-label {
  color: var(--muted);
  margin-bottom: 12px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.big-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
}

.medium-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}

.muted { color: var(--muted); }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }

.mini-badge {
  background: rgba(212,116,138,.1);
  border: 1px solid rgba(212,116,138,.22);
  color: var(--accent-light);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .72rem;
  letter-spacing: .06em;
  font-weight: 500;
}

/* ── Formulários ── */
.form-stack { display: grid; gap: 12px; }
.input-group { display: grid; gap: 6px; }

label {
  color: var(--muted);
  font-size: .82rem;
  letter-spacing: .04em;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(10, 6, 9, 0.8);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-height: 50px;
  padding: 0 16px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  font-size: .9rem;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(212,116,138,.4);
  box-shadow: 0 0 0 3px rgba(212,116,138,.08);
}

input::placeholder { color: var(--subtle); }

/* ── Botões ── */
.primary-btn,
.secondary-btn,
.link-btn,
.icon-btn {
  border: none;
  cursor: pointer;
  transition: all .18s ease;
}

.primary-btn,
.secondary-btn {
  min-height: 50px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .04em;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 4px 18px rgba(212,116,138,.28);
}

.primary-btn:hover {
  box-shadow: 0 6px 24px rgba(212,116,138,.4);
  transform: translateY(-1px);
}

.primary-btn:active { transform: translateY(0); }

.secondary-btn {
  background: rgba(255,255,255,.05);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.08);
}

.secondary-btn:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
}

.big-btn { min-height: 54px; font-size: .92rem; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.07);
  display: grid;
  place-items: center;
  font-size: .9rem;
}

.icon-btn:hover {
  background: rgba(212,116,138,.12);
  border-color: rgba(212,116,138,.22);
  color: var(--accent-light);
}

.icon-btn.small-btn {
  width: 34px;
  height: 34px;
  font-size: .8rem;
}

.link-btn {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .04em;
  padding: 0;
}

.link-btn:hover { color: var(--accent-light); }

/* ── Home cards ── */
.home-grid { display: grid; gap: 12px; }
.home-grid.four { grid-template-columns: 1fr; }

.home-card {
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(28,18,24,.85);
  transition: all .2s ease;
  text-decoration: none;
  color: var(--text);
}

.home-card:hover {
  border-color: rgba(212,116,138,.25);
  background: rgba(212,116,138,.06);
  transform: translateX(3px);
}

.home-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.home-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(212,116,138,.1);
  border: 1px solid rgba(212,116,138,.18);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1rem;
  flex-shrink: 0;
}

.home-card-text strong {
  display: block;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 2px;
}

.home-card-text small {
  color: var(--muted);
  font-size: .78rem;
}

.home-card-arrow {
  color: var(--subtle);
  font-size: .8rem;
  flex-shrink: 0;
}

/* ── Lista ── */
.list-stack { display: grid; gap: 10px; }

.list-item {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  transition: opacity .2s ease, border-color .2s ease;
}

.list-item:hover { border-color: rgba(212,116,138,.14); }

.list-main { min-width: 0; }

.list-title {
  font-weight: 500;
  font-size: .9rem;
  word-break: break-word;
  color: var(--text);
}

.list-title.done {
  text-decoration: line-through;
  color: var(--muted);
}

.list-sub {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 3px;
}

.item-actions { display: flex; gap: 6px; }

.item-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: .8rem;
  transition: all .15s ease;
}

.item-btn:hover {
  background: rgba(212,116,138,.1);
  border-color: rgba(212,116,138,.2);
  color: var(--accent-light);
}

/* ── Progresso ── */
.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 999px;
  transition: width .4s cubic-bezier(.22,.68,0,1.2);
}

/* ── Erro ── */
.error-text {
  color: #f09aaa;
  min-height: 18px;
  font-size: .82rem;
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 50;
  backdrop-filter: blur(4px);
}

.modal-content {
  width: min(100%, 520px);
  border-radius: 28px 28px 18px 18px;
  padding: 20px;
  background: rgba(22,14,19,.97);
  border: 1px solid rgba(212,116,138,.12);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: .03em;
  color: var(--text);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  z-index: 100;
}

.toast {
  min-width: 220px;
  max-width: 300px;
  background: rgba(22,14,19,.97);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  color: var(--text);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: .85rem;
}

.toast strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-light);
  font-size: .82rem;
  letter-spacing: .04em;
}

/* ── Calendário ── */
.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 0;
}

.calendar-day {
  min-height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,.05);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor: pointer;
  position: relative;
  font-size: .82rem;
  transition: all .15s ease;
}

.calendar-day.active {
  background: rgba(212,116,138,.14);
  border-color: rgba(212,116,138,.3);
}

.calendar-day.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(212,116,138,.3);
}

.calendar-day.has-task::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Abas de dias ── */
.days-tabs {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.fixed-days { grid-template-columns: repeat(7, 1fr); }

.day-tab {
  min-height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  font-size: .75rem;
  letter-spacing: .04em;
  transition: all .15s ease;
}

.day-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(212,116,138,.28);
}

/* ── Status semana ── */
.week-status-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.week-status-card {
  min-height: 72px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.03);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all .15s ease;
}

.week-status-card.active {
  border-color: rgba(212,116,138,.3);
  box-shadow: 0 0 0 1px rgba(212,116,138,.15);
}

.week-status-card.done {
  border-color: rgba(134,239,172,.25);
  background: rgba(134,239,172,.07);
}

.week-status-card.rest {
  border-color: rgba(255,255,255,.07);
  background: rgba(255,255,255,.03);
}

.week-status-card.missed {
  border-color: rgba(239,100,100,.22);
  background: rgba(239,100,100,.06);
}

.week-status-card.neutral {
  border-color: rgba(255,255,255,.06);
}

.week-status-day {
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.week-status-icon { font-size: .95rem; }

/* ── Edição semana ── */
.week-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── Modais de treino ── */
.treino-modal-box,
.treino-month-modal-box {
  width: min(100%, 520px);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 28px 28px 18px 18px;
  padding: 20px;
  align-self: center;
}

/* ── Calendário mensal ── */
.month-day {
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.month-day-number {
  font-size: .88rem;
  font-weight: 600;
}

.month-day-status { font-size: .9rem; }

.month-done {
  background: rgba(134,239,172,.08);
  border-color: rgba(134,239,172,.2);
}

.month-rest {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.06);
}

.month-missed {
  background: rgba(239,100,100,.07);
  border-color: rgba(239,100,100,.18);
}

.month-neutral {
  background: rgba(255,255,255,.03);
  border-color: rgba(255,255,255,.05);
}

.empty-day { visibility: hidden; }

/* ── Água ── */
body.water-theme {
  --accent: var(--water-accent);
  --accent-dark: #4a9fd4;
  --border: rgba(122,184,232,.22);
  --glow: 0 0 24px rgba(122,184,232,.1);
}

.water-card { text-align: center; }

.water-status {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  font-style: italic;
  color: var(--text);
}

.bottle-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0 20px;
}

.bottle {
  width: 110px;
  height: 230px;
  border-radius: 30px 30px 18px 18px;
  border: 2px solid rgba(255,255,255,.18);
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,.02);
}

.bottle-cap {
  width: 40px;
  height: 12px;
  border-radius: 8px 8px 0 0;
  background: rgba(255,255,255,.2);
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
}

.bottle-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, #a8d4f5, var(--water-accent));
  transition: height .4s cubic-bezier(.22,.68,0,1.2);
}

.water-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

/* ── Switch ── */
.save-money-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  cursor: pointer;
}

.save-money-text { display: flex; flex-direction: column; gap: 3px; }
.save-money-text strong { font-size: .9rem; color: var(--text); }
.save-money-text small { color: var(--muted); font-size: .78rem; }

.switch {
  position: relative;
  display: inline-flex;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input { display: none; }

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.08);
  transition: .25s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 4px;
  top: 3px;
  border-radius: 50%;
  background: white;
  transition: .25s ease;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 0 12px rgba(212,116,138,.2);
}

.switch input:checked + .slider::before {
  transform: translateX(21px);
  background: white;
}

/* ── Check de exercício ── */
.ex-check-btn {
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 !important;
  border-radius: 7px !important;
  border: 1.5px solid rgba(255,255,255,.15) !important;
  background: rgba(255,255,255,.04) !important;
  color: var(--accent-light);
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .72rem;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}

.ex-check-btn:hover {
  border-color: rgba(212,116,138,.4) !important;
  background: rgba(212,116,138,.08) !important;
}

.ex-check-btn:active { transform: scale(.88); }

.ex-check-btn.is-done {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)) !important;
  border-color: var(--accent) !important;
  color: white;
  box-shadow: 0 2px 10px rgba(212,116,138,.3);
}

.list-item { transition: opacity .2s ease; }
.list-item.exercise-done { opacity: .5; }

/* ── Check de rotina ── */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

/* ── Responsivo ── */
@media (max-width: 480px) {
  .app-shell { padding: 12px 12px 26px; }
  .card, .home-card, .modal-content, .auth-card { border-radius: 20px; padding: 14px; }
  .stats-two-grid { gap: 10px; }
  .week-status-grid, .days-tabs { gap: 5px; }
  .week-status-card { min-height: 62px; gap: 5px; }
  .page-header h1 { font-size: 1rem; }
}

/* ============================================================
   TEMA CLARO — Blush & Rosé
   ============================================================ */
body.light-theme {
  --bg:           #fdf6f8;
  --bg-soft:      #f8eff2;
  --card:         rgba(255,255,255,0.96);
  --card-solid:   #ffffff;
  --text:         #2a1a20;
  --muted:        #8a6a74;
  --subtle:       #b89aa4;
  --accent:       #c45570;
  --accent-dark:  #a03050;
  --accent-light: #e07090;
  --accent-glow:  rgba(196,85,112,.14);
  --gold:         #b8904a;
  --gold-light:   #d4b880;
  --border:       rgba(196,85,112,.18);
  --line:         rgba(0,0,0,.07);
  --shadow:       0 8px 28px rgba(0,0,0,.09);
  --shadow-sm:    0 3px 12px rgba(0,0,0,.07);
  --glow:         none;
}

body.light-theme {
  background: linear-gradient(180deg, #fdf6f8 0%, #f8eff2 100%);
  background-attachment: fixed;
  color: var(--text);
}

body.light-theme::before { opacity: .15; }

body.light-theme .glass {
  background: rgba(255,255,255,.95);
  border-color: rgba(196,85,112,.1);
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
  backdrop-filter: none;
}

body.light-theme .page-header {
  background: rgba(255,250,252,.92);
  border-color: rgba(196,85,112,.1);
  backdrop-filter: blur(20px);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
  background: #fdf0f3;
  color: var(--text);
  border-color: rgba(0,0,0,.1);
}

body.light-theme input:focus,
body.light-theme select:focus,
body.light-theme textarea:focus {
  border-color: rgba(196,85,112,.35);
  box-shadow: 0 0 0 3px rgba(196,85,112,.07);
}

body.light-theme input::placeholder { color: var(--subtle); }

body.light-theme .secondary-btn,
body.light-theme .icon-btn,
body.light-theme .item-btn {
  background: rgba(0,0,0,.04);
  color: var(--text);
  border-color: rgba(0,0,0,.09);
}

body.light-theme .icon-btn:hover {
  background: rgba(196,85,112,.1);
  border-color: rgba(196,85,112,.2);
  color: var(--accent);
}

body.light-theme .list-item {
  background: rgba(255,255,255,.8);
  border-color: rgba(0,0,0,.07);
}

body.light-theme .list-item:hover { border-color: rgba(196,85,112,.18); }

body.light-theme .day-tab {
  background: rgba(0,0,0,.04);
  color: var(--muted);
  border-color: rgba(0,0,0,.07);
}

body.light-theme .day-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border-color: transparent;
}

body.light-theme .week-status-card {
  background: rgba(255,255,255,.8);
  border-color: rgba(0,0,0,.07);
}

body.light-theme .week-status-card.active {
  border-color: rgba(196,85,112,.3);
}

body.light-theme .week-status-card.done {
  background: rgba(134,239,172,.1);
  border-color: rgba(134,239,172,.3);
}

body.light-theme .week-status-card.missed {
  background: rgba(239,100,100,.07);
  border-color: rgba(239,100,100,.2);
}

body.light-theme .mini-badge {
  background: rgba(196,85,112,.08);
  border-color: rgba(196,85,112,.18);
  color: var(--accent);
}

body.light-theme .progress-bar { background: rgba(0,0,0,.06); }

body.light-theme .modal { background: rgba(0,0,0,.4); }

body.light-theme .modal-content {
  background: rgba(255,250,252,.98);
  border-color: rgba(196,85,112,.1);
}

body.light-theme .toast {
  background: rgba(255,250,252,.98);
  border-left-color: var(--accent);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

body.light-theme .toast strong { color: var(--accent); }

body.light-theme .calendar-day {
  background: rgba(255,255,255,.8);
  border-color: rgba(0,0,0,.07);
  color: var(--text);
}

body.light-theme .calendar-day.active {
  background: rgba(196,85,112,.1);
  border-color: rgba(196,85,112,.25);
}

body.light-theme .month-neutral {
  background: rgba(255,255,255,.8);
  border-color: rgba(0,0,0,.07);
}

body.light-theme .home-card {
  background: rgba(255,255,255,.9);
  border-color: rgba(0,0,0,.07);
  color: var(--text);
}

body.light-theme .home-card:hover {
  border-color: rgba(196,85,112,.22);
  background: rgba(196,85,112,.04);
}

body.light-theme .home-card-icon {
  background: rgba(196,85,112,.08);
  border-color: rgba(196,85,112,.15);
  color: var(--accent);
}

body.light-theme .ex-check-btn {
  background: rgba(0,0,0,.05) !important;
  border-color: rgba(0,0,0,.15) !important;
  color: var(--accent);
}

body.light-theme .ex-check-btn.is-done {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)) !important;
  border-color: var(--accent) !important;
  color: white;
}

body.light-theme .brand-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(196,85,112,.25);
}

body.light-theme .switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

body.light-theme .save-money-toggle {
  background: rgba(0,0,0,.03);
  border-color: rgba(0,0,0,.07);
}

body.light-theme .week-edit-row select {
  background: #fdf0f3;
  color: var(--text);
}

/* ── Transição suave entre páginas ── */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-shell {
  animation: pageIn .22s cubic-bezier(.22,.68,0,1.1);
}

/* Saída ao navegar */
body.page-leaving .app-shell {
  animation: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
}

/* ============================================================
   MOBILE POLISH — ajustes para uso perfeito no celular
   ============================================================ */

/* ── Safe areas (notch / home indicator) ── */
:root {
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);
}

html {
  /* Evita bounce/overscroll no iOS */
  overscroll-behavior: none;
  /* Fonte base ligeiramente maior em mobile para legibilidade */
  font-size: 15px;
}

body {
  /* Previne zoom acidental ao focar inputs no iOS */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Remove highlight azul ao tocar */
  -webkit-tap-highlight-color: transparent;
}

/* ── Shell com safe areas ── */
.app-shell {
  padding-top: max(16px, var(--safe-top));
  padding-bottom: max(32px, calc(var(--safe-bottom) + 16px));
  padding-left:  max(14px, var(--safe-left));
  padding-right: max(14px, var(--safe-right));
}

/* ── Header sticky com safe area ── */
.page-header {
  top: max(10px, calc(var(--safe-top) + 6px));
}

/* ── Área de toque mínima 44px em todos os botões interativos ── */
.icon-btn,
.item-btn,
.ex-check-btn,
.day-tab,
.week-tab,
.calendar-day,
.week-status-card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* elimina delay de 300ms no iOS */
  user-select: none;
  -webkit-user-select: none;
}

/* Garante área de toque mínima sem mudar visual */
.item-btn {
  min-width: 36px;
  min-height: 36px;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
}

/* ── Links e botões: sem delay de toque ── */
a, button, input[type="checkbox"], input[type="radio"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── Inputs: fonte 16px evita zoom automático no iOS ── */
input,
select,
textarea {
  font-size: 16px !important;
  /* Melhora aparência no iOS */
  -webkit-appearance: none;
  appearance: none;
}

/* ── Modais: ssobem do fundo no mobile ── */
.modal {
  align-items: flex-end;
  padding: 0;
  padding-bottom: var(--safe-bottom);
}

.modal-content,
.treino-modal-box,
.treino-month-modal-box {
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + var(--safe-bottom));
  max-height: 92dvh; /* dvh = dynamic viewport height, resolve barra de endereço */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Modal do rotina.html (overlay customizado) */
.modal-overlay {
  padding-bottom: var(--safe-bottom);
  align-items: flex-end;
}

.modal-overlay .modal-box {
  border-radius: 24px 24px 0 0;
  max-width: 100%;
  padding-bottom: calc(20px + var(--safe-bottom));
}

/* ── Toast: respeita safe area inferior ── */
.toast-container {
  bottom: calc(14px + var(--safe-bottom));
  right: max(14px, var(--safe-right));
}

/* ── Scroll suave e sem barra de rolagem no iOS ── */
.page-content,
.list-stack {
  -webkit-overflow-scrolling: touch;
}

/* ── Cards: padding mais generoso no mobile ── */
@media (max-width: 480px) {
  .app-shell {
    padding-left:  max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
  }

  /* Texto um pouco maior para leitura no celular */
  .list-title   { font-size: .92rem; }
  .list-sub     { font-size: .78rem; }
  .home-card-text strong { font-size: .95rem; }

  /* Cards sem tanto padding desperdiçado */
  .card { padding: 16px 14px; }

  /* Botões primários mais altos (mais fáceis de tocar) */
  .primary-btn,
  .secondary-btn { min-height: 52px; font-size: .9rem; }

  /* Tabs da semana (rotina + treinos) - altura mínima de toque */
  .week-tab,
  .day-tab {
    min-height: 44px;
    padding: 6px 2px;
  }

  .week-tab .tab-day-num { font-size: .82rem; }
  .week-tab .tab-day-name { font-size: .62rem; }

  /* Status da semana (treinos) */
  .week-status-grid { gap: 5px; }
  .week-status-card { min-height: 64px; gap: 4px; }
  .week-status-day  { font-size: .62rem; }
  .week-status-icon { font-size: .88rem; }

  /* Calendário: células maiores para toque */
  .calendar-day { min-height: 44px; font-size: .85rem; }

  /* Itens de lista: mais espaço vertical para toque */
  .list-item { padding: 14px 12px; gap: 10px; }

  /* Barra de progresso mais visível */
  .progress-bar { height: 8px; }

  /* Home cards: padding melhor */
  .home-card { padding: 16px; }
  .home-card-icon { width: 40px; height: 40px; }

  /* Formulários: gap maior entre campos no mobile */
  .form-stack { gap: 14px; }

  /* Header: garante que os botões não fiquem apertados */
  .header-actions { gap: 6px; }
  .page-header { padding: 10px 12px; }
  .page-header h1 { font-size: 1rem; }

  /* Topbar da home */
  .simple-topbar { padding: 12px 14px; margin-bottom: 14px; }

  /* Modais internos (treino) - melhor espaçamento */
  .modal-head { margin-bottom: 16px; }
  .modal-head h2 { font-size: 1.1rem; }
}

/* ── Telas muito pequenas (iPhone SE, etc.) ── */
@media (max-width: 360px) {
  .week-tab .tab-day-name { display: none; } /* só número no SE */
  .week-status-day { display: none; }
  .brand-top h1,
  .brand-inline h1 { font-size: 1.1rem; }
  .page-header h1 { font-size: .9rem; }
}

/* ── Light theme: safe areas também ── */
body.light-theme .modal-content,
body.light-theme .treino-modal-box {
  background: #fff;
}


/* ── Correção botão voltar Android ── */
/* Garante que página restaurada do bfcache nunca fique invisível */
body:not(.page-leaving) .app-shell {
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
}

/* ── Custom Select (substitui <select> nativo) ── */
.custom-select-wrap {
  position: relative;
  width: 100%;
}

.custom-select-btn {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(10, 6, 9, 0.8);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font-body);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: border-color .2s ease, box-shadow .2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.custom-select-btn:focus,
.custom-select-btn.open {
  border-color: rgba(212,116,138,.4);
  box-shadow: 0 0 0 3px rgba(212,116,138,.08);
  outline: none;
}

.custom-select-arrow {
  font-size: .75rem;
  color: var(--muted);
  transition: transform .2s ease;
  flex-shrink: 0;
}

.custom-select-btn.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeInUp .15s ease;
}

.custom-select-option {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  transition: background .12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option:active {
  background: rgba(212,116,138,.08);
}

.custom-select-option.selected {
  color: var(--accent-light);
}

.custom-select-check {
  margin-left: auto;
  font-size: .75rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity .15s ease;
}

.custom-select-option.selected .custom-select-check {
  opacity: 1;
}

/* Light theme */
body.light-theme .custom-select-btn {
  background: #fdf0f3;
  color: var(--text);
  border-color: rgba(0,0,0,.1);
}

body.light-theme .custom-select-dropdown {
  background: #fff;
  border-color: rgba(196,85,112,.15);
}

body.light-theme .custom-select-option {
  border-color: rgba(0,0,0,.06);
}

body.light-theme .custom-select-option:hover {
  background: rgba(196,85,112,.06);
}
