/* Diseño común de MC Fitness: negro + azul del logo. */
:root {
  --bg: #07080a;
  --surface: #101216;
  --surface2: #181b21;
  --surface3: #20242b;
  --line: #272b33;
  --text: #f3f5f6;
  --muted: #8d95a0;
  --accent: #2bb0d3;
  --accent-soft: rgba(43, 176, 211, .14);
  --accent-ink: #00161d;
  --ok: #35c98a;
  --warn: #f2b441;
  --bad: #ef5d5d;
  --radius: 14px;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 24px; letter-spacing: .01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.rotulo { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Botones y campos */
button, input, select, textarea { font: inherit; color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface3); border-color: #353a44; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #46c2e2; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 32px; min-height: 32px; padding: 0; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.big { min-height: 50px; font-size: 16px; border-radius: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label.field { display: block; }
label.field > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #5d6570; }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238d95a0' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input[type=date], input[type=time] { color-scheme: dark; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.flat { padding: 0; overflow: hidden; }
.card > .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface3); color: var(--muted); white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: rgba(53, 201, 138, .14); color: var(--ok); }
.tag.warn { background: rgba(242, 180, 65, .14); color: var(--warn); }
.tag.bad { background: rgba(239, 93, 93, .14); color: var(--bad); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }

.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface3); color: var(--accent); font-weight: 600; object-fit: cover; overflow: hidden; }

table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface2); }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--accent-soft); color: var(--accent); }

/* Modal y avisos */
.modal-bg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 14px; background: rgba(0, 0, 0, .72); overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.modal.ancho { max-width: 860px; }
.modal > .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.modal .pie { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 28px); }
.toast { padding: 11px 16px; border-radius: 10px; background: var(--surface3); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(0, 0, 0, .5); }
.toast.bad { border-color: var(--bad); }
.toast.ok { border-color: var(--ok); }

/* Acceso */
.acceso { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 50% -10%, rgba(43, 176, 211, .16), transparent 70%), var(--bg); }
.acceso .caja { width: 100%; max-width: 380px; }
.acceso .logo { width: 150px; margin: 0 auto 6px; }
.acceso .nombre { text-align: center; font-size: 13px; letter-spacing: .32em; text-transform: uppercase; margin-bottom: 2px; }
.acceso .sub { text-align: center; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); margin-bottom: 28px; }

.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: giro .7s linear infinite; margin: 40px auto; }
.btn .spinner { width: 16px; height: 16px; margin: 0; border-color: rgba(0, 0, 0, .25); border-top-color: currentColor; }
@keyframes giro { to { transform: rotate(360deg); } }

/* Chat */
.burbujas { display: flex; flex-direction: column; gap: 6px; }
.burbuja { max-width: 80%; padding: 9px 13px; border-radius: 16px; background: var(--surface2); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.burbuja.mia { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.burbuja a { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.burbuja .hora { display: block; margin-top: 3px; font-size: 11px; opacity: .6; text-align: right; }
.burbuja .ticks { margin-left: 5px; letter-spacing: -2px; }
.burbuja .ticks.leido { color: #4fc3f7; opacity: 1; }
.visto { align-self: flex-end; margin: -4px 4px 2px 0; font-size: 11px; color: var(--muted); }
.burbuja img, .burbuja video { border-radius: 10px; max-height: 300px; margin-bottom: 4px; }
.dia-chat { align-self: center; margin: 10px 0 4px; font-size: 12px; color: var(--muted); }

/* Gráfica de peso */
.grafica { width: 100%; height: auto; overflow: visible; }
.grafica text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

.barra { height: 8px; border-radius: 999px; background: var(--surface3); overflow: hidden; }
.barra > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

@media (max-width: 720px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g2.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3.keep { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition: none !important; } }

/* Diferencia de peso/medidas entre revisiones y notas de voz en el chat */
.dif { font-weight: 700; white-space: nowrap; }
.dif.baja { color: var(--ok); }
.dif.sube { color: var(--warn, #f0a944); }
.burbuja audio { display: block; width: min(260px, 70vw); max-width: 100%; margin-bottom: 4px; }
.audios-info { padding: 4px 16px 0; }
.audios-info:empty { display: none; }
.btn.mic.grabando { background: #e5484d; border-color: #e5484d; color: #fff; animation: latido 1s ease-in-out infinite; }
@keyframes latido { 50% { transform: scale(1.08); } }
.comida-hecha { border-color: var(--ok); }
.comida-hecha h2 { color: var(--ok); }
/* Cambios recientes de la dieta (48 h): en rojo */
.cambiado, .alimento.cambiado span, .alimento.cambiado b { color: var(--bad); }
.tab.cambiado { color: var(--bad); }
.card.cambiada { border-color: var(--bad); }
.aviso.cambiada { border-color: var(--bad); }
.comida-hecha.cambiada { border-color: var(--bad); }
.peso-card form input { flex: 1; min-width: 0; }
/* Nota de vídeo: cámara a pantalla completa */
.nota-video { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
.nota-video video { flex: 1; width: 100%; object-fit: cover; transform: scaleX(-1); }
.nota-video .nv-pie { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: #000; color: #fff; }
.nota-video .nv-rec { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #e5484d; color: transparent; cursor: pointer; justify-self: center; }
.nota-video .nv-rec.on { border-radius: 18px; animation: latido 1s ease-in-out infinite; }
.nota-video .nv-tiempo { font-size: 13px; color: #ddd; }
.burbuja video { width: min(240px, 70vw); max-width: 100%; border-radius: 12px; margin-bottom: 4px; }

/* Foto del chat a pantalla completa al tocarla (2026-11-11). */
.burbuja img { cursor: zoom-in; }
.visor-foto { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .95); padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); cursor: zoom-out; }
.visor-foto img { max-width: 100%; max-height: 100%; object-fit: contain; }
.visor-foto button { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; font-size: 20px; cursor: pointer; }
