/* ===================================================================
   Tema «Brasa» — solo apariencia. No cambia estructura ni comportamiento:
   colores, tipografía, tamaños de texto, fondos, gráficas, barras y tabs.
   Se carga después de app.css y lo sobreescribe.
   =================================================================== */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('/static/fonts/manrope-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('/static/fonts/manrope-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'DM Serif Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/dm-serif-display-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Serif Display'; font-style: italic; font-weight: 400; font-display: swap; src: url('/static/fonts/dm-serif-display-latin-400-italic.woff2') format('woff2'); }

:root {
  /* Base */
  --surface-0: #F7F1E6;   /* papel */
  --surface-1: #FFFDF8;   /* hoja */
  --border: #E6DCCB;
  --grid: #F0E8DA;
  --text-primary: #1F1C14;
  --text-secondary: #5C5648;
  --text-muted: #8A8373;
  --accent: #C2541A;      /* brasa */
  --accent-dark: #9A3F12;
  --forest: #1B1E0F;
  --moss: #4A5520;
  --amber: #F2A03D;
  --good: #2F7A3A;
  --bad: #B23A1E;
  --radius: 14px;
  --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --grad-brasa: radial-gradient(circle at 0% 130%, rgba(138,145,40,.85) 0%, rgba(138,145,40,0) 45%), linear-gradient(115deg, #1B1E0F 0%, #2E2A10 38%, #7A3F14 72%, #E98A2C 100%);
  --grad-ember: linear-gradient(135deg, #D9632A 0%, #C2541A 55%, #A5431A 100%);

  /* Gráficas */
  --series-1: #5B6B1E;    /* Target / Total: musgo */
  --series-2: #C2541A;    /* Real / Total + Tax: brasa */
  --series-3: #2F6178;    /* Margin / MX + EE. UU.: acero */

  /* Meses (barra de semanas y hoja) */
  --month-a: #E3E6C8; --month-a-text: #3F4A1A; --month-b: #ECE5D8; --month-b-text: #4A4538;
  --mA-month: #D6DBB1; --mA-week: #E6E9CC; --mB-month: #E2D9C7; --mB-week: #EFE8DB; --sheet-ink: #1F1C14;

  /* Tags (fondo de pagado y pill) */
  --tag-fixed: #EEF1DF; --tag-budget: #DCE4C3; --tag-car: #F3E2EC; --tag-imprevisto: #FBE8C4; --tag-health: #E0ECF1; --tag-planeado: #ECE6F6;
  --paid-bg: #E6ECD3;
  --c-yellow: #FBE8C4; --c-pink: #F3E2EC; --c-blue: #E0ECF1; --c-orange: #FBE3D0; --c-red: #F5D6CF; --c-gray: #ECE6DA;
}

/* ---------- Tipografía ---------- */
body { font-family: var(--font-ui); background: var(--surface-0); color: var(--text-primary); font-feature-settings: 'tnum' 1; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: 2rem; letter-spacing: .005em; }
h2 { font-weight: 800; letter-spacing: -.005em; }
.hint { color: var(--text-muted); }
::selection { background: rgba(242,160,61,.35); }

/* Cifras grandes en serif */
.tile .big, .total-card .big, .ind-v, .week-title .wt-main, .sp-total strong, .fund-big, .big { font-family: var(--font-display); font-weight: 400; letter-spacing: .005em; }
.total-card .big small, .big small { font-family: var(--font-ui); }

/* Etiquetas en mayúsculas espaciadas (como «FUND») */
.week-title .wt-month { font-weight: 800; letter-spacing: .2em; font-size: .68rem; }
.ind-l, .tile .lbl, .total-card .lbl { text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; font-weight: 800; color: var(--text-muted); }

/* ---------- Superficies ---------- */
.card, .tile, .wp-items, .wp-sum, .ind, .ftab, .mo-tab { border-color: var(--border); }
.card { border-radius: 18px; box-shadow: 0 1px 2px rgba(60,40,10,.04); }
.wp-items, .wp-sum { border-radius: 16px; }
.tile { border-radius: 16px; }

/* ---------- Botones ---------- */
.btn { background: var(--grad-ember); border-radius: 12px; font-weight: 800; box-shadow: 0 4px 12px rgba(194,84,26,.22); }
.btn:hover { filter: brightness(1.04); }
.btn.ghost { background: var(--surface-1); color: var(--text-primary); border: 1.5px solid #D8CBB4; box-shadow: none; }
.btn.ghost.danger, button.link.danger { color: var(--bad); }
.btn.small { border-radius: 10px; }

/* ---------- Campos ---------- */
.form input[type=text], .form input:not([type]), .form input[type=date], .form input[type=password],
.form input[type=email], .login input, dialog.editor select, dialog.editor input:not([type=checkbox]), .form select, select, .sp-search {
  border: 1.5px solid #E2D7C4; border-radius: 12px; background: #FBF7EF; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 4px rgba(194,84,26,.13); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
dialog { border-radius: 20px; border: 1px solid var(--border); background: var(--surface-1); box-shadow: 0 24px 60px rgba(40,30,10,.25); }
dialog::backdrop { background: rgba(27,30,15,.38); }

/* ---------- Menú inferior ---------- */
/* Sin backdrop-filter: en iPhone, el desenfoque sobre las ~100 semanas (cada una con su capa) agotaba la memoria y Safari recargaba la página. */
.tabbar { background: #FFFDF8; border-top: 1px solid var(--border); }
.tabbar .tab { font-weight: 700; color: var(--text-muted); }
.tabbar .tab.on { color: var(--accent); font-weight: 800; }
.tabbar .tab.add svg { background: var(--grad-ember); border-radius: 12px; box-shadow: 0 6px 14px rgba(194,84,26,.35); }

/* ---------- Pestañas ---------- */
.dtab { font-weight: 700; }
.dtab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 800; }
.segmented { background: #EFE7D8; border-color: transparent; border-radius: 14px; }
.segmented .seg.on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 3px rgba(60,40,10,.15); }

/* ---------- Proyección ---------- */
.pager-bar .edge.prev { border-right-color: rgba(60,40,10,.18); }
.pager-bar .edge.next { border-left-color: rgba(60,40,10,.18); }
.week-title .wt-main { font-size: 1.35rem; line-height: 1.15; }
.week-title.is-now .wt-dates { color: var(--accent); font-weight: 800; }
.today-pill { background: var(--accent); letter-spacing: .04em; font-weight: 800; box-shadow: 0 3px 8px rgba(194,84,26,.3); }
.year-start { background: #F6E2CF; color: var(--accent-dark); }
.wp-items .add-circle { background: var(--grad-ember) !important; border-radius: 12px !important; box-shadow: 0 2px 5px rgba(194,84,26,.35) !important; color: #FFF8EE !important; }
.wp-items .it { border-bottom-color: rgba(60,40,10,.07); }
.it-total { font-weight: 800; }

/* Resumen: mismas filas, colores de la paleta */
.row-gastos { --rbg: #ECE5D8; --rbg-v: #ECE5D8; --rink: #1F1C14; }
.row-fel, .row-ws { --rbg: #E7EEF1; --rbg-v: #E7EEF1; --rink: #1F1C14; }
.row-fer, .row-eq { --rbg: #F4E7EF; --rbg-v: #F4E7EF; --rink: #1F1C14; }
.row-tax { --rbg: #FBE6D3; --rbg-v: #FBE6D3; --rink: #1F1C14; }
.row-taxg { --rbg: #FCF0E3; --rbg-v: #FCF0E3; --rink: #1F1C14; }
.row-wealth { --rbg: #EAE3D3; --rbg-v: #EAE3D3; --rink: #4A4538; }
.wp-sum .sr[class*="row-"] { border-bottom-color: rgba(60,40,10,.07); }
.wp-sum .sr[class*="row-"] dd.proj { color: rgba(31,28,20,.55); }
/* G&G Fund: el degradado del logo */
.wp-sum .sr.row-fund { background: var(--grad-brasa) !important; }
.wp-sum .sr.row-fund dt, .wp-sum .sr.row-fund dd, .wp-sum .sr.row-fund dd.proj { color: #F7F1E6 !important; }
.wp-sum .sr.row-fund dt { font-weight: 800; letter-spacing: .04em; }
.wp-sum .sr.row-fund dd { font-family: var(--font-display); font-size: 1.12em; font-weight: 400; }
.pay-tag { background: #FBE3D3; color: var(--accent-dark); border-radius: 6px; }

/* Indicadores */
.ind { border-radius: 14px; }
.ind.warn { background: #FCF0DF; border-color: #EBC9A0; }
.ind.warn .ind-l { color: #8A5A08; }
.ind.bad { background: #FBE6E1; border-color: #EDB8AA; }

/* ---------- Tags ---------- */
.tpill { font-weight: 800; }
.tpill.tk-fixed { color: #55602C; border-color: rgba(85,96,44,.3); }
.tpill.tk-budget { color: #3F4A1A; border-color: rgba(63,74,26,.3); }
.tpill.tk-car { color: #7A3B66; border-color: rgba(122,59,102,.3); }
.tpill.tk-imprevisto { color: #7E5206; border-color: rgba(126,82,6,.3); }
.tpill.tk-health { color: #2F6178; border-color: rgba(47,97,120,.3); }
.tpill.tk-planeado { color: #57478A; border-color: rgba(87,71,138,.3); }

/* ---------- Dashboard ---------- */
.mo-row.mz-0 { background: #F3F1E4; } .mo-cat.mz-0 { background: #E7E3CC; }
.mo-row.mz-1 { background: #FBF1E7; } .mo-cat.mz-1 { background: #F6E2CF; }
.mo-row.mz-2 { background: #F0F3E6; } .mo-cat.mz-2 { background: #E2E8D0; }
.mo-row.mz-3 { background: #F7EEF3; } .mo-cat.mz-3 { background: #EEDCE6; }
.mo-row.mz-4 { background: #FCF5E5; } .mo-cat.mz-4 { background: #F6E7C6; }
.mo-row.mz-5 { background: #EEF4F6; } .mo-cat.mz-5 { background: #DAE7EC; }
.mo-row.mz-6 { background: #FBEDEA; } .mo-cat.mz-6 { background: #F3D9D2; }
.mo-row.mz-7 { background: #F3EFE7; } .mo-cat.mz-7 { background: #E6DFD2; }
.mo-bf i { background: #DCCFB8; }
.mo-bar.max .mo-bf i { background: #E9A877; }
.mo-bar.sel .mo-bf i { background: var(--accent); }
.ft-head, .mo-cat, .hist-day { color: var(--text-secondary); }
.hist-row .hist-who { color: var(--text-primary); }

/* ---------- Aviso con Deshacer ---------- */
.toast { background: var(--forest); color: #F7F1E6; border-radius: 14px; }
.toast-u { color: var(--amber); }

/* ---------- Entrar ---------- */
.login h1 { font-family: var(--font-display); font-size: 2.2rem; }
.login .card { border-radius: 20px; box-shadow: 0 18px 40px rgba(60,40,10,.12); }

/* ---------- Fondo de emergencia ---------- */
.fr-fill { stroke: #5B6B1E; }
.fr-fill.part { stroke: #A9B36A; }
.fr-fill.z1 { stroke: #B23A1E; } .fr-fill.z1.part { stroke: #D98B78; }
.fr-fill.z2 { stroke: #E07A2E; } .fr-fill.z2.part { stroke: #EFB383; }
.fr-lbl.done { fill: #4A5520; }
.fr-lbl.done.z1 { fill: #9A2F17; } .fr-lbl.done.z2 { fill: #A5521A; }
.fd-ca, .sw.ca { background: #5B6B1E; } .fd-ab, .sw.ab { background: #2F6178; }
.ring strong, .fund-ring text.big { font-family: var(--font-display); font-weight: 400; }
.fr-track { stroke: #EFE7D8; }
.fr-big { font-family: var(--font-display); font-weight: 400; }
.fr-pct { fill: #4A5520; }

/* "Hoy" / "Ir a hoy": un solo distintivo con el estilo y lugar de "Ir a hoy" (entre la barra y el primer bloque) */
.today-fab { background: var(--accent); color: #FFF8EE; font-weight: 800; letter-spacing: .02em; box-shadow: 0 3px 10px rgba(194,84,26,.3); }
.today-fab.is-today { pointer-events: none; cursor: default; }
.today-pill { display: none !important; }
.today-ghost { opacity: .5; box-shadow: none; }
.today-ghost:hover { opacity: .8; }

/* Menú inferior en desktop: botones juntos al centro y con área de clic amplia */
.tabbar .tab { border-radius: 12px; transition: background .12s; }
@media (hover: hover) { .tabbar .tab:hover { background: #F3ECDF; color: var(--text-primary); } .tabbar .tab.on:hover { color: var(--accent); } }
@media (min-width: 760px) {
  .tabbar { justify-content: center; gap: 6px; }
  .tabbar .tab, .tabbar .tab-form { flex: 0 0 140px; max-width: 140px; }
}
.tabbar .tab .tab-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 3.5px #D8CBB4; }
.tabbar .tab.on .tab-av { box-shadow: 0 0 0 2px var(--surface-1), 0 0 0 3.5px var(--accent); }

/* ---------- Entrar con avatares ---------- */
.login-card { display: flex; flex-direction: column; gap: 4px; }
.who { border: 0; padding: 0; margin: 0 0 8px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.who legend { width: 100%; text-align: center; font-size: .7rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; padding: 0; }
.login .who-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; padding: 12px 10px 10px; width: 128px; border-radius: 18px; border: 1.5px solid var(--border); background: var(--surface-0); cursor: pointer; font-weight: 800; transition: border-color .12s, box-shadow .12s; }
.who-card input { position: absolute; opacity: 0; pointer-events: none; }
.who-card img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 4.5px #D8CBB4; }
.who-card:has(input:checked) { border-color: var(--accent); background: #FCF1E4; box-shadow: 0 0 0 3px rgba(194,84,26,.14); }
.who-card:has(input:checked) img { box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 5px var(--accent); }
.who-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.passkey-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.passkey-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login .forgot { margin-top: 10px; align-self: center; color: var(--accent); font-weight: 700; font-size: .9rem; }
.login-avatar { display: block; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 10px; box-shadow: 0 0 0 4px var(--surface-1), 0 0 0 6px var(--accent); }
.login .okmsg { background: #EEF1DF; border-radius: 10px; padding: 8px 10px; font-size: .9rem; }

/* ---------- Ajustes ---------- */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.set-card h2 { margin-bottom: 10px; }
.set-av { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.set-av img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 5px #D8CBB4; }
.av-pick { cursor: pointer; display: inline-block; }
.pk-list { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.pk-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-0); }
.pk-list li small { display: block; color: var(--text-muted); font-size: .78rem; }
.acct-who { display: flex; align-items: center; gap: 10px; }
.acct-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.form input[type=email] { display: block; width: 100%; padding: 9px 10px; color: var(--text-primary); font: inherit; font-size: 16px; margin-top: 4px; }

/* Gastos planeados debajo de Presupuestos semanales */
.g-col { display: flex; flex-direction: column; gap: 0; }
@media (min-width: 900px) { .g-col { gap: 16px; } .g-col > .card { margin: 0; } }
@media (min-width: 1100px) { .dpane[data-pane="tax"]:not([hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card-head .btn { white-space: nowrap; }
