/* MYGESTOR v5.2 · Hoy con dos tarjetas, temas Claro y Oscuro, cabecera propia de cada tema y pantallas de Ajustes con «← volver». */
:root[data-theme="light"] body { background: linear-gradient(180deg, #D2E4ED 0, #E6EFF5 240px, #F5F8FB 560px) no-repeat, #F5F8FB; }
:root[data-theme="dark"] body { background: linear-gradient(180deg, #091830 0, #071426 260px, #060F1E 600px) no-repeat, #060F1E; }
:root[data-theme="light"] { --bg: #F5F8FB; --text: #0F2236; --text2: #3F5367; --line: #BFCCD9; }
:root[data-theme="dark"] { --bg: #060F1E; }

/* Cabecera de Hoy: en claro, la fecha es el título y el saludo va debajo; en oscuro, al revés (el saludo manda). */
.hid { display: flex; flex-direction: column; gap: 2px; padding: 4px 16px 2px; }
.hid-date { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.hid-greet { font-size: 14px; color: var(--text2); }
:root[data-theme="dark"] .hid { flex-direction: column-reverse; gap: 4px; }
:root[data-theme="dark"] .hid-greet { font-size: 26px; line-height: 1.15; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
:root[data-theme="dark"] .hid-date { font-size: 16px; font-weight: 500; color: #A9B4EE; }
.top .hid { padding-left: 0; padding-right: 0; }

/* Tarjetas */
:root[data-theme="light"] { --hc-ag-bg: linear-gradient(180deg, #F3F0FC, #ECE8F8); --hc-ag-line: #C9C0E8; --hc-ag-h: #4A3699; --hc-fn-bg: linear-gradient(180deg, #EDF7F5, #E3F1EE); --hc-fn-line: #B3D3CC; --hc-fn-h: #0A5E57; --hc-sub: #455A6E; --hc-text: #0F2236; --hc-bar-ag: #6B4FC0; }
:root[data-theme="dark"] { --hc-ag-bg: linear-gradient(135deg, #2B2670 0%, #473AA3 100%); --hc-ag-line: rgba(196, 176, 255, .38); --hc-ag-h: #D6CCFF; --hc-fn-bg: linear-gradient(135deg, #06353B 0%, #0C6A62 100%); --hc-fn-line: rgba(100, 225, 205, .38); --hc-fn-h: #A9F2E5; --hc-sub: #D0C8FF; --hc-text: #FFFFFF; --hc-bar-ag: #C4A5FF; }
:root[data-theme="dark"] .hcard.fn { --hc-sub: #C2F0E8; }
.hcard { border: 1px solid var(--hc-line); border-radius: 22px; padding: 2px 16px 12px; display: flex; flex-direction: column; color: var(--hc-text); }
.hcard.ag { --hc-line: var(--hc-ag-line); --hc-h: var(--hc-ag-h); background: var(--hc-ag-bg); }
.hcard.fn { --hc-line: var(--hc-fn-line); --hc-h: var(--hc-fn-h); background: var(--hc-fn-bg); }
.hcard-h { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 56px; background: none; border: 0; border-bottom: 1px solid var(--hc-line); color: inherit; cursor: pointer; padding: 0; text-align: left; }
.hcard-h h2 { font-size: 22px; font-weight: 700; }
.hsec { padding: 10px 0 2px; }
.hsec + .hsec { border-top: 1px solid var(--hc-line); margin-top: 8px; padding-top: 12px; }
.hh { font-size: 17px; font-weight: 700; color: var(--hc-h); margin-bottom: 2px; }
.hlist { display: flex; flex-direction: column; }
.hrow { display: flex; align-items: center; gap: 4px; min-height: 52px; }
.hrow .check { width: 48px; height: 48px; margin-left: -8px; }
.hcard .check i { border-color: var(--hc-sub); background: transparent; }
.hcard .check[aria-pressed="true"] i, .hcard .check i.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root[data-theme="dark"] .hcard .check[aria-pressed="true"] i, :root[data-theme="dark"] .hcard .check i.on { background: #2DE2DB; border-color: #2DE2DB; color: #04292B; }
.hcard .check.static { cursor: default; }
.hmain { flex: 1; min-width: 0; display: flex; align-items: stretch; gap: 10px; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; padding: 6px 0; min-height: 48px; font: inherit; }
.hbar { width: 3px; border-radius: 2px; flex: none; min-height: 30px; }
.hbar.fn { background: var(--fin); }
:root[data-theme="dark"] .hbar.fn { background: #64E5B2; }
.ht { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ht b { font-size: 15px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.ht .hs { font-size: 13px; line-height: 1.35; color: var(--hc-sub); }
.hrow.wk { min-height: 48px; }
.hrow.wk .hmain { min-height: 48px; }
.hrow.wk .ht { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.hrow.wk .ht .hw { font-size: 13px; color: var(--hc-sub); font-variant-numeric: tabular-nums; }
.hrow.wk .ht b { font-size: 14px; font-weight: 500; }
.hrow.done[data-kind="tarea"] .ht b { text-decoration: line-through; color: var(--hc-sub); }
.hrow.past .ht { opacity: .78; }
.hamt { font-size: 15px; font-weight: 600; white-space: nowrap; padding-left: 6px; font-variant-numeric: tabular-nums; }
.hcard .iconbtn { color: var(--hc-sub); min-width: 44px; min-height: 44px; }
.hempty { font-size: 14px; color: var(--hc-sub); padding: 4px 0 6px; }
.hok { font-size: 14px; color: var(--hc-sub); padding: 2px 0; }
.hmore { min-height: 48px; display: inline-flex; align-items: center; color: var(--hc-h); text-decoration: underline; background: none; border: 0; cursor: pointer; font-size: 14px; padding: 0; }
.hconf { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--ok); margin: 0; }
:root[data-theme="dark"] .hconf { color: #7EF0C6; }
.hcard-h:focus-visible, .hmain:focus-visible, .hcard .check:focus-visible { outline-color: var(--focus); }
:root[data-theme="dark"] .hcard :focus-visible { outline-color: #FFFFFF; }

/* Barra inferior: el área activa se reconoce por algo más que el color (trazo superior, icono más grueso y texto en negrita) */
nav.bar button { position: relative; }
nav.bar button[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 50%; width: 30px; height: 3px; margin-left: -15px; border-radius: 0 0 3px 3px; background: var(--accent); }
nav.bar button[aria-current="page"] svg { stroke-width: 2.3; }
:root[data-theme="light"] nav.bar { background: color-mix(in srgb, #F5F8FB 94%, transparent); }

/* Pantallas dentro de Ajustes */
.top.sub { display: flex; flex-direction: column; gap: 4px; padding: 10px 16px 4px; padding-top: max(10px, env(safe-area-inset-top)); }
.backbtn { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-height: 48px; min-width: 48px; padding: 0 12px 0 4px; margin-left: -6px; background: none; border: 0; color: var(--accent); font-size: 17px; font-weight: 650; cursor: pointer; border-radius: 12px; }
.backbtn svg { stroke-width: 2.4; }
:root[data-theme="dark"] .backbtn { color: #2DE2DB; }
.top.sub h1 { font-size: 24px; margin-top: 0; }

.hsp { width: 40px; flex: none; }

/* ───── Mi año · «Por meses»: doce meses en una superficie que se desliza ───── */
.yr-scroll .yr-tblwrap { margin: 0 -16px; }
.yr-scroll { overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.yr-scroll:focus-visible { outline-offset: -3px; }
.yr-scroll .yr-tbl { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
.yr-scroll .yr-tbl th, .yr-tbl td { padding: 0; text-align: center; white-space: nowrap; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); font-variant-numeric: tabular-nums; }
.yr-scroll .yr-tbl .yr-m { width: 60px; min-width: 60px; }
.yr-scroll .yr-tbl thead th { padding: 0; font-size: 13px; font-weight: 600; color: var(--text2); }
.yr-scroll .yr-tbl thead th button { display: block; width: 100%; min-height: 48px; background: none; border: 0; padding: 0 8px; color: inherit; font: inherit; text-align: center; cursor: pointer; }
.yr-scroll .yr-tbl td > button, .yr-tbl td > span, .yr-tbl tfoot td > span { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 0 8px; margin: 0; text-align: center; background: none; border: 0; color: inherit; font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.yr-scroll .yr-tbl td > span { cursor: default; }
.yr-scroll .yr-tbl .nil { color: var(--text2); }
.yr-scroll .yr-tbl .yr-name { position: sticky; left: 0; z-index: 2; width: 92px; min-width: 92px; max-width: 92px; text-align: left; background: var(--bg); border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent); padding: 0 6px 0 14px; white-space: normal; }
.yr-scroll .yr-tbl thead .yr-name { font-size: 13px; color: var(--text2); font-weight: 600; vertical-align: middle; }
.yr-scroll .yr-tbl tbody .yr-name button { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: left; font-size: 14px; font-weight: 650; line-height: 1.25; min-height: 48px; padding: 0; background: none; border: 0; color: inherit; cursor: pointer; width: 100%; align-content: center; }
.yr-scroll .yr-tbl .yr-year { position: sticky; right: 0; z-index: 2; width: 64px; min-width: 64px; background: var(--bg); border-left: 1px solid color-mix(in srgb, var(--line) 70%, transparent); color: var(--text); font-weight: 650; }
.yr-scroll .yr-tbl thead .yr-year { font-size: 13px; color: var(--text2); }
.yr-scroll .yr-tbl .yr-m.sel { background: color-mix(in srgb, var(--accent) 14%, var(--bg)); }
.yr-scroll .yr-tbl thead th.yr-m.sel { color: var(--text); font-weight: 700; }
.yr-scroll .yr-tbl tfoot th, .yr-tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line); padding: 0; }
.yr-scroll .yr-tbl tfoot th.yr-name { padding: 0 6px 0 14px; }
.yr-scroll .yr-tbl tfoot td > span { min-height: 52px; font-weight: 700; }
.yr-mline { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--text2); }
.yr-mline b { color: var(--text); }
.yr-mline .link { min-height: 48px; display: inline-flex; align-items: center; }

/* Texto ampliado: la marca y las tres acciones pasan a dos líneas en vez de salirse por la derecha */
.top .brand { flex-wrap: wrap; row-gap: 2px; }
.top .logo { min-width: 0; flex: 1 1 auto; flex-wrap: wrap; }
.top .logo-t { overflow-wrap: anywhere; }
.top .brand > .row { flex: 0 0 auto; margin-left: auto; }

/* Con el teclado, el mes enfocado no queda tapado por las columnas fijas */
.yr-scroll { scroll-padding-left: 96px; scroll-padding-right: 68px; }

/* v5.3 · cuadro continuo de varios años */
.yr-scroll .yr-tbl .yr-band { text-align: left; font-size: 13px; font-weight: 650; color: var(--text2); padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.yr-scroll .yr-tbl .yr-band span { position: sticky; left: 100px; display: inline-block; padding: 0 10px; }
.yr-scroll .yr-tbl .yr-band.on { color: var(--text); }
.yr-scroll .yr-tbl .yr-jan { border-left: 2px solid color-mix(in srgb, var(--text2) 55%, transparent); }
.yr-scroll .yr-tbl .yr-bandrow .yr-name, .yr-scroll .yr-tbl .yr-bandrow .yr-year { background: var(--bg); }

/* v5.3 · Hoy: dos tarjetas más suaves. Oscuro: base azul tinta y el color concentrado en un extremo; claro: tarjetas apenas teñidas sobre el fondo azul grisáceo. */
:root[data-theme="dark"] { --hc-ag-bg: linear-gradient(115deg, #0D1A3A 0%, #121F4B 55%, #30297F 135%); --hc-ag-line: rgba(176, 160, 245, .22); --hc-ag-h: #D6CCFF;
  --hc-fn-bg: linear-gradient(115deg, #0B1B35 0%, #0B2A40 55%, #0B5A62 135%); --hc-fn-line: rgba(100, 225, 205, .22); }
:root[data-theme="light"] { --hc-ag-bg: linear-gradient(135deg, rgba(122, 98, 205, .09), rgba(122, 98, 205, .14)); --hc-ag-line: rgba(122, 98, 205, .30);
  --hc-fn-bg: linear-gradient(135deg, rgba(14, 140, 130, .09), rgba(14, 140, 130, .15)); --hc-fn-line: rgba(14, 140, 130, .32); }
.hcard { box-shadow: 0 10px 30px -18px rgba(8, 20, 50, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
:root[data-theme="light"] .hcard { box-shadow: 0 10px 28px -20px rgba(30, 60, 100, .45); }
.hcard .hh { font-size: 14px; font-weight: 650; letter-spacing: .02em; text-transform: none; color: var(--hc-h); margin: 0 0 2px; }
.hcard .ht b, .hcard .hrow .amt, .hcard .hrow .num { font-size: 15px; font-weight: 500; }
.hcard .hrow .hw, .hcard .ht .hs { font-size: 13px; font-weight: 400; }
