/* =====================================================================
   laMeta - Sistema de diseño
   Mobile-first, 375px. Dark por default: se carga un gasto de noche, en la
   cama, con el teléfono en la cara.
   ===================================================================== */

:root {
  /* Paleta */
  --bg:        #0F1115;
  --surface:   #191C22;
  --surface-2: #1F232B;
  --border:    #252A33;

  --jade:  #2ED08A;   /* ahorro, progreso */
  --coral: #FF6B5A;   /* gasto */
  --amber: #F5A623;   /* acento, CTA */
  --violet:#A78BFA;

  --ink:   #F2F3F5;
  --muted: #8B929E;
  --dim:   #5C6472;

  /* Tipografía */
  --serif: 'Instrument Serif', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Escala */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --gap:  16px;
  --pad:  20px;

  /* La animación de la barra. Que se sienta bien no es capricho: ES la
     función. Es lo único que los dos miran al mismo tiempo. */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --bar-ms:   800ms;

  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

a { color: var(--jade); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(46, 208, 138, .28); }

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

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

/* ------------------------------------------------------------ layout */

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--pad) calc(96px + var(--safe-b));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 12px;
  background: linear-gradient(var(--bg) 72%, transparent);
}

.topbar h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}
.topbar h1 em { font-style: italic; color: var(--jade); }

/* Los títulos de pantalla no van en serif: esa cara está reservada para el
   número de la meta, que es el único momento emocional del producto. */
.topbar h1.plain {
  font-family: var(--sans);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.2px;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-form { display: contents; }
.topbar-btn { min-height: 36px; padding: 0 13px; font-size: 14px; }

/* El "?" está en todas las pantallas. Discreto, pero siempre en el mismo
   lugar: si hay que buscarlo, no sirve. */
.topbar-actions .ic {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 15px;
  text-decoration: none;
  color: var(--muted);
}
.topbar-actions .ic:hover { color: var(--ink); border-color: var(--jade); }

.section { margin-top: 28px; }
.section > h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad);
}
.card + .card { margin-top: 12px; }

.card-flat { background: none; border: 0; padding: 0; }

/* -------------------------------------------------- el número grande */

.goal-hero { text-align: center; padding: 28px var(--pad) 24px; }

.goal-hero .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* El único elemento emocional del producto. Grande y con serifa, no un
   dígito de planilla. */
.goal-hero .amount {
  font-family: var(--serif);
  font-size: clamp(48px, 17vw, 72px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -1.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.goal-hero .target {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.goal-hero .pace {
  font-size: 13px;
  color: var(--dim);
  margin-top: 4px;
}

/* ------------------------------------------------------- progress bar */

.progress {
  height: 12px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin: 18px 0 10px;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #23B67A, var(--jade));
  transition: width var(--bar-ms) var(--ease-out), background var(--bar-ms) linear;
}

/* Cambia de color al pasar hitos. */
.progress[data-milestone="50"] > i { background: linear-gradient(90deg, var(--jade), #57DDA4); }
.progress[data-milestone="75"] > i { background: linear-gradient(90deg, #57DDA4, #8BE9C0); }
.progress[data-milestone="100"] > i { background: linear-gradient(90deg, var(--amber), var(--jade)); }

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

@keyframes celebrate {
  0%, 100% { transform: scale(1); }
  35%      { transform: scale(1.045); }
}
.celebrate { animation: celebrate 700ms var(--ease-out); }

/* ------------------------------------------------------- stage strip */

.stage-strip {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.stage-strip::-webkit-scrollbar { display: none; }

.stage {
  flex: 1 0 auto;
  min-width: 88px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: .34;                 /* las siguientes, apagadas */
  transition: opacity .25s;
}
.stage[data-state="current"]  { opacity: 1; border-color: rgba(46,208,138,.4); }
.stage[data-state="achieved"] { opacity: .62; }

.stage .n {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 1px;
}
.stage .name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stage .amt {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.stage[data-state="achieved"] .name::after { content: ' ✓'; color: var(--jade); }

/* ---------------------------------------------------------- botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;              /* pulgar, no mouse */
  padding: 0 20px;
  border: 0;
  border-radius: var(--r);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, opacity .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--amber); color: #141414; }
.btn-primary:hover  { filter: brightness(1.07); }
.btn-primary:active { filter: brightness(.94); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #262B34; }

.btn-danger { background: rgba(255,107,90,.14); color: var(--coral); }

.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.btn[data-loading="1"] {
  color: transparent;
  position: relative;
  pointer-events: none;
}
.btn[data-loading="1"]::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  color: #141414;
}
.btn-ghost[data-loading="1"]::after { color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-block { width: 100%; }

/* FAB. Abajo a la derecha, siempre alcanzable con el pulgar. */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(76px + var(--safe-b));
  z-index: 30;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--amber);
  color: #141414;
  border: 0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.42);
  display: grid;
  place-items: center;
}
.fab:active { transform: scale(.94); }

/* -------------------------------------------------------- formularios */

.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 16px;               /* <16px hace que iOS haga zoom al enfocar */
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--jade);
  outline: none;
}
.input::placeholder { color: var(--dim); }
.textarea { min-height: 84px; resize: vertical; }

/* El monto es lo primero que se toca. Grande, con la moneda fija al lado. */
.amount-input {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 14px;
}
.amount-input:focus-within { border-color: var(--jade); }

.amount-input .cur {
  font-family: var(--mono);
  font-size: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

/* Tocar el símbolo cambia la moneda. Ahorra un campo en el formulario más
   usado de la app. */
.cur-toggle {
  background: none;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
  border-radius: 7px;
}
.cur-toggle:hover { background: rgba(255,255,255,.05); }
.amount-input input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 500;
  padding: 6px 0;
  color: var(--ink);
}
.amount-input input::-webkit-outer-spin-button,
.amount-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-error {
  display: block;
  font-size: 12.5px;
  color: var(--coral);
  margin-top: 5px;
}

/* Toggle compartido / personal */
.segmented {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 3px;
  gap: 3px;
}
.segmented button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
}

/* ------------------------------------------------------ category chips */
/* Scroll horizontal, tap para elegir. Sin dropdown: un dropdown en un
   teléfono es dos taps y una lista que tapa la pantalla. */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 8px;
  margin: 0 calc(var(--pad) * -1);
  padding-left: var(--pad);
  padding-right: var(--pad);
  scroll-snap-type: x proximity;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] {
  color: var(--ink);
  border-color: currentColor;
  background: var(--surface);
}
.chip .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --------------------------------------------------------- avatares */

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: #10130f;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 11px; }

/* ------------------------------------------------------ lista de movs */

.day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--dim);
}
.day-header .sum { font-family: var(--mono); text-transform: none; letter-spacing: 0; }

.tx {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.tx:last-child { border-bottom: 0; }

.tx .icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.tx .body { flex: 1; min-width: 0; }
.tx .name {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tx .sub {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tx .amt {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tx .amt .usd {
  display: block;
  font-size: 11.5px;
  color: var(--dim);
}
.tx[data-kind="income"] .amt { color: var(--jade); }
.tx[data-kind="expense"] .amt { color: var(--ink); }
.tx[data-shared="0"] .name::after {
  content: 'personal';
  margin-left: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
}

/* --------------------------------------------------------- gráficos */
/* SVG inline, sin librería. Ver app/Core/Chart.php. */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.donut {
  flex-shrink: 0;
  display: block;
  margin: 0 auto;
}

.donut circle { transition: stroke-dasharray .6s var(--ease-out); }

.donut-legend {
  flex: 1;
  min-width: 190px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 9px;
  padding: 5px 0;
  font-size: 13.5px;
}

.donut-legend .sw { width: 10px; height: 10px; border-radius: 50%; }
.donut-legend .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .pc { color: var(--dim); font-size: 11.5px; }
.donut-legend .vl { color: var(--muted); font-size: 12.5px; }

.trend-svg {
  display: block;
  width: 100%;
  height: 96px;
  overflow: visible;
}

.trend-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--dim);
}

/* --------------------------------------------- acciones de una fila */

.tx-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Botón-ícono. 34px es el mínimo con el que un pulgar no falla. */
.ic {
  position: relative;
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 9px;
  color: var(--dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.ic:hover  { background: var(--surface-2); color: var(--ink); }
.ic:active { transform: scale(.92); }

.ic .badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  line-height: 13px;
  text-align: center;
}
/* Ámbar cuando hay una pregunta esperando respuesta. */
.ic .badge-open {
  background: var(--amber);
  border-color: var(--amber);
  color: #141414;
  font-weight: 600;
}

/* -------------------------------------------------- comentarios */

.thread { max-height: 42dvh; overflow-y: auto; }

.cm {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.cm:last-child { border-bottom: 0; }
.cm[data-open="1"] {
  border-left: 2px solid var(--amber);
  padding-left: 11px;
  margin-left: -13px;
}

.cm-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13px;
}

.cm-body {
  margin: 6px 0 0;
  font-size: 14px;
  color: #D4D8DE;
  white-space: pre-wrap;
  word-break: break-word;
}

.cm-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.cm-actions .btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 500;
}

/* Checkbox con etiqueta al lado. */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--jade); flex-shrink: 0; }

/* ------------------------------------------------ categorías */

.cat {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.cat:last-of-type { border-bottom: 0; }

.cat input[type="color"] {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}
.cat input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.cat input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }

.cat .cat-name { min-height: 34px; font-size: 14px; padding: 6px 10px; }

.syn-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 5px 5px 0;
  padding: 3px 4px 3px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.syn-chip b { color: var(--jade); font-weight: 500; }
.syn-chip button {
  width: 17px; height: 17px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.syn-chip button:hover { background: rgba(255,107,90,.18); color: var(--coral); }

/* ---------------------------------------- historial de aportes */

.hist { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.hist-row { padding: 5px 0; }

/* ------------------------------------------------------ ayuda */

.lead-help { color: var(--muted); font-size: 15px; margin-bottom: 14px; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 22px;
}
.search-ico {
  position: absolute;
  left: 14px;
  font-size: 19px;
  color: var(--dim);
  pointer-events: none;
}
.search input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px 12px 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 16px;
}
.search input:focus { border-color: var(--jade); outline: none; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { filter: invert(.6); }

.help-group { margin-top: 30px; }
.help-group h2 {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Cada pregunta es un <details>: se abre y cierra sin una línea de JS, y el
   teclado la recorre solo. */
.qa {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 8px;
  overflow: hidden;
}

.qa > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.qa > summary::-webkit-details-marker { display: none; }

.qa > summary::after {
  content: "+";
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--dim);
  transition: transform .18s;
}
.qa[open] > summary::after { content: "−"; color: var(--jade); }
.qa[open] > summary { color: var(--jade); }
.qa > summary:hover { background: var(--surface-2); }

.qa-body {
  padding: 0 16px 15px;
  font-size: 15px;
  color: var(--body);
}
.qa-body p { margin: 0 0 10px; }
.qa-body p:last-child { margin-bottom: 0; }
.qa-body b { color: var(--ink); font-weight: 600; }
.qa-body em { color: var(--ink); font-style: normal; font-weight: 500; }
.qa-body .dim { color: var(--dim); font-size: 14px; }
.qa-body code {
  font-family: var(--mono);
  font-size: 13.5px;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--jade);
}

/* Para el link de invitación y los ejemplos de WhatsApp: texto que se copia,
   no que se lee corrido. */
.mono-block {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 13px;
  color: var(--jade);
  word-break: break-all;
}

.no-hits {
  color: var(--muted);
  font-size: 15px;
  padding: 22px 2px;
}

/* ------------------------------------------------------ presupuesto */

.budget-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.budget-row:last-child { border-bottom: 0; }

.meter {
  height: 7px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.meter > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 500ms var(--ease-out);
}
.meter[data-status="ok"]   > i { background: var(--jade); }
.meter[data-status="warn"] > i { background: var(--amber); }
.meter[data-status="over"] > i { background: var(--coral); }

/* --------------------------------------------------- sheet (modal) */
/* Desde abajo, no centrado. Es un teléfono. */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 8, 11, .68);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sheet-backdrop[data-open="1"] { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 91;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 8px var(--pad) calc(24px + var(--safe-b));
  transform: translateY(100%);
  transition: transform .28s var(--ease-out);
}
.sheet[data-open="1"] { transform: none; }

.sheet .grabber {
  width: 38px; height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 8px auto 16px;
}
.sheet h2 { font-size: 19px; font-weight: 600; margin-bottom: 16px; }

@media (min-width: 640px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: 560px;
    transform: translate(-50%, 120%);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
  }
  .sheet[data-open="1"] { transform: translate(-50%, 0); }
}

/* --------------------------------------------------------- nav fija */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  background: rgba(15, 17, 21, .94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 8px;
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 500;
  transition: color .15s;
}
.tabbar a[aria-current="page"] { color: var(--jade); }
.tabbar a .ico { font-size: 19px; line-height: 1; }

/* ----------------------------------------------------------- varios */

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.jade { color: var(--jade); }
.coral { color: var(--coral); }
.amber { color: var(--amber); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill-ok   { background: rgba(46,208,138,.12);  border-color: rgba(46,208,138,.28);  color: var(--jade); }
.pill-warn { background: rgba(245,166,35,.12);  border-color: rgba(245,166,35,.28);  color: var(--amber); }
.pill-over { background: rgba(255,107,90,.12);  border-color: rgba(255,107,90,.28);  color: var(--coral); }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .5; }

/* Toasts */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 40px);
  max-width: 460px;
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--jade);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: toast-in .22s var(--ease-out);
  pointer-events: auto;
}
.toast[data-type="error"] { border-left-color: var(--coral); }
.toast[data-type="warn"]  { border-left-color: var(--amber); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Pantallas de auth: centradas, sin tabbar */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-box .brand {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  text-align: center;
  margin-bottom: 6px;
}
.auth-box .brand em { font-style: italic; color: var(--jade); }
.auth-box .tagline {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
}
