@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/poppins-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/poppins-latin-800-normal.woff2') format('woff2'); }
/* Friends — estilos (mobile-first)
   Paletas: indigo (por defecto), oceano, atardecer, grafito → atributo data-palette en <html>.
   Tema: claro / oscuro (manual) → atributo data-theme. */

:root {
  --bg: #F4F5FB;
  --surface: #FFFFFF;
  --surface-2: #EEF0F8;
  --ink: #14152B;
  --muted: #6B6F8A;
  --line: #E6E8F3;

  --primary: #5B5BF5;
  --primary-2: #9B5CF6;
  --primary-ink: #FFFFFF;
  --primary-soft: #ECECFF;
  --grad: linear-gradient(135deg, var(--primary), var(--primary-2));
  --glow1: rgba(155, 92, 246, .16);
  --glow2: rgba(91, 91, 245, .12);

  --away: #E5484D;
  --away-soft: #FDECEC;
  --visit: #10A37F;
  --host: #E8890C;
  --ok: #12A66B;
  --bad: #E5484D;
  --sun: #F5B942;
  --sun-soft: #FFF3D6;

  --shadow: 0 1px 2px rgba(20, 21, 43, .04), 0 8px 24px rgba(20, 21, 43, .06);
  --shadow-lg: 0 2px 6px rgba(20, 21, 43, .06), 0 18px 44px rgba(20, 21, 43, .12);
  --radius: 22px;
  --nav-h: 66px;
  color-scheme: light;
}

html[data-palette="oceano"] {
  --bg: #F0F7F9; --surface-2: #E8F1F4; --ink: #0B2530; --muted: #5E7782; --line: #DDEAEE;
  --primary: #0E8FB0; --primary-2: #14B8A6; --primary-soft: #DDF3F7;
  --glow1: rgba(20, 184, 166, .16); --glow2: rgba(14, 143, 176, .12);
}
html[data-palette="atardecer"] {
  --bg: #FFF7F2; --surface-2: #FBEEE7; --ink: #2A1710; --muted: #86635A; --line: #F4E3DA;
  --primary: #F2542D; --primary-2: #FF3D81; --primary-soft: #FFE9E1;
  --glow1: rgba(255, 61, 129, .13); --glow2: rgba(242, 84, 45, .13);
}
html[data-palette="grafito"] {
  --bg: #F5F5F6; --surface-2: #EDEDEF; --ink: #18181B; --muted: #71717A; --line: #E4E4E7;
  --primary: #18181B; --primary-2: #52525B; --primary-soft: #EBEBED;
  --glow1: rgba(0, 0, 0, .05); --glow2: rgba(0, 0, 0, .03);
}

html[data-theme="dark"] {
  --bg: #0E0F18; --surface: #171925; --surface-2: #20233A; --ink: #ECEEF8; --muted: #9A9EB8; --line: #272A3F;
  --primary: #7B7BFF; --primary-2: #B07CFF; --primary-soft: rgba(123, 123, 255, .16);
  --away-soft: rgba(229, 72, 77, .18); --sun-soft: rgba(245, 185, 66, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .4), 0 18px 44px rgba(0, 0, 0, .45);
  --glow1: rgba(155, 92, 246, .20); --glow2: rgba(91, 91, 245, .14);
  color-scheme: dark;
}
html[data-theme="dark"][data-palette="oceano"] { --bg: #0A1519; --surface: #112127; --surface-2: #17313A; --line: #1F3A44; --primary: #2BB6D6; --primary-2: #2DD4BF; --primary-soft: rgba(43, 182, 214, .16); --glow1: rgba(45, 212, 191, .16); --glow2: rgba(43, 182, 214, .12); }
html[data-theme="dark"][data-palette="atardecer"] { --bg: #170E0B; --surface: #22150F; --surface-2: #301E16; --line: #3A261C; --primary: #FF7A55; --primary-2: #FF5C9A; --primary-soft: rgba(255, 122, 85, .16); --glow1: rgba(255, 92, 154, .15); --glow2: rgba(255, 122, 85, .13); }
html[data-theme="dark"][data-palette="grafito"] { --bg: #0B0B0C; --surface: #151517; --surface-2: #1F1F22; --line: #2A2A2E; --primary: #F4F4F5; --primary-2: #A1A1AA; --primary-ink: #111113; --primary-soft: rgba(255, 255, 255, .09); --glow1: rgba(255, 255, 255, .05); --glow2: rgba(255, 255, 255, .03); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: "Poppins", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior: auto;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(520px 320px at 100% -4%, var(--glow1), transparent 70%), radial-gradient(460px 300px at -8% 6%, var(--glow2), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; transition: transform .15s ease, background-color .15s ease, box-shadow .2s ease, filter .15s ease, color .15s ease, opacity .15s ease, border-color .15s ease; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative; z-index: 1; }

/* ---------- barra superior ---------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top) + 20px) 20px 8px; }
.topbar h1 { font-size: 28px; line-height: 1.12; letter-spacing: -.025em; font-weight: 800; }
.topbar .sub { color: var(--muted); font-size: 15px; margin-top: 3px; font-weight: 500; }
.topbar .actions { display: flex; gap: 10px; flex-shrink: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 15px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-size: 18px; box-shadow: var(--shadow); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }

.view { padding: 8px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 110px); display: flex; flex-direction: column; gap: 14px; }
.view.enter > * { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.view.enter > *:nth-child(2) { animation-delay: .04s; } .view.enter > *:nth-child(3) { animation-delay: .08s; }
.view.enter > *:nth-child(4) { animation-delay: .12s; } .view.enter > *:nth-child(5) { animation-delay: .16s; }
.view.enter > *:nth-child(6) { animation-delay: .2s; } .view.enter > *:nth-child(n+7) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2 { font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin-bottom: 10px; }
.card.tap { cursor: pointer; width: 100%; text-align: left; display: block; }
.card.tap:active { transform: scale(.992); }
.section-title { font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 8px 4px 0; display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; font-size: 15px; }

.birthday-card { background: var(--grad); border: 0; color: #fff; display: flex; gap: 14px; align-items: center; }
.birthday-card .big { font-size: 20px; font-weight: 800; line-height: 1.2; }
.birthday-card .muted { color: rgba(255, 255, 255, .85); }
.nudge { display: flex; gap: 12px; align-items: center; background: var(--sun-soft); border: 1px solid color-mix(in srgb, var(--sun) 55%, transparent); border-radius: var(--radius); padding: 14px; }
.nudge .emoji { font-size: 30px; }
.nudge .txt { flex: 1; font-weight: 700; }
.nudge .txt small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }

.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--muted); font-size: 14px; }
.row .end { text-align: right; flex-shrink: 0; font-weight: 700; }

/* ---------- avatar ---------- */
.avatar { width: var(--s, 40px); height: var(--s, 40px); border-radius: 50%; background: var(--c, var(--primary)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: calc(var(--s, 40px) * .42); flex-shrink: 0; overflow: hidden; border: 2px solid var(--surface); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stack { display: flex; align-items: center; }
.stack .avatar { margin-left: -8px; }
.stack .avatar:first-child { margin-left: 0; }
.stack .avatar.st-declined { opacity: .35; }
.stack .avatar.st-accepted { box-shadow: 0 0 0 2px var(--ok); }

/* ---------- chips y botones ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--ink); border: 1px solid transparent; }
.chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.chip.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.chip.wait { background: var(--surface-2); color: var(--muted); }
.chip.sel { background: var(--grad); color: var(--primary-ink); }
button.chip { cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; padding: 13px 18px; font-weight: 800; background: var(--grad); color: var(--primary-ink); min-height: 50px; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.secondary { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.danger { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: none; }
.btn.small { min-height: 36px; padding: 7px 13px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.seg { display: flex; background: var(--surface-2); border-radius: 15px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 10px; border-radius: 12px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- navegación inferior (flotante) ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding: 0 12px calc(env(safe-area-inset-bottom) + 10px); pointer-events: none; }
.nav-in { pointer-events: auto; width: min(100%, 496px); height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.nav button .ic-wrap { width: 46px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background-color .2s ease, transform .2s ease; }
.nav button.on { color: var(--primary); }
.nav button.on .ic-wrap { background: var(--primary-soft); }
.nav button:active .ic-wrap { transform: scale(.9); }
.nav button.center .ic-wrap { width: 56px; height: 56px; border-radius: 50%; background: var(--grad); color: var(--primary-ink); margin-top: -26px; border: 4px solid var(--bg); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 42%, transparent); }
.nav button.center.on .ic-wrap { background: var(--grad); }

.fab { position: fixed; z-index: 15; right: max(18px, calc(50% - 260px + 18px)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); width: 58px; height: 58px; border-radius: 50%; background: var(--grad); color: var(--primary-ink); display: grid; place-items: center; box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 45%, transparent); }
.fab svg.i { width: 26px; height: 26px; stroke-width: 2.4; }
.fab:active { transform: scale(.93); }

/* ---------- calendario (franjas por semana) ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-head h2 { font-size: 21px; text-transform: none; letter-spacing: -.02em; color: var(--ink); margin: 0; font-weight: 800; }
.cal-head .nav-btns { display: flex; gap: 6px; }
.cal-head .icon-btn { width: 38px; height: 38px; font-size: 16px; border-radius: 12px; box-shadow: none; }
.cal-dows { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-top: 10px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--muted); font-weight: 800; padding: 6px 0; letter-spacing: .04em; }
.cal-weeks { display: flex; flex-direction: column; gap: 3px; }
.week { position: relative; }
.wk-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.day { position: relative; height: calc(36px + var(--lanes, 0) * 19px + 14px); min-height: 78px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; font-weight: 700; font-size: 14px; padding-top: 4px; overflow: hidden; }
.day.out { background: transparent; opacity: .45; }
.day .n { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; flex-shrink: 0; }
.day.today .n { background: var(--grad); color: var(--primary-ink); box-shadow: 0 4px 10px color-mix(in srgb, var(--primary) 40%, transparent); }
.day.special { background: var(--sun-soft); }
.day.special .n { color: #B07A00; }
html[data-theme="dark"] .day.special .n { color: var(--sun); }
.day .badge { position: absolute; top: 3px; right: 3px; font-size: 11px; line-height: 1; }
.day .more { position: absolute; right: 4px; bottom: 2px; font-size: 10px; font-weight: 800; color: var(--away); }
.wk-bars { position: absolute; left: 0; right: 0; top: 36px; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 17px; gap: 2px 3px; pointer-events: none; }
.seg-bar { display: block; border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 800; line-height: 17px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.seg-bar.away { background: var(--away); }
.seg-bar.visit { background: var(--visit); }
.seg-bar.host { background: var(--host); }
.seg-bar.plan { background: var(--grad); }
.seg-bar.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.seg-bar.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 6px 2px 0; align-items: center; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 3px; margin-right: 5px; }
.legend i.dotp { width: 8px; border-radius: 50%; background: var(--primary); }

/* ---------- planes ---------- */
.card.tap.event-card { display: flex; gap: 14px; align-items: center; transition: transform .2s ease, box-shadow .2s ease; }
.datebox { width: 56px; flex-shrink: 0; text-align: center; background: var(--grad); color: var(--primary-ink); border-radius: 16px; padding: 8px 0 7px; box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 28%, transparent); }
.datebox .d { font-size: 24px; font-weight: 800; line-height: 1; }
.datebox .m { font-size: 11px; font-weight: 800; letter-spacing: .06em; margin-top: 3px; opacity: .9; }
.datebox.special { background: linear-gradient(135deg, #F5B942, #F59E0B); color: #4A3200; box-shadow: 0 6px 14px rgba(245, 158, 11, .3); }

/* ---------- gastos ---------- */
.balance-card { text-align: center; background: var(--grad); color: #fff; border: 0; }
.balance-card .muted, .balance-card .small { color: rgba(255, 255, 255, .85); }
.balance-card .amt { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0 4px; }
.balance-card .amt.pos, .balance-card .amt.neg { color: #fff; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.pay-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; }
.pay-row + .pay-row { border-top: 1px solid var(--line); }
.pay-row .txt { flex: 1; min-width: 0; font-size: 15px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 800; padding: 4px 2px; }

/* ---------- asistente ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 11px 15px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; animation: rise .3s ease both; }
.bubble.bot { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; box-shadow: var(--shadow); }
.bubble.me { background: var(--grad); color: var(--primary-ink); border-bottom-right-radius: 6px; align-self: flex-end; }
.bubble.typing { color: var(--muted); letter-spacing: 3px; }
.draft { align-self: stretch; background: var(--surface); border: 2px solid var(--primary); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-lg); animation: rise .35s ease both; }
.draft .dt { font-size: 12px; letter-spacing: .08em; font-weight: 800; color: var(--primary); }
.draft .dtitle { font-size: 19px; font-weight: 800; }
.draft .line { display: flex; gap: 8px; align-items: baseline; }
.draft .line b { min-width: 74px; color: var(--muted); font-weight: 600; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions .chip { background: var(--surface); border-color: var(--line); }
.composer { position: fixed; left: 50%; transform: translateX(-50%); width: min(100%, 520px); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); padding: 10px 16px; display: flex; gap: 10px; z-index: 16; }
.composer input { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 18px; padding: 14px 18px; outline: none; min-width: 0; box-shadow: var(--shadow); }
.composer input:focus { border-color: var(--primary); }
.composer .send { width: 50px; height: 50px; border-radius: 17px; background: var(--grad); color: var(--primary-ink); font-size: 20px; flex-shrink: 0; box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 35%, transparent); }

/* ---------- hojas (sheets) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 12, 24, .5); backdrop-filter: blur(3px); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { position: relative; width: min(100%, 520px); max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 30px 30px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 24px); animation: up .25s cubic-bezier(.2, .8, .2, 1); }
.sheet.full { min-height: 92dvh; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet .sheet-x { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 15px; display: grid; place-items: center; }
.sheet .sheet-x:hover { background: var(--line); }
.sheet h2 { font-size: 23px; letter-spacing: -.02em; margin-bottom: 4px; padding-right: 40px; font-weight: 800; }
.sheet .body { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; outline: none; width: 100%; min-height: 48px; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--bg); }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.split-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.split-row .nm { flex: 1; font-weight: 600; }
.split-row input[type="number"], .split-row input[type="text"] { width: 96px; text-align: right; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; }
form[data-mode="equal"] .split-row .w { display: none; }
.split-row .calc { width: 80px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--muted); }
.err { color: var(--bad); font-weight: 700; font-size: 14px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 15px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; text-align: left; width: 100%; }
.menu-item .ic { font-size: 24px; }

.palettes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.palette { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; text-align: left; }
.palette i { width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; }
.palette.on { border-color: var(--primary); }

.medal { width: 28px; text-align: center; font-size: 20px; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 4px; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; padding: 28px; text-align: center; }
.login img.logo { width: 110px; height: 110px; border-radius: 28px; box-shadow: var(--shadow-lg); }
.login h1 { font-size: 30px; line-height: 1.1; letter-spacing: -.03em; font-weight: 800; }
.login form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.demo-note { background: var(--sun-soft); border: 1px solid color-mix(in srgb, var(--sun) 55%, transparent); border-radius: 14px; padding: 10px 12px; font-size: 14px; text-align: left; width: 100%; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 96px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-weight: 700; z-index: 60; max-width: 90%; text-align: center; box-shadow: var(--shadow-lg); animation: fade .15s ease; }
.splash { min-height: 100dvh; display: grid; place-items: center; }
.splash img { width: 96px; animation: pop 1.1s ease-in-out infinite alternate; }
@keyframes pop { to { transform: scale(1.08) rotate(-3deg); } }

/* ---------- clima / horas y avisos discretos ---------- */
.strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; width: 100%; padding: 9px 14px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); font-size: 13px; color: var(--muted); text-align: left; }
.strip b { color: var(--ink); font-weight: 800; }
.strip .clocks { margin-left: auto; }
.slim { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--ink); text-align: left; }
.slim .chev { margin-left: auto; color: var(--muted); }

/* ---------- hovers (solo con ratón) ---------- */
@media (hover: hover) {
  .card.tap:hover, .event-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
  .btn.secondary:hover, .btn.danger:hover, .btn.ghost:hover { filter: none; background: var(--line); }
  .icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
  .chip:hover { filter: brightness(.97); transform: translateY(-1px); }
  .nav button:hover .ic-wrap { background: var(--primary-soft); transform: translateY(-1px); }
  .nav button.center:hover .ic-wrap { transform: translateY(-3px) scale(1.04); background: var(--grad); }
  .fab:hover { transform: translateY(-2px) scale(1.05); }
  .slim:hover, .strip:hover, .menu-item:hover, .palette:hover { border-color: var(--primary); }
  .row:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
  .seg button:hover:not(.on) { color: var(--ink); }
  .swatch:hover { transform: scale(1.1); }
  .day:hover:not(.out) { background: var(--primary-soft); transform: translateY(-1px); }
}

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

@media (min-width: 900px) {
  body { background: color-mix(in srgb, var(--bg) 85%, var(--ink) 3%); }
}

/* ---------- acompañante ---------- */
.tip { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); border-radius: var(--radius); padding: 13px 14px; }
.tip .emoji { font-size: 26px; }
.tip .txt { flex: 1; font-weight: 700; font-size: 15px; }
.tip .txt small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; font-size: 13px; }
button.tip:hover { border-color: var(--primary); }

/* ---------- ajustes ---------- */
.set-hero { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; }
.set-hero .grow { flex: 1; min-width: 0; }
.set-name { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.set-group { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.set-gt { font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 8px 10px 4px; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px; border-radius: 16px; }
.set-row:hover, .set-person:hover { background: var(--primary-soft); }
.set-ic { width: 40px; height: 40px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.set-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-tx b { font-weight: 800; }
.set-tx small { color: var(--muted); font-size: 13px; }
.set-val { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.set-chev { color: var(--muted); display: grid; place-items: center; }
.set-chev svg.i { width: 18px; height: 18px; }
.set-out { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border-radius: 16px; color: var(--bad); font-weight: 800; background: color-mix(in srgb, var(--bad) 10%, transparent); }
.set-out svg.i { width: 20px; height: 20px; }
.locked { display: flex; align-items: center; gap: 8px; border: 1px dashed var(--line); background: var(--surface-2); border-radius: 14px; padding: 12px 14px; color: var(--muted); font-weight: 600; min-height: 48px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.set-person { border-radius: 14px; padding-left: 4px; padding-right: 4px; }

/* ---------- gastos ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { flex-shrink: 0; white-space: nowrap; background: var(--surface); border-color: var(--line); }
.filters .chip.sel { background: var(--grad); border-color: transparent; }
.card.tap.exp { display: flex; align-items: center; gap: 12px; }
.exp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.exp-desc { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.exp-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.exp-meta .avatar { border-width: 1px; }
.exp-tag { font-size: 12px; padding: 3px 9px; background: var(--primary-soft); color: var(--primary); }
.exp-amt { font-size: 18px; font-weight: 800; white-space: nowrap; }
.step { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--grad); color: var(--primary-ink); display: grid; place-items: center; font-size: 13px; font-weight: 800; }

/* ---------- gastos v2 ---------- */
.exp-desc .exp-tag { display: inline-block; margin-left: 6px; vertical-align: 1px; }
.pay-done { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.pay-done .exp-main { flex: 1; min-width: 0; }
.pay-done .exp-amt { color: var(--ok); }
details.more { margin: 4px 0 12px; }
details.more > summary { cursor: pointer; font-weight: 700; color: var(--primary); font-size: 14px; padding: 6px 0; }
details.more .seg { margin-top: 8px; }

.field[hidden] { display: none; }
.field .split-row input[type="checkbox"], .split-row input[type="checkbox"] { width: 22px; min-height: 0; height: 22px; padding: 0; flex: none; accent-color: var(--primary); }
.field .split-row input[type="number"] { width: 96px; min-height: 0; }
.split-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 14px; }

.strip .clocks { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.strip .clocks .trip { font-size: 12.5px; }
.gtabs { margin-bottom: 14px; }
.sum-row { display: flex; justify-content: space-around; text-align: center; margin: 4px 0 2px; }
.sum-row div { display: flex; flex-direction: column; gap: 2px; } .sum-row b { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.day-head { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 20px 4px 10px; }

/* ---------- chat del asistente (v2) ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.msg { display: flex; align-items: flex-end; gap: 8px; animation: rise .3s ease both; }
.msg.me { justify-content: flex-end; }
.bot-av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--grad); color: var(--primary-ink); box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.bot-av .i { width: 16px; height: 16px; }
.bubble { max-width: 82%; padding: 11px 16px; border-radius: 22px; word-wrap: break-word; white-space: normal; animation: none; font-size: 15px; line-height: 1.5; }
.bubble.bot { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 8px; box-shadow: var(--shadow); }
.bubble.me { background: var(--grad); color: var(--primary-ink); border-bottom-right-radius: 8px; box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 28%, transparent); white-space: pre-wrap; }
.bubble .li { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; }
.bubble .li i { width: 7px; height: 7px; border-radius: 50%; background: var(--grad); flex: none; transform: translateY(-1px); }
.bubble.typing { display: inline-flex; gap: 5px; padding: 15px 18px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); opacity: .35; animation: dot 1.1s ease-in-out infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .18s; } .bubble.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .3; } 40% { transform: translateY(-4px); opacity: 1; } }
.welcome { text-align: center; padding: 18px 4px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.welcome .orb { width: 74px; height: 74px; border-radius: 26px; display: grid; place-items: center; background: var(--grad); color: var(--primary-ink); box-shadow: 0 18px 40px color-mix(in srgb, var(--primary) 40%, transparent); animation: orb 4s ease-in-out infinite; margin-bottom: 8px; }
.welcome .orb .i { width: 36px; height: 36px; }
@keyframes orb { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.welcome h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); text-transform: none; }
.welcome p { margin: 0 8px 12px; color: var(--muted); font-size: 14px; }
.welcome .suggestions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.sugg { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 13px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; color: var(--ink); }
.sugg .e { font-size: 20px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); flex: none; }
.composer { padding: 10px 14px; }
.cmp-in { flex: 1; display: flex; align-items: flex-end; gap: 8px; background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 28px; padding: 6px 6px 6px 18px; box-shadow: var(--shadow-lg); }
.cmp-in:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent), var(--shadow-lg); }
.cmp-in textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; font: inherit; font-size: 15px; color: var(--ink); padding: 9px 0; max-height: 130px; line-height: 1.4; }
.cmp-in textarea::placeholder { color: var(--muted); opacity: .8; }
.composer .send { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 38%, transparent); }
.composer .send .i { width: 19px; height: 19px; }
.menu-item.hl { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.menu-item.hl .ic { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--primary) 60%, transparent)); }

/* ---------- formulario de gasto al estilo Tricount ---------- */
.tc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2px 16px; margin-bottom: 4px; }
.tc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; font-weight: 600; }
.tc-row + .tc-row { border-top: 1px solid var(--line); }
.tc-row select, .tc-row input[type="date"] { border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--primary); text-align: right; outline: 0; max-width: 60%; }
.tc-h { font-size: 12px; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 8px 2px -2px; }
.split-row.all { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 2px; font-weight: 700; }

/* chat: botón de nueva conversación */
.chat-tools { position: static; display: flex; justify-content: center; margin-bottom: 10px; pointer-events: none; }
.chat-reset { pointer-events: auto; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); color: var(--muted); font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow); }
.chat-reset .i { width: 15px; height: 15px; }
.chat-reset:active { transform: scale(.97); }

/* "Pagado por": desplegable propio, siempre hacia abajo */
.tc-pick { position: relative; }
.tc-pick-btn { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--primary); font-size: inherit; padding: 4px 0; }
.tc-pick-btn .i { width: 16px; height: 16px; }
.pick-list { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 210px; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.pick-list.hidden { display: none; }
.pick-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 11px; text-align: left; font-weight: 600; color: var(--ink); }
.pick-item:hover { background: var(--surface-2); }
.pick-item.on { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }

/* ---------- campo de fecha + calendario propio ---------- */
.dfield { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; font-weight: 600; text-align: left; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.dfield:focus-visible, .dfield:hover { border-color: var(--primary); }
.dfield .i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.dfield .dv.ph { color: var(--muted); font-weight: 500; }
.dfield.plain { width: auto; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--primary); font-weight: 700; }
.dfield.plain .i { color: var(--primary); }
.dp-ov { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.dp-scrim { position: absolute; inset: 0; background: rgba(8, 10, 20, .55); backdrop-filter: blur(3px); }
.dp-card { position: relative; width: min(100%, 400px); background: var(--surface); border: 1px solid var(--line); border-radius: 26px 26px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -20px 50px rgba(0,0,0,.35); animation: dp-up .22s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 560px) { .dp-ov { align-items: center; } .dp-card { border-radius: 26px; padding-bottom: 18px; } }
@keyframes dp-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.dp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-top b { font-size: 15px; }
.dp-x { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.dp-quick { display: flex; gap: 8px; margin-bottom: 8px; }
.dp-nav { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 6px; }
.dp-nav span { font-weight: 700; font-size: 16px; text-transform: none; }
.dp-nav .icon-btn[disabled] { opacity: .3; }
.dp-dow, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dp-dow span { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 0; }
.dp-grid { row-gap: 2px; }
.dp-grid i { display: block; }
.dp-d { height: 42px; font-weight: 600; font-size: 15px; color: var(--ink); border-radius: 14px; position: relative; font-variant-numeric: tabular-nums; }
.dp-d:hover:not([disabled]):not(.sel) { background: var(--surface-2); }
.dp-d[disabled] { color: var(--muted); opacity: .35; cursor: default; }
.dp-d.today:not(.sel)::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--primary); }
.dp-d.sel { background: var(--grad); color: var(--primary-ink, #fff); font-weight: 800; box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.dp-d.in { background: color-mix(in srgb, var(--primary) 16%, transparent); border-radius: 0; }
.dp-d.rs { border-top-right-radius: 14px; border-bottom-right-radius: 14px; }
.dp-d.re { border-top-left-radius: 14px; border-bottom-left-radius: 14px; }
.dp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; min-height: 40px; }
.dp-sum { flex: 1; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dp-link { color: var(--primary); font-weight: 700; padding: 8px 4px; }

/* planes de "mis amigos", candado y Evento Heteropatriarcal */
.event-card.ghost { opacity: 1; background: transparent; border: 1.5px dashed var(--line); box-shadow: none; }
.event-card.ghost .datebox { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.event-card.ghost .datebox .d, .event-card.ghost .datebox .m { color: var(--muted); }
.kicker { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.seg-bar.ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.lock { font-size: .85em; }
.chip.hetero { display: inline-flex; margin-bottom: 8px; background: color-mix(in srgb, var(--sun) 22%, transparent); border-color: var(--sun); font-weight: 700; }
.chip.hetero.sel { background: var(--sun); color: #3b2a00; }
.split-row.priv { padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); align-items: flex-start; }
.seg.sub { padding: 3px; }
.seg.sub button { font-size: 13px; padding: 8px 4px; }

/* ======================= v0.8 · estructura (móvil: idéntico a antes) ======================= */
.cal-layout, .cal-main, .cal-side, .cal-blk { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cols, .col { display: contents; }
.strip { order: -1; }
.bd-next { order: 9; }
.grid-list { display: flex; flex-direction: column; gap: 14px; }
.side-brand, .side-toggle { display: none; }

/* ======================= v0.8 · escritorio (≥1024px): menú lateral + espacios amplios ======================= */
@media (min-width: 1024px) {
  :root { --side-w: 248px; }
  #app[data-side="collapsed"] { --side-w: 84px; }
  body { background: var(--bg); }
  #app[data-tab] { max-width: none; margin: 0; padding-left: var(--side-w); transition: padding-left .25s cubic-bezier(.2, .8, .2, 1); }
  .login { max-width: 420px; margin: 0 auto; }

  /* menú lateral */
  .nav { position: fixed; inset: 0 auto 0 0; width: var(--side-w); display: block; padding: 0; z-index: 30; pointer-events: auto; transition: width .25s cubic-bezier(.2, .8, .2, 1); }
  .nav-in { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 6px; padding: 22px 14px 18px; background: var(--surface); border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: hidden; }
  .side-brand { display: flex; align-items: center; gap: 12px; padding: 2px 4px 20px 6px; margin-bottom: 4px; font-weight: 800; font-size: 19px; line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; }
  .side-brand span { flex: 1; min-width: 0; }
  .side-brand img { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; }
  .nav button { flex-direction: row; justify-content: flex-start; gap: 14px; height: 48px; padding: 0 12px; border-radius: 14px; font-size: 15px; font-weight: 700; color: var(--muted); white-space: nowrap; text-align: left; transition: background-color .15s ease, color .15s ease; }
  .nav button .ic-wrap { width: 26px; height: 26px; border-radius: 0; background: none !important; flex-shrink: 0; }
  .nav button .ic-wrap svg.i { width: 22px; height: 22px; }
  .nav button:hover { background: var(--surface-2); color: var(--ink); }
  .nav button:hover .ic-wrap, .nav button.center:hover .ic-wrap { transform: none; background: none; }
  .nav button.on { background: var(--primary-soft); color: var(--primary); }
  .nav button.center .ic-wrap { width: 26px; height: 26px; margin: 0; border: 0; box-shadow: none; background: none; color: inherit; border-radius: 0; }
  .nav button.center:not(.on) .ic-wrap { color: var(--primary); }
  .nav button.side-toggle { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; flex-shrink: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink); }
  .nav button.side-toggle:hover { background: var(--line); }
  .nav button.side-toggle svg.i { width: 19px; height: 19px; }

  #app[data-side="collapsed"] .side-brand span,
  #app[data-side="collapsed"] .nav button .lbl { display: none; }
  #app[data-side="collapsed"] .nav button { justify-content: center; padding: 0; }
  #app[data-side="collapsed"] .side-brand { flex-direction: column; justify-content: center; gap: 14px; padding: 2px 0 18px; }

  /* contenido */
  .topbar { max-width: 1320px; margin: 0 auto; padding: 32px 40px 10px; }
  .topbar h1 { font-size: 32px; }
  .view { max-width: 1320px; margin: 0 auto; padding: 10px 40px 56px; gap: 18px; }
  #app[data-tab="gastos"] .topbar, #app[data-tab="gastos"] .view { max-width: 920px; }
  #app[data-tab="asistente"] .topbar, #app[data-tab="asistente"] .view { max-width: 860px; }

  /* inicio: dos columnas */
  .cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .strip, .bd-next { order: 0; }
  .view { padding-bottom: 120px; }
  /* clima + horas como tarjeta propia */
  .strip { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 22px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); font-size: 14px; }
  .strip .wx { font-size: 22px; color: var(--ink); font-weight: 600; }
  .strip .wx b { font-size: 34px; letter-spacing: -.03em; margin-right: 4px; vertical-align: -3px; }
  .strip .clocks { margin-left: 0; align-items: flex-start; width: 100%; font-size: 14px; }
  .strip .wx + .clocks { padding-top: 12px; border-top: 1px solid var(--line); }
  .strip .clocks .trip { font-size: 13px; }

  /* calendario: mes grande + panel lateral */
  .cal-layout { gap: 26px; }
  .cal-main .card { padding: 22px 22px 18px; }
  .cal-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px 28px; align-items: start; }
  .cal-head h2 { font-size: 26px; }
  .cal-dows, .wk-days, .wk-bars { gap: 5px; }
  .cal-weeks { gap: 5px; }
  .cal-dow { font-size: 12px; padding: 10px 0 6px; }
  .day { height: calc(40px + var(--lanes, 0) * 22px + 14px); min-height: 104px; border-radius: 14px; font-size: 15px; padding-top: 6px; }
  .wk-bars { top: 40px; grid-auto-rows: 19px; gap: 3px 5px; }
  .seg-bar { font-size: 12px; line-height: 19px; padding: 0 8px; }

  /* planes: grilla */
  .grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; align-items: stretch; }
  .grid-list > .section-title, .grid-list > .empty { grid-column: 1 / -1; }

  /* asistente */
  .composer { left: calc(50% + var(--side-w) / 2); width: min(calc(100% - var(--side-w) - 80px), 780px); bottom: 22px; padding: 0; }
  .toast { left: calc(50% + var(--side-w) / 2); bottom: 32px; }

  /* botón + */
  .fab { right: 40px; bottom: 36px; }

  /* ventanas: modal centrado en vez de hoja inferior */
  .overlay { align-items: center; }
  .sheet { width: min(100%, 600px); max-height: 88vh; border-radius: 28px; padding: 14px 26px 28px; box-shadow: var(--shadow-lg); animation: fade .2s ease; }
  .sheet.full { min-height: 0; }
  .sheet .grab { display: none; }
}

@media (min-width: 1500px) {
  .topbar, .view { max-width: 1440px; }
}

/* enlace a Maps */
.maplink { color: var(--primary); font-weight: 700; text-decoration: none; }
.maplink:hover { text-decoration: underline; }
.maplink .small { font-weight: 500; color: var(--muted); }

/* ---------- carga rápida de gastos dentro del plan ---------- */
.quick-exp { display: flex; flex-direction: column; gap: 10px; }
.qe-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; }
.qe-row input { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 12px 14px; outline: none; min-width: 0; min-height: 48px; }
.qe-row input:focus { border-color: var(--primary); }
.qe-row input[name="amount"] { text-align: right; font-weight: 700; }
.qe-meta { display: flex; flex-direction: column; gap: 6px; }
.qe-meta .tc-row { padding: 4px 0; }
.qe-split { display: flex; flex-direction: column; gap: 8px; }
.more-opts { align-self: flex-start; color: var(--primary); font-weight: 700; font-size: 13px; padding: 2px 0; }
@media (max-width: 520px) { .qe-row { grid-template-columns: 1fr 104px; } .qe-row .btn { grid-column: 1 / -1; } }

/* ---------- ausencias en tonos suaves (los planes siguen siendo lo protagonista) ---------- */
.seg-bar.away, .seg-bar.visit, .seg-bar.host { font-weight: 700; border-radius: 7px; }
.seg-bar.away  { background: color-mix(in srgb, var(--away) 17%, transparent); color: color-mix(in srgb, var(--away) 70%, var(--ink)); box-shadow: inset 3px 0 0 var(--away); }
.seg-bar.visit { background: color-mix(in srgb, var(--visit) 17%, transparent); color: color-mix(in srgb, var(--visit) 70%, var(--ink)); box-shadow: inset 3px 0 0 var(--visit); }
.seg-bar.host  { background: color-mix(in srgb, var(--host) 19%, transparent); color: color-mix(in srgb, var(--host) 68%, var(--ink)); box-shadow: inset 3px 0 0 var(--host); }
.seg-bar.away.cl, .seg-bar.visit.cl, .seg-bar.host.cl { box-shadow: none; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.seg-bar.away.cr, .seg-bar.visit.cr, .seg-bar.host.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* tarjeta de plan en el chat */
.av-gap { width: 36px; flex: none; }
.evcard { display: block; width: min(100%, 460px); text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); color: inherit; }
.ec-top { display: flex; gap: 12px; align-items: center; }
.ec-date { flex: none; min-width: 52px; text-align: center; padding: 8px 6px; border-radius: 14px; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); font-size: 13px; line-height: 1.1; }
.ec-title { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.ec-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ec-place { margin-top: 10px; font-size: 13.5px; }
.ec-grp { margin-top: 14px; }
.ec-h { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.ec-h b { background: color-mix(in srgb, var(--muted) 18%, transparent); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.ec-ppl { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.ec-p { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--surface-2, color-mix(in srgb, var(--muted) 10%, transparent)); }
.ec-p small { font-size: 12.5px; font-weight: 600; }
.ec-grp.bad .ec-p { opacity: .6; }
.ec-more { margin-top: 14px; font-size: 12.5px; font-weight: 700; color: var(--primary); }

/* títulos de sección más presentes */
.section-title { font-size: 17px; letter-spacing: -.01em; color: var(--ink); font-weight: 800; padding: 12px 4px 2px; }
.section-title .btn { font-size: 13px; }
.bd-next h2 { font-size: 16px; letter-spacing: -.01em; color: var(--ink); font-weight: 800; margin-bottom: 12px; }
.bd-next h2 .i { width: 18px !important; height: 18px !important; color: var(--primary); }

/* la copa del ranking, bien visible */
.trophy-btn { background: linear-gradient(135deg, #FFD36B, #FF9F1C); border-color: transparent; color: #4A2B00; box-shadow: 0 8px 20px rgba(255, 159, 28, .42), inset 0 1px 0 rgba(255,255,255,.5); }
.trophy-btn .i { width: 22px; height: 22px; }
.trophy-btn .tl { display: none; font-weight: 800; font-size: 14px; }
.trophy-btn:hover { box-shadow: 0 10px 26px rgba(255, 159, 28, .55); }
@media (min-width: 1024px) {
  .trophy-btn { width: auto; padding: 0 16px 0 14px; gap: 8px; display: inline-flex; align-items: center; }
  .trophy-btn .tl { display: inline; }
}

/* galería de fotos del plan */
.ph-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
@media (min-width: 1024px) { .ph-grid { grid-template-columns: repeat(4, 1fr); } }
.ph-grid .ph { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--muted) 14%, transparent); padding: 0; border: 0; position: relative; }
.ph-grid .ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.ph-grid .ph:hover img { transform: scale(1.04); }
.ph-add { cursor: pointer; text-align: center; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(8, 9, 20, .94); display: flex; flex-direction: column; animation: rise .2s ease both; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 56px 12px 8px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.lb-wait { color: #fff; opacity: .7; }
.lb-x { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px 22px; color: #fff; font-size: 13px; }

/* sin zoom con los dedos ni doble toque */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
@media (max-width: 1023px) {
  /* iOS hace zoom solo al enfocar un campo con letra menor a 16px */
  input, select, textarea, .field input, .field select, .field textarea, .cmp-in textarea { font-size: 16px; }
}

/* el ranking mantiene siempre el mismo alto, tenga 2 o 10 filas */
.rank-card { min-height: min(600px, 62dvh); }

/* botón de dictado */
.composer .mic { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: transparent; color: var(--muted); align-self: flex-end; margin-bottom: 2px; transition: background-color .15s ease, color .15s ease; }
.composer .mic .i { width: 20px; height: 20px; }
.composer .mic:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.composer .mic.rec { background: #ef4444; color: #fff; animation: micpulse 1.1s ease-in-out infinite; }
.composer .mic.busy { opacity: .5; pointer-events: none; animation: micpulse 1.4s ease-in-out infinite; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 50% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); } }

/* el contenido no se mete debajo de la barra de estado (hora, batería) del celular */
.status-fill { position: fixed; top: 0; left: 0; right: 0; height: constant(safe-area-inset-top); height: env(safe-area-inset-top); background: var(--bg); z-index: 60; pointer-events: none; }
/* menos aire de sobra al final de cada pantalla */
.view { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 76px); }
@media (min-width: 1024px) { .view { padding-bottom: 80px; } }

/* Asistente en el celular: pantalla fija, solo se desplaza la conversación; el campo queda pegado al teclado */
@media (max-width: 1023px) {
  html.chat-lock, html.chat-lock body { overflow: hidden; height: 100%; overscroll-behavior: none; }
  html.chat-lock #app { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); min-height: 0; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }
  html.chat-lock .topbar { flex: none; }
  html.chat-lock .view { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: 12px; }
  html.chat-lock .composer { position: relative; left: auto; bottom: auto; transform: none; width: 100%; flex: none; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); }
  html.chat-lock.kb-open .composer { padding-bottom: 10px; }
  html.chat-lock.kb-open .nav { display: none; }
}
html.chat-lock .composer { box-sizing: border-box; }
.cmp-in { min-width: 0; } .cmp-in textarea { width: 100%; min-width: 0; }

/* franja de la hora: se funde con el fondo en vez de cortar el degradado */
.status-fill { background: var(--bg); }
.status-fill::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 14px; background: linear-gradient(var(--bg), transparent); pointer-events: none; }
/* con el teclado abierto el asistente se compacta para que entre más conversación */
@media (max-width: 1023px) {
  html.chat-lock.kb-open .topbar { padding-top: calc(env(safe-area-inset-top) + 2px); padding-bottom: 0; }
  html.chat-lock.kb-open .topbar h1 { font-size: 22px; }
  html.chat-lock.kb-open .topbar .icon-btn { width: 36px; height: 36px; }
  html.chat-lock.kb-open .chat-tools { display: none; }
  html.chat-lock.kb-open .welcome .orb, html.chat-lock.kb-open .welcome > p, html.chat-lock.kb-open .welcome .suggestions { display: none; }
  html.chat-lock.kb-open .composer { padding: 6px 12px 8px; }
}

.day.hol .n { color: #D64545; font-weight: 800; }
html[data-theme="dark"] .day.hol .n { color: #FF8A8A; }
.link-more { display:block; margin:10px auto 0; background:none; border:0; color:var(--primary); font:inherit; font-size:13px; font-weight:700; padding:8px 12px; cursor:pointer; }

html, body, button, a, input, textarea { touch-action: manipulation; }
@media (max-width: 1023px) {
  .cmp-in { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
  .composer, .cmp-in { will-change: auto; }
}
.legend b { margin-right: 5px; }

/* Formularios en hojas: nada puede ensanchar la hoja (iPhone) */
.sheet { overflow-x: hidden; max-width: 100vw; }
.sheet .body > *, .sheet .field, .sheet .field-row > * { min-width: 0; max-width: 100%; }
.sheet .dfield { box-sizing: border-box; }
.field select.time-sel { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; height: 48px; padding-right: 34px; font-weight: 600; color: var(--ink);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8aa3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }

/* Hojas fijas: el fondo no se mueve ni rebota mientras hay un formulario abierto */
html.sheet-open, html.sheet-open body, html.sheet-open #app { overflow: hidden; overscroll-behavior: none; }
.overlay { overscroll-behavior: none; }
.sheet { max-height: 94%; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.sheet.full { min-height: 0; height: 94%; }
input[type="hidden"], .field input[type="hidden"] { display: none !important; }

.cal-weeks { touch-action: pan-y; will-change: transform; }
.cal-weeks.in-next { animation: cal-in-next .22s ease-out; }
.cal-weeks.in-prev { animation: cal-in-prev .22s ease-out; }
@keyframes cal-in-next { from { transform: translateX(46px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cal-in-prev { from { transform: translateX(-46px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Carteles de Inicio */
.tip { position: relative; }
.tip .tip-x { flex: none; align-self: flex-start; width: 28px; height: 28px; margin: -6px -6px 0 0; border-radius: 50%; color: var(--muted); font-size: 14px; line-height: 1; display: grid; place-items: center; }
.tip .tip-x:active { background: color-mix(in srgb, var(--text) 10%, transparent); }
.tip.cartel { background: color-mix(in srgb, var(--accent, var(--primary)) 14%, var(--surface, #fff)); }
.tip-extra { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.nf-pill { display: inline-flex; align-items: center; gap: 6px; background: #0e1e25; color: #fff; font-weight: 500; font-size: 12px; padding: 7px 12px 7px 9px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.nf-pill svg { width: 14px; height: 14px; fill: #2fd6c2; flex: none; }
.nf-pill b { font-weight: 700; }
.nf-hide { background: #0e1e25; color: #fff; font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 999px; position: relative; }
.nf-hide::before { content: "👆"; position: absolute; right: -4px; bottom: -14px; font-size: 16px; }
input.sw { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 35%, transparent); position: relative; flex: none; transition: background .15s; }
input.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
input.sw:checked { background: var(--primary); }
input.sw:checked::after { transform: translateX(18px); }

/* Hora (mismo estilo que el selector de fecha) */
.tp-lab { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 2px 6px; }
.tp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.tp-b { height: 40px; border-radius: 12px; font-weight: 700; font-size: 14px; background: var(--surface-2); color: var(--ink); font-variant-numeric: tabular-nums; }
.tp-b.sel { background: var(--grad); color: var(--primary-ink, #fff); box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 30%, transparent); }
.dp-foot .btn[disabled] { opacity: .4; }

/* Planes abiertos, quizá, avisos de conflicto */
.ev-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.open-tag { display: inline-block; vertical-align: 2px; margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 10.5px; font-weight: 700; }
.join-pill { display: inline-block; flex: none; padding: 7px 14px; border-radius: 999px; background: var(--grad); color: var(--primary-ink, #fff); font-size: 13px; font-weight: 800; text-transform: none; letter-spacing: 0; cursor: pointer; }
.stack .avatar.st-maybe { box-shadow: 0 0 0 2px var(--sun, #f5a524); }
.conflicts:empty { display: none; }
.conf-box { background: color-mix(in srgb, var(--sun, #f5a524) 14%, transparent); border: 1px solid color-mix(in srgb, var(--sun, #f5a524) 45%, transparent); border-radius: 14px; padding: 10px 12px; margin: 10px 0; font-size: 13.5px; }
.conf-row { padding: 2px 0; font-weight: 600; }
.conf-row.soft { font-weight: 500; color: var(--muted); }
.conf-ask { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.rank-card .empty { display: grid; place-items: center; min-height: min(560px, 58dvh); text-align: center; }

/* contenido que pasa por detrás de la barra: difuminado suave */
.nav::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom) + 34px); background: linear-gradient(to top, color-mix(in srgb, var(--bg) 92%, transparent) 30%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); -webkit-mask-image: linear-gradient(to top, #000 55%, transparent); mask-image: linear-gradient(to top, #000 55%, transparent); pointer-events: none; }
.nav-in { position: relative; }
.event-card.ghost .datebox, .event-card.ghost .title, .event-card.ghost .meta, .event-card.ghost .kicker, .event-card.ghost .stack { opacity: .78; }

.gal h2 { margin-bottom: 8px; }
.ph-grid { grid-template-columns: repeat(3, 1fr); }
.ph-grid .ph.big { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.ph-grid .ph.solo { grid-column: 1 / -1; aspect-ratio: 16 / 10; border-radius: 16px; }
.ph-by { position: absolute; left: 6px; bottom: 6px; display: block; line-height: 0; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.gal-empty { text-align: center; padding: 14px 8px 16px; }
.gal-ic { font-size: 30px; }
.gal-t { font-weight: 800; margin: 4px 0 2px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 30px; line-height: 1; padding-bottom: 4px; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }
.card .gal-empty { display: block; text-align: center; }
.card .gal-empty > div { text-align: center; }
