/* =========================================================================
   Mandala · estilos
   Diseño pensado primero para móvil. Modo claro y oscuro automáticos según el sistema.
   ========================================================================= */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1b1c1f;
  --muted: #6b6e76;
  --line: #e4e1da;
  --track: #e7e4dd;
  --accent: #2f6fdf;
  --on-accent: #ffffff;
  --danger: #c8393b;
  --ok: #1a9e6e;
  --warn: #a8650a;
  --warn-bg: #fbf0dc;
  --shadow: 0 1px 2px rgb(20 20 30 / 6%), 0 4px 14px rgb(20 20 30 / 5%);
  --radius: 16px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --mc: var(--accent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518;
    --surface: #1d1f23;
    --surface-2: #26282e;
    --text: #ececee;
    --muted: #9a9ca4;
    --line: #2f3137;
    --track: #30333a;
    --accent: #6d9cf0;
    --on-accent: #0d1220;
    --danger: #ec6b6d;
    --ok: #3fc493;
    --warn: #e8a748;
    --warn-bg: #33281a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.icon {
  display: inline-flex;
  flex: none;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.center {
  text-align: center;
}

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tabbar-h) + var(--safe-b) + 28px);
}

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Cabeceras ---------- */

.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.page-title {
  flex: 1;
  min-width: 0;
}

.page-title h1 {
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.page-title p {
  font-size: 0.9rem;
}

.page-actions {
  display: flex;
  gap: 6px;
}

.today-header {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.day-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.day-summary > div:last-child {
  display: flex;
  flex-direction: column;
}

.day-summary strong {
  font-size: 1.15rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 4px 8px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.section-head .section-title {
  margin-bottom: 0;
}

.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
  background: var(--surface-2);
  transition: transform 0.08s ease, opacity 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.88rem;
  border-radius: 10px;
}

.btn.block {
  width: 100%;
}

.danger-text {
  color: var(--danger);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.3rem;
  line-height: 1;
}

.icon-btn.accent {
  background: var(--accent);
  color: var(--on-accent);
}

.icon-btn.disabled {
  opacity: 0.3;
}

.link-btn {
  border: 0;
  background: none;
  padding: 4px 0;
  color: var(--accent);
  font-weight: 600;
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row-actions .btn {
  flex: 1;
}

/* ---------- Listas ---------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 60px;
}

.item + .item {
  border-top: 1px solid var(--line);
}

.item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.item.done .item-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent);
}

/* Círculo para marcar */
.check {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--mc) 70%, var(--line));
  background: transparent;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.1s;
  /* Zona táctil más grande que el dibujo */
  box-shadow: 0 0 0 7px transparent;
}

.check:active {
  transform: scale(0.88);
}

.item.done .check {
  background: var(--mc);
  border-color: var(--mc);
  color: #fff;
}

.item.pop .check {
  animation: pop 0.35s ease;
}

@keyframes pop {
  40% {
    transform: scale(1.22);
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 1px 7px;
}

.tag.ok {
  color: var(--ok);
}

.tag.streak {
  color: #d9622b;
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 1px 8px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* ---------- Tarjetas ---------- */

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.mandala-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border-left: 5px solid var(--mc);
}

.mandala-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mandala-card h2 {
  font-size: 1.15rem;
}

.goal {
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.goal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border-left: 5px solid var(--mc);
}

.goal-text {
  font-weight: 550;
}

.card-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-section .section-title {
  margin: 0;
}

.prose p + p {
  margin-top: 8px;
}

.prose,
.card-section ol {
  line-height: 1.55;
}

.card-section ol {
  margin: 6px 0;
  padding-left: 20px;
}

/* ---------- Progreso ---------- */

.ring {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ring svg {
  position: absolute;
  inset: 0;
}

.ring circle {
  transition: stroke-dashoffset 0.5s ease;
}

.ring-label {
  position: relative;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 6px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat strong {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat span {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.25;
}

.stat.warn strong {
  color: var(--warn);
}

/* ---------- Avisos ---------- */

.notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
}

.notice.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 14px;
  padding: 12px 14px;
}

.banner span:nth-child(2) {
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 14px;
  background: #24262b;
  color: #f3f3f5;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
  z-index: 50;
  animation: toast-in 0.2s ease;
}

.toast button {
  border: 0;
  background: none;
  color: #8fb4ff;
  font-weight: 700;
  padding: 0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ---------- Vacío y bienvenida ---------- */

.empty {
  text-align: center;
  padding: 36px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.empty h2 {
  color: var(--text);
  font-size: 1.15rem;
}

.welcome {
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.welcome h2 {
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.welcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  gap: 4px;
}

.welcome-grid span {
  aspect-ratio: 1;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}

.welcome-grid span.c {
  background: var(--accent);
}

.steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

/* ---------- Tabla 9×9 ---------- */

.grid9 {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  width: 100%;
  aspect-ratio: 1;
}

.mblock {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

a.mblock:active {
  opacity: 0.75;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2px;
  border: 0;
  font-size: clamp(6px, 1.95cqi, 12px);
  line-height: 1.15;
  overflow: hidden;
  overflow-wrap: anywhere;
  hyphens: auto;
  background: var(--surface);
  min-width: 0;
  min-height: 0;
  position: relative;
}

.cell.empty {
  background: var(--surface-2);
}

.cell.empty.add {
  color: var(--muted);
  font-size: clamp(12px, 3.5cqi, 20px);
}

.cell.action {
  background: color-mix(in srgb, var(--mc) calc(8% + var(--p) * 47%), var(--surface));
}

.cell.shared::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.55;
}

.cell.area-cell {
  background: color-mix(in srgb, var(--mc) 26%, var(--surface));
  font-weight: 700;
}

.center-block .cell.area-cell {
  background: color-mix(in srgb, var(--mc) calc(18% + var(--p) * 40%), var(--surface));
}

.cell.goal-cell {
  background: var(--mc);
  color: #fff;
  font-weight: 800;
  font-size: clamp(7px, 2.3cqi, 14px);
}

.center-block {
  box-shadow: 0 0 0 2px var(--mc);
}

/* ---------- Área 3×3 ---------- */

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tile {
  aspect-ratio: 1;
  border: 0;
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
  position: relative;
  transition: transform 0.08s;
}

.tile:active {
  transform: scale(0.96);
}

.tile-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  color: var(--muted);
}

.action-tile {
  background: color-mix(in srgb, var(--mc) calc(8% + var(--p) * 40%), var(--surface));
}

.action-tile.done-today::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--mc);
}

.empty-tile {
  background: transparent;
  border: 2px dashed var(--line);
  box-shadow: none;
  color: var(--muted);
}

.empty-tile:disabled {
  opacity: 0.4;
}

.center-tile {
  background: color-mix(in srgb, var(--mc) 20%, var(--surface));
}

.center-tile strong {
  font-size: 0.85rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.area-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.area-nav .btn {
  max-width: 48%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Mapa de actividad ---------- */

.heatmap-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.heatmap {
  display: grid;
  gap: 3px;
  align-items: center;
}

.hm-label {
  font-size: 0.62rem;
  color: var(--muted);
  padding-right: 4px;
}

.hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-2);
  border: 0;
  padding: 0;
  min-width: 0;
}

.hm-cell.future,
.hm-cell.off {
  background: transparent;
}

.hm-cell.off {
  box-shadow: inset 0 0 0 1px var(--line);
}

.hm-cell.l1 {
  background: color-mix(in srgb, var(--mc) 30%, var(--surface-2));
}

.hm-cell.l2 {
  background: color-mix(in srgb, var(--mc) 52%, var(--surface-2));
}

.hm-cell.l3 {
  background: color-mix(in srgb, var(--mc) 75%, var(--surface-2));
}

.hm-cell.l4 {
  background: var(--mc);
}

.hm-cell.miss {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
}

.hm-cell.today {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

.hm-range {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.legend {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: -1px;
}

.legend.l4 {
  background: var(--mc);
}

.legend.miss {
  background: color-mix(in srgb, var(--danger) 28%, var(--surface-2));
}

/* ---------- Cronología ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 4px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timeline li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
}

.timeline li + li {
  border-top: 1px solid var(--line);
}

.tl-date {
  flex: none;
  width: 46px;
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.tl-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.tl-note {
  font-size: 0.88rem;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: pre-wrap;
}

.tl-day {
  font-size: 0.85rem;
  font-weight: 650;
  margin: 14px 4px 6px;
}

.tl-day:first-child {
  margin-top: 4px;
}

.ev-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ev-line .icon {
  margin-top: 2px;
  color: var(--muted);
}

.ev-hecha .ev-line .icon {
  color: var(--ok);
}

.filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.filter {
  flex: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

.filter.on {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---------- Equilibrio y duplicados ---------- */

.dups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.dup {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.dup-names {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
}

.group > .notice,
.group > p.muted {
  margin-top: 10px;
}

details.archived summary {
  cursor: pointer;
  list-style: none;
}

details.archived summary::-webkit-details-marker {
  display: none;
}

.kv {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.kv li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.kv li + li {
  border-top: 1px solid var(--line);
}

/* ---------- Hojas emergentes ---------- */

.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 640px;
  max-height: 90dvh;
  background: var(--bg);
  color: var(--text);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 40px rgb(0 0 0 / 18%);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: sheet-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.sheet::backdrop {
  background: rgb(0 0 0 / 38%);
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
}

.sheet-handle {
  width: 38px;
  height: 5px;
  border-radius: 99px;
  background: var(--line);
  margin: 8px auto 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 4px 20px;
}

.sheet-header h2 {
  flex: 1;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.sheet-header .icon-btn {
  width: 36px;
  height: 36px;
  box-shadow: none;
  background: var(--surface-2);
}

.sheet-body {
  padding: 8px 20px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-text {
  font-size: 1.05rem;
  font-weight: 550;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  font-weight: 550;
  text-align: left;
}

.menu-item.danger {
  color: var(--danger);
}

/* ---------- Formularios ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.field input,
.field textarea,
.journal textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  /* 16 px evita que el iPhone haga zoom al escribir */
  font-size: 16px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.journal textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.journal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.segmented {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
}

.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 0.88rem;
  font-weight: 550;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.segmented button small {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 400;
}

.segmented button.on {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.freq {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.freq-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.days {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.day {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
}

.day.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: 12px;
  padding: 6px;
}

.stepper .icon-btn {
  box-shadow: none;
  background: var(--surface-2);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
}

.swatch.on {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text);
}

.suggestions:empty {
  display: none;
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-radius: 14px;
  padding: 10px;
}

.suggestions-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
}

.pick-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- Barra de pestañas ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}

.tabbar a {
  flex: 1;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}

.tabbar svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tabbar a.on {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
