/* ============================================================
   FORJA — Design System
   Base: preto quase-puro + cartões cinza-elevado + amarelo único de destaque.
   Estrutura editorial (tipografia condensada 900, botões pílula, cartões de canto reto)
   com semântica de cor tipo terminal financeiro (verde/vermelho só como texto).
   Sem sombras, sem glassmorphism, sem gradientes atmosféricos — profundidade por contraste.
   Mobile-first; ≥768px vira workspace (sidebar + grelha de 12 colunas).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;900&family=JetBrains+Mono:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* --- Cor: superfícies --- */
  --bg: #0A0A0A;
  --surface-card: #1E2329;
  --surface-raised: #252B33;
  --surface-inset: #14181C;
  --border: #2B3139;
  --border-soft: #222831;

  /* --- Cor: texto --- */
  --text-primary: #FFFFFF;
  --text-secondary: #848E9C;
  --text-dim: #5E6673;

  /* --- Cor: acento (único, escasso) --- */
  --accent: #FCD535;
  --accent-soft: rgba(252, 213, 53, 0.12);
  --on-accent: #0A0A0A;

  /* --- Cor: semântica (texto, nunca fundo de botão) --- */
  --success: #0ECB81;
  --danger: #F6465D;

  /* --- Cor: macros (só dentro da barra de macros) --- */
  --macro-prot: #FCD535;
  --macro-hidr: #5B8DEF;
  --macro-gord: #B07CF0;

  /* --- Tipografia --- */
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* --- Espaçamento --- */
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* --- Raio --- */
  --radius-pill: 999px;
  --radius-sharp: 0;

  /* --- Layout --- */
  --sidebar-width: 248px;
  --tabbar-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --breakpoint-desktop: 768px;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

input, button, select { font: inherit; color: inherit; }
input, select { outline: none; }
button { cursor: pointer; }

/* sem setas nos inputs numéricos */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

::-webkit-scrollbar { width: 0; height: 0; }
@media (min-width: 768px) {
  .search-results::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 6px; }
  .search-results::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { background: var(--border); }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   TIPOGRAFIA
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.heading-xl, .heading-lg, .heading-md {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.05;
}
.heading-xl { font-size: 44px; }
.heading-lg { font-size: 30px; }
.heading-md { font-size: 21px; }

@media (min-width: 768px) {
  .heading-lg { font-size: 38px; }
}

.label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

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

.value-mono {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-unit {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

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

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { opacity: 0.92; }

.btn-primary { border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); }

.btn-secondary {
  border-radius: var(--radius-sharp);
  background: var(--surface-raised);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border);
}
.btn-secondary:not(:disabled):hover { opacity: 1; background: #2C333C; }

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  padding: 10px 14px;
  width: auto;
}
.btn-ghost:not(:disabled):hover { color: var(--text-primary); opacity: 1; }

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

.btn-sm { width: auto; padding: 10px 18px; font-size: 12px; }

/* ============================================================
   CARTÕES
   ============================================================ */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sharp);
  padding: var(--space-lg);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.card-head .label { margin: 0; }

.card-clickable {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.card-clickable:hover { background: var(--surface-raised); border-color: var(--accent); }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.app-main-inner > .card,
.app-main-inner .card-grid > .card,
.app-main-inner .dash-grid > .card,
.app-main-inner .card-grid-2 > .card,
.app-main-inner #refeicoes-container > .card {
  animation: rise 0.35s ease both;
}
.dash-grid > .card:nth-child(2), .card-grid-2 > .card:nth-child(2), #refeicoes-container > .card:nth-child(2) { animation-delay: 0.05s; }
.dash-grid > .card:nth-child(3), #refeicoes-container > .card:nth-child(3) { animation-delay: 0.1s; }
.dash-grid > .card:nth-child(4), #refeicoes-container > .card:nth-child(4) { animation-delay: 0.15s; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-field { display: flex; flex-direction: column; gap: var(--space-xs); width: 100%; }

.form-field label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.form-field input,
.form-field select,
.input {
  width: 100%;
  padding: 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px; /* ≥16px evita zoom no iOS; 15 + viewport fixa é suficiente nos inputs de linha */
  transition: border-color 0.15s ease;
}
.form-field input, .form-field select { font-size: 16px; }
.input { font-size: 16px; }

.input-mono, .input[type=number] { font-family: var(--font-mono); font-weight: 700; }

.form-field input::placeholder, .input::placeholder { color: var(--text-dim); }
.form-field input:focus, .form-field select:focus, .input:focus { border-color: var(--accent); }

.form-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23848E9C' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.form-error { font-family: var(--font-body); font-size: 13px; color: var(--danger); min-height: 18px; }
.form-message { font-family: var(--font-body); font-size: 13px; min-height: 18px; }
.form-message.is-error { color: var(--danger); }
.form-message.is-success { color: var(--success); }

.form-row { display: grid; gap: var(--space-md); grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Toggle de opções — grupo de pílulas, uma selecionada de cada vez */
.toggle-group { display: flex; gap: 8px; flex-wrap: wrap; }

.toggle-option {
  flex: 1;
  min-width: max-content;
  padding: 12px 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface-inset);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.toggle-option:hover { color: var(--text-primary); }
.toggle-option.is-selected { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* ============================================================
   MARCA
   ============================================================ */
.brand-mark { width: 36px; height: 36px; display: block; flex-shrink: 0; }

.brand-word {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  line-height: 1;
}

/* ============================================================
   ECRÃS DE AUTENTICAÇÃO
   ============================================================ */
.auth-page {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
}

.auth-aside { display: none; }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  animation: rise 0.4s ease both;
}

.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.auth-brand .brand-mark { width: 60px; height: 60px; }

.auth-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 40px;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  text-transform: uppercase;
  line-height: 1;
}

.auth-subtitle { font-size: 13px; color: var(--text-secondary); letter-spacing: 0.02em; }

.auth-form { width: 100%; display: flex; flex-direction: column; gap: var(--space-md); }
.auth-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.auth-switch { font-size: 13px; color: var(--text-secondary); text-align: center; }
.auth-switch a { color: var(--accent); }
.auth-switch a:hover { text-decoration: underline; }

@media (min-width: 900px) {
  .auth-page { grid-template-columns: minmax(380px, 1.1fr) 1fr; }

  .auth-aside {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 56px;
    background: var(--surface-inset);
    border-right: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
  }

  /* anilhas de ferro como textura: discos concêntricos, só contorno */
  .auth-aside::before {
    content: '';
    position: absolute;
    right: -160px;
    bottom: -160px;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    border: 1px solid var(--border);
    box-shadow:
      0 0 0 60px var(--surface-inset), 0 0 0 61px var(--border-soft),
      0 0 0 120px var(--surface-inset), 0 0 0 121px var(--border-soft);
    opacity: 0.8;
  }

  .auth-aside > * { position: relative; }

  .auth-aside-brand { display: flex; align-items: center; gap: 14px; }

  .auth-aside-claim {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(56px, 6.2vw, 92px);
    line-height: 0.92;
    text-transform: uppercase;
    letter-spacing: 0.01em;
  }
  .auth-aside-claim span { color: var(--accent); display: block; }

  .auth-aside-foot { font-size: 12px; color: var(--text-dim); letter-spacing: 0.04em; }

  .auth-brand { display: none; }
  .auth-card { gap: var(--space-lg); max-width: 380px; }
  .auth-head { align-self: stretch; }
}

.auth-head { display: none; }
@media (min-width: 900px) {
  .auth-head { display: block; }
  .auth-head .heading-lg { margin-top: 6px; }
  .auth-head .auth-subtitle { margin-top: 8px; }
}

/* ============================================================
   LOADING
   ============================================================ */
.loading-screen { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; background: var(--bg); }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-card);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BARRA DE PROGRESSO
   ============================================================ */
.progress-track { width: 100%; height: 8px; background: var(--surface-inset); position: relative; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.4s ease; }
.progress-fill.is-danger { background: var(--danger); }

/* Anel de progresso (SVG gerado em js/ui.js) */
.ring { display: block; flex-shrink: 0; }
.ring-track { fill: none; stroke: var(--surface-inset); }
.ring-fill { fill: none; stroke: var(--accent); stroke-linecap: butt; transition: stroke-dasharray 0.6s ease; }
.ring-fill.is-danger { stroke: var(--danger); }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring-wrap { position: relative; flex-shrink: 0; }

/* Barra de macros (proporção das kcal vindas de P/H/G) */
.macro-bar { display: flex; height: 8px; width: 100%; background: var(--surface-inset); gap: 2px; }
.macro-bar > span { display: block; height: 100%; min-width: 2px; transition: flex-basis 0.5s ease; }
.macro-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.macro-legend-item { display: flex; flex-direction: column; gap: 4px; }
.macro-legend-item .dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; }
.dot-prot { background: var(--macro-prot); }
.dot-hidr { background: var(--macro-hidr); }
.dot-gord { background: var(--macro-gord); }

/* ============================================================
   ESTADO VAZIO
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.empty-state p { margin: 0; }
.empty-state .btn { width: auto; padding: 12px 24px; }

/* ============================================================
   GRELHAS
   ============================================================ */
.card-grid, .card-grid-2, .dash-grid { display: flex; flex-direction: column; gap: var(--space-md); }

@media (min-width: 768px) {
  .card-grid { display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; gap: var(--space-lg); }
  .card-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; gap: var(--space-lg); }
  .dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--space-lg); align-items: stretch; }
  .span-7 { grid-column: span 7; }
  .span-5 { grid-column: span 5; }
  .span-6 { grid-column: span 6; }
  .span-12 { grid-column: 1 / -1; }
}

@media (min-width: 768px) and (max-width: 1060px) {
  .span-7, .span-5 { grid-column: 1 / -1; }
}

/* ============================================================
   NAVEGAÇÃO — tab bar (mobile) → sidebar de marca (desktop)
   ============================================================ */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(30, 35, 41, 0.97);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.app-brand, .app-nav-foot { display: none; }
.app-nav-items { display: flex; flex: 1; }

.app-nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  min-height: 44px;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.app-nav-item.is-active { color: var(--accent); }
.app-nav-item.is-active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 28%;
  right: 28%;
  height: 2px;
  background: var(--accent);
}

.app-nav-icon { width: 24px; height: 24px; display: block; flex-shrink: 0; }
.app-nav-icon svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app-nav-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============================================================
   CABEÇALHO DE ECRÃ + CONTEÚDO
   ============================================================ */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.screen-header .eyebrow { margin-bottom: 6px; }

.app-main { padding: var(--space-lg) var(--space-md) calc(var(--tabbar-height) + var(--safe-bottom) + var(--space-lg)); }

@media (min-width: 768px) {
  .app-shell { display: flex; min-height: 100vh; width: 100%; }

  .app-nav {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    height: 100vh;
    width: var(--sidebar-width);
    flex-shrink: 0;
    flex-direction: column;
    background: var(--surface-inset);
    border-top: none;
    border-right: 1px solid var(--border-soft);
    padding: 28px 16px;
  }

  .app-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 28px; }
  .app-brand .brand-mark { width: 34px; height: 34px; }
  .app-brand .brand-word { font-size: 24px; }

  .app-nav-items { flex: 0 0 auto; flex-direction: column; gap: 4px; }

  .app-nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 13px 14px;
    min-height: 0;
  }
  .app-nav-item:hover { color: var(--text-primary); background: var(--surface-card); }
  .app-nav-item.is-active { background: var(--surface-card); color: var(--accent); }
  .app-nav-item.is-active::before { top: 0; bottom: 0; left: 0; right: auto; width: 3px; height: auto; }

  .app-nav-label { font-size: 14px; letter-spacing: 0.06em; }

  .app-nav-foot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding: 0 4px;
  }
  .app-nav-foot .btn { width: 100%; }
  .app-nav-foot small { color: var(--text-dim); font-size: 11px; letter-spacing: 0.04em; padding: 0 2px; }

  .app-main { flex: 1; min-width: 0; padding: 48px 48px 64px; }
  .app-main-inner { max-width: 1240px; margin: 0 auto; }
  .screen-header { margin-bottom: 32px; }
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.hero-kcal { display: flex; align-items: center; gap: var(--space-lg); }
.hero-kcal-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.kcal-line { font-family: var(--font-mono); font-size: 13px; }
.kcal-line.ok { color: var(--success); }
.kcal-line.over { color: var(--danger); }

@media (max-width: 420px) {
  .hero-kcal { flex-direction: column; align-items: stretch; }
  .hero-kcal .ring-wrap { align-self: center; }
}

.next-workout { display: flex; flex-direction: column; gap: var(--space-md); height: 100%; }
.next-workout-day { font-family: var(--font-display); font-weight: 900; font-size: 44px; line-height: 1; text-transform: uppercase; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 10px;
  background: var(--surface-inset);
  box-shadow: inset 0 0 0 1px var(--border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.next-workout .btn { margin-top: auto; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { text-align: center; }
.week-day .label { margin-bottom: 8px; display: block; }
.week-day.is-today .label { color: var(--accent); }
.week-cell {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface-inset);
}
.week-cell.is-trained { background: var(--accent); border-color: var(--accent); }
.week-cell .dot-meal { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.week-cell.is-trained .dot-meal { background: var(--on-accent); }

.weight-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-md); }
.spark { display: block; flex-shrink: 0; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: var(--accent-soft); stroke: none; }
.spark circle { fill: var(--accent); }
.delta { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form .input { flex: 1; min-width: 0; padding: 11px 14px; }
.inline-form .btn { flex-shrink: 0; }

/* ============================================================
   PESQUISA / LISTA DE ALIMENTOS
   ============================================================ */
.search-results { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); }

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  background: var(--surface-inset);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-raised); }

.meal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.meal-head-right { display: flex; align-items: center; gap: 14px; }

.food-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--border-soft); }
.food-row:first-child { border-top: none; }
.food-row-name { font-family: var(--font-body); font-size: 14px; color: var(--text-primary); flex: 1; min-width: 0; }
.food-row-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.food-row-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}
.food-row-delete:hover { color: var(--danger); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface-card);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: rise 0.25s ease both;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-family: var(--font-mono); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.modal-close:hover { color: var(--text-primary); }

@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal { max-height: 80vh; }
}

/* ============================================================
   TREINO ATIVO — espaço de trabalho (foco + lista), pensado para crescer
   ============================================================ */
.workout-layout { display: flex; flex-direction: column; gap: var(--space-md); }

@media (min-width: 768px) {
  .workout-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: var(--space-lg); align-items: start; }
  .workout-side { position: sticky; top: 32px; }
}

.timer-card {
  position: sticky;
  top: 8px;
  z-index: 20;
  margin-bottom: var(--space-md);
  border-color: var(--accent);
  background: var(--surface-card);
}
.timer-time { font-family: var(--font-mono); font-weight: 700; font-size: 34px; color: var(--accent); font-variant-numeric: tabular-nums; }

.exercise-list { display: flex; flex-direction: column; }

.exercise-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 10px;
  margin: 0 -10px;
  width: calc(100% + 20px);
  border: none;
  border-top: 1px solid var(--border-soft);
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: background 0.15s ease;
}
.exercise-list-item:first-child { border-top: none; }
.exercise-list-item:hover { background: var(--surface-raised); }
.exercise-list-name { color: var(--text-primary); }
.exercise-list-item.is-current { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.exercise-list-item.is-current .exercise-list-name { color: var(--accent); }
.exercise-list-status { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.exercise-list-status.is-done { color: var(--success); }

.set-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.set-row:first-child { border-top: none; }
.set-row.is-done .set-row-label { color: var(--success); }

.set-row-label {
  width: 60px;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.set-row input {
  flex: 1;
  width: 0;
  min-width: 0;
  padding: 13px 10px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  text-align: center;
}
.set-row input:focus { border-color: var(--accent); }
.set-row input:disabled { opacity: 0.55; border-style: dashed; }
.set-row .btn { flex-shrink: 0; min-width: 84px; }

.last-time { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============================================================
   PERFIL
   ============================================================ */
.profile-grid { display: flex; flex-direction: column; gap: var(--space-md); }
@media (min-width: 900px) {
  .profile-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--space-lg); align-items: start; }
  .profile-side { display: flex; flex-direction: column; gap: var(--space-lg); }
}
@media (max-width: 899px) { .profile-side { display: flex; flex-direction: column; gap: var(--space-md); } }

/* ============================================================
   GRÁFICOS
   ============================================================ */
.chart-box { position: relative; height: 240px; }
@media (min-width: 768px) { .chart-box { height: 300px; } }
