/* ═══════════════════════════════════════════════════════════
   Ancla — hoja de estilos

   Reglas de diseño de este proyecto:
   · Nada de rojo para "no lo hiciste". El rojo solo existe para borrar.
   · Tipografía grande. Una decisión visible a la vez.
   · Mucho aire: el espacio en blanco es lo que evita el agobio.
   · El fondo de "Ahora" es un cielo que sigue la hora real del día
     (--sky y --sky-x los pone app.js). No es adorno: es para que
     sepas en qué parte del día estás sin leer un número.
   ═══════════════════════════════════════════════════════════ */

/* ---------- Tipografía ----------
   Bricolage Grotesque solo para la voz de la app (títulos, la
   frase grande). Los controles y el cuerpo usan la fuente del
   sistema para que se sienta nativa en el iPhone. */
@font-face {
  font-family: 'Bricolage';
  src: url('fonts/bricolage.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

/* ---------- Modo claro (base) ---------- */
:root {
  --bg:          #f1f0ec;
  --bg-elev:     #ffffff;
  --bg-sunken:   #e4e3de;
  --text:        #1a1922;
  --text-2:      #1a192299;
  --text-3:      #1a192259;
  --separator:   #1a19221a;

  --tint:        #4a55c4;   /* índigo: acciones */
  --warm:        #d4842a;   /* ámbar: medicamento */
  --calm:        #2c9a88;   /* teal: descanso, hecho */
  --danger:      #d24b4b;   /* solo para borrar */

  --sky:         #dad8ea;   /* lo sobreescribe app.js según la hora */
  --sky-x:       50%;

  --tabbar-bg:   #f4f3eff0;
  --sheet-bg:    #ffffff;
  --shadow:      0 1px 2px #1a192214, 0 8px 24px #1a19220f;
  --shadow-lg:   0 4px 12px #1a192214, 0 20px 50px #1a192214;
  --radius:      16px;
  --radius-lg:   22px;
  --ease:        cubic-bezier(.32, .72, 0, 1);

  --font-display: 'Bricolage', 'SF Pro Display', -apple-system, system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
}

/* ---------- Modo oscuro ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0e0f16;
    --bg-elev:   #191a24;
    --bg-sunken: #262733;
    --text:      #eeedf4;
    --text-2:    #eeedf499;
    --text-3:    #eeedf459;
    --separator: #eeedf41f;

    --tint:      #8d95f2;
    --warm:      #f0a54d;
    --calm:      #4ec4b2;
    --danger:    #f07070;

    --sky:       #14152b;

    --tabbar-bg: #14151ef0;
    --sheet-bg:  #191a24;
    --shadow:    0 1px 2px #00000066, 0 8px 24px #00000040;
    --shadow-lg: 0 10px 40px #00000080;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; height: 100%; background: var(--bg); }

body {
  min-height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}

button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════════
   CIELO
   Una luz suave detrás de "Ahora" y del temporizador. Su color y
   su posición horizontal (--sky-x, como el sol) siguen la hora.
   ═══════════════════════════════════════════════════════════ */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(150% 58% at var(--sky-x) -6%, var(--sky) 0%, transparent 74%);
  opacity: 0;
  transition: opacity .6s var(--ease);
}

.sky.is-on { opacity: 1; }

.onboard, .app, .focus, .sheet, .backdrop, .toast { position: relative; z-index: 1; }

/* ═══════════════════════════════════════════════════════════
   CONFIGURACIÓN INICIAL
   ═══════════════════════════════════════════════════════════ */

.onboard {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.onboard__inner { width: 100%; max-width: 380px; }

.onboard__step { animation: stepIn .45s var(--ease); }

@keyframes stepIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.onboard__mark { width: 40px; height: 40px; color: var(--tint); margin-bottom: 26px; }

.onboard__brand {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1;
  margin-bottom: 18px;
}

.onboard__title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 12px;
  text-wrap: balance;
}

.onboard__text { font-size: 17px; color: var(--text-2); line-height: 1.5; margin-bottom: 18px; max-width: 32ch; }
.onboard__text--sm { font-size: 15px; }
.onboard__text em { font-style: normal; color: var(--text); font-weight: 600; }

.bigTime {
  display: block;
  width: 100%;
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 600;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  padding: 16px 20px;
  margin-bottom: 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  -webkit-user-select: text;
  user-select: text;
}

.bigTime::-webkit-calendar-picker-indicator { display: none; }

/* ═══════════════════════════════════════════════════════════
   ESTRUCTURA
   ═══════════════════════════════════════════════════════════ */

.app {
  max-width: 520px;
  margin-inline: auto;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.view {
  padding: 0 20px;
  padding-top: calc(10px + env(safe-area-inset-top));
  animation: viewIn .3s var(--ease);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════
   AHORA
   ═══════════════════════════════════════════════════════════ */

.nowHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 2px 0;
}

.nowHead__greet { font-size: 15px; font-weight: 600; color: var(--text-2); }

.nowHead__clock {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* La nota del día: una línea que la IA escribe una vez al día. Si no hay, no ocupa nada. */
.nowHead__note {
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.45;
  padding: 6px 2px 0;
  max-width: 38ch;
  animation: fadeIn .5s var(--ease);
}

/* Aviso de instalación (solo en Safari, con clave) */
.banner {
  margin: 14px 0 -10px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn .4s var(--ease);
}
.banner__text { font-size: 14.5px; line-height: 1.5; color: var(--text-2); }
.banner__text b { color: var(--text); font-weight: 600; }
.banner .btn { align-self: flex-start; padding: 11px 18px; font-size: 15px; }

.row__mini {
  flex: none;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--tint);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* La frase única — el corazón de la app. Sin caja: solo las palabras sobre la luz. */
.now {
  padding: 34px 2px 0;
  min-height: 250px;
  animation: cardIn .4s var(--ease);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.now__tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--accent, var(--tint));
  margin-bottom: 14px;
}

.now__emoji { font-size: 15px; line-height: 1; letter-spacing: 0; }

.now__title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.08;
  text-wrap: balance;
  margin-bottom: 12px;
  max-width: 14ch;
  -webkit-user-select: text;
  user-select: text;
}

.now__sub {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 24px;
  max-width: 34ch;
}

.now__actions { display: flex; flex-direction: column; gap: 4px; }

/* Acciones secundarias: presentes pero calladas. Nunca compiten con la principal. */
.now__secondary { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; margin-left: -12px; }

.now__link {
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  border-radius: 12px;
  transition: background .15s, transform .18s var(--ease);
}

.now__link:active { background: var(--bg-sunken); transform: scale(.97); }

/* ---------- Barra de IA: "cuéntame" ---------- */

.aiBar {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin-top: 26px;
  padding: 13px 16px;
  border-radius: 18px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform .18s var(--ease);
}

.aiBar:active { transform: scale(.985); }
.aiBar__icon { width: 18px; height: 18px; color: var(--tint); flex: none; }
.aiBar__text { flex: 1; font-size: 15px; color: var(--text-2); line-height: 1.35; }
.aiBar__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--tint); opacity: 0; transition: opacity .2s; }
.aiBar.is-unread .aiBar__dot { opacity: 1; }
.aiBar.is-unread .aiBar__text { color: var(--text); font-weight: 500; }

/* ---------- Accesos rápidos ---------- */

.quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.aiBar[hidden] + .quick { margin-top: 26px; }

.quick__btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform .18s var(--ease);
}

.quick__btn:active { transform: scale(.96); }
.quick__icon { width: 22px; height: 22px; flex: none; color: var(--tint); }
.quick__label { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.25; }

/* ═══════════════════════════════════════════════════════════
   DÍA
   ═══════════════════════════════════════════════════════════ */

.pageHead { padding: 16px 2px 18px; }

.pageHead__title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.1;
}

.pageHead__sub { font-size: 15px; color: var(--text-2); margin-top: 4px; }

.sectionTitle {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin: 30px 0 10px 4px;
}

.hint {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
  margin: -2px 4px 12px;
}

.hint--tight { margin: 8px 0 0; }

/* ---------- Línea de tiempo ---------- */

.timeline { display: flex; flex-direction: column; }

.tl { display: flex; gap: 12px; align-items: stretch; }

.tl__time {
  flex: none;
  width: 46px;
  padding-top: 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tl__rail {
  flex: none;
  width: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-sunken);
  margin-top: 18px;
  flex: none;
  border: 2px solid var(--bg);
  box-sizing: content-box;
  z-index: 1;
  transition: background .3s, box-shadow .3s;
}

.tl__line { width: 2px; flex: 1; background: var(--separator); margin-top: -2px; }
.tl:last-child .tl__line { display: none; }

.tl__body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 6px 13px 8px;
  border-bottom: .5px solid var(--separator);
  border-radius: 12px 12px 0 0;
  transition: opacity .3s, background .2s;
}

.tl:last-child .tl__body { border-bottom: 0; }

.tl__emoji { font-size: 18px; flex: none; }
.tl__label { flex: 1; font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tl__mark {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
  display: grid; place-items: center;
  transition: background .25s, border-color .25s;
}

.tl__mark svg {
  width: 13px; height: 13px;
  stroke: #fff; stroke-width: 3.2;
  stroke-dasharray: 20; stroke-dashoffset: 20;
  transition: stroke-dashoffset .3s var(--ease) .05s;
}

/* Hecho — teal suave, nunca rojo para lo contrario */
.tl.is-done .tl__mark { background: var(--calm); border-color: var(--calm); }
.tl.is-done .tl__mark svg { stroke-dashoffset: 0; }
.tl.is-done .tl__dot { background: var(--calm); }
.tl.is-done .tl__label { color: var(--text-2); }

/* Ancla que ya pasó y no se marcó: se atenúa. Sin rojo, sin regaño. */
.tl.is-past:not(.is-done) .tl__body { opacity: .45; }

/* Ancla actual: un baño suave de color */
.tl.is-current .tl__body {
  background: color-mix(in srgb, var(--tint) 9%, transparent);
  border-radius: 12px;
  border-bottom-color: transparent;
  padding-left: 10px;
  padding-right: 8px;
}
.tl.is-current .tl__dot { background: var(--tint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tint) 22%, transparent); }

/* ---------- Bandeja de captura ---------- */

.inbox {
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.inbox:empty { display: none; }

.inboxItem {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: .5px solid var(--separator);
  transition: opacity .3s, background .15s;
}

.inboxItem:last-child { border-bottom: 0; }
.inboxItem:active { background: var(--bg-sunken); }

.inboxItem__check {
  flex: none;
  width: 23px; height: 23px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
  display: grid; place-items: center;
  transition: background .25s, border-color .25s;
}

.inboxItem__check svg {
  width: 12px; height: 12px;
  stroke: #fff; stroke-width: 3.4;
  stroke-dasharray: 20; stroke-dashoffset: 20;
  transition: stroke-dashoffset .3s var(--ease) .05s;
}

.inboxItem__text {
  flex: 1;
  font-size: 16px;
  line-height: 1.4;
  word-break: break-word;
  padding-top: 1px;
}

.inboxItem__go {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--tint);
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tint) 12%, transparent);
}

.inboxItem.is-done { opacity: .42; }
.inboxItem.is-done .inboxItem__check { background: var(--calm); border-color: var(--calm); }
.inboxItem.is-done .inboxItem__check svg { stroke-dashoffset: 0; }
.inboxItem.is-done .inboxItem__text { text-decoration: line-through; }
.inboxItem.is-done .inboxItem__go { display: none; }

.inboxEmpty { font-size: 14.5px; color: var(--text-3); line-height: 1.55; padding: 6px 4px; max-width: 36ch; }

/* ═══════════════════════════════════════════════════════════
   AJUSTES
   ═══════════════════════════════════════════════════════════ */

.card {
  background: var(--bg-elev);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card--rows { padding: 0; overflow: hidden; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  border-bottom: .5px solid var(--separator);
  transition: background .15s;
}

.row:last-child { border-bottom: 0; }
.row--btn:active { background: var(--bg-sunken); }
.row__label { flex: 1; min-width: 0; font-size: 16px; }
.row__hint { font-size: 14px; color: var(--text-3); }
.row--danger .row__label { color: var(--danger); }
.row--tint .row__label { color: var(--tint); font-weight: 600; }

.row__x { flex: none; color: var(--text-3); font-size: 20px; line-height: 1; padding: 2px 4px; margin-right: -4px; }

.row__time {
  flex: none;
  border: 0;
  background: var(--bg-sunken);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -webkit-user-select: text;
  user-select: text;
}

.row__time::-webkit-calendar-picker-indicator { display: none; }

.row__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  padding: 2px 0;
  -webkit-user-select: text;
  user-select: text;
}

.row__input::placeholder { color: var(--text-3); }
.row__input:focus { outline: none; }

.row__text { flex: 1; font-size: 14px; color: var(--text-2); line-height: 1.5; padding: 2px 0; }

/* Interruptor */
.switch {
  flex: none;
  width: 50px; height: 30px;
  border-radius: 999px;
  background: var(--bg-sunken);
  position: relative;
  transition: background .28s var(--ease);
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #00000033;
  transition: transform .28s var(--ease);
}

.switch.is-on { background: var(--calm); }
.switch.is-on::after { transform: translateX(20px); }

/* Chips (comidas) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips:empty { margin-bottom: 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  font-size: 14.5px;
  font-weight: 500;
}

.chip__x { color: var(--text-3); font-size: 17px; line-height: 1; padding: 0 2px; }
.chip--btn { background: var(--bg-sunken); box-shadow: none; transition: all .2s var(--ease); }
.chip--btn.is-sel { background: var(--tint); color: #fff; }

.addRow { display: flex; gap: 8px; }

.addRow__input {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  padding: 12px 15px;
  border-radius: 13px;
  border: 1.5px solid transparent;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  -webkit-user-select: text;
  user-select: text;
  transition: border-color .2s;
}

.addRow__input:focus { outline: none; border-color: var(--tint); }
.addRow__input::placeholder { color: var(--text-3); }

.addRow__time { flex: none; width: 92px; text-align: center; }

.addRow__btn {
  flex: none;
  padding: 12px 17px;
  border-radius: 13px;
  background: var(--tint);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.addRow__btn:active { opacity: .8; }

/* Notificaciones */
.notif__state { font-size: 15.5px; font-weight: 600; margin-bottom: 5px; }
.notif__help { font-size: 14px; color: var(--text-2); line-height: 1.5; margin-bottom: 14px; }
.notif__help:last-child { margin-bottom: 0; }

/* Patrón pastilla ↔ sueño */
.pattern { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.pattern:empty { margin-top: 0; }

.pRow {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.pRow__day { color: var(--text-3); font-weight: 600; }
.pRow__bars { display: flex; flex-direction: column; gap: 3px; }

.pBar {
  height: 15px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  min-width: 46px;
}

.pBar--pill  { background: var(--warm); }
.pBar--sleep { background: var(--calm); }
.pBar--none  { background: var(--bg-sunken); color: var(--text-3); }

/* Lo que la IA observa del patrón */
.insight {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tint) 8%, transparent);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  animation: fadeIn .4s var(--ease);
  -webkit-user-select: text;
  user-select: text;
}

.insight__meta { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* Memoria: lo que Ancla sabe de ti */
.mem { list-style: none; }

.mem__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: .5px solid var(--separator);
  font-size: 14.5px;
  line-height: 1.45;
}

.mem__item:last-child { border-bottom: 0; }
.mem__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--tint); margin-top: 8px; }
.mem__text { flex: 1; -webkit-user-select: text; user-select: text; }
.mem__x { color: var(--text-3); font-size: 18px; line-height: 1; padding: 0 4px; }

.mem__empty { padding: 14px; font-size: 14px; color: var(--text-3); line-height: 1.5; }

.mem__group {
  padding: 12px 14px 4px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
}
.mem__group + .mem__item { border-top: 0; }

/* Estado pequeño en filas de ajustes */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  margin-right: 8px;
  vertical-align: middle;
}
.dot--ok { background: var(--calm); }
.dot--warm { background: var(--warm); }

/* ═══════════════════════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════════════════════ */

.btn {
  border-radius: 14px;
  padding: 15px 22px;
  font-size: 16.5px;
  font-weight: 600;
  transition: transform .18s var(--ease), opacity .2s;
  text-align: center;
}

.btn:active { transform: scale(.97); opacity: .86; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--tint); color: #fff; }
.btn--warm { background: var(--warm); color: #fff; }
.btn--calm { background: var(--calm); color: #fff; }
.btn--soft { background: var(--bg-sunken); color: var(--text-2); font-size: 15px; padding: 13px 20px; }
.btn--ghost { background: var(--bg-elev); color: var(--tint); box-shadow: var(--shadow); }
.btn--danger { background: transparent; color: var(--danger); font-size: 15px; padding: 12px 20px; }
.btn--block { display: block; width: 100%; }
.btn--block + .btn--block { margin-top: 9px; }

/* La acción principal de la tarjeta lleva el color del ancla */
.now__actions .btn--primary { background: var(--accent, var(--tint)); }

/* ═══════════════════════════════════════════════════════════
   PESTAÑAS
   ═══════════════════════════════════════════════════════════ */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--separator);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0 7px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  transition: color .2s;
}

.tab svg { width: 23px; height: 23px; }
.tab.is-active { color: var(--tint); }
.tab:active { opacity: .55; }

/* ═══════════════════════════════════════════════════════════
   ENFOQUE / TEMPORIZADOR
   ═══════════════════════════════════════════════════════════ */

.focus {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 30px 24px;
  padding-top: calc(30px + env(safe-area-inset-top));
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
  animation: focusIn .35s var(--ease);
}

/* Fondo propio (opaco) con el mismo cielo encima */
.focus::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(150% 58% at var(--sky-x) -6%, var(--sky) 0%, transparent 74%), var(--bg);
}

@keyframes focusIn {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: none; }
}

.focus__close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 18px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-2);
  font-size: 24px;
  line-height: 1;
  display: grid; place-items: center;
}

.focus__what {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  text-align: center;
  max-width: 320px;
  line-height: 1.2;
  text-wrap: balance;
}

.focus__ringWrap { position: relative; width: min(72vw, 280px); aspect-ratio: 1; }

.focus__ring { transform: rotate(-90deg); overflow: visible; }
.focus__track { stroke: var(--bg-sunken); stroke-width: 12; }

.focus__fill {
  stroke: var(--tint);
  stroke-width: 12;
  stroke-linecap: round;
  /* 2πr con r=88 → 552.9 */
  stroke-dasharray: 552.9;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .35s linear;
}

.focus.is-done .focus__fill { stroke: var(--calm); }

.focus__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
  pointer-events: none;
}

.focus__time {
  font-family: var(--font-display);
  font-size: 58px;
  font-weight: 600;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

.focus__hint { font-size: 13px; color: var(--text-3); font-weight: 600; }

.focus__hit { position: absolute; inset: 0; border-radius: 50%; }
.focus__hit:active + .focus__center { opacity: .6; }

.focus__presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.focus__note {
  font-size: 14px;
  color: var(--text-2);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   HOJAS MODALES (captura, elemento de la bandeja)
   ═══════════════════════════════════════════════════════════ */

.backdrop {
  position: fixed;
  inset: 0;
  background: #00000066;
  z-index: 40;
  animation: fadeIn .3s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  max-width: 520px;
  margin-inline: auto;
  background: var(--sheet-bg);
  border-radius: 24px 24px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp .42s var(--ease);
}

@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

.sheet.is-closing { animation: sheetDown .3s var(--ease) forwards; }

@keyframes sheetDown { to { transform: translateY(100%); } }

.sheet__grabber {
  width: 36px; height: 5px;
  border-radius: 3px;
  background: var(--text-3);
  margin: 8px auto 0;
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: .5px solid var(--separator);
}

.sheet__title { font-size: 17px; font-weight: 600; }
.sheet__action { color: var(--tint); font-size: 17px; padding: 4px; }
.sheet__action--bold { font-weight: 600; }
.sheet__action:active { opacity: .5; }

.sheet__body { padding: 18px 16px 24px; }

.capture {
  width: 100%;
  font-size: 17px;
  line-height: 1.5;
  padding: 15px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--bg-sunken);
  resize: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color .2s;
}

.capture:focus { outline: none; border-color: var(--tint); }
.capture::placeholder { color: var(--text-3); }

/* Hoja de un elemento de la bandeja */
.item__text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 18px;
  text-wrap: balance;
  -webkit-user-select: text;
  user-select: text;
}

/* El primer paso que sugiere la IA */
.step {
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--tint) 9%, transparent);
  margin-bottom: 14px;
  animation: fadeIn .4s var(--ease);
}

.step__label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--tint); margin-bottom: 6px; }
.step__text { font-size: 17px; line-height: 1.4; font-weight: 500; -webkit-user-select: text; user-select: text; }
.step__why { font-size: 13.5px; color: var(--text-2); margin-top: 6px; line-height: 1.45; }

.item__row { display: flex; gap: 8px; margin-top: 8px; }
.item__row .btn { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   CHARLA CON ANCLA
   Es una vista fija (no scrollea la página): el historial scrollea
   adentro y el cuadro de texto se queda abajo. ai.js le ajusta la
   altura cuando el teclado del iPhone se abre.
   ═══════════════════════════════════════════════════════════ */

.view--chat {
  position: fixed;
  left: 0; right: 0; top: 0;
  bottom: calc(56px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin-inline: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: none;
}

.chat__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  border-bottom: .5px solid var(--separator);
  background: var(--bg);
}

.chat__mark { width: 20px; height: 20px; color: var(--tint); flex: none; align-self: center; }
.chat__title { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.chat__hint { font-size: 12.5px; color: var(--text-3); font-weight: 500; }

.chat__log {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat__day {
  align-self: center;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 14px 0 6px;
}

.chat__day:first-child { padding-top: 4px; }

.chat__empty {
  margin: auto;
  text-align: center;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.55;
  max-width: 32ch;
  padding: 20px;
}

.chat__empty strong { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--text); margin-bottom: 8px; }
.chat__empty .btn { display: inline-block; margin-top: 4px; }

.msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  animation: msgIn .3s var(--ease);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.msg--me { align-self: flex-end; background: var(--tint); color: #fff; border-bottom-right-radius: 6px; }
.msg--ancla { align-self: flex-start; background: var(--bg-elev); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.msg--error { align-self: center; background: transparent; box-shadow: none; color: var(--text-3); font-size: 13.5px; text-align: center; max-width: 30ch; }
.msg--thinking { padding: 13px 16px; }

/* Cuando Ancla escribió primero (por notificación) */
.msg__cap {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tint);
  margin-bottom: 4px;
}

.msg__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 13px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tint) 12%, transparent);
  color: var(--tint);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  line-height: 1.3;
  white-space: normal;
}

.msg__chip svg { width: 15px; height: 15px; flex: none; }
.msg__chip:active { opacity: .7; }
.msg__chip.is-used { opacity: .5; pointer-events: none; }

/* Un plan que se creó en la charla */
.msg__plan {
  display: block;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--bg-sunken);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

/* Puntos de "pensando" */
.dots { display: inline-flex; gap: 5px; align-items: center; height: 20px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .3; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }

@keyframes dot {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

.chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 10px;
  border-top: .5px solid var(--separator);
  background: var(--bg);
}

.chat__input {
  flex: 1;
  min-width: 0;
  padding: 11px 15px;
  border-radius: 20px;
  background: var(--bg-elev);
  border: 1.5px solid transparent;
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  -webkit-user-select: text;
  user-select: text;
}

.chat__input:focus { outline: none; border-color: var(--tint); }
.chat__input::placeholder { color: var(--text-3); }

.chat__photo {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  color: var(--tint);
  display: grid; place-items: center;
}

.chat__photo svg { width: 21px; height: 21px; }
.chat__photo:active { opacity: .7; }

/* Foto lista para mandar */
.chat__pending { position: relative; flex: none; width: 42px; height: 42px; }
.chat__pending img { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; display: block; }
.chat__pendingX {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text); color: var(--bg);
  font-size: 14px; line-height: 1; display: grid; place-items: center;
}

.msg__img { display: block; width: min(60vw, 240px); border-radius: 12px; margin-bottom: 8px; }
.msg__photoTag { font-size: 12px; opacity: .75; margin-bottom: 2px; }

.chat__send {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--tint);
  color: #fff;
  display: grid; place-items: center;
  transition: opacity .2s, transform .18s var(--ease);
}

.chat__send svg { width: 20px; height: 20px; stroke-width: 2.4; }
.chat__send:active { transform: scale(.92); }
.chat__send:disabled { opacity: .35; }

/* ═══════════════════════════════════════════════════════════
   AVISO FLOTANTE
   ═══════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 16px);
  transform: translateX(-50%);
  z-index: 90;
  padding: 12px 22px;
  border-radius: 999px;
  background: #1a1922ee;
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  max-width: calc(100vw - 40px);
  text-align: center;
  box-shadow: 0 4px 24px #00000040;
  animation: toastIn .35s var(--ease);
}

@media (prefers-color-scheme: dark) {
  .toast { background: #eeedf4f0; color: #0e0f16; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.toast.is-out { animation: toastOut .3s var(--ease) forwards; }

@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -16px); } }

/* ═══════════════════════════════════════════════════════════
   VARIOS
   ═══════════════════════════════════════════════════════════ */

.footNote {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.5;
  margin: 24px 12px 0;
}

.footNote--dim { color: var(--text-3); font-size: 12px; margin-top: 8px; }

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