/* Control de mi meta de salud — versión portátil, estilo libreta */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f6f1e7;
  color: #1a1a1a;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.app { max-width: 430px; margin: 0 auto; min-height: 100vh; }

.header { padding: 28px 20px 8px; }
.header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.subtitle { margin: 4px 0 0; color: #6b6257; font-size: 0.95rem; }

.container { padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }

.tab { display: none; }
.tab.active { display: grid; gap: 16px; align-content: start; }

.card {
  background: #fffdf8;
  border: 1px solid #e5dcc8;
  border-radius: 14px;
  padding: 18px;
}

.card h2 { margin: 0 0 4px; font-size: 1.25rem; letter-spacing: -0.01em; }
.card h3 { margin: 20px 0 8px; font-size: 1.05rem; }
.hint { color: #6b6257; font-size: 0.92rem; margin: 0 0 12px; }
.empty { color: #8a8172; font-size: 0.95rem; }

/* Resumen */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.stat {
  background: #f6f1e7;
  border: 1px solid #e5dcc8;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat .label { font-size: 0.85rem; color: #6b6257; }
.stat strong { font-size: 1.45rem; letter-spacing: -0.02em; }
.stat .sub { font-size: 0.85rem; color: #6b6257; }

.kcal-today {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: #f6f1e7;
  border: 1px solid #e5dcc8;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
}
.kcal-today span { color: #6b6257; }
.kcal-today strong { font-size: 1.5rem; letter-spacing: -0.02em; }

/* Formularios */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
.form-inline { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }

input, select {
  padding: 12px;
  border: 1px solid #c9bfa9;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  width: 100%;
  background: #fff;
  color: #1a1a1a;
}
input:focus, select:focus { outline: 2px solid #1a1a1a; outline-offset: 1px; }

button {
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: #1a1a1a;
  color: #fffdf8;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}
button:active { opacity: 0.85; }

.btn-primary { margin-top: 4px; }
.btn-secondary { background: #fffdf8; color: #1a1a1a; border: 1px solid #1a1a1a; }
.btn-danger { background: #fffdf8; color: #b3261e; border: 1px solid #b3261e; }
.btn-link {
  background: none;
  color: #1a1a1a;
  min-height: 40px;
  text-decoration: underline;
  font-weight: 600;
}
button.small {
  min-height: 0;
  width: auto;
  padding: 6px 12px;
  font-size: 0.9rem;
  background: #f6f1e7;
  color: #1a1a1a;
  border: 1px solid #e5dcc8;
}

/* Chips (Gym) */
.chips-group { display: grid; gap: 8px; }
.chips-label { font-weight: 600; font-size: 0.95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  width: auto;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fffdf8;
  color: #1a1a1a;
  border: 1px solid #c9bfa9;
  font-weight: 600;
}
.chip.selected { background: #1a1a1a; color: #fffdf8; border-color: #1a1a1a; }

/* Foto de comida */
.photo-step { margin: 12px 0; }
.photo-step img, #photo-preview {
  width: 100%;
  border-radius: 12px;
  display: block;
  margin-bottom: 12px;
  border: 1px solid #e5dcc8;
}

/* Progreso */
.progress-wrap { margin: 12px 0 4px; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.92rem; margin-top: 12px; }
.progress-bar { background: #e9e1cf; border-radius: 999px; overflow: hidden; height: 10px; margin-top: 6px; }
.progress-bar div { height: 100%; width: 0%; background: #1a1a1a; transition: width 0.3s ease; }

/* Gráficas */
.charts { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 8px; }
.chart-box { border: 1px solid #e5dcc8; border-radius: 12px; padding: 12px; }

/* Listas (historial) */
.list-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #efe8d8;
}
.list-item:last-child { border-bottom: 0; }
.list-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-body p { margin: 2px 0; }
.list-item .item-title { font-weight: 700; }
.list-item .item-meta { color: #6b6257; font-size: 0.9rem; }

.summary-box {
  background: #f6f1e7;
  border: 1px solid #e5dcc8;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0 4px;
  font-size: 0.95rem;
}

/* Fotos de progreso */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.photo-item { border: 1px solid #e5dcc8; border-radius: 12px; overflow: hidden; background: #f6f1e7; }
.photo-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.photo-item .photo-body { padding: 10px; }
.photo-item .photo-body p { margin: 4px 0; font-size: 0.92rem; }

/* Barra inferior */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 430px;
  display: flex;
  background: #fffdf8;
  border-top: 1px solid #e5dcc8;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
.bottom-nav button {
  flex: 1;
  min-height: 56px;
  border-radius: 0;
  background: none;
  color: #8a8172;
  font-size: 0.95rem;
  padding: 8px 4px 10px;
}
.bottom-nav button.active { color: #1a1a1a; }


/* Marca */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 56px; height: 56px; border-radius: 14px; border: 1px solid #e5dcc8; flex-shrink: 0; }
