.card    { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-sm { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }

input, select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus { border-color: var(--accent); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9893' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
select option { background: var(--bg2); }

label.field-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text2); margin-bottom: 6px; letter-spacing: 0.01em; }
.field { margin-bottom: 14px; }

.btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; padding: 14px; border: none;
  border-radius: var(--radius); font-family: var(--sans);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--accent); color: #0f1117; }
.btn-primary:active { background: var(--accent2); transform: scale(0.98); }
.btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-ghost:active { opacity: 0.7; transform: scale(0.98); }
.btn-danger { background: rgba(240,90,90,0.12); color: var(--red); border: 1px solid rgba(240,90,90,0.2); }

.chip-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border2);
  background: var(--bg3); color: var(--text2); font-size: 0.867rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.chip.selected { background: rgba(200,240,90,0.12); border-color: var(--accent); color: var(--accent); }
.chip-sub {
  display: block; font-size: 0.6rem; font-weight: 400;
  color: var(--text3); letter-spacing: 0.03em; margin-top: 1px;
}
.chip.selected .chip-sub { color: var(--accent); opacity: 0.8; }

.macro-bars { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.macro-bar-item { background: var(--bg3); border-radius: 10px; padding: 12px 10px; text-align: center; }
.macro-val { font-family: var(--mono); font-size: 1.2rem; font-weight: 500; }
.macro-name { font-size: 0.733rem; color: var(--text2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.06em; }
.macro-prog { height: 3px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.macro-prog-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }

.kcal-big { text-align: center; padding: 4px 0 16px; }
.kcal-num { font-family: var(--mono); font-size: 3.467rem; font-weight: 500; line-height: 1; color: var(--accent); }
.kcal-label { font-size: 0.8rem; color: var(--text2); margin-top: 4px; letter-spacing: 0.06em; text-transform: uppercase; }
.kcal-of { font-size: 0.867rem; color: var(--text3); margin-top: 2px; }

.micros-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.micro-item { background: var(--bg3); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.micro-label { font-size: 0.733rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
.micro-val { font-family: var(--mono); font-size: 1rem; font-weight: 500; color: var(--text); }
.micro-unit { font-size: 0.667rem; color: var(--text3); }

.gramos-badge {
  display: inline-block; background: rgba(200,240,90,0.1);
  border: 1px solid rgba(200,240,90,0.2); color: var(--accent);
  border-radius: 6px; padding: 2px 8px;
  font-family: var(--mono); font-size: 0.8rem;
}

.registro-group { margin-bottom: 18px; }
.grupo-header {
  font-family: var(--mono); font-size: 0.667rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text3); padding: 0 2px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.grupo-header::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.registro-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg3);
  border-radius: 10px; margin-bottom: 6px;
}
.reg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.reg-info { flex: 1; min-width: 0; }
.reg-nombre { font-size: 0.933rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-detalle { font-family: var(--mono); font-size: 0.733rem; color: var(--text2); margin-top: 1px; }
.reg-kcal { font-family: var(--mono); font-size: 0.867rem; color: var(--text2); flex-shrink: 0; }

.dot-desayuno { background: #f0a85a; }
.dot-almuerzo { background: #5ab4f0; }
.dot-cena     { background: #c8f05a; }
.dot-snack    { background: #9a7ef0; }

.item-menu-wrap { position: relative; flex-shrink: 0; }
.btn-tres-puntos { background: none; border: none; color: var(--text3); font-size: 1.2rem; line-height: 1; padding: 4px 6px; cursor: pointer; border-radius: 6px; -webkit-tap-highlight-color: transparent; transition: background 0.15s; }
.btn-tres-puntos:active { background: var(--border); }
.ctx-menu { position: absolute; right: 0; top: 28px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 10px; overflow: hidden; z-index: 150; min-width: 160px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); display: none; }
.ctx-menu.open { display: block; animation: fadeIn 0.15s ease; }
.ctx-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-size: 0.933rem; cursor: pointer; transition: background 0.1s; -webkit-tap-highlight-color: transparent; }
.ctx-item:active { background: var(--bg3); }
.ctx-item.danger { color: var(--red); }
.ctx-item + .ctx-item { border-top: 1px solid var(--border); }
[data-theme="light"] .ctx-menu { background: var(--bg2); }

.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input { padding-left: 40px; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }

.alimento-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg3);
  border-radius: 10px; margin-bottom: 6px; cursor: pointer;
  border: 1px solid transparent; transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.alimento-item:active, .alimento-item.selected { border-color: var(--accent); }
.ali-info { flex: 1; min-width: 0; }
.ali-nombre { font-size: 0.933rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ali-meta { font-family: var(--mono); font-size: 0.733rem; color: var(--text2); margin-top: 2px; }
.ali-kcal { font-family: var(--mono); font-size: 0.867rem; color: var(--text2); flex-shrink: 0; text-align: right; }

.grafica-wrap { margin-top: 14px; background: var(--bg3); border-radius: 12px; padding: 14px 10px 10px; overflow: hidden; }
.grafica-titulo { font-family: var(--mono); font-size: 0.667rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); margin-bottom: 12px; padding-left: 4px; }
.grafica-svg { width: 100%; display: block; }

.peso-hoy-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.peso-hoy-info { flex: 1; }
.peso-hoy-label { font-size: 0.733rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.peso-hoy-val { font-family: var(--mono); font-size: 1.733rem; font-weight: 500; color: var(--accent); }
.peso-hoy-val.vacio { color: var(--text3); font-size: 1.2rem; }
.btn-peso { background: var(--bg3); border: 1px solid var(--border2); border-radius: 10px; color: var(--text); font-family: var(--sans); font-size: 0.867rem; font-weight: 500; padding: 8px 14px; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: all 0.15s; }
.btn-peso:active { opacity: 0.7; transform: scale(0.97); }

.hb-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 8px; border-bottom: 1px solid var(--border);
  cursor: pointer; -webkit-tap-highlight-color: transparent; margin-bottom: 4px;
}
.hb-section-title { font-family: var(--mono); font-size: 0.667rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text3); }
.hb-section-chev { font-size: 0.733rem; color: var(--text3); }
.hb-section-body { padding-top: 4px; }

.hb-row { padding: 10px 0 8px; border-bottom: 1px solid var(--border); }
.hb-row:last-child { border-bottom: none; }
.hb-top-row { display: grid; grid-template-columns: 90px 1fr 40px; align-items: baseline; margin-bottom: 6px; }
.hb-name { font-size: 0.933rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.hb-mid { display: flex; align-items: baseline; gap: 3px; justify-self: center; text-align: center; }
.hb-val-actual { font-family: var(--mono); font-size: 0.867rem; font-weight: 500; }
.hb-unit { font-family: var(--mono); font-size: 0.733rem; }
.hb-sep { font-size: 0.8rem; color: var(--border2); }
.hb-val-obj { font-family: var(--mono); font-size: 0.8rem; color: var(--text3); }
.hb-pct-badge { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; justify-self: end; }
.hb-track { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; position: relative; }
.hb-track-fill { height: 100%; border-radius: 4px; transition: width 0.5s cubic-bezier(0.32,0.72,0,1); position: relative; z-index: 1; }
.hb-track-mark { position: absolute; top: -1px; bottom: -1px; left: 83.3%; width: 2px; border-radius: 1px; background: rgba(255,255,255,0.3); z-index: 2; }