/* Familia — indigo and saffron, with one capulana-inspired band as the signature. */
@font-face{font-family:"Bricolage";src:url(fonts/bricolage.woff2) format("woff2");font-weight:200 800;font-display:swap}

:root{
  --paper:#F3F4F9;--surface:#FFFFFF;--ink:#161A33;--muted:#5D6382;--line:#E1E4EF;--soft:#ECEEF6;
  --indigo:#1D2660;--indigo-2:#2A3478;--blue:#3446A8;--blue-soft:#E7EAFB;
  --saffron:#F2B705;--saffron-soft:#FFF4D1;--in:#0E7A55;--in-soft:#E1F3EA;--out:#B4233C;--out-soft:#FBE7EB;
  --display:"Bricolage",system-ui,sans-serif;--body:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --nav-h:64px;--safe-b:env(safe-area-inset-bottom,0px);--safe-t:env(safe-area-inset-top,0px);
  --band:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20' viewBox='0 0 40 20'%3E%3Cpath d='M0 20 10 0 20 20Z' fill='%23F2B705'/%3E%3Cpath d='M10 0h20L20 20Z' fill='%230E8A60'/%3E%3Cpath d='M20 20 30 0 40 20Z' fill='%23F2B705'/%3E%3Cpath d='M30 0h10v20ZM0 0h10L0 20Z' fill='%23C8323C'/%3E%3Ccircle cx='20' cy='6' r='1.8' fill='%23fff'/%3E%3Ccircle cx='0' cy='6' r='1.8' fill='%23fff'/%3E%3Ccircle cx='40' cy='6' r='1.8' fill='%23fff'/%3E%3C/svg%3E");
  color-scheme:light;
}
@media (prefers-color-scheme:dark){
  :root{--paper:#0E1124;--surface:#171B36;--ink:#ECEEF8;--muted:#9DA3C7;--line:#272C52;--soft:#20254A;
    --indigo:#161D4F;--indigo-2:#222A63;--blue:#8C9CFF;--blue-soft:#232A5C;--saffron-soft:#3A3115;
    --in:#45C996;--in-soft:#12332A;--out:#FF8094;--out-soft:#3A1A24;color-scheme:dark}
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.45 var(--body);font-variant-numeric:tabular-nums}
[hidden]{display:none!important}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:3px solid var(--blue);outline-offset:2px;border-radius:8px}
.i{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex:none}
.muted{color:var(--muted)}.small{font-size:13px}.center{text-align:center}
.in{color:var(--in)}.out{color:var(--out)}
h1,h2,h3{font-family:var(--display);letter-spacing:-.01em;margin:0}
h1{font-size:28px;font-weight:700;line-height:1.15}
h2{font-size:19px;font-weight:650}
h3{font-size:15px;font-weight:650}
.band{height:12px;background:var(--band) repeat-x;background-size:24px 12px}

/* Splash and login */
.splash{position:fixed;inset:0;background:var(--indigo);display:grid;place-items:center;z-index:50}
.splash .band{position:absolute;top:0;left:0;right:0;height:14px;background-size:28px 14px}
.splash-name{font-family:var(--display);font-size:30px;font-weight:700;color:#fff;margin:0}
.login{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;background:var(--paper)}
.login-art{background:var(--indigo);height:180px;position:relative;flex:none}
.band-tall{position:absolute;left:0;right:0;top:0;height:20px;background-size:40px 20px}
.login-card{width:min(420px,calc(100% - 32px));margin:-72px auto 32px;background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:26px 22px 18px;position:relative;box-shadow:0 18px 40px -24px #1D266066}
.login-card h1{font-size:30px}
.login-card>.muted{margin:6px 0 22px}
.lang-switch{display:inline-flex;gap:4px;background:var(--soft);padding:4px;border-radius:12px}
.lang-switch button{border:0;background:none;border-radius:9px;padding:7px 14px;font-size:14px;font-weight:650;color:var(--muted)}
.lang-switch button.on{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px #0000001f}
#loginLang{display:flex;justify-content:flex-end;margin:-8px -6px 12px 0}

/* Shell and navigation */
.shell{min-height:100vh}
.view{max-width:760px;margin:0 auto;padding:0 16px calc(var(--nav-h) + 96px + var(--safe-b));outline:none}
.nav{position:fixed;left:0;right:0;bottom:0;z-index:20;display:grid;grid-template-columns:repeat(5,1fr);background:var(--surface);border-top:1px solid var(--line);padding:0 4px var(--safe-b)}
.nav>button[data-tab]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;height:var(--nav-h);border:0;background:none;color:var(--muted);font-size:11.5px;font-weight:600;position:relative}
.nav>button[data-tab].active{color:var(--ink)}
.nav>button[data-tab].active::before{content:"";position:absolute;top:0;left:28%;right:28%;height:3px;border-radius:0 0 3px 3px;background:var(--saffron)}
.nav>.nav-brand,.nav>.nav-record,.nav>.nav-who{display:none}
.fab{position:fixed;right:18px;bottom:calc(var(--nav-h) + 16px + var(--safe-b));z-index:21;width:60px;height:60px;border-radius:20px;border:0;background:var(--saffron);color:#1D2660;display:grid;place-items:center;box-shadow:0 10px 24px -8px #8a6a0099}
.fab .i{width:28px;height:28px;stroke-width:2.4}

.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;padding:calc(22px + var(--safe-t)) 0 14px}
.page-head p{margin:4px 0 0}

/* Home hero: the one bold surface */
.hero{background:var(--indigo);color:#fff;margin:0 -16px;padding:calc(16px + var(--safe-t)) 20px 22px;border-radius:0 0 26px 26px;position:relative;overflow:hidden}
.hero .band{position:absolute;top:0;left:0;right:0}
.hero-top{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:6px;font-size:14px}
.hero-top b{font-family:var(--display);font-size:17px;font-weight:650}
.sync{display:inline-flex;align-items:center;gap:6px;color:#ffffffb3;font-size:12.5px;background:none;border:0;padding:6px 0}
.sync .dot{width:7px;height:7px;border-radius:50%;background:#45C996}
.sync.off .dot{background:var(--saffron)}
.hero-label{margin:22px 0 0;color:#ffffffbf;font-size:14px}
.hero-amount{font-family:var(--display);font-size:clamp(40px,12vw,56px);font-weight:700;line-height:1.05;margin:4px 0 0;letter-spacing:-.02em}
.hero-amount small{font-size:.38em;font-weight:600;opacity:.75;margin-left:6px;letter-spacing:0}
.hero-amount.neg{color:#FFB3BF}
.hero-stats{display:grid;grid-template-columns:1fr 1fr;gap:14px 18px;margin:22px 0 0;padding-top:16px;border-top:1px solid #ffffff26}
.hero-stats div{min-width:0}
.hero-stats dt{font-size:12.5px;color:#ffffffa6}
.hero-stats dd{margin:2px 0 0;font-size:17px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Sections, panels, rows */
.block{margin-top:26px}
.block-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:10px}
.block-head .muted{font-size:14px}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:18px;overflow:hidden}
.panel.pad{padding:16px}
.list{list-style:none;margin:0;padding:0}
.row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:12px;padding:12px 14px;border-top:1px solid var(--line);width:100%;text-align:left;background:none;border-left:0;border-right:0;border-bottom:0}
.list>li:first-child>.row,.list>.row:first-child{border-top:0}
button.row:hover{background:var(--soft)}
.row-main{min-width:0}
.row-main b{display:block;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-main span{display:block;font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row.two{grid-template-columns:1fr auto}
.row.wrap .row-main b{white-space:normal;font-weight:550;font-size:15px}
.row-end{text-align:right;font-weight:650;white-space:nowrap}
.row-end span{display:block;font-size:12.5px;font-weight:500;color:var(--muted)}
.avatar{width:40px;height:40px;border-radius:14px;display:grid;place-items:center;font-weight:700;font-size:14px;color:#fff;flex:none}
.avatar.c0{background:#3446A8}.avatar.c1{background:#0E7A55}.avatar.c2{background:#B4233C}.avatar.c3{background:#8A5A00}.avatar.c4{background:#6B3FA0}.avatar.c5{background:#0F6E8C}
.avatar.exp{background:var(--soft);color:var(--muted)}
.avatar .i{width:20px;height:20px}
.list-foot{display:block;width:100%;padding:13px;border:0;border-top:1px solid var(--line);background:none;color:var(--blue);font-weight:650}
.month{display:flex;justify-content:space-between;align-items:baseline;gap:10px;margin:22px 4px 8px}
.month span{font-size:13px;color:var(--muted)}

.chip{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:4px 10px;font-size:12.5px;font-weight:650;white-space:nowrap}
.chip.paid{background:var(--in-soft);color:var(--in)}
.chip.due{background:var(--saffron-soft);color:#7A5A00}
.chip.owe{background:var(--out-soft);color:var(--out)}
.chip.role{background:var(--blue-soft);color:var(--blue)}
@media (prefers-color-scheme:dark){.chip.due{color:var(--saffron)}}

.empty{padding:28px 18px;text-align:center;color:var(--muted)}
.empty b{display:block;color:var(--ink);font-size:16px;margin-bottom:4px}

/* Filters */
.chips{display:flex;gap:8px;overflow-x:auto;padding:2px 2px 8px;margin:0 -16px;padding-left:16px;padding-right:16px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chips button{flex:none;border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:8px 14px;font-size:14px;font-weight:600;color:var(--muted)}
.chips button.on{background:var(--ink);border-color:var(--ink);color:var(--surface)}
.select-inline{margin-top:6px}

/* Loans */
.loan-card{display:block;width:100%;text-align:left;background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:16px;margin-bottom:10px}
.loan-top{display:grid;grid-template-columns:auto 1fr auto;gap:12px;align-items:center}
.meter{height:8px;border-radius:99px;background:var(--soft);margin:14px 0 8px;overflow:hidden}
.meter i{display:block;height:100%;border-radius:99px;background:var(--in)}
.loan-foot{display:flex;justify-content:space-between;gap:10px;font-size:13px;color:var(--muted)}
.summary-line{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:16px 18px}
.summary-line b{font-family:var(--display);font-size:24px}

/* Statements */
.stmt{margin:0}
.stmt div{display:flex;justify-content:space-between;gap:16px;padding:11px 16px;border-top:1px solid var(--line)}
.stmt div:first-child{border-top:0}
.stmt dt{color:var(--muted)}.stmt dd{margin:0;font-weight:600;text-align:right}
.stmt .total{background:var(--soft)}.stmt .total dt,.stmt .total dd{color:var(--ink);font-weight:700}
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:14px}
th,td{padding:11px 14px;text-align:right;border-top:1px solid var(--line);white-space:nowrap}
th{font-size:12.5px;color:var(--muted);font-weight:600;border-top:0;background:var(--soft)}
th:first-child,td:first-child{text-align:left}

/* Forms and buttons */
.field{display:block;font-size:14px;font-weight:600;margin-bottom:14px}
.field input,.field select,.field textarea{display:block;width:100%;margin-top:6px;min-height:48px;padding:11px 13px;font-size:16px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.field input:focus,.field select:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-soft)}
.field input:disabled{background:var(--soft);color:var(--muted)}
.field .hint{display:block;font-weight:400;font-size:13px;color:var(--muted);margin-top:5px}
.fields-2{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.check{display:flex;gap:12px;align-items:center;padding:13px 14px;border:1px solid var(--line);border-radius:12px;margin-bottom:14px;font-size:15px;cursor:pointer}
.check input{width:22px;height:22px;margin:0;accent-color:var(--blue);flex:none}
.preview{background:var(--soft);border-radius:12px;padding:12px 14px;font-size:14px;margin-bottom:14px}
.preview b{font-weight:700}
.form-err{color:var(--out);font-size:14px;margin:0 0 12px;min-height:0}
.form-err:empty{display:none}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:10px 18px;border-radius:14px;border:0;font-weight:650;font-size:15px;text-decoration:none}
.btn.primary{background:var(--blue);color:#fff}
@media (prefers-color-scheme:dark){.btn.primary{color:#0E1124}}
.btn.accent{background:var(--saffron);color:#1D2660}
.btn.ghost{background:var(--soft);color:var(--ink)}
.btn.danger{background:var(--out-soft);color:var(--out)}
.btn.small{min-height:36px;padding:6px 14px;font-size:14px;border-radius:11px}
.btn.wide{width:100%}
.btn:disabled{opacity:.55;cursor:default}
.btn-row{display:flex;gap:10px;flex-wrap:wrap}.btn-row>.btn{flex:1 1 140px}
.seg{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;background:var(--soft);padding:5px;border-radius:14px;margin-bottom:18px}
.seg button{border:0;background:none;border-radius:10px;padding:9px 2px;font-size:13px;font-weight:650;color:var(--muted)}
.seg button.on{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px #0000001f}

/* Sheet */
.sheet-wrap{position:fixed;inset:0;z-index:40;background:#0B0F2A8c;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:var(--surface);width:100%;max-width:560px;max-height:92vh;max-height:92dvh;overflow:auto;border-radius:24px 24px 0 0;padding:8px 20px calc(22px + var(--safe-b));animation:up .22s ease-out}
.sheet-handle{width:42px;height:5px;border-radius:9px;background:var(--line);margin:0 auto 14px}
.sheet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:16px}
.sheet-head p{margin:3px 0 0}
.x{border:0;background:var(--soft);width:36px;height:36px;border-radius:12px;display:grid;place-items:center;flex:none;color:var(--muted)}
.x .i{width:18px;height:18px}
.detail-amount{font-family:var(--display);font-size:34px;font-weight:700;margin:2px 0 14px}
@keyframes up{from{transform:translateY(24px);opacity:.4}to{transform:none;opacity:1}}

.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(var(--nav-h) + 92px + var(--safe-b));z-index:60;background:var(--ink);color:var(--surface);padding:12px 18px;border-radius:14px;font-weight:600;font-size:15px;max-width:calc(100% - 32px);box-shadow:0 10px 30px -10px #0006}
.banner{display:flex;gap:10px;align-items:center;background:var(--saffron-soft);border-radius:14px;padding:12px 14px;margin-top:16px;font-size:14px}
.noscript{padding:20px;text-align:center}

/* Tablet and desktop: side navigation */
@media (min-width:960px){
  .shell{display:grid;grid-template-columns:260px 1fr}
  .nav{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;gap:4px;padding:0 14px 18px;border-top:0;border-right:1px solid var(--line);background:var(--surface)}
  .nav>.nav-brand{display:flex;align-items:center;gap:10px;font-family:var(--display);font-weight:700;font-size:19px;padding:30px 8px 18px;margin:0 -14px 8px;padding-left:22px;position:relative}.nav-brand::before{content:"";position:absolute;top:0;left:0;right:0;height:10px;background:var(--band) repeat-x;background-size:20px 10px}
  .nav-logo{width:34px;height:34px;border-radius:11px;background:url(icons/icon-192.png) center/cover}
  .nav>.nav-record:not([hidden]){display:flex;margin:0 0 12px}
  .nav>button[data-tab]{flex-direction:row;justify-content:flex-start;gap:12px;height:46px;padding:0 12px;border-radius:12px;font-size:15px}
  .nav>button[data-tab]:hover{background:var(--soft);color:var(--ink)}
  .nav>button[data-tab].active{background:var(--blue-soft);color:var(--ink)}
  .nav>button[data-tab].active::before{top:12px;bottom:12px;left:0;right:auto;width:3px;height:auto;border-radius:0 3px 3px 0}
  .nav>.nav-who{display:block;margin-top:auto;padding:12px;font-size:13px;color:var(--muted);border-top:1px solid var(--line)}
  .nav-who b{display:block;color:var(--ink);font-size:14px}
  .fab{display:none}
  .view{max-width:1080px;padding:8px 36px 60px;width:100%}
  .page-head{padding-top:34px}
  .hero{margin:28px 0 0;border-radius:24px;padding:22px 30px 28px}
  .hero-stats{grid-template-columns:repeat(4,1fr)}
  .home-grid{display:grid;grid-template-columns:1.15fr 1fr;gap:0 28px;align-items:start}
  .sheet-wrap{align-items:center}
  .sheet{border-radius:24px;padding:24px 26px 26px}
  .sheet-handle{display:none}
  .toast{bottom:28px}
  .chips{margin:0;padding-left:2px;padding-right:2px}
}
@media (min-width:600px) and (max-width:959px){.view{padding-left:28px;padding-right:28px}.hero{margin:0 -28px}}

@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

@media print{
  .nav,.fab,.sheet-wrap,.toast,.no-print,.banner{display:none!important}
  body{background:#fff;color:#000}.shell{display:block}.view{max-width:none;padding:0}
  .panel{border-color:#bbb;break-inside:avoid}
}
