/* ───────────────────────── Bitácora · estilos ─────────────────────────
   Tokens de color de la paleta validada (claro/oscuro).
   Cada área tiene su color de identidad; siempre va acompañado de su nombre o icono. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --hair: rgba(11, 11, 11, 0.08);
  --hair-2: rgba(11, 11, 11, 0.15);
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --series-1: #2a78d6;
  --good-text: #006300;
  --warn: #fab219;
  --critical: #d03b3b;
  --critical-text: #b8312f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.04);

  --a-universidad: #6250d6;
  --a-trabajo: #2a78d6;
  --a-economia: #008300;
  --a-salud: #eb6834;
  --a-viajes: #1baf7a;
  --a-familia: #e87ba4;
  --a-futuro: #eda100;
  --a-personal: #898781;

  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #252523;
    --hair: rgba(255, 255, 255, 0.08);
    --hair-2: rgba(255, 255, 255, 0.16);
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --series-1: #3987e5;
    --good-text: #0ca30c;
    --critical-text: #ef7b7b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

    --a-universidad: #9085e9;
    --a-trabajo: #3987e5;
    --a-economia: #0ca30c;
    --a-salud: #d95926;
    --a-viajes: #199e70;
    --a-familia: #d55181;
    --a-futuro: #c98500;
    --a-personal: #898781;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.noscroll { overflow: hidden; }
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 8px; }
code { font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--good-text); }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── Arranque / errores ───────── */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-weight: 600; }
.fatal { max-width: 520px; margin: 15vh auto; }
.loading { padding: 32px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--hair-2); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { border-color: var(--critical); }

/* ───────── Estructura ───────── */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 14px; display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 750; font-size: 18px; padding: 4px 8px 14px; letter-spacing: -0.02em; }
.side-label { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 10px 2px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.side-nav a > span:first-child { width: 22px; text-align: center; }
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.on { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow); }
.side-nav .dot { margin-left: auto; }
.side-bottom { margin-top: auto; padding-top: 12px; }
.count { margin-left: auto; background: var(--ink); color: var(--page); font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }

.main { padding: 28px 40px 80px; min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; }
.page.narrow { max-width: 760px; }
.page-head { margin: 4px 0 18px; }
.page-head p { margin-top: 6px; }

.demo-bar {
  max-width: 1180px; margin: 0 auto 18px; padding: 9px 14px; border-radius: 12px; font-size: 13.5px;
  background: color-mix(in srgb, var(--warn) 20%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
}

.tabbar { display: none; }

/* ───────── Tarjetas y rejilla ───────── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.span-2 { grid-column: span 2; }
.card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0;
}
.grid > .card { margin-bottom: 0; }
a.card { display: block; text-decoration: none; transition: transform 0.12s ease; }
a.card:hover { transform: translateY(-1px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-ico { font-size: 17px; }
.more { font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.more:hover { color: var(--ink); }
.empty { padding: 16px 4px; color: var(--muted); text-align: center; font-size: 14px; }
.empty.small { padding: 8px; font-size: 13px; }
.stack { display: grid; gap: 14px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 10px; }

/* ───────── Hero de "Hoy" ───────── */
.hero { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin: 6px 0 22px; }
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 550; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.context { margin-top: 8px; color: var(--ink-2); display: inline-flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--hair); padding: 5px 12px; border-radius: 99px; font-size: 14px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; margin-bottom: 18px; border-radius: 14px;
  background: var(--ink); color: var(--page); text-decoration: none; font-size: 15px;
}
.banner span:nth-child(2) { flex: 1; }

/* ───────── Filas ───────── */
.list { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 12px;
  text-decoration: none; color: inherit; min-width: 0;
}
.row:hover { background: var(--surface-2); }
.row.as-btn { width: calc(100% + 16px); border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.kicon {
  flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 18px;
  background: color-mix(in srgb, var(--area, var(--muted)) 13%, var(--surface-2));
}
.kicon.big { width: 58px; height: 58px; border-radius: 16px; font-size: 30px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.row-right { flex: none; text-align: right; font-weight: 600; }
.row-right small { font-weight: 450; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--area, var(--muted)); flex: none; }

/* ───────── Chips ───────── */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 550;
  background: var(--surface-2); color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.chip.area { background: color-mix(in srgb, var(--area) 14%, var(--surface)); color: var(--ink); }
.chip.due.soon { background: color-mix(in srgb, var(--warn) 24%, var(--surface)); color: var(--ink); }
.chip.due.over { background: color-mix(in srgb, var(--critical) 14%, var(--surface)); color: var(--critical-text); }
.chip.st-hecho { color: var(--good-text); }
.chip.st-cancelado { text-decoration: line-through; }
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* ───────── Botones ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--hair-2); background: var(--surface); color: var(--ink); font: 550 14px var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap; position: relative;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--page); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.88; }
.btn.danger { color: var(--critical-text); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; margin-top: 12px; padding: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 18px; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: 0.3; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 18px; }
.card .actions { margin: 12px 0 0; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.card .quick { margin: 12px 0 0; }
.chip-btn {
  padding: 7px 12px; border-radius: 99px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--ink);
  font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; flex: none;
}
.chip-btn.on { background: var(--ink); color: var(--page); border-color: var(--ink); }
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 8px 0; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 7px 16px; border-radius: 9px; font: 550 14px var(--font); color: var(--ink-2); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ───────── Cifras ───────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stats.tiles { margin-bottom: 16px; }
.stats.tiles .stat { background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.big-num { font-size: 18px; font-weight: 700; }

/* ───────── Medidores ───────── */
.meter { margin: 12px 0; }
.meter-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 550; margin-bottom: 6px; }
.meter-top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--area, var(--series-1)); min-width: 3px; transition: width 0.4s ease; }
.meter-fill.over { background: var(--critical); }
.meter-sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
a.goal { display: block; text-decoration: none; border-radius: 12px; padding: 2px 8px; margin: 0 -8px; }
a.goal:hover { background: var(--surface-2); }
a.goal .meter { margin: 8px 0; }

/* ───────── Gráficos ───────── */
.chart { position: relative; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  background: var(--ink); color: var(--page); font-size: 12.5px; line-height: 1.35; padding: 7px 10px; border-radius: 9px;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.barlist { display: grid; gap: 2px; }
.bl-row { display: grid; grid-template-columns: minmax(100px, 38%) 1fr auto; align-items: center; gap: 10px; padding: 5px 0; cursor: default; }
.bl-label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-track { position: relative; height: 12px; }
.bl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.bl-budget { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink-2); border-radius: 1px; }
.bl-val { font-size: 13.5px; font-weight: 600; min-width: 64px; text-align: right; }
.over-flag { color: var(--critical-text); }
.legend { font-size: 12px; color: var(--muted); margin: 8px 0 0; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lg-budget { display: inline-block; width: 2px; height: 12px; background: var(--ink-2); }

.cols-plot { height: var(--h); padding-top: 22px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--axis); }
.col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.col-bar { position: relative; width: 100%; max-width: 48px; background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 2px; opacity: 0.55; }
.col.current .col-bar { opacity: 1; }
.col:hover .col-bar { opacity: 0.85; }
.col-label { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.cols-x { display: flex; gap: 8px; margin-top: 6px; }
.cols-x span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11.5px; color: var(--muted); overflow: hidden; }

.line { width: 100%; touch-action: pan-y; }
.line svg { display: block; overflow: visible; }
.line .grid { stroke: var(--grid); stroke-width: 1; }
.line .axis-t { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.line .ln { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line .ln-end, .line .ln-hi { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.line .ln-label { fill: var(--ink-2); font-size: 12px; font-weight: 650; font-family: var(--font); }
.line .cross { stroke: var(--axis); stroke-width: 1; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 12px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wd-dot {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--hair-2); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.wd.on .wd-dot { background: var(--area, var(--series-1)); border-color: var(--area, var(--series-1)); }
.wd.today .wd-dot { outline: 2px solid var(--ink); outline-offset: 2px; }
.wd-l { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ───────── Viajes, asignaturas, personas, áreas ───────── */
.trip { display: flex; gap: 14px; align-items: center; text-decoration: none; margin-bottom: 6px; }
.trip-count { flex: none; width: 66px; height: 66px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--area) 14%, var(--surface-2)); font-size: 12px; color: var(--ink-2); }
.trip-count .big { font-size: 24px; font-weight: 750; color: var(--ink); line-height: 1.1; }
.trip-title { font-weight: 650; font-size: 16px; }
.trip-info { min-width: 0; }
.trip-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 4px; }
.subject-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.subject-meta { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.subject-next { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }
.subject-next span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; text-decoration: none; border: 1px solid var(--hair); }
.person:hover { background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none;
  background: color-mix(in srgb, var(--a-familia) 22%, var(--surface-2)); }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.area-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--hair); box-shadow: inset 4px 0 0 var(--area), var(--shadow); font-size: 13px;
}
.area-tile b { font-size: 15px; }
.area-head { display: flex; align-items: center; gap: 14px; }
.area-ico { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 28px; flex: none;
  background: color-mix(in srgb, var(--area) 15%, var(--surface-2)); }
.area-tile .area-ico { width: 42px; height: 42px; font-size: 22px; margin-bottom: 6px; }
.month-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.month-nav b { font-size: 17px; min-width: 170px; text-align: center; }
.month-nav b::first-letter { text-transform: uppercase; }

/* ───────── Ficha ───────── */
.item-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.item-head h1 { font-size: 26px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.facts > div { background: var(--surface); border: 1px solid var(--hair); border-radius: 13px; padding: 10px 13px; }
.facts dt { font-size: 12px; color: var(--muted); font-weight: 550; }
.facts dd { margin: 2px 0 0; font-weight: 550; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.body-text { white-space: pre-wrap; line-height: 1.6; }
.sub-group { margin-bottom: 10px; }
.sub-title { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 0; }
.link-row { display: flex; align-items: center; gap: 8px; }
.link-row .rel { font-size: 12px; color: var(--muted); width: 110px; flex: none; }
.link-row .row { flex: 1; margin: 0; }
.meta-foot { font-size: 12.5px; color: var(--muted); text-align: center; margin: 8px 0 24px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.ph { aspect-ratio: 1; border-radius: 11px; overflow: hidden; border: 0; padding: 0; background: var(--surface-2); cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 82vh; object-fit: contain; border-radius: 8px; }

/* ───────── Formularios ───────── */
.editor { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 0; }
.card .field + .field, form > .field + .field { margin-top: 0; }
.field > span, .field-label { font-size: 13px; color: var(--ink-2); font-weight: 550; }
.field-label { margin: 14px 0 0; }
.input {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--hair-2); background: var(--surface);
  color: var(--ink); font: 15px var(--font); outline: none; min-width: 0;
}
.input:focus { border-color: var(--series-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-1) 22%, transparent); }
.input.ghost { background: var(--surface-2); color: var(--muted); }
textarea.input { resize: vertical; line-height: 1.5; }
.input.big { font-size: 17px; }
.input.huge { font-size: 28px; font-weight: 700; padding: 10px 14px; }
.input.search { font-size: 16px; padding: 12px 14px; margin-bottom: 12px; }
select.input { appearance: auto; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.parent-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.form-error { color: var(--critical-text); font-size: 14px; }
form .field + .field { margin-top: 12px; }
.editor .field + .field { margin-top: 0; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.toggle input { width: 18px; height: 18px; }
.capture-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.thumb { position: relative; width: 78px; height: 78px; border-radius: 12px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; cursor: pointer; }
.quick-expense { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 10px; }
.budgets { display: grid; gap: 8px; }
.budget { display: grid; grid-template-columns: 1fr 110px 16px; align-items: center; gap: 8px; font-size: 14px; }
.budget .input { padding: 7px 10px; text-align: right; }
.tips { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); font-size: 14px; }

.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 12px; }
.kind-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--ink); font: 500 13px var(--font); cursor: pointer; }
.kind-btn span { font-size: 22px; }
.kind-btn:hover { background: var(--surface-2); }

/* ───────── Bandeja ───────── */
.inbox-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.inbox-text { font-size: 16px; white-space: pre-wrap; }
.inbox-result { font-size: 14px; color: var(--ink-2); background: var(--surface-2); padding: 8px 12px; border-radius: 10px; margin-top: 10px; }
.inbox-card .photos { margin-top: 8px; }

/* ───────── Línea temporal ───────── */
.day { margin-bottom: 6px; }
.day-head { font-size: 14px; font-weight: 650; margin: 18px 4px 8px; }
.day-head.future { color: var(--series-1); }
.day .card { padding: 8px 18px; margin-bottom: 0; }

/* ───────── Modal y avisos ───────── */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.42); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; width: min(560px, 100%); max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; gap: 10px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; display: grid; gap: 12px; }
.picker-list { max-height: 52vh; overflow-y: auto; margin-top: 8px; padding: 0 8px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 550; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); animation: pop 0.2s ease; }
.toast.error { background: var(--critical); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ───────── Acceso ───────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); text-align: center; display: grid; gap: 12px; padding: 28px; }
.login-card img { margin: 0 auto; }
.login-card .field { text-align: left; }

/* ───────── Móvil ───────── */
@media (max-width: 899px) {
  .shell { display: block; }
  .side { display: none; }
  .main { padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 92px); }
  h1 { font-size: 25px; }
  .hero { margin-bottom: 16px; }
  .hero-actions { display: none; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .span-2 { grid-column: auto; }
  .card { padding: 16px; border-radius: 18px; }
  .input, .input.search { font-size: 16px; } /* evita el zoom de iOS */
  .stat-value { font-size: 23px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--hair);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0; text-decoration: none;
    font-size: 11px; font-weight: 600; color: var(--muted); position: relative;
  }
  .tabbar a span { font-size: 21px; line-height: 1.2; }
  .tabbar a.on { color: var(--ink); }
  .tabbar a.plus span {
    width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; margin-top: -18px;
    background: var(--ink); color: var(--page); font-size: 28px; font-weight: 400; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  }
  .tabbar .count { position: absolute; top: 0; right: calc(50% - 22px); font-size: 10px; padding: 0 5px; }
  .toasts { bottom: calc(env(safe-area-inset-bottom) + 92px); }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; width: 100%; max-height: 90vh; padding-bottom: env(safe-area-inset-bottom); }
  .link-row { flex-wrap: wrap; }
  .link-row .rel { width: 100%; margin-bottom: -6px; }
  .quick-expense { grid-template-columns: 1fr; }
  .demo-bar { font-size: 12.5px; }
}
