/* ============================================================
   UYARIQ SALUD · Base + componentes compartidos
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; }
h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 650; }
p { margin: 0; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img, svg { max-width: 100%; display: block; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--r-pill);
  font-weight: 650; font-size: var(--fs-body);
  transition: transform .15s var(--ease-out), box-shadow .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover { box-shadow: var(--shadow-float); }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-ghost:hover { background: var(--line); }
.btn-danger { background: var(--crit); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: var(--fs-small); }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-soft);
}
.card-flat { box-shadow: none; }

/* ---------- Chips de estado (siempre icono + texto) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-small); font-weight: 600;
  padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  white-space: nowrap; color: var(--ink);
}
.chip .dot { font-size: 10px; line-height: 1; }
.chip-ok      { background: var(--ok-bg); }      .chip-ok .dot      { color: var(--ok); }
.chip-warn    { background: var(--warn-bg); }    .chip-warn .dot    { color: var(--warn); }
.chip-crit    { background: var(--crit-bg); }    .chip-crit .dot    { color: var(--crit); }
.chip-neutral { background: var(--neutral-bg); } .chip-neutral .dot { color: var(--neutral); }

/* ---------- Eyebrow / etiquetas ---------- */
.eyebrow {
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand);
}
.label-muted {
  font-size: var(--fs-micro); font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------- Badge DEMO (siempre visible) ---------- */
.demo-badge {
  position: fixed; left: 14px; bottom: 14px; z-index: 90;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 6px 14px;
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-2);
  box-shadow: var(--shadow-soft); pointer-events: none;
}
.demo-badge::before { content: '◦'; color: var(--gamify); font-size: 14px; }

/* ---------- Skeleton (placeholder de carga) ---------- */
.skel {
  border-radius: var(--r-sm);
  background: linear-gradient(100deg, var(--surface-2) 40%, var(--line) 50%, var(--surface-2) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-line { height: 13px; margin: 8px 0; }
.skel-block { height: 90px; margin: 10px 0; }

/* ---------- Placeholder de vista en construcción ---------- */
.wip {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface);
}
.wip .wip-tag {
  align-self: flex-start;
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gamify-ink); background: var(--gamify-soft);
  padding: 3px 10px; border-radius: var(--r-pill);
}
.wip p { color: var(--ink-2); font-size: var(--fs-small); max-width: 52ch; }

/* ---------- Toast ---------- */
#toast-zone { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--bg);
  padding: 11px 20px; border-radius: var(--r-pill);
  font-size: var(--fs-small); font-weight: 600;
  box-shadow: var(--shadow-float);
  animation: toast-in .25s var(--ease-out);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Transición de vistas ---------- */
.view-enter { animation: view-in .24s var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Anillo de progreso (gamificación) ---------- */
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-track { stroke: var(--line); }
.ring .ring-fill { stroke: var(--gamify); stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease-out); }
.ring .ring-label { position: absolute; text-align: center; font-family: var(--font-display); font-weight: 700; }

/* ---------- Barra de progreso hacia meta ---------- */
.goalbar { display: flex; flex-direction: column; gap: 6px; }
.goalbar .gb-head { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-small); }
.goalbar .gb-track { height: 9px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.goalbar .gb-fill { height: 100%; border-radius: var(--r-pill); background: var(--brand); transition: width 1s var(--ease-out); }
.goalbar.gb-gamify .gb-fill { background: var(--gamify); }

/* ---------- Utilidades ---------- */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); }
.muted { color: var(--muted); } .small { font-size: var(--fs-small); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}
