/* Tokens del diseño A (claro) y versión oscura; reset y piezas básicas compartidas por todas las vistas. */
@font-face {
  font-family: Geist;
  src: url('/fonts/Geist.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #eeede8;
  --ink: #15171c;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --line: #e5e4df;
  --line-2: #f0efea;
  --box-line: #cfcdc6;
  --accent: #b9ea00;
  --accent-ink: #15171c;
  --now: #2f6fed;
  --now-ink: #1d4fc4;
  --now-bg: #eef3ff;
  --done: #1f8a4c;
  --done-bg: #e3f5ea;
  --danger: #c2412d;
  --danger-bg: #fdecea;
  --dark: #15171c;
  --dark-2: #1f232c;
  --on-dark: #ffffff;
  --on-dark-muted: #9aa1ad;
  --area-negocio: #2f6fed;
  --area-salud: #1f8a4c;
  --area-desarrollo: #6d3fc7;
  --area-relaciones: #c2410c;
  --cat-rutina: #9a9890;
  --cat-rutina-bg: #efeeea;
  --cat-trabajo: #2f6fed;
  --cat-trabajo-bg: #eef3ff;
  --cat-salud: #1f8a4c;
  --cat-salud-bg: #e3f5ea;
  --cat-social: #c2410c;
  --cat-social-bg: #fff1e0;
  --cat-personal: #6d3fc7;
  --cat-personal-bg: #f1ebff;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 44px;
  --side: 248px;
  --shadow: 0 10px 30px rgb(0 0 0 / .22);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --ink: #eceef2; --ink-2: #c3c8d2; --muted: #9aa1ad;
    --line: #2a2f39; --line-2: #232833; --box-line: #3a4050; --accent: #c8ff00; --accent-ink: #0f1115;
    --now: #6f9bff; --now-ink: #9dbbff; --now-bg: #1b2436; --done: #4cc38a; --done-bg: #15291f; --danger: #ff8a75; --danger-bg: #3a1d18;
    --dark: #262b36; --dark-2: #323846;
    --cat-rutina-bg: #20232a; --cat-trabajo-bg: #1b2436; --cat-salud-bg: #15291f; --cat-social-bg: #2d1f14; --cat-personal-bg: #241a36;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --ink: #eceef2; --ink-2: #c3c8d2; --muted: #9aa1ad;
  --line: #2a2f39; --line-2: #232833; --box-line: #3a4050; --accent: #c8ff00; --accent-ink: #0f1115;
  --now: #6f9bff; --now-ink: #9dbbff; --now-bg: #1b2436; --done: #4cc38a; --done-bg: #15291f; --danger: #ff8a75; --danger-bg: #3a1d18;
  --dark: #262b36; --dark-2: #323846;
  --cat-rutina-bg: #20232a; --cat-trabajo-bg: #1b2436; --cat-salud-bg: #15291f; --cat-social-bg: #2d1f14; --cat-personal-bg: #241a36;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (max-width: 1023px) { body { font-size: 15px; line-height: 1.4; } }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--now); }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--now); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Títulos de sección: 12 px, mayúsculas */
.h { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
@media (max-width: 1023px) { .h { font-size: 11px; letter-spacing: .08em; } }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
@media (max-width: 1023px) { .card { border-radius: 16px; padding: 14px; } }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card__link { font-size: 12px; font-weight: 600; text-decoration: none; }
.card--dark { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
.card--dark .h { color: var(--accent); }
.card--dark .muted { color: var(--on-dark-muted); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--icon { width: 36px; padding: 0; }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn--wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
@media (max-width: 1023px) { .btn { height: 40px; font-size: 14px; } .btn--sm { height: 32px; font-size: 13px; } }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 20px; line-height: 1; display: grid; place-items: center; padding: 0; color: var(--ink); text-decoration: none; flex: none;
}
.icon-btn--pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn svg { width: 18px; height: 18px; }
.step { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); display: grid; place-items: center; padding: 0; }
@media (max-width: 1023px) { .step { width: 34px; height: 34px; font-size: 16px; } }

/* Chips, etiquetas, barras */
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink); white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.chip--accent[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 1023px) { .chip { height: 36px; font-size: 14px; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; text-decoration: none; }
.tag--meta { border-color: transparent; background: var(--now-bg); color: var(--now-ink); }
.tag--done { border-color: transparent; background: var(--done-bg); color: var(--done); }
.tag--late { border-color: transparent; background: var(--danger-bg); color: var(--danger); }
.tag--now { color: var(--now-ink); border-color: transparent; padding: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .3s ease; }
.bar--accent i { background: var(--accent); }
.bar--done i { background: var(--done); }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }

/* Casillas (hábitos y tareas) */
.chk { display: flex; align-items: center; gap: 10px; min-height: 36px; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; font-size: 14px; color: var(--ink); }
.chk .t { flex: 1 1 auto; min-width: 12ch; overflow-wrap: break-word; }
.chk .tag { flex: 0 1 auto; min-width: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
.chk[aria-pressed="true"] .t { color: var(--muted); text-decoration: line-through; }
.box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--box-line); flex: none; display: grid; place-items: center; background: var(--surface); color: transparent; transition: background .15s, border-color .15s; }
.box svg { width: 13px; height: 13px; }
.chk[aria-pressed="true"] .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chk--sub { font-size: 13px; min-height: 32px; }
.chk--sub .box { width: 18px; height: 18px; border-radius: 5px; }
@media (max-width: 1023px) {
  .chk { min-height: var(--tap); font-size: 15px; font-weight: 600; gap: 12px; }
  .chk[aria-pressed="true"] .t { font-weight: 500; }
  .box { width: 26px; height: 26px; border-radius: 9px; border-width: 2px; }
  .box svg { width: 14px; height: 14px; }
  .chk--sub { font-size: 14px; font-weight: 500; min-height: 36px; }
  .chk--sub .box { width: 22px; height: 22px; border-radius: 7px; }
}

/* Campos */
.field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 12px; min-height: 38px; font-size: 14px;
}
.field textarea { resize: vertical; }
@media (max-width: 1023px) { .field { font-size: 13px; } .field input, .field textarea, .field select { min-height: var(--tap); font-size: 16px; border-radius: 12px; } }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.save-state { font-size: 12px; color: var(--muted); min-height: 1.2em; }

/* Avisos */
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.banner { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--dark); color: var(--on-dark); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30;
  max-width: calc(100% - 32px);
}
.toast--error { background: var(--danger); color: #fff; }
@media (min-width: 1024px) { .toast { bottom: 32px; left: calc(var(--side) + (100vw - var(--side)) / 2); } }

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