
  :root {
    --bg: #F5F3EF; --surface: #FFFEFB; --surface-2: #EDEBE5; --ink: #192733; --muted: #626362; --faint: #A9A9A4;
    --line: #E4E2DB; --navy: #1D3F5E; --ochre: #B58118; --moss: #2F6848; --falu: #A33B2B;
    --falu-soft: #F6E5E0; --on-navy: #FFFFFF; --shadow: 0 12px 32px -8px rgba(25,39,51,.20);
    --acento-toast: #E6B95F; --sobre-falu: #FFFFFF;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #131414; --surface: #1C1D1E; --surface-2: #252727; --ink: #EEEDE9; --muted: #A9A8A5; --faint: #5B5C5A;
      --line: #2E302F; --navy: #9BC3E4; --ochre: #E6B95F; --moss: #8DCC9E; --falu: #EF9A8C;
      --falu-soft: #3A221E; --on-navy: #171410; --shadow: 0 12px 32px -8px rgba(0,0,0,.6);
      --acento-toast: #805B14; --sobre-falu: #131414;
    }
  }
  :root[data-theme="dark"] {
    --bg: #131414; --surface: #1C1D1E; --surface-2: #252727; --ink: #EEEDE9; --muted: #A9A8A5; --faint: #5B5C5A;
    --line: #2E302F; --navy: #9BC3E4; --ochre: #E6B95F; --moss: #8DCC9E; --falu: #EF9A8C;
    --falu-soft: #3A221E; --on-navy: #171410; --shadow: 0 12px 32px -8px rgba(0,0,0,.6);
    --acento-toast: #805B14; --sobre-falu: #131414;
  }
  :root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 60px); -webkit-text-size-adjust: 100%; }
  *, *::before, *::after { box-sizing: inherit; -webkit-tap-highlight-color: transparent; }
  body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.4; -webkit-font-smoothing: antialiased; }
  body.locked { overflow: hidden; }
  button { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 8px; }
  .wrap { max-width: 560px; margin: 0 auto; padding: 0 20px 128px; }

  /* Top bar */
  .top { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 0; font-size: .92rem; color: var(--muted); }
  .top b { color: var(--ink); font-weight: 600; }
  .status { display: inline-flex; align-items: center; gap: 7px; }
  .status i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
  .status.live i { background: var(--moss); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moss) 25%, transparent); }
  .status.local i { background: var(--ochre); }

  /* Hero */
  .hero { padding: 40px 0 28px; }
  .flow { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
  .flow .line { width: 44px; height: 2px; background: var(--line); position: relative; }
  .flow .line::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--faint); border-right: 0; }
  .flow.even .line, .flow.even #toAv { display: none; }
  .who { margin: 0; font-size: 1.1rem; color: var(--muted); }
  .big { font-size: clamp(4.2rem, 22vw, 7.2rem); font-weight: 700; letter-spacing: -0.055em; line-height: .95; margin: 6px 0 0; }
  .big .cents { font-size: .42em; letter-spacing: -0.02em; color: var(--muted); font-weight: 600; margin-left: 3px; }
  .split { margin-top: 26px; }
  .split-bar { display: flex; height: 4px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 3px; }
  .split-bar span { transition: width .6s cubic-bezier(.2,.8,.2,1); border-radius: 99px; }
  .split-j { background: var(--navy); } .split-y { background: var(--ochre); }
  .split-legend { display: flex; justify-content: space-between; margin-top: 10px; font-size: .9rem; color: var(--muted); }
  .split-legend b { color: var(--ink); font-weight: 600; margin-left: 4px; }

  /* Stats */
  .vista { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
  .vista .seg { flex: 1 1 220px; margin: 0; }
  .mesnav { display: flex; align-items: center; gap: 4px; font-weight: 600; }
  .mesnav span { min-width: 9.5em; text-align: center; }
  .mesnav .x svg { width: 22px; height: 22px; }
  .etq { margin: 0 0 4px; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
  .etq-centro { color: var(--muted); font-size: .75rem; align-self: center; }
  .stats small { display: block; font-size: .72rem; color: var(--muted); margin-top: 1px; white-space: nowrap; }
  .chip-sel { flex: 0 0 auto; font: inherit; font-size: .9rem; color: var(--muted); background: var(--surface-2); border: 4px solid transparent; background-clip: padding-box; border-radius: 99px; padding: 3px 9px; min-height: 44px; max-width: 13em; }
  .cats { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 2px; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cat-chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 8px 12px; min-height: 44px; font: inherit; font-size: .9rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
  .cat-chip[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
  .cat-chip .bola { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
  .link { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: .85rem; padding: 10px 0; min-height: 44px; cursor: pointer; }
  .cat-tag { display: inline-flex; align-items: center; gap: 4px; }
  .clista { margin: 4px 0 18px; }
  .crow { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .crow .cn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .crow.archivada .cn { color: var(--muted); text-decoration: line-through; }
  .crow button { background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; min-height: 44px; padding: 0 8px; cursor: pointer; text-decoration: underline; }
  .csub { font-size: 1rem; margin: 6px 0 12px; }
  .swatches, .iconos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
  .swatches button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
  .swatches button[aria-checked="true"] { border-color: var(--ink); }
  .iconos button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; padding: 0; }
  .iconos button svg { width: 24px; height: 24px; }
  .iconos button[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
  .saldar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 14px; }
  .row.pago .concept { font-style: italic; }
  .row.pago .amt { color: var(--muted); }
  .pago-estado { color: var(--muted); padding: 0 14px 0 4px; display: inline-grid; place-items: center; }
  .pago-estado svg { width: 20px; height: 20px; }
  .row.pago.aceptado .pago-estado { color: var(--moss); }
  .row.pago.disputado .pago-estado { color: var(--falu); }
  .saldar [hidden] { display: none; }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0; }
  .stats div { padding: 14px 0; }
  .stats div + div { padding-left: 14px; border-left: 1px solid var(--line); }
  .stats dt { font-size: .8rem; color: var(--muted); }
  .stats dd { margin: 2px 0 0; font-size: 1.08rem; font-weight: 600; white-space: nowrap; }

  /* Banner */
  .banner { background: var(--surface); border: 1px solid var(--ochre); border-radius: 14px; padding: 14px 16px; margin-top: 20px; font-size: .95rem; }
  .banner p { margin: 0 0 10px; }
  .banner-btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  .linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 10px; font-size: .92rem; }
  .bbtn { background: var(--ink); color: var(--bg); border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 600; cursor: pointer; min-height: 44px; }

  /* Filters */
  .filters { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; margin: 0 -20px; padding: 14px 20px 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
    background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: box-shadow .2s; }
  .filters::-webkit-scrollbar { display: none; }
  .filters.scrolled { box-shadow: 0 1px 0 var(--line); }
  .chip { flex: 0 0 auto; border: 4px solid transparent; background: transparent; background-clip: padding-box; border-radius: 99px; padding: 3px 9px; font-size: .9rem; color: var(--muted); cursor: pointer; min-height: 44px; font-weight: 500; }  /* pastilla visible de 36 px, área táctil de 44 px */
  .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
  .sep { flex: 0 0 1px; background: var(--line); margin: 8px 4px; }

  /* List */
  .day { margin-top: 18px; }
  .day-h { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 8px; font-size: .88rem; color: var(--muted); }
  .day-h h3 { margin: 0; font-size: .88rem; font-weight: 600; color: var(--ink); }
  .card { background: var(--surface); border-radius: 16px; overflow: hidden; }
  .row { display: grid; grid-template-columns: 1fr auto; align-items: center; position: relative; }
  .row + .row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--line); }
  .item { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 13px 8px 13px 14px; background: none; border: 0; text-align: left; cursor: pointer; min-height: 62px; }
  .item:active { opacity: .6; }
  .av { flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
  .av.lg { flex-basis: 40px; width: 40px; height: 40px; font-size: .95rem; }
  .av-J { background: var(--navy); color: var(--on-navy); }
  .av-Y { background: var(--ochre); color: #2A1E05; }
  .av-A { background: linear-gradient(90deg, var(--navy) 50%, var(--ochre) 50%); color: transparent; }
  .mid { flex: 1; min-width: 0; }
  .concept { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; line-height: 1.25; }
  .meta { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; }
  .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
  .dot-C { background: var(--navy); } .dot-P { background: var(--ochre); }
  .amt { flex: 0 0 auto; font-weight: 600; font-size: 1rem; text-align: right; }
  .amt small { display: block; font-size: .76rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
  .row.disputado .amt { color: var(--falu); }
  .row.aceptado .amt { color: var(--ink); }

  .acts { display: flex; gap: 0; padding-right: 2px; }
  .act { width: 44px; height: 44px; border: 0; background: none; padding: 0; cursor: pointer; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
  .act svg { width: 26px; height: 26px; padding: 4px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); transition: background .15s, color .15s, box-shadow .15s; }
  .act:hover svg { box-shadow: inset 0 0 0 1.5px var(--muted); color: var(--muted); }
  .act-ok[aria-pressed="true"] svg { background: var(--moss); color: var(--bg); box-shadow: none; }
  .act-no[aria-pressed="true"] svg { background: var(--falu); color: var(--bg); box-shadow: none; }
  .row.aceptado .act-no svg { box-shadow: none; }
  .row.disputado .act-ok svg { box-shadow: none; }
  .reason { grid-column: 1 / -1; margin: -6px 14px 12px 58px; font-size: .85rem; color: var(--falu); }
  .row.new { animation: flash 1.4s ease-out; }
  @keyframes flash { from { background: color-mix(in srgb, var(--ochre) 18%, transparent); } to { background: transparent; } }

  .ro { margin: 20px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: .9rem; color: var(--muted); }
  body.readonly .acts, body.readonly .fab { opacity: .35; }
  .empty { text-align: center; color: var(--muted); padding: 48px 16px; }
  .foot { text-align: center; margin-top: 32px; color: var(--muted); font-size: .84rem; max-width: 40ch; margin-left: auto; margin-right: auto; }
  .skeleton { height: 62px; border-radius: 16px; background: var(--surface); margin-top: 12px; animation: pulse 1.1s ease-in-out infinite alternate; }
  @keyframes pulse { to { opacity: .45; } }

  /* FAB */
  .fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 20; width: 60px; height: 60px; border-radius: 50%;
    background: var(--ink); color: var(--bg); border: 0; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; transition: transform .15s; }
  .fab svg { width: 24px; height: 24px; }
  .fab:active { transform: scale(.92); }
  @media (min-width: 620px) { .fab { right: calc(50% - 280px + 20px); } }

  /* Sheets */
  .backdrop { position: fixed; inset: 0; background: rgba(8,16,24,.45); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 30; }
  .backdrop.open { opacity: 1; pointer-events: auto; }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; background: var(--surface); border-radius: 22px 22px 0 0; max-width: 560px; margin: 0 auto;
    max-height: 92%; overflow-y: auto; transform: translateY(105%); transition: transform .34s cubic-bezier(.2,.85,.2,1); padding: 0 20px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .sheet.open { transform: translateY(0); }
  .sheet.dragging { transition: none; }
  .grab { padding: 10px 0 2px; display: flex; justify-content: center; cursor: grab; touch-action: none; }
  .grab i { width: 36px; height: 4px; border-radius: 99px; background: var(--line); }
  .sheet-h { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 6px; touch-action: none; }
  .sheet-h h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
  .x { background: radial-gradient(circle, var(--surface-2) 16.5px, transparent 17.5px); border: 0; width: 44px; height: 44px; margin: -5px; border-radius: 50%; cursor: pointer; line-height: 1; color: var(--muted); display: inline-grid; place-items: center; padding: 0; }
  .x svg { width: 20px; height: 20px; }
  .x:disabled svg { opacity: .4; }
  .amount-field { display: flex; align-items: baseline; justify-content: center; gap: 2px; padding: 18px 0 22px; }
  .amount-field span { font-size: 2rem; color: var(--muted); font-weight: 600; }
  .amount-field input { font: inherit; font-size: 3.4rem; font-weight: 700; letter-spacing: -0.045em; border: 0; background: none; color: var(--ink); width: 6.5ch; padding: 0; }
  .amount-field input:focus { outline: none; }
  .amount-field input:focus-visible { box-shadow: 0 2px 0 var(--navy); }
  .amount-field input::placeholder { color: var(--muted); }
  .f { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 16px; }
  .inp { display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--muted); border-radius: 12px; padding: 13px 14px; min-height: 48px; }
  .inp:focus { outline: none; border-color: var(--navy); background: var(--surface); }
  textarea.inp { resize: vertical; min-height: 100px; }
  .seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; margin-top: 6px; gap: 3px; }
  .seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 10px 6px; cursor: pointer; font-size: .95rem; color: var(--muted); min-height: 44px; font-weight: 500; }
  .seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15,34,51,.14); font-weight: 600; }
  .hint { font-size: .85rem; color: var(--muted); margin: -8px 0 16px; min-height: 1.2em; }
  /* Reparto con invitados */
  .reparto { margin-bottom: 8px; }
  #sInv { white-space: normal; }
  .invitados { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--ink); font-size: .95rem; }
  .stepper { display: flex; align-items: center; gap: 10px; }
  .stepper .x { margin: 0; }
  .stepper .x:disabled { opacity: .4; cursor: default; }
  .stepper .inp { width: 4.2em; margin: 0; text-align: center; padding: 10px 6px; -moz-appearance: textfield; }
  .stepper .inp::-webkit-inner-spin-button, .stepper .inp::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
  .reparto-prev { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; color: var(--ink); font-size: .9rem; }
  .reparto-prev p { margin: 0; }
  .reparto-prev p:last-child { color: var(--muted); font-size: .82rem; }
  .reparto-prev dl { margin: 8px 0; display: grid; gap: 4px; }
  .reparto-prev dl div { display: flex; justify-content: space-between; gap: 12px; }
  .reparto-prev dt { color: var(--muted); }
  .reparto-prev dd { margin: 0; font-weight: 600; white-space: nowrap; }
  .date-row { display: flex; gap: 6px; margin-top: 6px; }
  .date-row .chip { min-height: 48px; border: 0; padding: 7px 13px; border-radius: 12px; background: var(--bg); }
  .date-row .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
  .date-row .inp { margin-top: 0; flex: 1; min-width: 0; }
  .err { color: var(--falu); font-size: .9rem; min-height: 1.3em; margin: 0 0 8px; }
  .sub { color: var(--muted); margin: 0 0 16px; font-size: .95rem; }
  .primary { width: 100%; background: var(--ink); color: var(--bg); border: 0; border-radius: 14px; padding: 16px; font-size: 1rem; font-weight: 600; cursor: pointer; min-height: 54px; }
  .primary.warn { background: var(--falu); color: var(--sobre-falu); }
  .primary:disabled { opacity: .5; }
  .danger { width: 100%; background: none; color: var(--falu); border: 0; border-radius: 14px; padding: 14px; font-size: .95rem; font-weight: 600; cursor: pointer; margin-top: 4px; min-height: 48px; }
  .danger.neutral { color: var(--muted); }

  /* Toast */
  .toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
    background: var(--ink); color: var(--bg); border-radius: 12px; padding: 11px 10px 11px 16px; display: flex; align-items: center; gap: 12px; z-index: 40;
    transition: opacity .2s, transform .2s; box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 40px); font-size: .93rem; }
  body.locked .toast { bottom: auto; top: calc(64px + env(safe-area-inset-top, 0px)); }
  .toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
  .toast button { background: none; border: 0; color: var(--acento-toast); font-weight: 700; cursor: pointer; padding: 6px 8px; }

  @media (min-width: 700px) {
    .sheet { bottom: auto; top: 50%; border-radius: 22px; transform: translateY(-46%) scale(.98); opacity: 0; pointer-events: none; transition: transform .22s, opacity .18s; width: 480px; left: 50%; right: auto; margin-left: -240px; box-shadow: var(--shadow); }
    .sheet.open { transform: translateY(-50%) scale(1); opacity: 1; pointer-events: auto; }
    .grab { visibility: hidden; height: 12px; padding: 0; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
  button.status { background: none; border: 0; padding: 4px 0; cursor: pointer; color: inherit; font: inherit; }
  .setup { position: fixed; inset: 0; z-index: 50; background: var(--bg); padding: 48px 24px; max-width: 520px; margin: 0 auto; }
  .setup code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
  .reason b { font-weight: 600; }

  /* Navegación y dashboard: el mismo documento y canal en vivo. */
  [hidden] { display: none !important; }
  .wrap { padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
  .section-title { font-size: 1.6rem; letter-spacing: -.03em; margin: 28px 0 14px; }
  .section-title:focus { outline: none; }
  .appnav { position: fixed; z-index: 19; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .appnav a { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: .75rem; }
  .appnav svg { width: 22px; height: 22px; }
  .nav-hueco { display: block; }
  .appnav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); font-weight: 700; }
  .navbrand { display: none; }
  /* Móvil y tableta: el + ocupa el hueco central de la barra (52 px de alto + 8 de margen). */
  .fab { left: calc(50% - 28px); right: auto; width: 56px; height: 56px; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .hero { padding-top: 18px; }
  .home-head { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; gap: 12px; }
  .home-head h2 { font-size: 1.05rem; margin: 0; }
  .home-stats button { background: none; border: 0; padding: 0; text-align: left; min-height: 44px; cursor: pointer; width: 100%; }
  .home-stats strong { display: block; font-size: 1.15rem; color: var(--ink); }
  .home-stats span { font-size: .8rem; color: var(--muted); }
  .section-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .dash-grid { display: grid; gap: 16px; }
  .dash-card, .setting-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; min-width: 0; }
  .dash-card h2, .setting-card h2 { margin: 0 0 12px; font-size: 1.05rem; }
  .dash-card p, .setting-card p { color: var(--muted); font-size: .9rem; }
  .dash-card .metric { color: var(--ink); font-size: 1.9rem; font-weight: 700; margin: 2px 0 8px; letter-spacing: -.03em; }
  .chart { display: block; width: 100%; height: auto; color: var(--navy); margin: 12px 0; overflow: visible; }
  .table-scroll { overflow-x: auto; }
  .dash-table { border-collapse: collapse; width: 100%; font-size: .82rem; }
  .dash-table caption { text-align: left; color: var(--muted); padding-bottom: 8px; }
  .dash-table th, .dash-table td { padding: 10px 4px; text-align: right; border-bottom: 1px solid var(--line); }
  .dash-table th:first-child, .dash-table td:first-child { text-align: left; }
  .dash-table button { background: none; border: 0; padding: 6px 0; min-height: 44px; color: var(--ink); cursor: pointer; text-align: left; text-decoration: underline; font: inherit; }
  .dash-table .amount { white-space: nowrap; }
  .setting-card + .setting-card { margin-top: 16px; }
  .setting-card select { max-width: 100%; }
  .check-setting { display: flex; gap: 12px; align-items: center; min-height: 48px; cursor: pointer; }
  .check-setting input { width: 22px; height: 22px; accent-color: var(--navy); }
  .help-keys { padding: 14px; background: var(--surface-2); border-radius: 12px; line-height: 1.8; }
  .help-keys kbd { font: inherit; font-weight: 700; }
  .stats dd { white-space: normal; overflow-wrap: anywhere; }
  .split-legend { gap: 8px; flex-wrap: wrap; }
  @media (max-width: 359px) {
    .wrap { padding-left: 14px; padding-right: 14px; }
    .filters { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
    .item { gap: 7px; padding-left: 10px; }
    .av { flex-basis: 26px; height: 26px; }
    .act { width: 44px; }
    .amt { font-size: .9rem; }
    .stats div + div { padding-left: 8px; }
  }
  @media (min-width: 1000px) {
    .wrap { max-width: 1180px; margin-left: 200px; padding: 0 36px 100px; }
    .appnav { top: 0; bottom: 0; right: auto; width: 200px; display: flex; flex-direction: column; gap: 8px; padding: 32px 16px; border-top: 0; border-right: 1px solid var(--line); }
    .appnav a { display: flex; align-items: center; gap: 14px; padding: 12px; font-size: .95rem; }
    .navbrand { display: block; font-weight: 700; font-size: 1.2rem; padding: 8px 12px 30px; }
    .vista { justify-content: flex-start; }
    .vista .seg { flex: 0 1 340px; }
    #seccion-inicio { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0 32px; }
    #titulo-inicio { grid-column: 1 / -1; }
    #seccion-inicio .hero { grid-row: 2 / 5; }
    .home-stats { align-self: start; margin-top: 18px; }
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .big { font-size: clamp(4rem, 7vw, 6.5rem); }
    .nav-hueco { display: none; }
    .fab { left: auto; right: 28px; bottom: 28px; width: 60px; height: 60px; }
    .toast { bottom: 104px; }
    #sheet, #gsheet { left: auto; right: 0; top: 0; bottom: 0; width: 460px; max-width: calc(100% - 32px); max-height: 100%; margin: 0; border-radius: 22px 0 0 22px; transform: translateX(105%); padding-top: env(safe-area-inset-top, 0px); }
    #sheet.open, #gsheet.open { transform: translateX(0); }
  }
  /* Íconos SVG en línea con el texto (categorías, pagos, dirección) */
  .ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -.2em; }
  .cat-chip .ico { width: 18px; height: 18px; }
  .seg .ico { width: 16px; height: 16px; margin: 0 2px; }
  /* Atrás: en la barra superior, fuera de Inicio */
  .top-izq { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .x.atras { margin: -10px 0 -10px -12px; color: var(--ink); }

  /* U5.2 · Gastos: mes, categoría, más filtros, filtros activos y resultado */
  .filters { position: static; flex-wrap: wrap; }   /* en varias líneas ya no se fija: taparía la lista en el teléfono */
  #filtroMes { max-width: 16em; }
  .mas-filtros { display: none; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 2px 0 8px; }
  .mas-filtros.abierto { display: flex; }
  .mas-filtros .grupo { display: flex; flex-wrap: wrap; gap: 0; }
  .buscar { flex: 1 1 220px; max-width: 100%; min-height: 44px; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
  .activos { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 6px; }
  .activo { min-height: 44px; font: inherit; font-size: .88rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
  .activo.limpiar { border-color: transparent; background: transparent; color: var(--navy); text-decoration: underline; }
  .resultado { margin: 2px 0 12px; color: var(--muted); font-size: .9rem; }
  .mes-sep { margin: 22px 0 4px; font-size: 1rem; font-weight: 700; }
  #btnMasFiltros span { font-weight: 700; }
  @media (min-width: 1000px) { .mas-filtros { display: flex; } #btnMasFiltros { display: none; } }
  .dash-grid { align-items: start; }   /* U5.3 · tarjetas con su propia altura */
  .top { gap: 12px; } .top .status { flex: none; }   /* U5.4 · el mes no toca el estado */

  /* UA · Avatares: la foto llena el círculo; anillo del color de cada persona (la inicial queda si no hay foto) */
  .av.foto { background: none; overflow: hidden; }
  .av.foto img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
  .av-J.foto { box-shadow: 0 0 0 2px var(--navy); } .av-Y.foto { box-shadow: 0 0 0 2px var(--ochre); }
  #pAv { margin: 4px 0 10px; }
  /* Selectores de quién pagó y de la dirección del pago: la foto junto al nombre (oculta si no hay foto) */
  .seg .av.sel { display: inline-grid; vertical-align: middle; width: 24px; height: 24px; flex: none; margin: -3px 6px -1px 0; }
  .seg .av.sel[hidden] { display: none; }

  /* U6 · Accesibilidad */
  /* Texto solo para lectores de pantalla (final del nombre de las filas) */
  .sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .item { position: relative; }
  /* Notas de las cifras como <dd> (antes <small>), con el mismo aspecto */
  .stats dd.nota { display: block; margin: 1px 0 0; font-size: .72rem; font-weight: 400; color: var(--muted); white-space: nowrap; overflow-wrap: normal; }
  /* Decisión del usuario (6 oct): la línea de categoría/tipo y la de fecha/estado de las filas, y el nombre de las
     categorías, ya no se cortan (antes «Groceries · Co», «Plataforma Digi…»): pasan a otra línea si no caben. */
  .meta { flex-wrap: wrap; row-gap: 1px; white-space: normal; }
  .meta .cat-tag { min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere; }   /* solo si no cabe ni sola en su línea */
  .crow .cn { white-space: normal; overflow-wrap: break-word; }
  /* Texto grande (letra del navegador al 200 % en un teléfono): nada se corta ni sale de la pantalla y todo el texto
     crece con la preferencia de letra (rem). Tres excepciones, que no caben al doble en un teléfono: la deuda (ya
     es de 67–86 px), el monto del formulario y las etiquetas del menú inferior (acompañadas de su ícono). Nunca quedan
     más pequeñas que con la letra normal (los mínimos en px son sus tamaños con 16 px) y crecen hasta donde cabe. */
  @media (max-width: 19.99em) {
    .top { flex-wrap: wrap; }
    .mesnav { flex: 1 1 100%; justify-content: space-between; }
    .mesnav span { min-width: 0; flex: 1; }
    .big { font-size: max(67.2px, 22vw); }                          /* = tamaño normal en teléfonos: clamp(4.2rem, 22vw, …) con 16 px */
    .amount-field span { font-size: max(32px, min(2rem, 9vw)); }
    .amount-field input { font-size: max(54.4px, min(3.4rem, 15vw)); }
    .stats { grid-template-columns: 1fr; }
    .stats div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
    .stats dd { white-space: nowrap; overflow-wrap: normal; }
    .row { grid-template-columns: 1fr; }
    .item { flex-wrap: wrap; row-gap: 4px; }
    .amt { flex: 1 1 100%; text-align: right; }
    .acts, .pago-estado { justify-self: end; padding-bottom: 6px; }
    .crow { flex-wrap: wrap; }
    .crow .cn { flex: 1 1 calc(100% - 30px); }
    .crow .cn + button { margin-left: auto; }
    .filters, .cats { flex-wrap: wrap; overflow-x: visible; }
    .chip-sel, #filtroMes { max-width: 100%; }
    .appnav a { font-size: max(12px, min(.75rem, 3.6vw)); }
  }

  /* P1a · Cabecera A: título de la sección, estado de sincronización y botón de cuenta (el mes vive en cada sección) */
  .top-izq { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
  .top-titulo { margin: 0; font-size: 1.6rem; letter-spacing: -.03em; line-height: 1.15; color: var(--ink); font-weight: 700; }
  .top-titulo:focus { outline: none; }
  .top-der { display: flex; align-items: center; gap: 6px; flex: none; }
  .top-cuenta { border: 0; background: none; padding: 2px; min-width: 44px; min-height: 44px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
  .top-cuenta .av { width: 36px; height: 36px; flex-basis: 36px; }
  .av-vacio { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--faint); }
  #seccion-gastos, #seccion-dashboard, #seccion-ajustes { padding-top: 14px; }
  .dash-periodo { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
  /* Atajo «Toda la deuda de hoy» del pago */
  #gTodo { border: 1px solid var(--line); min-height: 44px; margin: -8px 0 4px; }
  #gTodoTxt { margin: 0 0 14px; }
  #detCalculo summary { padding: 6px 0; cursor: pointer; }   /* objetivo táctil ≥ 24 px junto a «Registrar pago» */
  /* Letra grande: el título ocupa su propia línea y crece hasta donde cabe una palabra larga («Movimientos»); nunca
     queda menor que el tamaño normal (1.6rem con 16 px = 25.6 px). Estado y cuenta pasan a la línea siguiente. */
  @media (max-width: 19.99em) {
    .top { flex-wrap: wrap; row-gap: 4px; }
    .top-izq { flex: 1 1 100%; }
    .top-titulo { font-size: max(25.6px, min(1.6rem, 11vw)); }
    .top-der { margin-left: auto; }
  }

  /* P1b · Análisis con su propia barra de filtros (las mismas piezas que Movimientos) */
  #aFiltros { margin-top: -6px; }
  #analisisMes { max-width: 16em; }   /* como #filtroMes: «Octubre de 2026 · este mes» completo */
  @media (min-width: 1000px) { #aBtnMas { display: none; } }
  @media (max-width: 19.99em) { #analisisMes { max-width: 100%; } }

  /* P1c · Barras con período y «Filtros (N)»; búsqueda de Movimientos bajo su barra; panel de filtros */
  #filtroTexto { display: block; width: 100%; margin: 0 0 8px; }
  #fsheet .seg { flex-wrap: wrap; }
  #fsheet .seg button { flex: 1 1 auto; }
  #fsheet .f select { width: 100%; margin-top: 6px; }
  #fAviso:empty { display: none; }
  #fLimpiar { margin-top: 8px; }

  /* P2 · Análisis rediseñado: gráficos en HTML/CSS (texto en rem, crece con la letra elegida) */
  #aTexto { display: block; width: 100%; margin: 0 0 8px; }
  #seccion-dashboard .link, #seccion-dashboard .dash-table { font-size: .875rem; }   /* ≥ 14 px */
  .cifras { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 10px; }
  .cifras > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .cif-et { font-size: .875rem; color: var(--muted); }
  .cif-val { font-size: 1.35rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
  .dash-card .comp { color: var(--ink); }
  .bola { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; display: inline-block; }
  .hb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
  .hb-fila { position: relative; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; background: none; border: 0; border-radius: 10px; padding: 8px 6px; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 44px; }
  .hb-fila:hover { background: var(--surface-2); }
  .hb-et { display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
  .hb-val { font-size: .95rem; font-weight: 600; white-space: nowrap; }
  .hb-barra { grid-column: 1 / -1; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
  .hb-barra span { display: block; height: 100%; border-radius: 99px; background: var(--navy); }
  .ver-todas { display: block; }
  /* Cuando la fila no cabe (letra grande o pantalla muy angosta): nombre, importe y barra uno debajo de otro. */
  @container (max-width: 15rem) { .hb-fila { grid-template-columns: 1fr; } .hb-val { white-space: normal; } }
  #seccion-dashboard .table-scroll:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  /* Columnas: el área reserva arriba el alto del valor; la barra mide --p del área y el valor va justo encima. */
  .dash-card { container-type: inline-size; }
  .dash-card.ancha { grid-column: 1 / -1; }   /* en escritorio (dos columnas), «¿Cómo cambió el gasto?» usa todo el ancho */
  .cols { list-style: none; padding: 0; display: flex; gap: 4px; align-items: stretch; height: 13rem; margin: 6px 0 8px; }
  .col { flex: 1; min-width: 0; }
  .col-btn { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 6px; background: none; border: 0; border-radius: 10px; padding: 4px 2px; font: inherit; color: var(--ink); cursor: pointer; min-height: 44px; }
  .col-btn:hover, .col-btn.elegido { background: var(--surface-2); }
  .col-area { flex: 1; min-height: 0; padding-top: 1.5rem; display: flex; }
  .col-dentro { position: relative; flex: 1; }
  .col-barra { position: absolute; bottom: 0; left: 15%; width: 70%; height: var(--p); background: var(--navy); border-radius: 8px 8px 2px 2px; }
  .col-barra.en-curso { opacity: .55; }
  .col-val { position: absolute; left: -2px; right: -2px; bottom: calc(var(--p) + 4px); text-align: center; font-size: .875rem; font-weight: 600; white-space: nowrap; }
  .col-val .largo { display: none; }
  .col-et { font-size: .95rem; color: var(--muted); text-align: center; }
  /* No caben como columnas (container query en rem: crece con la letra elegida): barras horizontales con el importe exacto. */
  @container (max-width: 15rem) { .cols { height: auto; flex-direction: column; } }
  @container (max-width: 32rem) { .cols.muchas { height: auto; flex-direction: column; } }
  @container (max-width: 15rem) { .cols .col-btn { display: grid; grid-template-columns: auto 1fr; } }
  @container (max-width: 32rem) { .cols.muchas .col-btn { display: grid; grid-template-columns: auto 1fr; } }
  @container (max-width: 15rem) { .cols .col-area, .cols .col-dentro { display: contents; } .cols .col-et { grid-row: 1; grid-column: 1; text-align: left; } .cols .col-val { position: static; grid-row: 1; grid-column: 2; text-align: right; white-space: normal; } .cols .col-val .corto { display: none; } .cols .col-val .largo { display: inline; } .cols .col-barra { position: static; grid-column: 1 / -1; height: 10px; width: var(--p); border-radius: 99px; } }
  @container (max-width: 32rem) { .cols.muchas .col-area, .cols.muchas .col-dentro { display: contents; } .cols.muchas .col-et { grid-row: 1; grid-column: 1; text-align: left; } .cols.muchas .col-val { position: static; grid-row: 1; grid-column: 2; text-align: right; white-space: normal; } .cols.muchas .col-val .corto { display: none; } .cols.muchas .col-val .largo { display: inline; } .cols.muchas .col-barra { position: static; grid-column: 1 / -1; height: 10px; width: var(--p); border-radius: 99px; } }
  .div { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
  .div li { display: grid; grid-template-columns: 1fr; gap: 4px; }
  .div-et { font-size: .95rem; font-weight: 600; color: var(--ink); }
  .div-eje { position: relative; height: 12px; background: linear-gradient(to right, transparent calc(50% - 1px), var(--muted) calc(50% - 1px), var(--muted) calc(50% + 1px), transparent calc(50% + 1px)); }
  .div-barra { position: absolute; top: 1px; height: 10px; border-radius: 99px; }
  .div-barra.der { left: 50%; background: var(--ochre); }
  .div-barra.izq { right: 50%; background: var(--navy); }
  .div-val { font-size: .9rem; color: var(--muted); }
  .ver-datos { margin-top: 8px; }
  .ver-datos summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-size: .9rem; }
  .desde-analisis { margin: 0 0 8px; padding: 4px 12px; background: var(--surface-2); border-radius: 12px; color: var(--ink); font-size: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
  .desde-analisis .link { color: var(--ink); font-size: .9rem; }
  @media (max-width: 19.99em) { .cifras { flex-direction: column; } }

  /* P5 · Medios de pago y conceptos frecuentes */
  /* «Pagado con»: una línea discreta (etiqueta y botón); la lista se abre debajo, en el flujo del panel */
  .medio-f { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .medio-et { flex: 0 0 auto; }
  .medio-sel { flex: 1 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .medio-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 6px 10px 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer; }
  .medio-btn:disabled { opacity: .6; cursor: default; }
  .medio-btn .ico { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
  .medio-btn .medio-chev { width: 1rem; height: 1rem; color: var(--muted); }
  .medio-btn-txt { overflow-wrap: anywhere; text-align: left; }
  .medio-lista { flex: 1 0 100%; list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
  .medio-op { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 1rem; color: var(--ink); }
  .medio-op .ico { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; color: var(--muted); }
  .medio-op[aria-selected="true"] { font-weight: 600; }
  .medio-op[aria-selected="true"] .ico { color: var(--ink); }
  .medio-op:hover, .medio-op:focus { background: var(--surface-2); outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
  .medio-op:hover:not(:focus) { box-shadow: none; }
  /* En las filas, solo el ícono (el nombre va para lectores de pantalla y como título) */
  .medio-ico { display: inline-flex; color: var(--muted); }
  .medio-ico .ico { width: 1rem; height: 1rem; }
  .f-et { display: block; }
  .conceptos { list-style: none; margin: 6px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-height: 17rem; overflow-y: auto; box-shadow: var(--shadow); }
  .concepto-op { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 1rem; color: var(--ink); }
  .concepto-op[aria-selected="true"], .concepto-op:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ink); }
  .concepto-txt { min-width: 0; overflow-wrap: anywhere; }
  .concepto-usos { flex: 0 0 auto; font-size: .875rem; color: var(--muted); white-space: nowrap; }
  #hintConcepto:empty, #hintMedio[hidden], #gHintMedio[hidden] { display: none; }

  /* P8a · Reparto personalizado (prototipo v3): barra JARS/Yaz con la parte exacta, montos escritos y aportaciones de Ambos */
  .rep8 { margin: 10px 0 4px; }
  .rep8-cab { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; font-size: .95rem; color: var(--ink); margin-bottom: 4px; }
  .rep8-cab b { font-weight: 650; }
  .rango { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 10px; border-radius: 99px; margin: 14px 0; outline-offset: 8px;
           background: linear-gradient(90deg, var(--navy) 0 var(--p, 50%), var(--ochre) var(--p, 50%) 100%); }
  .rango::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.25), inset 0 0 0 2px var(--ink); cursor: grab; }
  .rango::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.25), inset 0 0 0 2px var(--ink); cursor: grab; }
  .rango:focus-visible { outline: 2px solid var(--ink); }
  .montos { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0; }
  .montos label { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
  .montos .inp { width: 7.5rem; margin: 0; }
  .rep8-pie { display: flex; justify-content: flex-end; }
  .alt { background: none; border: 0; padding: 4px 0; font: inherit; font-size: .875rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
  .rep8 .err:empty { display: none; }
  #aportesEt { display: block; margin-top: 4px; }
  /* Pantallas angostas (320 px): el dato bajo el importe («JARS debe $0.005», «JARS: $1,234.56») y la línea del reparto pasan a otra
     línea en lugar de cortarse; donde caben, no cambia nada. Las barras se describen por su encabezado con los importes (Chromium
     no expone aria-valuetext en una barra nativa). */
  @media (max-width: 359px) { .amt small { max-width: 4.75rem; margin-left: auto; } .meta { overflow-wrap: anywhere; } }

  /* P8b · Devoluciones (pantallas v4): fila verde con signo menos, ícono ↩, línea «Devuelto» en el gasto y pestañas del alta */
  .ico-dev { width: 1em; height: 1em; vertical-align: -0.15em; flex: none; }
  .row.dev .amt { color: var(--moss); }
  .row.dev .amt small { color: var(--muted); }
  .devuelto { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 6px 0 12px; font-size: .92rem; color: var(--ink); }
  .devuelto .link { min-height: 44px; }
  #devBloqueo { margin: 0 0 12px; }
  .amount-field.monto-fijo input { opacity: .6; }
  .pest { display: flex; gap: 20px; margin: 0 0 8px; }
  .pest button { background: none; border: 0; padding: 8px 0; min-height: 44px; font: inherit; font-size: 1.05rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
  .pest button[aria-selected="true"] { color: var(--ink); font-weight: 650; border-bottom-color: var(--ink); }
  .pest button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  .cif-dev { color: var(--muted); }

  /* Selector de período: un <select> nativo no parte su texto en líneas, así que la opción elegida se muestra en una «cara» de
     texto que sí se parte (con letra grande y en tramos largos). El select queda encima, transparente y del mismo tamaño, y
     sigue siendo el control: toque y selector del teléfono, teclado y lector de pantalla. La caja se ve como el chip anterior.
     La flecha (con transform, que la pintaría encima) y la cara no reciben el puntero, y el select hereda el redondeo de la caja
     (el de .chip-sel, 99px, dejaría sin toque las esquinas de una caja de varias líneas): toda la caja entrega el toque al select. */
  .periodo { position: relative; flex: 0 1 auto; min-width: 0; max-width: 100%; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 3px 12px 3px 9px; font-size: .9rem; line-height: 1.25; color: var(--muted); background: var(--surface-2); border: 4px solid transparent; background-clip: padding-box; border-radius: 22px; }
  .periodo:has(> select[hidden]) { display: none; }
  .periodo-cara { min-width: 0; overflow-wrap: anywhere; pointer-events: none; }
  .periodo::after { content: ''; flex: none; width: .42em; height: .42em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-25%) rotate(45deg); pointer-events: none; }
  .periodo > select.chip-sel { position: absolute; z-index: 1; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); max-width: none; min-height: 0; margin: 0; padding: 0; border-radius: inherit; opacity: 0; cursor: pointer; }
  .periodo > #filtroMes, .periodo > #analisisMes { max-width: none; }   /* anula los topes anteriores (16em y 100%) */
  .periodo:has(> select:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }

  /* R1 · Estado de la conexión: un punto sobre el avatar del botón de cuenta, con una forma distinta en cada estado (no solo
     el color): lleno en vivo, aro gris al conectar, aro ocre al reconectar y rojo con «×» sin conexión. El texto del estado
     solo se ve con un problema (data-ver), junto al avatar. Los colores de texto cumplen 4.5:1 sobre el fondo. */
  :root { --estado-ocre: #8A6212; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --estado-ocre: #E6B95F; } }
  :root[data-theme="dark"] { --estado-ocre: #E6B95F; }
  .top-cuenta { position: relative; }
  .top-cuenta .punto { position: absolute; right: 2px; bottom: 3px; width: 12px; height: 12px; border-radius: 50%; display: none; place-items: center; background: var(--bg); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }
  .top-cuenta .punto svg { display: none; width: 10px; height: 10px; fill: none; stroke: var(--sobre-falu); stroke-width: 1.8; stroke-linecap: round; }
  .top-cuenta[data-estado="vivo"] .punto { display: grid; background: var(--moss); }
  .top-cuenta[data-estado="conectando"] .punto { display: grid; border: 2.5px solid var(--muted); }
  .top-cuenta[data-estado="reconectando"] .punto { display: grid; border: 2.5px solid var(--ochre); }
  .top-cuenta[data-estado="sinred"] .punto { display: grid; width: 14px; height: 14px; right: 1px; bottom: 2px; background: var(--falu); }
  .top-cuenta[data-estado="sinred"] .punto svg { display: block; }
  .estado-txt { display: none; font-size: .875rem; font-weight: 600; line-height: 1.2; text-align: right; color: var(--muted); }
  .estado-txt[data-ver] { display: inline; }
  .estado-txt[data-estado="reconectando"] { color: var(--estado-ocre); }
  .estado-txt[data-estado="sinred"] { color: var(--falu); }
  .top-der { min-width: 0; }
  /* R1-1 · El título ocupa su ancho completo (base = su contenido, no 0): si el título y el bloque de estado y cuenta no caben
     en una fila, el bloque pasa debajo, alineado a la derecha, y nada se monta sobre el título. */
  .top { flex-wrap: wrap; row-gap: 4px; }
  .top-izq { flex: 1 1 auto; }
  .top-der { margin-left: auto; }
  /* R1-3 · Con letra grande, el título conserva su propia línea (regla de P1a): la base del 100 % vuelve a mandar después de
     la regla anterior, que tiene la misma especificidad. */
  @media (max-width: 19.99em) { .top-izq { flex: 1 1 100%; } }

  /* R2 · Inicio rediseñado (lienzo aprobado «Final · Inicio»). Tarjeta oscura de la deuda con tokens propios en los tres
     bloques de tema; tarjetas claras con gráficos de 318 px de ancho útil; «Aceptar» y los enlaces de 44 px. Textos en rem
     ≥ .875 (14 px con letra normal); con letra grande, la deuda no queda menor que con la letra normal. */
  :root { --deuda-fondo: #192733; --deuda-texto: #FFFFFF; --deuda-sec: #C9D1D8; --deuda-borde: #6B7782; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --deuda-fondo: #22303D; --deuda-texto: #EEEDE9; --deuda-sec: #B9C3CC; --deuda-borde: #7C8995; } }
  :root[data-theme="dark"] { --deuda-fondo: #22303D; --deuda-texto: #EEEDE9; --deuda-sec: #B9C3CC; --deuda-borde: #7C8995; }
  #seccion-inicio .hero.deuda { margin-top: 10px; padding: 20px; border-radius: 22px; background: var(--deuda-fondo); color: var(--deuda-texto); display: flex; flex-direction: column; gap: 12px; }
  .deuda :focus-visible { outline-color: var(--deuda-texto); }
  .deuda .flow { margin: 0; gap: 10px; }
  .deuda .flow[hidden] { display: none; }
  .deuda .flow .lg { width: 30px; height: 30px; flex-basis: 30px; font-size: .875rem; box-shadow: 0 0 0 2px var(--deuda-sec); }
  .deuda .flow .line { background: var(--deuda-sec); }
  .deuda .flow .line::after { border-left-color: var(--deuda-sec); }
  .deuda .who { margin: 0; font-size: 1.0625rem; font-weight: 600; color: var(--deuda-texto); }
  .deuda .big { margin: 0; display: flex; align-items: flex-start; flex-wrap: wrap; font-size: 1rem; line-height: 1; letter-spacing: 0; }
  .deuda .big[hidden] { display: none; }
  .deuda .big .moneda, .deuda .big .cents { font-size: 1.5rem; font-weight: 600; color: var(--deuda-sec); margin: 5px 0 0; letter-spacing: 0; }
  .deuda .big .entero { font-size: 3rem; font-weight: 700; letter-spacing: -0.03em; }
  .deuda #heroNota { margin: -4px 0 0; font-size: .875rem; color: var(--deuda-sec); }
  .deuda .saldar { margin: 0; gap: 4px 18px; }
  .deuda .pago-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--deuda-borde); border-radius: 22px; background: transparent; color: var(--deuda-texto); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
  .deuda .pago-btn svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  .deuda #detCalculo summary { min-height: 44px; display: inline-flex; align-items: center; padding: 0 2px; color: var(--deuda-sec); text-decoration: underline; text-underline-offset: 3px; list-style: none; cursor: pointer; }
  .deuda #detCalculo summary::-webkit-details-marker { display: none; }
  .deuda #detCalculo[open] { flex-basis: 100%; }
  .deuda .calc-caja { margin-top: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--ink); }
  .deuda .calc-caja :focus-visible { outline-color: var(--navy); }
  .calc-pagos { margin: 6px 0 0; }
  .calc-pagos .link { min-height: 44px; }
  .home-card { margin-top: 14px; padding: 16px 16px 8px; border-radius: 22px; background: var(--surface); }
  .home-card[hidden] { display: none; }
  .home-card > h2, .home-card .home-head h2 { margin: 0; font-size: 1.0625rem; font-weight: 700; }
  .home-card .home-head { margin-top: 0; flex-wrap: wrap; row-gap: 0; }   /* con letra grande, el enlace pasa debajo del título */
  .home-card h2 { overflow-wrap: anywhere; }
  .home-card .home-head .link { min-height: 44px; display: inline-flex; align-items: center; }
  #homeDeuda, #homeMes { padding-bottom: 16px; }
  .graf { margin: 8px 0 0; }
  .graf svg { display: block; width: 100%; max-width: 318px; height: auto; }
  .graf .cero { stroke: var(--faint); stroke-width: 1; }
  .graf .b-Y { fill: var(--ochre); }
  .graf .b-J { fill: var(--navy); }
  .graf .hoy { stroke: var(--ink); stroke-width: 1.5; }
  /* Las etiquetas de los meses van bajo columnas de ancho fijo (el gráfico mide 318 px como máximo): nunca menores que con la
     letra normal (14 px a partir de 318 px de ancho) y con un tope de 17 px; el texto completo está en «Ver datos». */
  .graf-etq { display: grid; max-width: 318px; margin: 2px 0 6px; font-size: min(.875rem, 4.4vw, 17px); color: var(--muted); text-align: center; }
  .graf-etq .hoy { color: var(--ink); font-weight: 700; }
  .graf figcaption { margin: 0; }
  .ver-datos summary { min-height: 44px; display: flex; align-items: center; color: var(--navy); font-weight: 600; cursor: pointer; }
  .tabla-desplazable { overflow-x: auto; }
  .tabla-desplazable table { width: 100%; border-collapse: collapse; font-size: .875rem; }
  .tabla-desplazable th, .tabla-desplazable td { padding: 6px 8px 6px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
  .rev-lista, .ult-lista { list-style: none; margin: 8px 0 0; padding: 0; }
  .rev-fila { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
  .rev-fila .rev-item { flex: 1; min-width: 0; min-height: 56px; padding: 10px 4px; gap: 10px; }
  .rev-txt, .ult-txt { display: flex; flex-direction: column; min-width: 0; }
  .rev-tit, .ult-tit { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
  .rev-meta, .ult-meta, .rev-nota, .rev-pie { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
  .rev-motivo { font-size: .875rem; color: var(--falu); overflow-wrap: anywhere; }
  .rev-nota { flex: 0 1 40%; padding-right: 4px; text-align: right; }
  .aceptar { flex: none; min-width: 44px; min-height: 44px; padding: 0 14px; border: 1px solid var(--moss); border-radius: 12px; background: var(--surface); color: var(--moss); font-weight: 600; cursor: pointer; }
  .rev-pie { margin: 4px 0 8px; }
  .rev-pie .link { min-height: 44px; }
  .ult-lista li { border-top: 1px solid var(--line); }
  .ult-lista .ult-item { width: 100%; min-height: 56px; justify-content: space-between; padding: 10px 4px; }
  .ult-monto { flex: none; font-weight: 700; color: var(--ink); }
  .ult-item.dev .ult-monto { color: var(--moss); }
  .mes-frase { margin: 8px 0 0; color: var(--muted); }
  .mes-frase b, .mes-neto { color: var(--ink); }
  .mes-neto { font-size: 1.5rem; font-weight: 700; }
  .pagado-barra { display: flex; gap: 3px; height: 10px; margin: 6px 0; border-radius: 99px; overflow: hidden; }
  .pagado-barra .p-J { background: var(--navy); }
  .pagado-barra .p-Y { background: var(--ochre); }
  .pagado-barra .p-A { background: var(--faint); }
  .pagado-leyenda { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
  @media (max-width: 19.99em) {
    .deuda .big .entero { font-size: max(48px, min(3rem, 15vw)); }
    .deuda .big .moneda, .deuda .big .cents { font-size: max(24px, min(1.5rem, 7.5vw)); }
    .rev-fila { flex-wrap: wrap; }
    .rev-fila .rev-item { flex-basis: 100%; }   /* «Aceptar» pasa debajo: la fila conserva todo su ancho */
    .rev-nota { flex-basis: 100%; text-align: left; padding: 0 4px 10px; }
    .rev-fila .aceptar { margin: 0 4px 10px auto; }
  }
  @media (min-width: 1000px) {
    #seccion-inicio { align-items: start; }
    #seccion-inicio .hero.deuda { grid-column: 1; grid-row: 1; }
    #homeDeuda { grid-column: 1; grid-row: 2; }
    #homeMes { grid-column: 1; grid-row: 3; }
    #homeRevisar { grid-column: 2; }
    #homeUlt { grid-column: 2; grid-row: span 2; }   /* sin «Por revisar», sube a la primera fila */
    .deuda .big .entero { font-size: 3.5rem; }
  }

  /* R3 · Análisis rediseñado (lienzo aprobado «Final · Análisis»): la frase con Registrado/Devuelto/Neto, el ritmo del mes, el
     calendario (lista con letra grande o en pantallas angostas), categorías con pista común y tendencia, 6 meses con promedio,
     quién pagó, compartido/personal en anillo y la deuda en una frase. Textos en rem ≥ .875; controles de 44 px. */
  .dash-card.frase h2 { font-size: 1.25rem; line-height: 1.3; }
  .fr-cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
  .fr-cifras div { min-width: 0; }
  .fr-cifras dt { font-size: .875rem; color: var(--muted); }
  .fr-cifras dd { margin: 2px 0 0; font-size: 1.0625rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
  .dash-card .graf svg text { fill: var(--muted); font-family: inherit; }
  .dash-card .graf .eje { stroke: var(--line); stroke-width: 1; }
  .dash-card .graf .marca { stroke: var(--line); stroke-dasharray: 2 4; }
  .dash-card .graf polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
  .dash-card .graf polyline.actual { stroke: var(--navy); stroke-width: 3; }
  .dash-card .graf polyline.previo { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 4 3; }
  .dash-card .graf circle.actual { fill: var(--navy); }
  .dash-card .graf circle.previo { fill: var(--muted); }
  .dash-card .graf figcaption { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 0; font-size: .875rem; color: var(--muted); }
  .ley { display: inline-flex; align-items: center; gap: 6px; }
  .ley::before { content: ""; display: inline-block; width: 18px; }
  .ley.actual::before { border-top: 3px solid var(--navy); }
  .ley.previo::before { border-top: 2px dashed var(--muted); }
  /* La tarjeta tiene 18 px de relleno: el calendario se extiende 6 px a cada lado para que a 390 px el contenedor mida 324 px
     y quepan 7 × 44 px + 6 × 2 px (20 rem). */
  .cal-cont { container-type: inline-size; margin: 8px -6px 0; }
  .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
  .cal-cab { font-size: .875rem; color: var(--muted); text-align: center; }
  .cal-dia { min-height: 44px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px 0; border: 0;
    border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: .875rem; line-height: 1.1; overflow-wrap: anywhere; }
  .cal-dia b { font-weight: 700; }
  button.cal-dia { cursor: pointer; }
  .cal-dia.vacio, .cal-dia.futuro { background: transparent; color: var(--muted); }
  .cal-dia.q1 { background: color-mix(in srgb, var(--navy) 10%, var(--surface)); }
  .cal-dia.q2 { background: color-mix(in srgb, var(--navy) 20%, var(--surface)); }
  .cal-dia.q3 { background: color-mix(in srgb, var(--navy) 30%, var(--surface)); }
  .cal-dia.q4 { background: color-mix(in srgb, var(--navy) 40%, var(--surface)); }
  .cal-dia.neg { background: repeating-linear-gradient(135deg, var(--falu-soft) 0 4px, var(--surface) 4px 8px); }
  .cal-lista { display: none; list-style: none; margin: 0; padding: 0; }
  .cal-item { width: 100%; min-height: 44px; padding: 8px 4px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
  /* Siete objetivos de 44 px más seis separaciones de 2 px necesitan 20 rem: si no caben (pantalla angosta o letra grande), lista. */
  @container (max-width: 19.99rem) { .cal-grid { display: none; } .cal-lista { display: block; } }
  .cat-lista { list-style: none; margin: 8px 0 0; padding: 0; }
  .cat-fila { display: block; width: 100%; min-height: 44px; padding: 8px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .cat-linea { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
  .cat-nom { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
  .cat-tend { font-size: .875rem; color: var(--muted); }
  .cat-tend.sube { color: var(--falu); }
  .cat-tend.baja { color: var(--moss); }
  .cat-imp { font-weight: 700; }
  .cat-pista { display: block; height: 8px; margin-top: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
  .cat-pista span { display: block; height: 100%; border-radius: inherit; }
  .dash-card .graf rect.otro { fill: var(--navy); opacity: .62; }
  .dash-card .graf rect.elegido { fill: var(--navy); }
  .dash-card .graf .prom { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 4; }
  .meses-etq span { display: flex; justify-content: center; align-items: center; min-width: 0; }
  .mes-col { min-height: 44px; min-width: 0; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
  .col-ast { color: var(--muted); }
  .quien-btn { min-height: 44px; }
  .tipo-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
  .tipo-card h2 { margin-top: 0; }
  .dona-fondo { fill: none; stroke: var(--surface-2); stroke-width: 6; }
  .dona-parte { fill: none; stroke: var(--navy); stroke-width: 6; }
  .tipo-linea { margin: 0; }
  .tipo-linea .link { min-height: 44px; text-align: left; }
  .deuda-frase p { margin: 0; }
  /* R3-3/R3-4 · Cada mes ocupa su columna completa (ancho y alto ≥ 44 px): la figura recupera 6 px del relleno de la tarjeta, así
     a 320 px seis columnas miden 44.3 px. */
  .meses-graf { margin-inline: -6px; }
  .meses-etq .mes-col { width: 100%; min-width: 44px; }
  /* R3-5 · Columnas netas con el cero: una negativa baja desde la línea del cero, con patrón (no solo el signo). */
  .cols .col-barra { bottom: var(--z, 0%); }
  .cols .col-val { bottom: calc(var(--z, 0%) + var(--p) + 4px); }
  .cols .col.neg .col-barra { bottom: calc(var(--z) - var(--p)); border-radius: 2px 2px 8px 8px; background: repeating-linear-gradient(135deg, var(--navy) 0 4px, var(--surface) 4px 6px); }
  .cols .col.neg .col-val { bottom: calc(var(--z) + 4px); }
  .cols.con-neg .col-dentro::after { content: ""; position: absolute; left: 0; right: 0; bottom: var(--z); border-top: 1px solid var(--line); }

/* P9 · Quién confirma y concepto de los pagos (lienzo XDi5R1KGHXSgMSixaQ1FoN, ronda 3 aprobada) */
  .rev-linea { display: inline-flex; align-items: center; gap: 4px; margin-top: 1px; font-size: .875rem; font-weight: 600; color: var(--estado-ocre); overflow-wrap: anywhere; }
  .rev-linea.mia { color: var(--moss); }
  .rev-linea.sin { color: var(--muted); font-weight: 400; }
  .rev-linea svg { width: 14px; height: 14px; flex: none; }
  .rev-linea.sin svg { color: var(--moss); }
  .row.aceptado .rev-estado { color: var(--moss); }
  .row.disputado .rev-estado { color: var(--falu); }
  .rev-etq { align-self: flex-start; margin-top: 4px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink); font-size: .875rem; font-weight: 600; }
  .rev-sub { margin: 2px 0 0; font-size: .875rem; color: var(--muted); }
  .home-card.esperando { padding: 4px 14px; border-radius: 18px; background: var(--surface-2); }
  .esp-head { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
  .esp-head h2 { margin: 0; font-size: .9375rem; font-weight: 700; }
  .esp-resumen { flex: 1 1 auto; font-size: .875rem; color: var(--muted); }
  .esp-head .link { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }   /* «Ver»/«Ocultar»: 44 × 44 px */
  .esperando .ult-lista li { border-top-color: var(--line); }
  .esperando .rev-pie { margin: 0 0 4px; }
  .rev-panel { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; background: var(--bg); font-size: .875rem; color: var(--muted); }
  .rev-panel[hidden] { display: none; }
  .rev-panel b { display: block; margin-bottom: 2px; font-size: .9375rem; color: var(--ink); }
  .rev-panel-ico { flex: none; display: inline-grid; margin-top: 1px; color: var(--estado-ocre); }
  .rev-panel-ico svg { width: 20px; height: 20px; }
  .rev-panel.aceptado .rev-panel-ico { color: var(--moss); }
  .rev-panel.disputado .rev-panel-ico { color: var(--falu); }
  .concepto-et { display: flex; justify-content: space-between; gap: 8px; }
  .concepto-cuenta { font-size: .875rem; color: var(--muted); }
  .concepto-cuenta.excede { color: var(--falu); font-weight: 600; }
  #gConcepto[aria-invalid="true"] { border-color: var(--falu); }
/* fin de P9 */

/* P10 · Gastos por pagar (lienzo HzA1zQuHWocKF6wfJTcs1T, ronda 3 aprobada; pestaña «Por pagar» por decisión del usuario) */
  .pp-lista { list-style: none; margin: 8px 0 0; padding: 0; }
  .pp-lista[hidden] { display: none; }
  .pp-fila { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
  .pp-fila .pp-item { flex: 1; min-width: 0; min-height: 56px; padding: 10px 4px; }
  .pp-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .pp-fila.pagado .pp-txt { flex: 1; padding: 10px 4px; }
  .pp-tit { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
  .pp-meta { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
  .pp-vencido, .pp-pagado { display: inline-block; padding: 0 7px; border-radius: 99px; font-weight: 700; }
  .pp-vencido { background: var(--falu-soft); color: var(--falu); }
  .pp-pagado { background: color-mix(in srgb, var(--moss) 16%, transparent); color: var(--moss); }
  .pp-pagar { flex: none; min-width: 44px; min-height: 44px; padding: 0 14px; border: 1px solid var(--navy); border-radius: 12px; background: var(--surface); color: var(--navy); font-weight: 600; cursor: pointer; }
  .pp-fila .pp-ver { flex: none; min-width: 44px; padding: 0 4px; font-size: .875rem; color: var(--navy); }
  /* Movimientos: la sección plegable, arriba de las cifras y los filtros */
  .pp-sec { margin: 4px 0 14px; padding: 2px 16px 6px; border-radius: 22px; background: var(--surface); }
  .pp-sec[hidden] { display: none; }
  .pp-sec-h { margin: 0; font-size: 1.0625rem; }
  .pp-sec-h button { width: 100%; min-height: 52px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; border: 0; background: none; padding: 4px; font: inherit; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer; }
  .pp-sec-tit { flex: 1 1 auto; }
  .pp-sec-res { font-size: .875rem; font-weight: 500; color: var(--muted); }
  .pp-sec-h svg { width: 18px; height: 18px; flex: none; transition: transform .2s; }
  .pp-sec-h button[aria-expanded="true"] svg { transform: rotate(180deg); }
  .pp-nota, .pp-aviso { margin: 0 4px 8px; font-size: .875rem; color: var(--muted); }
  .pp-aviso[hidden], .pp-vacio[hidden] { display: none; }
  .pp-aviso .link { min-height: 44px; }
  .pp-vacio { margin: 4px 4px 10px; color: var(--ink); }
  .pp-sec-pie { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0 12px; margin-top: 4px; border-top: 1px solid var(--line); }
  .pp-sec-pie .link { min-width: 44px; padding: 0 4px; color: var(--navy); }
  /* «Marcar como pagado» en el formulario de gasto */
  .pp-origen { margin: 8px 0 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: .9rem; }
  .pp-origen[hidden], .pp-quien[hidden] { display: none; }
  .pp-quien { margin: 6px 0 0; font-size: .875rem; font-weight: 600; color: var(--estado-ocre); }
  /* Pestañas: con tres, a 320 px o con letra grande, pasan a otra línea en vez de salirse */
  .pest { flex-wrap: wrap; column-gap: 20px; row-gap: 0; }
  /* Panel del gasto por pagar: el contenido se desplaza y las acciones quedan fijas abajo (PP10-6) */
  .seg.cuatro button { padding: 10px 2px; font-size: .9rem; }
  textarea.pp-nota-inp { min-height: 76px; resize: none; }
  #ppNota[aria-invalid="true"], #ppConcepto[aria-invalid="true"] { border-color: var(--falu); }
  .pp-ayuda { margin: 6px 0 0; }
  .pp-explica { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-size: .9rem; }
  .pp-pie { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom, 0px)); z-index: 1; margin: 0 -20px; padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
  .pp-pie .err { margin: 0; min-height: 0; }
  .pp-pie .err:empty { display: none; }
  .pp-acciones { display: flex; gap: 8px; }
  .pp-acciones > * { flex: 1 1 0; margin: 0; }
  .pp-acciones [hidden] { display: none; }
  .pp-marcar { width: 100%; min-height: 50px; border: 0; border-radius: 14px; background: var(--moss); color: var(--surface); font-weight: 700; font-size: 1rem; cursor: pointer; }
  .pp-borrar { min-height: 50px; border: 1px solid var(--falu); border-radius: 14px; background: var(--surface); color: var(--falu); font-weight: 600; cursor: pointer; }
  .pp-sec-btn { min-height: 46px; border: 1px solid var(--navy); border-radius: 14px; background: var(--surface); color: var(--navy); font-weight: 600; cursor: pointer; }
  .pp-marcar[hidden], .pp-sec-btn[hidden], .pp-borrar[hidden] { display: none; }
  .pp-marcar:disabled, .pp-borrar:disabled, .pp-sec-btn:disabled { opacity: .5; cursor: default; }
  /* Diálogo de cambios sin guardar: cubre el panel (el panel transformado es su referencia) */
  .pp-dialogo { position: fixed; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px; background: rgba(8,16,24,.45); border-radius: inherit; }
  .pp-dialogo[hidden] { display: none; }
  .pp-dialogo-caja { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
  .pp-dialogo-caja h3 { margin: 0; font-size: 1.05rem; }
  .pp-dialogo-caja p { margin: 0; color: var(--ink); }
  .pp-dialogo-caja .primary { min-height: 50px; padding: 12px; }
  @media (max-width: 19.99em) {
    .pp-fila { flex-wrap: wrap; }
    .pp-fila .pp-item { flex-basis: 100%; }   /* «Pagar» pasa debajo: la fila conserva todo su ancho */
    .pp-fila .pp-pagar { margin: 0 4px 10px auto; }
    .pp-acciones { flex-direction: column; }
    .pp-acciones > * { flex: none; }   /* en columna, cada botón con su alto: el texto en dos líneas no se sale */
    .pp-pie { position: static; margin: 4px 0 0; padding: 10px 0 0; }   /* con letra grande, un pie fijo taparía el formulario: va al final */
    .seg.cuatro { flex-wrap: wrap; }
    .seg.cuatro button { flex: 1 1 40%; }
  }
/* fin de P10 */

/* P18 · Avatar de «Ambos» con las dos fotos y fotos en todos lados. */
/* P18 · «Ambos» con al menos una foto: dos mitades (JARS a la izquierda, Yaz a la derecha), cada cara centrada en la suya, una
   línea fina entre ellas y el aro de 2 px de las fotos partido en navy y ocre. La mitad sin foto lleva su color y su inicial. */
.av-A.par { position: relative; isolation: isolate; background: none; color: inherit; }
.av-A.par::before { content: ''; position: absolute; inset: -2px; border-radius: 50%; z-index: 0; background: linear-gradient(90deg, var(--navy) 50%, var(--ochre) 50%); }
.av-A.par::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 1.5px; transform: translateX(-50%); background: var(--surface); z-index: 2; }
.av-A.par .mitad { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; z-index: 1; display: grid; place-items: center; font-weight: 700; line-height: 1; container-type: size; }
.av-A.par .mJ { left: 0; border-radius: 999px 0 0 999px; background: var(--navy); color: var(--on-navy); }
.av-A.par .mY { right: 0; border-radius: 0 999px 999px 0; background: var(--ochre); color: #2A1E05; }
.av-A.par .mitad img { position: absolute; top: 0; left: -50%; height: 100%; width: 200%; max-width: none; object-fit: cover; display: block; }
.av-A.par .mJ b { transform: translateX(1px); } .av-A.par .mY b { transform: translateX(-1px); }
/* P18C-1 · Las iniciales decorativas (aria-hidden) de las mitades y de los círculos chicos se dimensionan con su círculo: con letra
   normal, el tamaño de siempre (1em); con letra grande, no pasan del 65 % de su alto y caben enteras. El texto visible no cambia. */
.av-A.par .mitad > b, .av.mini > b { font-size: min(1em, 65cqh); line-height: 1; }
/* P18 · Círculos chicos (listas de reparto y leyendas de quién pagó); el hueco alinea las opciones sin persona. */
.av.mini { display: inline-grid; vertical-align: middle; width: 20px; height: 20px; flex: none; margin: -2px 6px 0 0; container-type: size; }
.medio-op .av.mini { margin: 0; }
.av.mini.av-hueco { visibility: hidden; }
/* P18 · Filas de «Últimos movimientos» y «Por pagar» con su círculo; «sin definir quién»: un «?» tenue. */
.ult-item .ult-txt, .pp-item .pp-txt { flex: 1 1 auto; }
.pp-item .av-vacio { color: var(--muted); }
/* P18 · Un selector con círculos no parte el círculo y el nombre en dos líneas: si no caben, las opciones pasan a otra fila. */
.seg button:has(> .av.sel:not([hidden])) { white-space: nowrap; }
.seg:has(> button > .av.sel:not([hidden])) { flex-wrap: wrap; }
/* P18 · Con letra grande, cualquier grupo de opciones pasa a otra fila antes que salirse de la pantalla (antes de P18 se salían
   «Personal» y «Ambos» a 320 px con la letra al 200 %). Con letra normal no cambia nada: las opciones caben en su fila. */
@media (max-width: 19.99em) { .seg { flex-wrap: wrap; } }
/* fin de P18 */

/* P13 · Exportar. La × de los paneles conserva sus 44 px aunque el título sea largo (con letra grande se encogía); el título se parte en líneas. */
.sheet-h .x { flex: none; }
.sheet-h h2 { min-width: 0; overflow-wrap: break-word; }
/* fin de P13 */

/* P14 · Modo oscuro (y claro): un token para los contornos de los controles y las marcas neutras de los gráficos, con al menos 3:1 contra
   los tres fondos de cada tema, y el texto de los campos vacíos con el gris de la app (4.5:1). */
:root { --control: #85857F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --control: #737572; } }
:root[data-theme="dark"] { --control: #737572; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.buscar, .medio-btn { border-color: var(--control); }
.pagado-barra .p-A { background: var(--control); }
.graf .cero { stroke: var(--control); }
/* fin de P14 */

/* P15 · Escritorio (solo con min-width: 1000px; el teléfono no cambia). La tabla de Movimientos, además, solo con 62.5em de ancho: con
   letra grande vuelven las tarjetas. */
@media (min-width: 1000px) {
  /* Todos los paneles a la derecha (antes, solo el gasto y el pago; los demás, centrados). */
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: 460px; max-width: calc(100% - 32px); max-height: 100%; margin: 0; border-radius: 22px 0 0 22px;
    transform: translateX(105%); opacity: 1; padding-top: env(safe-area-inset-top, 0px); }
  .sheet.open { transform: translateX(0); }
}
@media (min-width: 1000px) and (min-width: 62.5em) {
  /* Si aun así no cupiera, la tabla se desplaza dentro de su caja (enfocable y con nombre), nunca se recorta. */
  .mtabla-caja { margin-top: 12px; background: var(--surface); border-radius: 16px; overflow-x: auto; }
  .mtabla-caja:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  #seccion-gastos.con-tabla #list { display: none; }
  .mtabla { width: 100%; border-collapse: collapse; font-size: .95rem; }
  .mtabla thead th { text-align: left; font-size: .875rem; font-weight: 600; color: var(--muted); padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 1; }
  .mtabla thead th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; white-space: nowrap; }
  .mtabla thead th button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
  .mtabla thead th[aria-sort] button { color: var(--ink); }
  .mtabla td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .mtabla tr.mt-fila { cursor: pointer; }
  .mtabla tr.mt-fila:hover td { background: var(--surface-2); }
  .mtabla .mt-dia th, .mtabla .mt-mes th { text-align: left; padding: 14px 12px 6px; font-size: .875rem; font-weight: 600; color: var(--ink); background: var(--bg); }
  .mtabla .mt-mes th { font-size: 1rem; }
  .mtabla .mt-dia th span { float: right; color: var(--muted); font-weight: 400; }
  .mtabla .num { text-align: right; white-space: nowrap; }
  .mtabla .mt-abrir { all: unset; cursor: pointer; display: block; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
  .mtabla .mt-abrir:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
  .mtabla .mt-sub { display: block; font-size: .875rem; color: var(--muted); }
  .mtabla .mt-quien { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
  .mtabla .mt-quien .av { width: 28px; height: 28px; flex-basis: 28px; }
  .mtabla .mt-papel { display: block; font-size: .875rem; color: var(--muted); }
  .mtabla .mt-cat { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  .mtabla .mt-medio { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
  .mtabla tr.disputado td:first-child { box-shadow: inset 3px 0 var(--falu); }
  .mtabla tr.dev .mt-monto { color: var(--moss); }
  .mtabla .mt-estado { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
  .mtabla .mt-estado-txt { font-size: .875rem; color: var(--muted); white-space: nowrap; margin-right: 4px; }
  .mtabla tr.aceptado .mt-estado-txt { color: var(--moss); }
  .mtabla tr.disputado .mt-estado-txt { color: var(--falu); }
}
/* De 62.5 a 74.99em la tabla no tiene sitio para siete columnas: el medio se ve en el detalle, las celdas se acercan y la categoría puede
   partirse en dos líneas. */
@media (min-width: 1000px) and (min-width: 62.5em) and (max-width: 74.99em) {
  .mtabla .c-medio { display: none; }
  .mtabla td, .mtabla thead th { padding-left: 8px; padding-right: 8px; }
  .mtabla .mt-cat { white-space: normal; }
}
/* Análisis en tres columnas en pantallas anchas (de 1000 a 1439 px, en dos). */
@media (min-width: 1440px) { .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* fin de P15 */
/* P16 · Moneda del pago: selector, «Otra», «Equivale a USD» y el importe original en filas, tabla e Inicio. */
.mon-f { margin-top: -6px; }
.mon-f .seg { margin-top: 6px; }
.mon-campo { margin-top: 12px; }
.f.mon-campo { margin-top: 0; }
.mon-usd { position: relative; }
.mon-usd > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--muted); pointer-events: none; }
.mon-usd .inp { width: 100%; padding-left: 28px; }
.mon-cambio { margin: 6px 0 0; font-size: .875rem; color: var(--muted); }
.mon-cod { text-transform: uppercase; letter-spacing: .08em; max-width: 8ch; }
.mon-fija { margin: 0 0 4px; font-size: .95rem; color: var(--muted); text-align: center; }
.mon-fija b { color: var(--ink); }
.meta .mon-orig, .ult-meta .mon-orig { font-weight: 600; color: var(--ink); }
.mon-orig-rev { font-weight: 400; color: var(--muted); }
.mt-orig { display: block; font-size: .875rem; color: var(--muted); font-weight: 400; }
/* fin de P16 */

/* P17 · Reparto en los gastos por pagar: el bloque del gasto (mismas clases) dentro del panel; la línea del planeado al pagar. */
#fRepPP { margin: 0 0 8px; }
/* fin de P17 */

/* P19 · La gráfica de Inicio: el importe de cada barra, en su columna, y «Hasta hoy» bajo el mes en curso. Los importes se achican con el
   ancho (vw) para caber en seis columnas a 320 px; con letra grande, el tope de 15px los mantiene dentro de su columna. */
.graf-montos { display: grid; max-width: 318px; margin: 4px 0 0; font-size: min(.875rem, 3.4vw, 15px); font-weight: 600; color: var(--ink); text-align: center; white-space: nowrap; }
.graf-montos .hoy { font-weight: 800; }
.graf-montos + .graf-etq { margin-top: 0; }
.graf-etq span { line-height: 1.2; }

/* P20 · La moneda: el botón y la lista de «Pagado con»; las opciones son botones. */
.mon-f.medio-f { margin-top: 0; }
.mon-f .mon-campo { flex: 1 0 100%; margin-top: 4px; }
.medio-lista button.medio-op { width: 100%; border: 0; background: none; font: inherit; text-align: left; }
.medio-lista button.medio-op:hover, .medio-lista button.medio-op:focus { background: var(--surface-2); }   /* como las de «Pagado con» */
.mon-btn[aria-disabled="true"] { opacity: .6; cursor: default; }   /* P20C-1 · la moneda fija: bloqueada pero enfocable */
.medio-lista button.medio-op[aria-selected="true"] { font-weight: 600; }
/* fin de P19 y P20 */

/* P21 · Las dos casillas son editables: columnas que se apilan cuando el ancho o la letra lo requieren. */
#ppsheet .montos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
#ppsheet .montos label { display: block; min-width: 0; }
#ppsheet .montos .inp { width: 100%; min-width: 0; margin-top: 6px; }
/* fin de P21 */

/* P22 · Una sola barra con sus importes siempre visibles; adelanto opcional sin otra barra. */
#sheet .montos, #ppsheet .montos { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap:12px; }
#sheet .montos label, #ppsheet .montos label { display:block; min-width:0; color:var(--ink); }
#sheet .montos .inp, #ppsheet .montos .inp { width:100%; min-width:0; margin-top:6px; }
#sheet .p22-barra, #ppsheet .p22-barra { position:relative; margin:4px 0 8px; }
#sheet .p22-rail, #ppsheet .p22-rail { position:absolute; left:14px; right:14px; top:17px; height:10px; border-radius:99px; background:linear-gradient(to right,var(--navy) 0 var(--p),var(--ochre) var(--p) 100%); }
#sheet #pRango, #ppsheet #ppPRango { position:relative; height:44px; padding:0; margin:0; border-radius:0; background:transparent; }
#sheet #pRango::-webkit-slider-runnable-track, #ppsheet #ppPRango::-webkit-slider-runnable-track { height:10px; background:transparent; }
#sheet #pRango::-webkit-slider-thumb, #ppsheet #ppPRango::-webkit-slider-thumb { margin-top:-9px; }
#sheet #pRango::-moz-range-track, #ppsheet #ppPRango::-moz-range-track { height:10px; background:transparent; }
#sheet .p22-adelanto, #ppsheet .p22-adelanto { border-top:1px solid var(--line); padding-top:6px; }
.p22-adelanto, .p22-adelanto *, .p22-adelanto *::before, .p22-adelanto *::after { box-sizing:border-box; }
.p22-adelanto summary { min-height:44px; padding:10px 0; color:var(--muted); cursor:pointer; }
.p22-adelanto .p22-real { display:block; margin:8px 0 12px; }
.p22-adelanto .alt { min-height:44px; white-space:normal; text-align:left; }
.p22-resultado { color:var(--moss); }
/* fin de P22 */
