:root{
    --ink:#1F3E68;
    --ink-2:#2A4D7A;
    --paper:#FAF6ED;
    --paper-2:#F2ECDB;
    --paper-line:#E3DBC8;
    --gold:#B79A58;
    --gold-soft:#D9C48F;
    --forest:#2F6B52;
    --clay:#B14B34;
    --ink-soft:#5B6B68;
    --ink-faint:#8B9895;
    --radius:18px;
  }
  *{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
  html,body{margin:0; padding:0;}
  body{
    background: linear-gradient(180deg,#12294A,#1F3E68 40%, #17335A);
    font-family:'IBM Plex Sans', sans-serif;
    color:var(--ink);
    min-height:100vh;
    display:flex;
    align-items:flex-start;
    justify-content:center;
    padding:28px 12px;
  }
  .stage{
    width:100%;
    max-width:420px;
  }
  .phone{
    position:relative;
    background:var(--paper);
    border-radius:34px;
    overflow:hidden;
    box-shadow: 0 30px 70px -20px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
    height:844px;
    max-height:calc(100vh - 56px);
    max-height:calc(100dvh - 56px);
    min-height:600px;
    display:flex;
    flex-direction:column;
  }
  .notch{
    position:absolute; top:0; left:50%; transform:translateX(-50%);
    width:120px; height:24px; background:var(--ink); border-radius:0 0 16px 16px; z-index:50;
  }

  /* ---- Screen system ---- */
  .screen{ display:none; flex-direction:column; flex:1; min-height:0; }
  .screen.active{ display:flex; }

  /* ---- Perforation divider (signature motif) ---- */
  .perf{
    position:relative;
    height:1px;
    margin: 14px 0;
    border-top: 2px dashed var(--paper-line);
  }
  .perf::before,.perf::after{
    content:"";
    position:absolute; top:50%; transform:translateY(-50%);
    width:14px; height:14px; border-radius:50%;
    background: var(--ink);
  }
  .perf::before{ left:-19px; }
  .perf::after{ right:-19px; }
  .perf-label{
    text-align:center;
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    letter-spacing:.04em;
    color:var(--ink-faint);
    margin:-6px 0 14px;
  }

  /* ================= LOGIN ================= */
  #screen-login{
    background: radial-gradient(120% 90% at 50% -10%, #2A4D7A 0%, #1F3E68 55%, #14294A 100%);
    color:var(--paper);
    justify-content:space-between;
    padding:64px 28px 36px;
  }
  .brand{ text-align:center; }
  .brand-mark{
    width:104px; height:104px; margin:0 auto 16px;
    border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    overflow:hidden;
    box-shadow:0 0 0 1px rgba(255,255,255,.08), 0 10px 30px -8px rgba(0,0,0,.5);
  }
  .brand-mark img{ width:100%; height:100%; object-fit:cover; display:block; }
  .brand h1{
    font-family:'Fraunces', serif; font-weight:600; font-size:30px; margin:0;
    letter-spacing:.01em;
  }
  .brand p{
    font-size:13px; color:#9FB4B0; margin:8px 0 0; font-family:'IBM Plex Mono',monospace;
    letter-spacing:.03em;
  }
  .profiles{ display:flex; gap:14px; justify-content:center; margin-top:44px; }
  .profile-chip{
    display:flex; flex-direction:column; align-items:center; gap:10px;
    background:transparent; border:none; cursor:pointer; color:#DCE7E4;
    font-family:'IBM Plex Sans'; font-size:13px;
  }
  .profile-avatar{
    width:60px; height:60px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
    font-family:'Fraunces',serif; font-size:20px; color:var(--ink);
    background:var(--gold-soft);
    border:2px solid transparent;
    transition:.15s;
  }
  .profile-chip.selected .profile-avatar{
    border-color:var(--gold); box-shadow:0 0 0 4px rgba(201,154,59,.25);
    background:var(--gold);
  }
  .pin-area{ margin-top:40px; }
  .pin-dots{ display:flex; gap:14px; justify-content:center; margin-bottom:26px; }
  .pin-dot{ width:12px; height:12px; border-radius:50%; border:1.5px solid var(--gold-soft); }
  .pin-dot.filled{ background:var(--gold); border-color:var(--gold); }
  .pin-pad{
    display:grid; grid-template-columns:repeat(3,1fr); gap:14px;
    max-width:260px; margin:0 auto;
  }
  .pin-key{
    aspect-ratio:1; border-radius:50%; border:1px solid rgba(255,255,255,.14);
    background:rgba(255,255,255,.04); color:var(--paper);
    font-family:'IBM Plex Mono'; font-size:19px; display:flex; align-items:center; justify-content:center;
    cursor:pointer;
  }
  .pin-key:active{ background:rgba(201,154,59,.35); }
  .pin-key.ghost{ background:transparent; border:none; }
  .login-hint{ text-align:center; font-size:11.5px; color:#7C918D; margin-top:22px; font-family:'IBM Plex Mono',monospace; }

  /* ================= HEADER (ledger page) ================= */
  .ledger-header{
    background:var(--ink);
    color:var(--paper);
    padding:26px 22px 30px;
    position:relative;
  }
  .header-top{ display:flex; align-items:center; gap:10px; }
  .mini-logo{ width:34px; height:34px; border-radius:50%; flex-shrink:0; box-shadow:0 0 0 1px rgba(255,255,255,.15); }
  .ledger-header .eyebrow{
    font-family:'IBM Plex Mono', monospace; font-size:11px; letter-spacing:.08em;
    color:var(--gold-soft); text-transform:uppercase; display:flex; justify-content:space-between; align-items:center;
  }
  .month-switch{ display:flex; align-items:center; gap:10px; }
  .month-switch button{ background:none;border:none;color:var(--gold-soft);font-size:15px;cursor:pointer;padding:2px 6px; }
  .balance-summary-row{ display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:10px; }
  .balance-line{ display:flex; align-items:baseline; gap:10px; margin-top:0; min-width:0; }
  .privacy-button{
    flex:0 0 auto; width:42px; height:42px; display:flex; align-items:center; justify-content:center;
    border:1px solid rgba(255,255,255,.16); border-radius:50%; background:rgba(255,255,255,.06);
    color:var(--gold-soft); cursor:pointer;
  }
  .privacy-button:active{ background:rgba(183,154,88,.2); }
  .privacy-icon{ width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  .privacy-icon-hidden{ display:none; }
  .privacy-button.masked .privacy-icon-visible{ display:none; }
  .privacy-button.masked .privacy-icon-hidden{ display:block; }
  .private-value{ letter-spacing:.08em; }
  .balance-line .num{
    font-family:'Fraunces', serif; font-weight:600; font-size:40px; letter-spacing:-.01em;
  }
  .balance-line .curr{ font-family:'IBM Plex Mono'; font-size:15px; color:var(--gold-soft); }
  .carry-note{
    font-family:'IBM Plex Mono', monospace; font-size:11.5px; color:#9FB4B0;
    margin-top:6px;
  }
  .accounts-row{ display:flex; gap:10px; margin-top:20px; }
  .account-chip{
    flex:1; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.1);
    border-radius:14px; padding:11px 13px;
  }
  .account-chip .label{ font-size:10.5px; letter-spacing:.06em; color:#9FB4B0; font-family:'IBM Plex Mono'; text-transform:uppercase; }
  .account-chip .val{ font-family:'IBM Plex Mono'; font-size:16px; font-weight:600; margin-top:4px; }
  .account-chip.veg .val{ color:var(--gold-soft); }

  /* ================= BODY / LIST ================= */
  .body-scroll{
    flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
    padding:20px 22px 100px; background:var(--paper);
  }
  #screen-home .body-scroll{ min-height:0; }
  .section-title{
    font-family:'IBM Plex Mono'; font-size:11px; letter-spacing:.08em; text-transform:uppercase;
    color:var(--ink-faint); margin:0 0 12px;
  }
  .entry-section-head{
    display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px;
  }
  .entry-section-head .section-title{ margin-bottom:3px; }
  .entry-filter-summary{
    margin:0; color:var(--ink-faint); font-family:'IBM Plex Mono'; font-size:10.5px; line-height:1.35;
  }
  .entry-filter-toggle{
    flex:0 0 auto; display:flex; align-items:center; gap:5px; padding:7px 10px;
    border:1px solid var(--paper-line); border-radius:10px; background:var(--paper-2);
    color:var(--ink-soft); font-family:'IBM Plex Sans'; font-size:11.5px; cursor:pointer;
  }
  .entry-filter-toggle svg{
    width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round;
  }
  .entry-filter-toggle.active{
    border-color:var(--gold); background:#F3E8C9; color:var(--ink);
  }
  .entry-filter-panel{
    display:none; margin:0 0 13px; padding:12px; border:1px solid var(--paper-line);
    border-radius:13px; background:var(--paper-2);
  }
  .entry-filter-panel.show{ display:block; }
  .entry-filter-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .entry-filter-grid .field{ margin-bottom:0; }
  .entry-filter-grid .field input{
    width:100%; min-width:0; margin-top:5px; padding:10px 8px; border:1px solid var(--paper-line);
    border-radius:10px; background:var(--paper); color:var(--ink); font-family:'IBM Plex Sans'; font-size:13px;
  }
  .entry-filter-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:10px; }
  .entry-filter-actions button{ padding:8px 11px; font-size:11.5px; }
  .entry{
    display:flex; align-items:center; gap:12px;
    padding:12px 4px 12px 0; border-bottom:1px solid var(--paper-line);
  }
  .entry:last-child{ border-bottom:none; }
  .entry-icon{
    width:38px; height:38px; border-radius:11px; background:var(--paper-2);
    display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0;
  }
  .entry-info{ flex:1; min-width:0; }
  .entry-info .desc{ font-size:14px; font-weight:500; }
  .entry-info .meta{ font-size:11.5px; color:var(--ink-faint); font-family:'IBM Plex Mono'; margin-top:2px; }
  .entry-val{
    flex:0 0 auto; min-width:max-content; padding-right:2px; overflow:visible;
    font-family:'IBM Plex Mono'; font-size:14.5px; font-weight:600; white-space:nowrap;
    font-variant-numeric:tabular-nums;
  }
  .entry-val::after{ content:none !important; }
  .entry-val.out{ color:var(--clay); }
  .entry-val.in{ color:var(--forest); }
  .empty-note{ text-align:center; padding:30px 10px; color:var(--ink-faint); font-size:13px; }
  .empty-note.compact-loading{ padding:18px 10px; }

  /* ================= NAV ================= */
  .tabbar{
    position:absolute; bottom:0; left:0; right:0;
    display:flex; align-items:center; justify-content:space-around;
    background:rgba(250,246,237,.92); backdrop-filter:blur(6px);
    border-top:1px solid var(--paper-line);
    padding:10px 6px calc(10px + env(safe-area-inset-bottom));
    z-index:40;
  }
  .tab{
    display:flex; flex-direction:column; align-items:center; gap:4px;
    background:none; border:none; cursor:pointer; color:var(--ink-faint);
    font-family:'IBM Plex Sans'; font-size:10px; padding:4px 8px;
  }
  .tab.active{ color:var(--ink); }
  .tab .ic{ font-size:19px; }
  .tab-fab{
    width:52px; height:52px; border-radius:50%; background:var(--gold);
    display:flex; align-items:center; justify-content:center; color:var(--ink);
    font-size:24px; margin-top:-30px; box-shadow:0 8px 18px -6px rgba(201,154,59,.6);
    border:4px solid var(--paper);
  }

  /* ================= FORM (Lançar) ================= */
  .form-screen .ledger-header{ padding-bottom:22px; }
  .toggle-row{ display:flex; gap:8px; margin-bottom:18px; }
  .toggle-btn{
    flex:1; padding:11px; border-radius:12px; border:1px solid var(--paper-line);
    background:var(--paper-2); font-family:'IBM Plex Sans'; font-size:13.5px; font-weight:500;
    color:var(--ink-soft); cursor:pointer;
  }
  .toggle-btn.on.saida{ background:var(--clay); border-color:var(--clay); color:#fff; }
  .toggle-btn.on.entrada{ background:var(--forest); border-color:var(--forest); color:#fff; }
  .field{ margin-bottom:16px; }
  .field label{ font-family:'IBM Plex Mono'; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-faint); }
  .field input, .field select{
    width:100%; margin-top:6px; padding:12px 13px; border-radius:12px;
    border:1px solid var(--paper-line); background:var(--paper); font-family:'IBM Plex Sans'; font-size:15px; color:var(--ink);
  }
  .value-input{ font-family:'IBM Plex Mono'; font-size:22px !important; font-weight:600; }
  .chips{ display:flex; flex-wrap:wrap; gap:8px; margin-top:6px; }
  .chip{
    padding:8px 12px; border-radius:20px; border:1px solid var(--paper-line); background:var(--paper-2);
    font-size:13px; cursor:pointer; color:var(--ink-soft);
  }
  .chip.sel{ background:var(--ink); color:var(--paper); border-color:var(--ink); }
  .save-btn{
    width:100%; padding:15px; border-radius:14px; border:none; background:var(--ink);
    color:var(--paper); font-family:'IBM Plex Sans'; font-weight:600; font-size:15px; cursor:pointer; margin-top:8px;
  }
  .save-btn:active{ opacity:.85; }
  .save-btn:disabled,.modal-btn:disabled,.chat-send:disabled{ opacity:.55; cursor:default; }
  .button-progress{ display:inline-flex; align-items:center; gap:8px; }
  .button-progress::before{ content:""; width:14px; height:14px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:spin .7s linear infinite; }
  .toast{
    position:fixed; bottom:calc(92px + env(safe-area-inset-bottom)); left:50%;
    width:max-content; max-width:calc(min(420px,100vw) - 32px);
    transform:translateX(-50%) translateY(20px);
    background:var(--ink); color:var(--paper); padding:12px 18px; border-radius:12px; font-size:13px;
    opacity:0; transition:.25s; pointer-events:none; z-index:160; white-space:normal; text-align:center;
    font-family:'IBM Plex Sans'; display:flex; align-items:center; justify-content:center; gap:8px;
    box-shadow:0 14px 35px -18px rgba(0,0,0,.75);
  }
  .toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

  /* ================= CONTAS (dívidas/fixos) ================= */
  .subtabs{ display:flex; gap:8px; margin-bottom:16px; }
  .subtab{
    padding:8px 14px; border-radius:20px; font-size:12.5px; border:1px solid var(--paper-line);
    background:var(--paper-2); color:var(--ink-soft); cursor:pointer; font-family:'IBM Plex Sans'; font-weight:500;
  }
  .subtab.sel{ background:var(--ink); color:var(--paper); border-color:var(--ink); }
  .card{
    background:var(--paper-2); border:1px solid var(--paper-line); border-radius:14px; padding:14px 15px; margin-bottom:12px;
  }
  .card-top{ display:flex; justify-content:space-between; align-items:baseline; }
  .card-top .name{ font-size:14.5px; font-weight:600; }
  .card-top .amount{ font-family:'IBM Plex Mono'; font-size:14px; color:var(--clay); }
  .bar-track{ height:6px; background:var(--paper-line); border-radius:4px; margin-top:10px; overflow:hidden; }
  .bar-fill{ height:100%; background:var(--gold); border-radius:4px; }
  .card-foot{ display:flex; justify-content:space-between; margin-top:8px; font-size:11px; color:var(--ink-faint); font-family:'IBM Plex Mono'; }
  .mark-paid{
    margin-top:10px; width:100%; padding:9px; border-radius:10px; border:1px solid var(--forest);
    background:transparent; color:var(--forest); font-size:12.5px; font-weight:600; cursor:pointer;
  }
  .mark-paid.done{ background:var(--forest); color:#fff; }

  /* ================= CONSULTOR ================= */
  #screen-consultor.active{
    position:absolute;
    inset:0;
    padding-bottom:82px;
    background:var(--paper);
  }
  #screen-consultor .body-scroll{
    flex:1;
    min-height:0;
    display:flex;
    flex-direction:column;
    padding:16px 22px 10px;
    overflow-y:auto;
  }
  .chat-log{ flex:1; display:flex; flex-direction:column; gap:12px; }
  .bubble{
    max-width:82%; padding:12px 14px; border-radius:16px; font-size:13.5px; line-height:1.55;
    white-space:pre-wrap; overflow-wrap:anywhere;
  }
  .bubble.bot{ align-self:flex-start; background:var(--paper-2); border:1px solid var(--paper-line); border-bottom-left-radius:4px; }
  .bubble.user{ align-self:flex-end; background:var(--ink); color:var(--paper); border-bottom-right-radius:4px; }
  .bubble.bot b{ color:var(--forest); }
  .prompt-chips{
    flex:0 0 auto;
    display:flex;
    gap:8px;
    overflow-x:auto;
    padding:10px 22px;
    background:var(--paper);
  }
  .prompt-chip{
    white-space:nowrap; padding:9px 13px; border-radius:20px; border:1px solid var(--paper-line);
    background:var(--paper); font-size:12.5px; color:var(--ink-soft); cursor:pointer; font-family:'IBM Plex Sans';
  }
  .chat-input-row{
    flex:0 0 auto;
    display:flex;
    align-items:flex-end;
    gap:8px;
    margin:0 14px 12px;
    padding:8px;
    border:1px solid var(--paper-line);
    border-radius:18px;
    background:#fffdf8;
    box-shadow:0 8px 22px -18px rgba(31,62,104,.65);
  }
  .chat-input-row textarea{
    flex:1;
    min-width:0;
    min-height:44px;
    max-height:116px;
    resize:none;
    overflow-y:auto;
    border:none;
    outline:none;
    background:transparent;
    color:var(--ink);
    padding:10px 8px;
    font-family:'IBM Plex Sans';
    font-size:14px;
    line-height:1.4;
  }
  .chat-input-row textarea::placeholder{ color:var(--ink-faint); }
  .chat-send{
    flex:0 0 auto;
    width:44px;
    height:44px;
    border-radius:50%;
    background:var(--ink);
    color:var(--paper);
    border:none;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    font-size:18px;
  }
  .chat-send:disabled{ opacity:.45; cursor:default; }
  .chat-helper{
    padding:0 22px 8px;
    color:var(--ink-faint);
    font-family:'IBM Plex Mono';
    font-size:10px;
    line-height:1.35;
    background:var(--paper);
  }
  .typing{ display:flex; gap:4px; padding:4px 2px; }
  .typing span{ width:6px; height:6px; border-radius:50%; background:var(--ink-faint); animation:blink 1.2s infinite; }
  .typing span:nth-child(2){ animation-delay:.2s; }
  .typing span:nth-child(3){ animation-delay:.4s; }
  @keyframes blink{ 0%,80%,100%{opacity:.25} 40%{opacity:1} }

  .note-banner{
    margin:0 22px 16px; padding:10px 13px; border-radius:12px; background:#EFE6C8; border:1px solid var(--gold-soft);
    font-size:11.5px; color:#5C4A1E; font-family:'IBM Plex Mono', monospace; line-height:1.5;
  }


  /* ================= MAIS OPÇÕES ================= */
  .more-list{ display:flex; flex-direction:column; gap:12px; }
  .more-item{
    width:100%; display:flex; align-items:center; gap:13px; text-align:left;
    padding:15px; border-radius:14px; border:1px solid var(--paper-line);
    background:var(--paper-2); color:var(--ink); cursor:pointer;
  }
  .more-item .more-icon{
    width:42px; height:42px; border-radius:12px; background:var(--paper);
    display:flex; align-items:center; justify-content:center; font-size:19px; flex-shrink:0;
  }
  .more-item .more-copy{ flex:1; min-width:0; }
  .more-item .more-title{ display:block; font-size:14.5px; font-weight:600; line-height:1.25; }
  .more-item .more-desc{ display:block; margin-top:4px; font-size:11.5px; line-height:1.4; color:var(--ink-faint); }
  .more-item .more-arrow{ color:var(--gold); font-size:20px; }

  /* ================= SWIPE ACTIONS ================= */
  .swipe-shell{
    --swipe-distance:146px;
    position:relative; overflow:hidden; border-radius:14px;
    touch-action:pan-y; user-select:none;
  }
  .swipe-shell.entry-shell{ border-radius:12px; }
  .swipe-actions{
    position:absolute; top:0; right:0; bottom:0;
    width:var(--swipe-distance); display:flex; align-items:stretch;
    gap:6px; padding-left:6px; z-index:1;
  }
  .swipe-action{
    flex:1; min-width:0; border:none; border-radius:12px;
    color:#fff; cursor:pointer;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:4px; font-family:'IBM Plex Sans'; font-size:10.5px; font-weight:600;
  }
  .swipe-action.edit{ background:var(--gold); color:var(--ink); }
  .swipe-action.delete{ background:var(--clay); }
  .swipe-action .act-ic{
    width:20px;
    height:20px;
    display:flex;
    align-items:center;
    justify-content:center;
    line-height:0;
  }
  .swipe-action .act-ic svg{
    display:block;
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }
  .swipe-content{
    position:relative; z-index:2; background:var(--paper);
    transform:translateX(0); transition:transform .22s ease;
    will-change:transform;
  }
  .entry-shell .swipe-actions{ top:4px; bottom:4px; }
  .entry-shell .swipe-action{ border-radius:11px; }
  .card-swipe{ margin-bottom:12px; }
  .card-swipe .swipe-content{ height:100%; background:transparent; }
  .card-swipe .card{ height:100%; margin-bottom:0; }
  .card-swipe .swipe-actions{ border-radius:14px; }
  .card-swipe .swipe-action{ border-radius:14px; }
  .swipe-shell.open .swipe-content{ transform:translateX(calc(-1 * var(--swipe-distance))); }
  .swipe-hint{
    margin:0 0 12px; color:var(--ink-faint); font-family:'IBM Plex Mono';
    font-size:10.5px; line-height:1.45;
  }

  /* ================= ADICIONAR EM CONTAS ================= */
  .add-account-btn{
    width:100%; display:flex; align-items:center; justify-content:center; gap:9px;
    margin:0 0 12px; padding:12px 14px; border:1px dashed var(--gold);
    border-radius:13px; background:rgba(183,154,88,.09); color:var(--ink);
    font-family:'IBM Plex Sans'; font-size:13.5px; font-weight:600; cursor:pointer;
    transition:background .15s, transform .15s;
  }
  .add-account-btn:active{ background:rgba(183,154,88,.19); transform:scale(.99); }
  .add-account-icon{
    width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center;
    background:var(--gold); color:var(--ink); font-family:'IBM Plex Mono'; font-size:17px; line-height:1;
  }
  .modal-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
  .modal-help{
    margin:-6px 0 14px; color:var(--ink-faint); font-family:'IBM Plex Mono';
    font-size:10.5px; line-height:1.5;
  }
  @media (max-width:360px){ .modal-grid{ grid-template-columns:1fr; gap:0; } }

  /* ================= EDIT MODAL ================= */
  .modal-backdrop{
    position:fixed; inset:0; z-index:180; display:none; align-items:flex-end; justify-content:center;
    width:100vw; height:100vh; height:100dvh;
    background:rgba(15,34,61,.52); backdrop-filter:blur(2px);
  }
  .modal-backdrop.show{ display:flex; }
  .modal-sheet{
    width:min(100%,420px); max-height:min(88dvh,720px); overflow-y:auto;
    background:var(--paper); border-radius:22px 22px 0 0;
    padding:20px 22px calc(22px + env(safe-area-inset-bottom));
    box-shadow:0 -18px 45px -20px rgba(0,0,0,.5);
  }
  .modal-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
  .modal-title{ font-family:'Fraunces',serif; font-size:20px; font-weight:600; }
  .modal-close{ border:none; background:none; color:var(--ink-faint); font-size:22px; cursor:pointer; }
  .modal-actions{ display:flex; gap:10px; margin-top:18px; }
  .modal-btn{
    flex:1; padding:12px; border-radius:12px; font-family:'IBM Plex Sans';
    font-size:13.5px; font-weight:600; cursor:pointer;
  }
  .modal-btn.secondary{ border:1px solid var(--paper-line); background:var(--paper-2); color:var(--ink); }
  .modal-btn.primary{ border:1px solid var(--ink); background:var(--ink); color:var(--paper); }
  .modal-btn.danger{ border:1px solid var(--clay); background:var(--clay); color:#fff; }

  ::-webkit-scrollbar{ width:0; height:0; }


  /* ================= V4 / APP REAL ================= */
  .auth-screen{
    background:radial-gradient(120% 90% at 50% -10%,#2A4D7A 0%,#1F3E68 55%,#14294A 100%);
    color:var(--paper);
    justify-content:flex-start;
    padding:54px 28px 34px;
    overflow-y:auto;
  }
  .auth-screen .brand-mark{ width:94px; height:94px; margin-bottom:12px; }
  .auth-screen .brand h1{ font-size:29px; }
  .auth-copy{ max-width:330px; margin:10px auto 0; color:#9FB4B0; font-size:12.5px; line-height:1.55; }
  .auth-form{ width:100%; margin-top:28px; }
  .auth-label{
    display:block; margin:0 0 7px; color:#AFC0BD;
    font-family:'IBM Plex Mono',monospace; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase;
  }
  .auth-input-wrap{ position:relative; margin-bottom:14px; }
  .auth-input{
    width:100%; padding:13px 44px 13px 14px; border-radius:13px;
    border:1px solid rgba(255,255,255,.18); background:rgba(255,255,255,.07);
    color:var(--paper); font-family:'IBM Plex Sans'; font-size:15px; outline:none;
  }
  .auth-input::placeholder{ color:#829895; }
  .auth-input:focus{ border-color:var(--gold-soft); box-shadow:0 0 0 3px rgba(183,154,88,.16); }
  .auth-input.code{ text-align:center; font-family:'IBM Plex Mono'; font-size:23px; letter-spacing:.28em; padding-right:14px; }
  .password-toggle{
    position:absolute; top:50%; right:10px; transform:translateY(-50%);
    width:32px; height:32px; border:0; border-radius:50%; background:transparent; color:var(--gold-soft); cursor:pointer;
  }
  .auth-primary{
    width:100%; border:0; border-radius:14px; padding:14px 16px;
    background:var(--gold); color:var(--ink); font-weight:600; cursor:pointer;
  }
  .auth-secondary{
    width:100%; margin-top:10px; border:1px solid rgba(255,255,255,.18); border-radius:14px;
    padding:12px 16px; background:rgba(255,255,255,.04); color:var(--paper); cursor:pointer;
  }
  .auth-links{ display:flex; justify-content:center; flex-wrap:wrap; gap:8px 18px; margin-top:18px; }
  .auth-link{ border:0; background:none; color:var(--gold-soft); font-size:12.5px; cursor:pointer; padding:4px; }
  .auth-back{ align-self:flex-start; border:0; background:none; color:var(--gold-soft); padding:4px 0 14px; cursor:pointer; }
  .auth-message{ margin-top:14px; color:#AFC0BD; font-size:11.5px; line-height:1.5; text-align:center; }
  .auth-message.error{ color:#FFD5CB; }
  .profiles{ margin-top:24px; }
  .profile-chip{ min-width:78px; }
  .profile-avatar{ text-transform:uppercase; }
  .profile-status{ display:block; max-width:78px; color:#8FA5A1; font-family:'IBM Plex Mono'; font-size:9px; line-height:1.25; text-align:center; }

  .loading-layer{
    position:fixed; inset:0; z-index:150; display:none; align-items:center; justify-content:center;
    background:rgba(20,41,74,.52); backdrop-filter:blur(2px);
  }
  .loading-layer.show{ display:flex; }
  .loading-box{ min-width:150px; padding:18px; border-radius:16px; background:var(--paper); color:var(--ink); text-align:center; box-shadow:0 18px 50px -20px rgba(0,0,0,.7); }
  .spinner{ width:28px; height:28px; margin:0 auto 9px; border:3px solid var(--paper-line); border-top-color:var(--gold); border-radius:50%; animation:spin .8s linear infinite; }
  @keyframes spin{ to{ transform:rotate(360deg); } }
  .loading-box p{ margin:0; font-size:12px; }

  .screen-header{ background:var(--ink); color:var(--paper); padding:25px 22px 18px; }
  .screen-header-row{ display:flex; align-items:center; gap:10px; }
  .back-button{ width:36px; height:36px; border:1px solid rgba(255,255,255,.13); border-radius:50%; background:rgba(255,255,255,.05); color:var(--gold-soft); font-size:20px; cursor:pointer; }
  .screen-header h2{ margin:0; font-family:'Fraunces',serif; font-size:21px; font-weight:600; }
  .screen-header p{ margin:3px 0 0; color:#9FB4B0; font-size:11.5px; }
  .screen-body{ flex:1; min-height:0; overflow-y:auto; padding:20px 22px 100px; background:var(--paper); }
  .screen-body.no-tabbar{ padding-bottom:24px; }

  .month-switch button:disabled{ opacity:.35; }
  .swipe-content{ position:relative; z-index:2; background:var(--paper); transition:transform .18s ease; }
  .card-swipe .swipe-content{ background:transparent; }
  .card-swipe{ margin-bottom:12px; }
  .card-swipe .card{ margin-bottom:0; min-height:100%; }
  .swipe-action.edit{ background:#B79A58; color:var(--ink); }
  .swipe-action.delete{ background:#B94D37; color:#fff; }

  .category-scroll{ display:flex; gap:8px; overflow-x:auto; padding-bottom:3px; }
  .field input[type="date"]{ min-width:0; }
  .form-note{ margin:4px 0 14px; color:var(--ink-faint); font-size:11.5px; line-height:1.45; }
  .primary-inline{ border:0; border-radius:12px; background:var(--ink); color:var(--paper); padding:11px 14px; font-weight:600; cursor:pointer; }
  .outline-inline{ border:1px solid var(--ink); border-radius:12px; background:transparent; color:var(--ink); padding:10px 13px; font-weight:600; cursor:pointer; }
  .danger-inline{ border:1px solid var(--clay); border-radius:12px; background:transparent; color:var(--clay); padding:10px 13px; font-weight:600; cursor:pointer; }
  .section-actions{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
  .add-account-btn{
    width:100%; display:flex; align-items:center; justify-content:center; gap:7px;
    margin-bottom:14px; padding:11px; border:1px dashed var(--gold); border-radius:13px;
    background:#F7F0DE; color:var(--ink); font-weight:600; cursor:pointer;
  }
  .mark-paid:disabled{ opacity:.55; cursor:default; }

  .report-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .report-stat{ padding:13px; border:1px solid var(--paper-line); border-radius:14px; background:var(--paper-2); }
  .report-stat span{ display:block; color:var(--ink-faint); font-family:'IBM Plex Mono'; font-size:10px; text-transform:uppercase; }
  .report-stat strong{ display:block; margin-top:5px; font-family:'IBM Plex Mono'; font-size:16px; }
  .category-group{ margin-top:18px; }
  .category-list{ border-top:1px solid var(--paper-line); }
  .category-line{ display:flex; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--paper-line); font-size:13px; }
  .category-line strong{ font-family:'IBM Plex Mono'; white-space:nowrap; }

  .profile-list{ display:flex; flex-direction:column; gap:10px; }
  .profile-card-real{ display:flex; align-items:center; gap:12px; padding:14px; border:1px solid var(--paper-line); border-radius:14px; background:var(--paper-2); }
  .profile-card-real .avatar{ width:44px; height:44px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:var(--gold-soft); color:var(--ink); font-family:'Fraunces'; font-weight:600; }
  .profile-card-real .copy{ flex:1; min-width:0; }
  .profile-card-real .copy strong{ display:block; }
  .profile-card-real .copy small{ display:block; margin-top:3px; color:var(--ink-faint); }
  .status-pill{ padding:5px 8px; border-radius:999px; background:#E6EFE9; color:var(--forest); font-size:10px; white-space:nowrap; }
  .status-pill.warn{ background:#F4E8C5; color:#7A5E1D; }

  .settings-block{ margin-bottom:16px; padding:15px; border:1px solid var(--paper-line); border-radius:15px; background:var(--paper-2); }
  .settings-block h3{ margin:0 0 12px; font-size:14.5px; }
  .settings-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:9px 0; border-bottom:1px solid var(--paper-line); font-size:12.5px; }
  .settings-row:last-child{ border:0; }
  .settings-row small{ color:var(--ink-faint); }
  .switch-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:10px 0; }
  .switch-row input{ width:20px; height:20px; accent-color:var(--ink); }
  .settings-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .settings-grid .field{ margin-bottom:0; }
  .full-span{ grid-column:1/-1; }

  .chat-status{ color:var(--ink-faint); font-family:'IBM Plex Mono'; font-size:10px; padding:0 22px 6px; }
  .chat-input-row textarea{ box-sizing:border-box; }

  .modal-help.error{ color:var(--clay); }
  .modal-sheet.large{ max-height:88%; overflow-y:auto; }
  .modal-grid.one{ grid-template-columns:1fr; }
  .confirm-copy{ margin:14px 0 2px; color:var(--ink-soft); font-size:13.5px; line-height:1.55; }

  @media (max-width:480px){
    body{ padding:0; }
    .entry-filter-grid{ grid-template-columns:1fr 1fr; }
    .entry-filter-grid .field input{ font-size:12px; }
    .entry-val{ font-size:14px; }
    .modal-sheet{ width:100%; max-height:86dvh; }
    .stage{ max-width:none; height:100vh; height:100dvh; }
    .phone{ border-radius:0; height:100vh; height:100dvh; max-height:none; min-height:0; }
    .notch{ display:none; }
    .ledger-header{ padding-left:17px; padding-right:17px; }
    .body-scroll,.screen-body{ padding-left:17px; padding-right:17px; }
    .balance-line .num{ font-size:35px; }
    .account-chip .val{ font-size:14px; }
    .swipe-shell{ --swipe-distance:136px; }
  }


  /* =========================================================
     V4.2.4 — AÇÕES DE SWIPE TOTALMENTE OCULTAS QUANDO FECHADAS
     ========================================================= */
  .swipe-shell{
    isolation:isolate;
  }

  .swipe-shell .swipe-actions{
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transform:translate3d(100%,0,0);
    transition:
      opacity .08s ease,
      transform .18s ease,
      visibility 0s linear .18s;
  }

  .swipe-shell.open .swipe-actions,
  .swipe-shell.swiping .swipe-actions{
    opacity:1;
    visibility:visible;
    transform:translate3d(0,0,0);
    transition:
      opacity .08s ease,
      transform .18s ease,
      visibility 0s;
  }

  .swipe-shell.open .swipe-actions{
    pointer-events:auto;
  }

  .swipe-shell.swiping .swipe-actions{
    pointer-events:none;
  }

  .swipe-shell .swipe-content{
    width:100%;
    min-width:100%;
    box-sizing:border-box;
    border-radius:inherit;
    backface-visibility:hidden;
    transform:translate3d(0,0,0);
  }

  .swipe-shell.open .swipe-content{
    transform:translate3d(
      calc(-1 * var(--swipe-distance)),
      0,
      0
    );
  }



  /* =========================================================
     V4.3.0 — CUSTOS FIXOS POR COMPETÊNCIA E ADIANTAMENTO
     ========================================================= */
  .fixed-summary-title{
    margin:2px 0 9px;
  }
  .fixed-summary-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;
    margin-bottom:16px;
  }
  .fixed-summary-item{
    min-width:0;
    padding:12px 13px;
    border:1px solid var(--paper-line);
    border-radius:14px;
    background:var(--paper-2);
  }
  .fixed-summary-item span{
    display:block;
    color:var(--ink-faint);
    font-family:'IBM Plex Mono',monospace;
    font-size:9.5px;
    line-height:1.35;
    letter-spacing:.04em;
    text-transform:uppercase;
  }
  .fixed-summary-item strong{
    display:block;
    margin-top:5px;
    font-family:'IBM Plex Mono',monospace;
    font-size:15px;
    white-space:nowrap;
  }
  .advance-fixed-btn{
    width:100%;
    margin:0 0 10px;
    padding:12px 14px;
    border:1px solid var(--ink);
    border-radius:13px;
    background:var(--ink);
    color:var(--paper);
    font-family:'IBM Plex Sans';
    font-size:13px;
    font-weight:600;
    cursor:pointer;
  }
  .advance-fixed-btn:active{
    transform:scale(.99);
  }
  .fixed-guidance{
    margin:0 0 14px;
    color:var(--ink-faint);
    font-family:'IBM Plex Mono',monospace;
    font-size:10px;
    line-height:1.5;
  }
  .fixed-card .card-top{
    align-items:flex-start;
    gap:12px;
  }
  .fixed-card-copy{
    min-width:0;
    flex:1;
  }
  .fixed-card .amount{
    flex:0 0 auto;
    white-space:nowrap;
  }
  .fixed-card-meta{
    margin-top:4px;
    color:var(--ink-faint);
    font-family:'IBM Plex Mono',monospace;
    font-size:10.5px;
    line-height:1.5;
  }
  .fixed-status-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-top:10px;
  }
  .fixed-status{
    display:inline-flex;
    align-items:center;
    min-width:0;
    padding:5px 8px;
    border-radius:999px;
    font-family:'IBM Plex Sans';
    font-size:10px;
    font-weight:600;
  }
  .fixed-status.overdue{ background:#F5DED8; color:var(--clay); }
  .fixed-status.open{ background:#F1E5C5; color:#765A19; }
  .fixed-status.partial{ background:#E2E9F1; color:var(--ink); }
  .fixed-status.paid{ background:#E3EFE7; color:var(--forest); }
  .fixed-status.forgiven{ background:#EEE8F2; color:#665075; }
  .fixed-pay-button{
    flex:0 0 auto;
    min-width:74px;
    padding:8px 14px;
    border:1px solid var(--forest);
    border-radius:10px;
    background:transparent;
    color:var(--forest);
    font-family:'IBM Plex Sans';
    font-size:11.5px;
    font-weight:600;
    cursor:pointer;
  }
  .fixed-pay-button:disabled{
    opacity:.55;
    cursor:default;
  }
  .fixed-progress-copy{
    display:flex;
    justify-content:space-between;
    gap:10px;
    margin-top:6px;
    color:var(--ink-faint);
    font-family:'IBM Plex Mono',monospace;
    font-size:9.5px;
  }
  .advance-help{
    margin-top:8px;
    margin-bottom:0;
  }
  .advance-mode-row{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin-top:15px;
  }
  .advance-mode-button{
    padding:10px;
    border:1px solid var(--paper-line);
    border-radius:12px;
    background:var(--paper-2);
    color:var(--ink-soft);
    font-size:12.5px;
    font-weight:600;
    cursor:pointer;
  }
  .advance-mode-button.sel{
    border-color:var(--ink);
    background:var(--ink);
    color:var(--paper);
  }
  .advance-review{
    margin-top:16px;
    padding:13px;
    border:1px solid var(--gold-soft);
    border-radius:13px;
    background:#F7F0DE;
    color:var(--ink-soft);
    font-size:12.5px;
    line-height:1.55;
  }
  .advance-review strong{
    color:var(--ink);
  }
  .advance-review.error{
    border-color:rgba(177,75,52,.45);
    background:#F8E8E3;
    color:var(--clay);
  }
  @media (max-width:360px){
    .fixed-summary-grid{ grid-template-columns:1fr; }
    .fixed-status-row{ align-items:flex-end; }
  }