/* MYGESTOR v2 · estilos. Tokens de color por tema (azul noche + turquesa). Móvil primero (360–430 px). */
@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071321; --surface: #101F32; --surface2: #172A40; --line: #2A4260; --ctl: #6C87A8; --text: #F3F7FC; --text2: #B7C7DA;
  --accent: #2DE2DB; --on-accent: #04292B; --accent-soft: rgba(45, 226, 219, .14);
  --agenda: #C4A5FF; --fin: #64E5B2; --dep: #68BDFF; --lec: #FFC779; --err: #FF9B96; --ok: #64E5B2; --warn: #FFC779;
  --glow: 0 0 0 1px rgba(45, 226, 219, .35), 0 0 18px rgba(45, 226, 219, .35);
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --sky1: #0A1B31; --sky2: #123456; --sky3: #1F6F7C; --hill1: #0B2238; --hill2: #08192B; --sun: #2DE2DB;
  --focus: #FFFFFF;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F4F7FA; --surface: #FFFFFF; --surface2: #EAF0F6; --line: #C3CFDB; --ctl: #6B7F94; --text: #112237; --text2: #42566A;
  --accent: #006E71; --on-accent: #FFFFFF; --accent-soft: rgba(0, 110, 113, .10);
  --agenda: #5B3FA8; --fin: #0A6847; --dep: #0A5A96; --lec: #86500A; --err: #B3261E; --ok: #0A6847; --warn: #86500A;
  --glow: 0 0 0 1px rgba(0, 110, 113, .25); --shadow: 0 8px 24px rgba(17, 34, 55, .18);
  --sky1: #CFE8F2; --sky2: #E8F3F0; --sky3: #FBE7C9; --hill1: #7FB6B4; --hill2: #4E8F92; --sun: #E9A34B;
  --focus: #112237;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 400 16px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
.small { font-size: 14px; } .tiny { font-size: 13px; }
.muted { color: var(--text2); }
.num { font-variant-numeric: tabular-nums; }
.bold { font-weight: 650; }

/* ───── Estructura ───── */
#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; position: relative; }
.top { position: relative; padding: 16px 16px 20px; padding-top: max(16px, env(safe-area-inset-top)); overflow: hidden; background: linear-gradient(180deg, var(--sky1), var(--sky2) 60%, var(--sky3)); border-radius: 0 0 24px 24px; min-height: 124px; }
.top svg.land { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 64px; pointer-events: none; }
.top > *:not(.land) { position: relative; z-index: 1; }
.top .brand { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.top .logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .06em; font-size: 13px; color: var(--text); }
.top .logo i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-style: normal; font-weight: 800; box-shadow: var(--glow); }
:root[data-theme="light"] .top h1, :root[data-theme="light"] .top .muted, :root[data-theme="light"] .top .logo { color: #112237; }
:root[data-theme="light"] .top .muted { color: #2E4357; }
main { flex: 1; padding: 16px 16px 120px; display: flex; flex-direction: column; gap: 16px; }
.view-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

nav.bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; background: var(--surface); border-top: 1px solid var(--line); display: grid; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
nav.bar.five { grid-template-columns: repeat(5, 1fr); } nav.bar.four { grid-template-columns: repeat(4, 1fr); } nav.bar.three { grid-template-columns: repeat(3, 1fr); }
nav.bar button { background: none; border: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--text2); border-radius: 12px; cursor: pointer; }
nav.bar button svg { width: 24px; height: 24px; }
nav.bar button[aria-current="page"] { color: var(--accent); font-weight: 650; }
nav.bar button.add { color: var(--on-accent); }
nav.bar button.add span.plus { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: var(--glow); margin-top: -22px; color: var(--on-accent); }
nav.bar button.add span.lbl { color: var(--text2); font-size: 12px; }

/* ───── Componentes ───── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.accent { border-color: var(--accent); box-shadow: var(--glow); }
.card.tone-agenda { border-left: 4px solid var(--agenda); } .card.tone-fin { border-left: 4px solid var(--fin); } .card.tone-dep { border-left: 4px solid var(--dep); } .card.tone-lec { border-left: 4px solid var(--lec); }
.k { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text2); }
.big { font-size: 32px; line-height: 1.1; font-weight: 750; letter-spacing: -.01em; }
.big.neg { color: var(--err); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack.s8 { gap: 8px; } .stack.s4 { gap: 4px; } .stack.s24 { gap: 24px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--ctl); background: var(--surface2); color: var(--text); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease, background .12s ease; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: var(--glow); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); border-color: var(--err); background: transparent; }
.btn.block { width: 100%; } .btn.sm { min-height: 48px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; min-height: 48px; padding: 0 8px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.iconbtn { width: 48px; height: 48px; border-radius: 14px; background: transparent; border: 0; display: inline-grid; place-items: center; cursor: pointer; color: var(--text); }
.top .iconbtn { background: rgba(7, 19, 33, .35); color: #F3F7FC; } :root[data-theme="light"] .top .iconbtn { background: rgba(255, 255, 255, .55); color: #112237; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 0 16px; border-radius: 24px; border: 1px solid var(--ctl); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 550; }
.chip[aria-pressed="true"], .chip[aria-checked="true"], .chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { min-height: 48px; border: 0; border-radius: 10px; background: transparent; color: var(--text2); font-weight: 600; cursor: pointer; font-size: 14px; }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 12px; background: var(--surface2); color: var(--text2); white-space: nowrap; }
.tag.agenda { color: var(--agenda); } .tag.fin { color: var(--fin); } .tag.dep { color: var(--dep); } .tag.lec { color: var(--lec); } .tag.err { color: var(--err); } .tag.warn { color: var(--warn); }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lab { font-size: 14px; font-weight: 600; color: var(--text2); }
.input, select.input, textarea.input { min-height: 52px; width: 100%; border: 1px solid var(--ctl); border-radius: 14px; background: var(--surface2); padding: 0 14px; color: var(--text); }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.input.big { font-size: 34px; font-weight: 750; min-height: 68px; text-align: left; }
.input[aria-invalid="true"] { border-color: var(--err); }
.err { color: var(--err); font-size: 14px; font-weight: 550; }
.hint { color: var(--text2); font-size: 14px; }
.sw { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.sw input { position: absolute; opacity: 0; width: 52px; height: 48px; top: 50%; transform: translateY(-50%); right: 0; margin: 0; }
.sw .track { width: 52px; height: 32px; border-radius: 16px; background: var(--surface2); border: 1px solid var(--ctl); position: relative; flex: none; transition: background .15s; }
.sw .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text2); transition: transform .15s, background .15s; }
.sw input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.sw input:checked + .track::after { transform: translateX(20px); background: var(--accent); }
.sw input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
details.more > summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 8px; }

/* Listas */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .t { flex: 1; min-width: 0; } .item .t b { display: block; font-weight: 600; overflow-wrap: anywhere; } .item .t span { display: block; font-size: 14px; color: var(--text2); }
.item.done .t b { text-decoration: line-through; color: var(--text2); }
.item .amt { font-weight: 650; white-space: nowrap; }
.item .amt.pos { color: var(--ok); } .item .amt.neg { color: var(--text); }
button.item, a.item { background: none; border: 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; cursor: pointer; color: inherit; }
button.item:last-child { border-bottom: 0; }
.check { width: 48px; height: 48px; flex: none; display: grid; place-items: center; background: none; border: 0; cursor: pointer; }
.check i { width: 26px; height: 26px; border: 2px solid var(--text2); border-radius: 8px; display: grid; place-items: center; transition: background .12s; }
.check[aria-pressed="true"] i { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.bar-track { height: 10px; border-radius: 6px; background: var(--surface2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .2s ease; }
.bar-fill.fin { background: var(--fin); } .bar-fill.dep { background: var(--dep); } .bar-fill.lec { background: var(--lec); } .bar-fill.agenda { background: var(--agenda); }
.empty { text-align: center; padding: 24px 12px; color: var(--text2); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty h3 { color: var(--text); }
.banner { border-radius: 14px; padding: 12px 16px; background: var(--accent-soft); border: 1px solid var(--accent); display: flex; align-items: center; gap: 12px; }
.banner.warn { background: rgba(255, 199, 121, .14); border-color: var(--warn); }
.banner.err { background: rgba(255, 155, 150, .14); border-color: var(--err); }
.recognition { font-size: 15px; font-weight: 550; display: flex; gap: 8px; align-items: center; }
.recognition svg { flex: none; color: var(--accent); }
:root[data-theme="light"] .recognition svg { color: #006E71; }

/* Cálculo explicado */
.calc { display: flex; flex-direction: column; gap: 4px; }
.calc .ln { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.calc .ln .why { font-size: 14px; color: var(--text2); display: block; }
.calc .ln.total { border-bottom: 0; border-top: 2px solid var(--text2); font-weight: 750; font-size: 18px; }
.calc .neg { color: var(--err); }

/* Calendario */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal .wd { text-align: center; font-size: 13px; color: var(--text2); font-weight: 600; padding: 4px 0; }
.cal button.d { min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; font-size: 15px; }
.cal button.d.out { color: var(--text2); }
.cal button.d.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal button.d.sel { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal button.d.band { background: var(--accent-soft); border-radius: 0; }
.cal button.d.start { border-radius: 12px 0 0 12px; background: var(--accent); color: var(--on-accent); } .cal button.d.end { border-radius: 0 12px 12px 0; background: var(--accent); color: var(--on-accent); }
.cal button.d.start.end { border-radius: 12px; }
.cal .dots { display: flex; gap: 2px; align-items: center; min-height: 6px; font-size: 11px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.cal .dots b { font-size: 11px; font-weight: 700; color: var(--text2); }
.cal button.d.sel .dots b, .cal button.d.start .dots b, .cal button.d.end .dots b { color: inherit; }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.seg-bar { display: inline-block; width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week button { min-height: 72px; border-radius: 12px; border: 1px solid var(--ctl); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
.week button.sel { border-color: var(--accent); background: var(--accent-soft); }
.week button.today b { color: var(--accent); }

/* Gráficos */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--text2); font-size: 11px; font-family: inherit; }
.chart .grid { stroke: var(--line); stroke-width: 1; opacity: .7; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* Hoja (panel) */
.backdrop { position: fixed; inset: 0; background: rgba(2, 8, 16, .62); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .16s ease; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: up .2s ease; border: 1px solid var(--line); border-bottom: 0; }
.sheet header { display: flex; align-items: center; gap: 8px; padding: 12px 8px 4px 20px; }
.sheet header h2 { flex: 1; }
.sheet .body { overflow-y: auto; padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.sheet footer { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.sheet footer .btn { flex: 1; }
.sheet footer:empty { display: none; }
.grab { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 8px auto 0; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(10px + env(safe-area-inset-top)); width: min(540px, calc(100% - 24px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: none; background: var(--surface2); color: var(--text); border: 1px solid var(--accent); border-radius: 14px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); animation: up .18s ease; }
.toast.err { border-color: var(--err); }
.toast span { flex: 1; font-weight: 550; }
.toast button { pointer-events: auto; background: none; border: 0; color: var(--accent); font-weight: 700; min-height: 48px; padding: 0 12px; cursor: pointer; }
.toast.err button { color: var(--err); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { min-height: 96px; border-radius: 16px; border: 1px solid var(--ctl); background: var(--surface2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--text); padding: 12px; text-align: center; }
.opt svg { width: 28px; height: 28px; }
.opt.agenda svg { color: var(--agenda); } .opt.fin svg { color: var(--fin); } .opt.dep svg { color: var(--dep); } .opt.lec svg { color: var(--lec); }
.cover { width: 56px; height: 76px; border-radius: 6px 10px 10px 6px; display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; box-shadow: inset 4px 0 0 rgba(0, 0, 0, .25); }
.offline { background: var(--surface2); color: var(--text2); text-align: center; font-size: 13px; padding: 4px; }

@keyframes up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
@media (max-width: 380px) { .big { font-size: 28px; } h1 { font-size: 28px; } .grid2 { gap: 8px; } .chip { padding: 0 12px; } }
@media print { nav.bar, .toasts, .top .iconbtn { display: none; } }

/* Mi mes: línea de fechas deslizable */
.tl { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.tl:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.tl-item { flex: 0 0 148px; scroll-snap-align: start; min-height: 96px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 4px; text-align: left; padding: 10px 12px; border-radius: 14px; background: var(--surface2, rgba(255,255,255,.05)); border: 1px solid var(--line); color: var(--text); cursor: pointer; font: inherit; }
.tl-item .tl-d { font-size: 12px; color: var(--text2); }
.tl-item b { font-size: 15px; overflow-wrap: anywhere; }
.tl-item .num { font-size: 13px; color: var(--text2); }
.tl-item.now { border-color: var(--fin); }
.tl-item.cobro .num { color: var(--fin); }
.tl-item.reserva { border-style: dashed; }
/* La cifra se anima una sola vez al apartar dinero */
@keyframes mgPulse { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.big.pulse { animation: mgPulse .7s ease-out 1; transform-origin: left center; }
.recognition.done { color: var(--fin); }
@media (prefers-reduced-motion: reduce) { .big.pulse { animation: none; } .tl { scroll-behavior: auto; } }

/* Calendario mensual con títulos */
.mcard { padding: 8px 0; }
.mcal { display: block; }
.mwd { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 13px; color: var(--text2); font-weight: 600; padding: 2px 0 4px; }
.mrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.mday { min-height: 84px; padding: 2px 0 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; border-left: 1px solid transparent; }
.mday.out .num { color: var(--text2); }
.mday .num { align-self: center; min-width: 28px; min-height: 28px; border: 0; background: transparent; color: var(--text); font-size: 13px; border-radius: 14px; cursor: pointer; padding: 0 4px; }
.mday.today .num { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
.mday.sel .num { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: none; }
.mday.sel { background: var(--accent-soft); }
.mday .ev { display: block; width: 100%; min-height: 18px; border: 0; border-left: 3px solid var(--c, var(--agenda)); border-radius: 4px; background: color-mix(in srgb, var(--c, var(--agenda)) 14%, var(--surface)); color: var(--text); font-size: 10.5px; line-height: 13px; text-align: left; padding: 2px 1px 2px 2px; cursor: pointer; overflow: hidden; overflow-wrap: anywhere; hyphens: none; letter-spacing: -.1px; }
.mday .ev .et { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mday .ev.done { text-decoration: line-through; }
.mday .ev.band { min-height: 28px; border-radius: 0; margin: 0 -1px; width: calc(100% + 2px); }
.mday .ev.band.inicio, .mday .ev.band.unico { border-radius: 4px 0 0 4px; margin-left: 2px; width: calc(100% - 1px); }
.mday .ev.band.fin { border-radius: 0 4px 4px 0; margin-right: 2px; width: calc(100% - 1px); }
.mday .ev.band:not(.inicio) { border-left-width: 0; }
.mday .ev-gap { min-height: 28px; }
.mday .more-n { align-self: flex-start; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; min-height: 20px; padding: 0 4px; cursor: pointer; }
.mday.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }

.mday { position: relative; }
.mday .num::after { content: ''; position: absolute; inset: 0; border-radius: 6px; }
.mday .ev, .mday .more-n { position: relative; z-index: 1; }
.mday .ev { min-height: 24px; }
.mday .more-n { min-height: 24px; min-width: 32px; }

/* Tablas de datos y barras de presupuesto */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.tbl th, .tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.tbl th[scope=row], .tbl thead th:first-child { text-align: left; font-weight: 600; }
.tbl thead th { font-size: 12px; color: var(--text2); font-weight: 600; }
.bar-fill.over { background: var(--err, #D64545); }

/* Fondos superiores a elegir en Perfil (siempre suaves: el texto conserva contraste) */
:root[data-bg="aurora"][data-theme="dark"] { --sky1: #14183A; --sky2: #2A2468; --sky3: #1F6F7C; --sun: #B79CFF; }
:root[data-bg="aurora"][data-theme="light"] { --sky1: #DDD6FF; --sky2: #E7F0FF; --sky3: #D5F5EE; --sun: #8C6CFF; }
:root[data-bg="atardecer"][data-theme="dark"] { --sky1: #2A1830; --sky2: #5A2A47; --sky3: #8A4A3A; --sun: #FFB36B; }
:root[data-bg="atardecer"][data-theme="light"] { --sky1: #FFE0D0; --sky2: #FFEBD9; --sky3: #FFF3CF; --sun: #F08A3C; }
:root[data-bg="bosque"][data-theme="dark"] { --sky1: #0A2418; --sky2: #12402B; --sky3: #1F6F5A; --sun: #7CF0B5; }
:root[data-bg="bosque"][data-theme="light"] { --sky1: #D3EBDD; --sky2: #E4F3E7; --sky3: #F2F7DA; --sun: #3FAE72; }
:root[data-bg="grafito"][data-theme="dark"] { --sky1: #14171C; --sky2: #232831; --sky3: #333B47; --sun: #9FB4CC; }
:root[data-bg="grafito"][data-theme="light"] { --sky1: #E3E7EC; --sky2: #EEF1F4; --sky3: #F7F8FA; --sun: #6C7C90; }
.swatch { display: block; width: 100%; min-height: 64px; border-radius: 14px; border: 2px solid var(--line); cursor: pointer; padding: 0; background: linear-gradient(135deg, var(--a), var(--b)); color: var(--text); font-weight: 600; font-size: 13px; text-align: left; padding: 8px 10px; }
.swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-size: 28px; font-weight: 700; color: var(--text); flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.srch { width: 100%; }
.grp-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); margin: 14px 0 4px; }

.seg.tabs5 button { padding-left: 4px; padding-right: 4px; font-size: 13px; min-width: 0; }

/* Selector de agenda en la cabecera */
.agpick { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 48px; max-width: 100%; padding: 0 14px; margin: 2px 0 4px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; font-size: 15px; cursor: pointer; }
.agpick .agname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agpick .agcaret { color: var(--text2); font-size: 13px; }
.agdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: transparent; border: 2px solid color-mix(in srgb, var(--text2) 60%, transparent); box-sizing: border-box; }
.agdot[style] { border: 0; }
.agrow { display: flex; align-items: center; gap: 8px; }
.agrow .agitem { flex: 1; min-width: 0; }
.agrow .agitem[aria-pressed="true"] { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: -2px; }

/* Mi mes: previsión (registrado / pendiente / cierre) */
.fc-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.fc-tbl th, .fc-tbl td { padding: 6px 4px; text-align: right; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.fc-tbl thead th { color: var(--text2); font-size: 12px; font-weight: 600; vertical-align: bottom; }
.fc-tbl th[scope="row"], .fc-tbl thead th:first-child { text-align: left; font-weight: 650; }
.fc-cell { background: none; border: 0; color: inherit; font: inherit; min-height: 48px; min-width: 56px; padding: 0 4px; cursor: pointer; text-align: right; text-decoration: underline dotted color-mix(in srgb, var(--text2) 60%, transparent); text-underline-offset: 4px; }
.fc-cell.close { font-weight: 700; }
.fc-diff th, .fc-diff td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
