/* Porã Contable — design 3.0: calm premium fintech. Midnight / Emerald / Mint / Champagne on Cloud, Inter.
   Green means "approved by a person"; a figure the AI produced is neutral until the accountant approves it.
   Layout: sidebar + content on desktop, bottom tab bar with a round scan button on phones. */
:root {
  --bg: #f7f8fa; --surface: #ffffff; --surface-2: #f1f3f5; --fg: #171c20; --muted: #646e78; --line: #e6e9ed;
  --brand: #0e5a43; --brand-2: #0e5a43; --brand-deep: #064536; --brand-fg: #ffffff; --brand-soft: #dcece4; --midnight: #101c18;
  --accent: #d9b45d; --accent-fg: #2a1f05; --accent-soft: #f6edd6;
  --ok: #0e5a43; --ok-bg: #dcece4; --warn: #8a4b08; --warn-bg: #fff1e0; --bad: #b42318; --bad-bg: #fdecea; --info: #1f5fa8; --info-bg: #e7f0fb;
  --neutral: #4a535c; --neutral-bg: #eef0f2;
  --hero-a: #0e5a43; --hero-b: #064536;
  --c4: #2f5d8a; --c5: #b5523b; --c6: #7a4e9b;
  --shadow: 0 1px 2px rgba(16, 28, 24, .05), 0 10px 28px -20px rgba(16, 28, 24, .22);
  --shadow-lg: 0 30px 80px -30px rgba(16, 28, 24, .4);
  --r: 20px; --r-sm: 14px;
  --display: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --side: 248px; --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b1210; --surface: #121a17; --surface-2: #18221e; --fg: #ecf1ee; --muted: #9aa7a1; --line: #24302b;
  --brand: #13704f; --brand-2: #7fd1ae; --brand-deep: #0b3d30; --brand-soft: #16302a; --midnight: #050a08;
  --accent: #d9b45d; --accent-fg: #2a1f05; --accent-soft: #2e2610;
  --ok: #7fd1ae; --ok-bg: #16302a; --warn: #f2bd6b; --warn-bg: #2e2311; --bad: #f59a8e; --bad-bg: #33191a; --info: #8db8f0; --info-bg: #14243a;
  --neutral: #c3ccd3; --neutral-bg: #232c33;
  --hero-a: #0f4a39; --hero-b: #08332a;
  --c4: #6f9ccc; --c5: #e08a72; --c6: #b08ad0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -20px rgba(0, 0, 0, .7); --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .8); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0b1210; --surface: #121a17; --surface-2: #18221e; --fg: #ecf1ee; --muted: #9aa7a1; --line: #24302b;
  --brand: #13704f; --brand-2: #7fd1ae; --brand-deep: #0b3d30; --brand-soft: #16302a; --midnight: #050a08;
  --accent: #d9b45d; --accent-fg: #2a1f05; --accent-soft: #2e2610;
  --ok: #7fd1ae; --ok-bg: #16302a; --warn: #f2bd6b; --warn-bg: #2e2311; --bad: #f59a8e; --bad-bg: #33191a; --info: #8db8f0; --info-bg: #14243a;
  --neutral: #c3ccd3; --neutral-bg: #232c33;
  --hero-a: #0f4a39; --hero-b: #08332a;
  --c4: #6f9ccc; --c5: #e08a72; --c6: #b08ad0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -20px rgba(0, 0, 0, .7); --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .8); color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 400 15.5px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; font-weight: 600; } h3 { font-size: 1.02rem; font-weight: 600; } h4 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--brand-2); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; } .right { text-align: right; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { flex: none; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- primitives ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; font: 700 1.12rem var(--display); color: var(--fg); letter-spacing: -.02em; }
.logo i { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); box-shadow: 5px -5px 0 var(--accent); margin-top: 4px; }
.logo b { font-weight: 500; color: var(--muted); margin-left: -4px; }
.logo.light { color: #fff; } .logo.light i { background: #fff; } .logo.light b { color: rgba(255, 255, 255, .7); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 11px 18px; border: 1px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2; transition: transform .1s, filter .15s, background .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; filter: none; transform: none; }
.btn.primary { background: var(--brand); color: var(--brand-fg); box-shadow: 0 8px 20px -12px var(--brand); }
.btn.accent { background: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--fg); }
.btn.danger { background: var(--bad); color: #fff; } .btn.ghost.danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.wa { background: #1f9d55; color: #fff; }
.btn.sm { padding: 7px 12px; font-size: .88rem; border-radius: 10px; }
.btn.big { padding: 14px 20px; font-size: 1.02rem; border-radius: 14px; }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brand-2); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .77rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--info); } .chip.n { background: var(--brand-soft); color: var(--brand-2); } .chip.accent { background: var(--accent-soft); color: var(--warn); }
.chip.xs { font-size: .68rem; padding: 1px 7px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.center { justify-content: center; } .row.sm { gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 700; color: var(--fg); }
input, select, textarea { width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font-weight: 500; font-size: .98rem; transition: border-color .15s, box-shadow .15s; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 4px var(--brand-soft); }
input[readonly], select:disabled { opacity: .85; }
.hint { font-weight: 500; font-size: .8rem; color: var(--muted); } .hint.good { color: var(--ok); } .hint.bad { color: var(--bad); }
.err { color: var(--bad); font-weight: 700; font-size: .9rem; min-height: 1.2em; }
.alert { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px; text-decoration: none; font-weight: 600; color: var(--fg); background: var(--info-bg); }
.alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.bad { background: var(--bad-bg); color: var(--bad); } .alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.info { background: var(--info-bg); color: var(--info); }
.alert span { flex: 1; } .alert.small { padding: 10px 12px; font-size: .88rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button, .seg label span { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; font-weight: 700; font-size: .88rem; color: var(--muted); cursor: pointer; display: block; }
.seg label { flex: 1; position: relative; } .seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; padding: 0; }
.seg button.on, .seg input:checked + span { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); }
.seg.sm button { padding: 5px 11px; }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand-2); border-radius: 50%; animation: sp .8s linear infinite; margin: 20px auto; }
.spin.sm { width: 16px; height: 16px; border-width: 2px; margin: 0; display: inline-block; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .88rem; text-decoration: none; color: var(--brand-2); margin-top: auto; }
.confirm { background: var(--bad-bg); border-radius: 12px; padding: 12px; margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.copyfallback { width: 100%; height: 80px; margin-top: 8px; }

.boot { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 10px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(380px, 560px); }
.auth-brand { background: radial-gradient(120% 90% at 0% 0%, var(--brand-2), var(--brand) 55%, #08392a); color: #fff; padding: 40px max(40px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; justify-content: space-between; gap: 30px; position: relative; overflow: hidden; }
.auth-brand::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .05); }
.auth-hero h1 { font-size: clamp(1.8rem, 3.2vw, 2.7rem); font-weight: 700; max-width: 16ch; }
.auth-hero > p { margin-top: 14px; max-width: 44ch; color: rgba(255, 255, 255, .82); font-size: 1.05rem; }
.auth-foot { color: rgba(255, 255, 255, .75); font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.receipt-demo { margin-top: 34px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.paper { width: 190px; background: #fffdf7; color: #2a2a2a; border-radius: 6px 6px 0 0; padding: 16px 14px 22px; font: 500 .72rem/1.5 ui-monospace, monospace; display: flex; flex-direction: column; gap: 3px; position: relative; overflow: hidden; transform: rotate(-3deg); box-shadow: var(--shadow-lg); -webkit-mask: linear-gradient(#000 calc(100% - 8px), transparent 0), conic-gradient(from 135deg at top, transparent 25%, #000 0) 0 100% / 12px 8px repeat-x; mask: linear-gradient(#000 calc(100% - 8px), transparent 0), conic-gradient(from 135deg at top, transparent 25%, #000 0) 0 100% / 12px 8px repeat-x; }
.paper b { font-size: .82rem; letter-spacing: .1em; } .paper hr { border: 0; border-top: 1px dashed #bbb; width: 100%; margin: 4px 0; }
.paper .ln { height: 6px; background: #e8e4d8; border-radius: 3px; } .paper .ln.s { width: 60%; }
.paper .beam { position: absolute; left: 0; right: 0; height: 26px; top: -30px; background: linear-gradient(transparent, rgba(229, 170, 22, .55), transparent); animation: beam 3s ease-in-out infinite; }
@keyframes beam { 0% { top: -30px; } 60%, 100% { top: 105%; } }
.agent-pills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.agent-pills li { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 5px 12px 5px 9px; font-size: .82rem; font-weight: 700; width: max-content; animation: pill 4.2s var(--d) infinite both; }
@keyframes pill { 0%, 10% { opacity: .35; transform: translateX(-4px); } 18%, 85% { opacity: 1; transform: none; background: rgba(255, 255, 255, .2); } 100% { opacity: .35; } }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding-block: 32px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); gap: 16px; background: var(--bg); }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 440px; align-self: center; }
.auth-card h2 { font-size: 1.6rem; }
.pw { position: relative; } .pw input { padding-right: 46px; } .pw .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.meter { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; display: block; }
.meter i { display: block; height: 100%; width: var(--w, 0); background: var(--bad); transition: width .2s, background .2s; }
.meter[data-s="2"] i { background: var(--warn); } .meter[data-s="3"] i, .meter[data-s="4"] i { background: var(--ok); }
.checkline { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; }
.checkline input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .84rem; } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-btns { display: grid; gap: 8px; }
.switch { text-align: center; color: var(--muted); font-size: .92rem; }
.demo-note { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: .84rem; text-align: center; }
.sent { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--ok); } .sent p { color: var(--muted); }
.lang select { width: auto; padding: 6px 10px; border-radius: 9px; font-weight: 700; font-size: .85rem; background: var(--surface); }
.only-mobile { display: none; }

/* ---------- onboarding ---------- */
.onboard { min-height: 100vh; padding-block: 24px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: radial-gradient(80% 50% at 50% 0%, var(--brand-soft), var(--bg)); }
.ob-top { max-width: 640px; margin: 0 auto 24px; display: flex; justify-content: space-between; align-items: center; }
.ob-card { max-width: 640px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.ob-card form { display: flex; flex-direction: column; gap: 16px; }
.steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 22px; align-items: center; }
.steps li { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.steps li:not(:last-child)::after { content: ""; } .steps li.on { background: var(--brand); color: #fff; border-color: var(--brand); } .steps li.done { background: var(--brand-soft); color: var(--brand-2); }
.radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .ob-role { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card { cursor: pointer; position: relative; } .radio-card input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; padding: 0; }
.radio-card > span { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); height: 100%; transition: border-color .15s, background .15s; }
.radio-card small { font-weight: 500; color: var(--muted); }
.radio-card input:checked + span { border-color: var(--brand-2); background: var(--brand-soft); }
.radio-card input:focus-visible + span { outline: 3px solid var(--accent); }
.seg-field { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; } .seg-field legend { font-size: .86rem; font-weight: 700; margin-bottom: 6px; }
.ob-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 22px 14px; padding-left: max(14px, env(safe-area-inset-left, 0px)); background: var(--surface); border-right: 1px solid var(--line); }
.side-logo { text-decoration: none; padding: 4px 10px 18px; }
.side nav { display: flex; flex-direction: column; gap: 3px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 700; font-size: .95rem; }
.side nav a:hover { background: var(--surface-2); color: var(--fg); }
.side nav a.on { background: var(--brand-soft); color: var(--brand-2); }
.side nav a.cta { background: var(--brand); color: #fff; margin: 6px 0; box-shadow: 0 10px 20px -14px var(--brand); } .side nav a.cta.on { background: var(--brand-2); }
.side nav a em { margin-left: auto; font-style: normal; font-size: .72rem; background: var(--warn); color: #fff; border-radius: 999px; padding: 1px 7px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 0 10px; }
.side-foot .link { color: var(--muted); }
.main { min-width: 0; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 14px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent; }
.top-l { display: flex; align-items: center; gap: 12px; min-width: 0; } .top-l h1 { font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { display: flex; align-items: center; gap: 6px; }
.bell .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 2px solid var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #f2cf6b); color: var(--accent-fg); font: 700 .95rem var(--display); text-decoration: none; flex: none; }
.avatar.sm { width: 34px; height: 34px; font-size: .85rem; }
.client-bar { display: flex; align-items: center; gap: 10px; margin: 0 max(28px, env(safe-area-inset-right, 0px)) 8px max(28px, env(safe-area-inset-left, 0px)); padding: 10px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-weight: 600; flex-wrap: wrap; }
.client-bar span { flex: 1; }
.view { padding-block: 8px 60px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; max-width: 1240px; }
.view.enter { animation: rise .28s ease both; }
@keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bottom { display: none; }

/* ---------- dashboard ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.hello h2 { font-size: 1.7rem; font-weight: 700; }
.period { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pnav { display: flex; align-items: center; gap: 4px; } .pnav b { font-family: var(--display); font-weight: 600; min-width: 110px; text-align: center; text-transform: capitalize; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } .kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--brand-soft); opacity: .6; }
.kpi.good::after { background: var(--ok-bg); } .kpi.warn::after { background: var(--warn-bg); }
.k-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; margin-bottom: 8px; position: relative; z-index: 1; }
.kpi.good .k-ic { background: var(--ok-bg); color: var(--ok); } .kpi.warn .k-ic { background: var(--warn-bg); color: var(--warn); }
.k-l { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.k-v { font: 700 1.55rem var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; position: relative; }
.kpi small { color: var(--muted); font-size: .82rem; }
.grid-dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-dash .span2 { grid-column: span 2; }
.grid-dash > .card, .grid-2 > .card { display: flex; flex-direction: column; }
.chart-box { position: relative; height: 260px; } .chart-box.donut { height: 220px; }
.due { display: flex; gap: 16px; align-items: center; }
.due-day { width: 76px; height: 82px; border-radius: 16px; background: var(--brand); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; box-shadow: 0 12px 24px -14px var(--brand); }
.due-day b { font: 700 2.1rem/1 var(--display); } .due-day span { text-transform: uppercase; font-size: .75rem; font-weight: 700; letter-spacing: .08em; opacity: .85; }
.due p { margin-bottom: 4px; }
.bar-mini { height: 6px; border-radius: 99px; background: var(--surface-2); margin: 16px 0 12px; overflow: hidden; } .bar-mini i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--accent)); border-radius: 99px; }
.uso-bar { height: 14px; border-radius: 99px; overflow: hidden; display: flex; background: var(--surface-2); }
.uso-bar i.e { background: var(--brand); } .uso-bar i.p { background: var(--accent); }
.uso-leg { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: .9rem; }
.uso-leg span { display: flex; align-items: center; gap: 8px; } .uso-leg b { margin-left: auto; font-variant-numeric: tabular-nums; }
.uso-leg i { width: 10px; height: 10px; border-radius: 3px; } .uso-leg i.e { background: var(--brand); } .uso-leg i.p { background: var(--accent); }
.cobro-sum { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-decoration: none; color: var(--fg); padding: 12px; border-radius: 12px; background: var(--surface-2); }
.cobro-sum span { display: flex; align-items: center; gap: 8px; } .cobro-sum strong { font: 700 1.1rem var(--display); font-variant-numeric: tabular-nums; } .cobro-sum small { color: var(--muted); grid-column: 1 / -1; }
.feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.feed li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.feed li div { min-width: 0; } .feed small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed a { color: var(--muted); text-decoration: none; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; flex: none; }
.ag.bad { background: var(--bad-bg); color: var(--bad); } .ag.big { width: 40px; height: 40px; border-radius: 12px; }
.empty-hero { text-align: center; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.eh-art { width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-2); margin-bottom: 6px; }
.pipeline { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; counter-reset: p; }
.pipeline li { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: var(--surface-2); position: relative; }
.pipeline li small { color: var(--muted); font-size: .8rem; }

/* ---------- lists ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar select { width: auto; }
.search { flex: 1; min-width: 220px; position: relative; flex-direction: row; align-items: center; } .search .ic { position: absolute; left: 12px; color: var(--muted); } .search input { padding-left: 40px; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: .88rem; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip-btn.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip-btn em { font-style: normal; background: var(--warn-bg); color: var(--warn); border-radius: 99px; padding: 0 7px; font-size: .75rem; }
.list-card { padding: 6px; }
.doc-list { display: flex; flex-direction: column; }
.doc-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--fg); }
.doc-row:hover { background: var(--surface-2); }
.doc-row + .doc-row { border-top: 1px solid var(--line); }
.thumb { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; color: var(--muted); border: 1px solid var(--line); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.dr-main { min-width: 0; display: flex; flex-direction: column; } .dr-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .dr-main small { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-amt { text-align: right; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; } .dr-amt small { color: var(--muted); font-size: .78rem; }
.acc-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font: 600 .74rem var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; } .tbl td small { display: block; color: var(--muted); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- scan ---------- */
.scan-hero { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; border: 2px dashed var(--line); background: linear-gradient(180deg, var(--surface), var(--surface-2)); transition: border-color .15s, background .15s; }
.scan-hero.over { border-color: var(--brand-2); background: var(--brand-soft); }
.scan-hero h2 { font-size: 1.6rem; } .scan-hero > p { max-width: 52ch; }
.scan-art { position: relative; width: 120px; height: 120px; border-radius: 30px; display: grid; place-items: center; color: var(--brand-2); background: var(--brand-soft); overflow: hidden; margin-bottom: 4px; }
.scan-art .frame { position: absolute; inset: 14px; border: 3px solid var(--brand-2); border-radius: 16px; -webkit-mask: conic-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) top left / 30% 30% no-repeat, linear-gradient(#000 0 0) top right / 30% 30% no-repeat, linear-gradient(#000 0 0) bottom left / 30% 30% no-repeat, linear-gradient(#000 0 0) bottom right / 30% 30% no-repeat; }
.scan-art .beam { position: absolute; left: 18px; right: 18px; height: 3px; background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: scanb 2.2s ease-in-out infinite alternate; }
@keyframes scanb { from { top: 22px; } to { top: 96px; } }
.scan-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.queue { display: flex; flex-direction: column; gap: 10px; }
.q-head { display: flex; justify-content: space-between; align-items: center; }
.q-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; }
.q-item .thumb { width: 56px; height: 56px; }
.q-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; } .q-main > b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .q-main small { color: var(--muted); }
.q-item.error small { color: var(--bad); }
.pipe { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; }
.pipe li { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); transition: all .2s; }
.pipe li.run { background: var(--accent-soft); color: var(--warn); border-color: transparent; animation: pulse 1s ease-in-out infinite; }
.pipe li.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; } .pipe li.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; } .pipe li.err { background: var(--bad-bg); color: var(--bad); }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- document detail ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; width: max-content; }
.doc-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.doc-head h2 { font-size: 1.6rem; } .doc-head .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.doc-total { text-align: right; display: flex; flex-direction: column; } .doc-total b { font: 700 1.9rem var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; } .doc-total small { color: var(--muted); }
.doc-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
.doc-left { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 80px; min-width: 0; }
.doc-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.preview { padding: 10px; margin: 0; } .preview img { width: 100%; max-height: 520px; object-fit: contain; border-radius: 12px; background: var(--surface-2); display: block; }
.noimg { height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); background: var(--surface-2); border-radius: 12px; }
.cdc { display: flex; flex-direction: column; gap: 8px; } .cdc code { font: 600 .86rem/1.5 ui-monospace, monospace; word-break: break-all; color: var(--fg); } .cdc small { font-weight: 700; color: var(--muted); }
.timeline ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; position: relative; }
.timeline li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; position: relative; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 38px; bottom: -6px; width: 2px; background: var(--line); }
.timeline .pass-h { margin: 4px 0 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .timeline .pass-h small { color: var(--muted); font-size: .78rem; }
.timeline details.old { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; } .timeline details.old summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.timeline details.old .pass { opacity: .62; } .timeline details.old li small { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.timeline li div { min-width: 0; } .timeline small { display: block; color: var(--muted); font-size: .8rem; } .timeline time { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.questions { border: 1.5px solid var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 140px); }
.questions h3 { display: flex; align-items: center; gap: 8px; }
.q { padding: 14px 0; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 10px; } .q:first-child { border-top: 0; }
.q-t { font-weight: 700; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; } .opts.many { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.opt { border: 1.5px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 11px; font-weight: 700; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 1px; }
.opt small { font-size: .7rem; color: var(--brand-2); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.opt.sug { border-color: var(--brand-2); } .opt.on { background: var(--brand); color: #fff; border-color: var(--brand); } .opt.on small { color: #fff; }
.findings { display: flex; flex-direction: column; gap: 8px; }
.ai-reason { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); margin-top: 12px; flex-wrap: wrap; }
.conf-bar { flex: 0 0 80px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; } .conf-bar i { display: block; height: 100%; background: var(--brand-2); }
.uso-seg { display: flex; margin-bottom: 12px; }
.fld { gap: 5px; } .fld > span { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.fld.warn input, .fld.warn select { border-color: var(--warn); } .fld.error input, .fld.error select { border-color: var(--bad); background: var(--bad-bg); }
.fld small { font-weight: 600; font-size: .76rem; color: var(--warn); } .fld.error small { color: var(--bad); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } .cdot.hi { background: var(--ok); } .cdot.mid { background: var(--warn); } .cdot.lo { background: var(--bad); }
.tax-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tax-cell { padding: 14px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.tax-cell small { color: var(--muted); font-weight: 700; font-size: .78rem; } .tax-cell b { font: 700 1.25rem var(--display); font-variant-numeric: tabular-nums; } .tax-cell b.good { color: var(--ok); }
.tax-notes { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }
.tax-notes li { display: flex; gap: 8px; align-items: flex-start; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto auto; gap: 8px; align-items: center; padding: 6px 0; }
.item input { padding: 9px 11px; font-size: .92rem; }
.item.not-mine input { text-decoration: line-through; opacity: .6; }
.toggle { flex-direction: row; align-items: center; gap: 6px; font-size: .84rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; white-space: nowrap; }
.toggle input { width: 16px; height: 16px; accent-color: var(--brand); padding: 0; }
.toggle:has(input:checked) { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand-2); }
.split-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.split-sum div { padding: 12px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; } .split-sum span { font-size: .8rem; color: var(--muted); font-weight: 700; } .split-sum b { font: 700 1.1rem var(--display); font-variant-numeric: tabular-nums; }
.split-sum .accent { background: var(--accent-soft); } .split-sum .accent b { color: var(--warn); }
.cobro-card { border: 1.5px solid var(--accent); } .cobro-card .grid2 { margin: 12px 0; }
.acc-panel { border: 1.5px solid var(--info); }
.sticky-actions { position: sticky; bottom: 12px; display: flex; justify-content: space-between; gap: 10px; padding: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); z-index: 3; }
.tip { display: flex; gap: 14px; align-items: flex-start; border: 1.5px solid var(--brand-2); background: var(--brand-soft); } .tip > .ic { color: var(--brand-2); margin-top: 2px; } .tip p { margin: 4px 0 10px; color: var(--fg); }

/* ---------- cobros ---------- */
.cobro-explain { display: flex; flex-direction: column; gap: 16px; background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.how3 { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.how3 li { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.how3 li span { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font: 700 .85rem var(--display); margin-bottom: 4px; }
.how3 small { color: var(--muted); }
.new-cobro { padding: 14px; border-radius: 14px; background: var(--surface-2); margin-bottom: 12px; display: flex; flex-direction: column; gap: 12px; }
.cobro-list { display: flex; flex-direction: column; }
.cobro-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 12px 4px; border-top: 1px solid var(--line); }
.cobro-row:first-child { border-top: 0; } .cobro-row.pagado { opacity: .65; }
.cr-main { min-width: 0; display: flex; flex-direction: column; } .cr-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-amt { font: 700 1.05rem var(--display); font-variant-numeric: tabular-nums; } .cr-act { display: flex; gap: 6px; align-items: center; }
.msg-preview { white-space: pre-wrap; background: var(--surface-2); padding: 14px; border-radius: 12px; font: 500 .9rem/1.5 var(--body); border: 1px solid var(--line); max-height: 240px; overflow: auto; margin: 0; }

/* ---------- chat ---------- */
.chat-card { display: flex; flex-direction: column; gap: 12px; min-height: 60vh; }
.chat-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); } .chat-head small { display: block; color: var(--muted); }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 56vh; padding: 4px; }
.msg { max-width: min(78%, 560px); padding: 11px 14px; border-radius: 16px; display: flex; flex-direction: column; gap: 4px; }
.msg p { white-space: pre-wrap; } .msg small { font-size: .72rem; color: var(--muted); }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; } .msg.me small { color: rgba(255, 255, 255, .75); }
.msg.them { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--accent-soft); border-bottom-left-radius: 4px; }
.typing { flex-direction: row; gap: 4px; padding: 14px; } .typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); animation: blink 1.2s infinite; } .typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .25; } }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.composer { display: flex; gap: 8px; } .composer input { flex: 1; }
.link-acc { display: flex; flex-direction: column; gap: 10px; max-width: 480px; } .link-acc .row input { flex: 1; width: auto; }

/* ---------- deadlines / profile ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; margin-bottom: 14px; }
.cal-grid span { padding: 9px 0; border-radius: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-grid .wd { color: var(--muted); font-size: .78rem; text-transform: uppercase; padding: 4px 0; }
.cal-grid .due { background: var(--brand); color: #fff; } .cal-grid .today { outline: 2px solid var(--accent); }
.rem { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.rem li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.rem li.warn .ag { background: var(--warn-bg); color: var(--warn); } .rem small { display: block; color: var(--muted); }
.code-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); flex-wrap: wrap; }
.code-box code { font: 700 1.3rem var(--display); letter-spacing: .18em; color: var(--brand-2); } .code-box small { width: 100%; color: var(--muted); font-weight: 700; }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 6px; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer; font-weight: 700; color: var(--fg); text-align: left; }
.row-btn:first-of-type { border-top: 0; } .row-btn span { flex: 1; } .row-btn .ic:first-child { color: var(--brand-2); }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
form.card { display: flex; flex-direction: column; gap: 14px; }
.acc-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; background: linear-gradient(135deg, var(--surface), var(--info-bg)); }
.acc-hero .code-box { flex-direction: column; align-items: flex-start; }

/* ---------- sheet / legal ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(8, 20, 14, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; padding-left: max(0px, env(safe-area-inset-left, 0px)); padding-right: max(0px, env(safe-area-inset-right, 0px)); }
.sheet-wrap.in { opacity: 1; }
.sheet { position: relative; background: var(--surface); width: min(620px, 100%); border-radius: 24px 24px 0 0; padding: 26px 22px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); transform: translateY(24px); transition: transform .25s; max-height: 88vh; overflow: auto; }
.sheet-wrap.in .sheet { transform: none; }
.sheet.tall { width: min(820px, 100%); height: 88vh; }
.sheet .close { position: absolute; right: 12px; top: 12px; }
.sheet h3 { display: flex; align-items: center; gap: 8px; padding-right: 40px; }
.legal { font-size: .95rem; line-height: 1.65; } .legal h1 { font-size: 1.5rem; margin-bottom: 6px; } .legal h2 { font-size: 1.1rem; margin: 22px 0 8px; } .legal p, .legal ul, .legal ol { margin: 0 0 10px; max-width: 72ch; } .legal .draft { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-weight: 700; } .legal table { border-collapse: collapse; width: 100%; font-size: .88rem; } .legal td, .legal th { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }

/* ---------- tour ---------- */
#tour { position: fixed; inset: 0; z-index: 60; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(6, 18, 12, .58); transition: all .25s; pointer-events: none; outline: 2px solid var(--accent); }
.tour-pop { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--surface); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 8px; animation: rise .25s ease both; }
.tour-pop small { color: var(--brand-2); font-weight: 700; } .tour-pop p { color: var(--muted); }
.tour-btns { display: flex; justify-content: space-between; margin-top: 6px; } .tour-pop .link { align-self: center; color: var(--muted); margin-top: 4px; }

/* ---------- toast ---------- */
#toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--fg); color: var(--bg); font-weight: 700; box-shadow: var(--shadow-lg); animation: rise .25s ease both; transition: opacity .4s, transform .4s; }
.toast.bad { background: var(--bad); color: #fff; } .toast.info { background: var(--info); color: #fff; } .toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .grid-dash { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .shell { display: block; }
  .side { display: none; }
  .only-mobile { display: inline-flex; }
  .top-l h1 { display: none; }
  .top { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .client-bar { margin-left: max(16px, env(safe-area-inset-left, 0px)); margin-right: max(16px, env(safe-area-inset-right, 0px)); }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 700; border-radius: 12px; }
  .bottom a.on { color: var(--brand-2); }
  .bottom a.fab { margin-top: -26px; } .bottom a.fab .ic { width: 58px; height: 58px; padding: 16px; border-radius: 20px; background: var(--brand); color: #fff; box-shadow: 0 12px 24px -10px var(--brand); border: 4px solid var(--bg); box-sizing: border-box; }
  .doc-grid { grid-template-columns: 1fr; } .doc-left { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; } .auth-brand { display: none; } .auth-main .only-mobile { display: inline-flex; }
  #toasts { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .k-v { font-size: 1.2rem; } .kpi { padding: 14px; }
  .grid-dash { grid-template-columns: 1fr; } .grid-dash .span2 { grid-column: auto; }
  .chart-box { height: 220px; }
  .hello h2 { font-size: 1.35rem; } .period { width: 100%; justify-content: space-between; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how3 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr 1fr; }
  .doc-row { grid-template-columns: 44px minmax(0, 1fr) auto; } .doc-row .chip { grid-column: 2 / -1; justify-self: start; } .doc-row .thumb { width: 44px; height: 44px; }
  .cobro-row { grid-template-columns: auto minmax(0, 1fr) auto; } .cobro-row .chip { justify-self: start; } .cr-act { grid-column: 1 / -1; justify-content: flex-end; }
  .q-item { grid-template-columns: 48px minmax(0, 1fr); } .q-item > .btn, .q-item > .spin { grid-column: 1 / -1; justify-self: end; } .q-item .thumb { width: 48px; height: 48px; }
  .pipe li span { display: none; } .pipe li { padding: 4px 6px; }
  .grid3 { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 16px; }
  .auth-card, .ob-card { padding: 22px; }
  .item { grid-template-columns: minmax(0, 1fr) 96px auto; } .item .icon-btn { grid-column: 3; grid-row: 1; } .item .toggle { grid-column: 1 / -1; justify-self: start; }
  .scan-btns { flex-direction: column; width: 100%; } .scan-btns .btn { width: 100%; }
  .toolbar select, .toolbar .btn { flex: 1; }
  .doc-total { text-align: left; }
}
@media (max-width: 440px) { .grid2, .radio-grid, .ob-role, .fields { grid-template-columns: 1fr; } .kpis.two { grid-template-columns: 1fr; } .top-r .lang { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- stages of the figures (estimate → filed) ---------- */
.stages header { margin-bottom: 10px; }
.stage-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.stage-leg { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: .86rem; }
.stage-leg span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.stage-leg b { color: var(--fg); font-variant-numeric: tabular-nums; }
.stage-leg i, .stage-bar i { display: inline-block; }
.stage-leg i { width: 10px; height: 10px; border-radius: 3px; }
.st-estimate { background: var(--c6); } .st-review { background: var(--accent); } .st-approved { background: var(--brand-2); } .st-exported { background: var(--c4); } .st-filed { background: var(--brand); }
.stages p { margin-top: 8px; }

/* ---------- phases 2-5 ---------- */
.side nav { overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; }
.nav-h { font: 600 .68rem var(--display); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 14px 12px 4px; opacity: .8; }
.side-logo .logo.wl img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.side-logo .logo.wl b { color: var(--fg); margin: 0; font-weight: 700; }
.wl-by { display: block; color: var(--muted); font-size: .72rem; padding-left: 2px; }
.tabs { margin-bottom: 16px; flex-wrap: wrap; }
.tab-body h4 { margin: 14px 0 6px; font-size: .92rem; }
.btn.xs { padding: 4px 9px; font-size: .78rem; border-radius: 8px; }
select.xs { padding: 3px 6px; font-size: .78rem; border-radius: 8px; max-width: 180px; border: 1px solid var(--line); background: var(--surface); }
.nowrap { flex-wrap: nowrap; gap: 4px; }
.tbl tr.sel td { background: var(--brand-soft); }
.tbl tr.tot td { font-weight: 800; border-top: 2px solid var(--line); }
.tbl tr.muted td { color: var(--muted); }
.tbl .good, .good { color: var(--ok); } .bad { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sub-banner { margin-bottom: 12px; }
.plan-name { font: 700 1.6rem var(--display); letter-spacing: -.02em; margin: 4px 0; }
.limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.limits div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; } .limits small { display: block; color: var(--muted); font-size: .75rem; } .limits b { font: 700 1.05rem var(--display); }
.quote { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.quote li { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.quote li.tot { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 800; font-size: 1.08rem; }
.quote li.good { color: var(--ok); }
.result { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--ok-bg); color: var(--ok); font: 700 1.1rem var(--display); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.journal { display: flex; flex-direction: column; gap: 10px; }
.je { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.je.estimate, .je.review { border-style: dashed; }
.je header { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; } .je header span { color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jl { display: grid; grid-template-columns: 62px minmax(0, 1fr) 110px 110px; gap: 8px; font-size: .88rem; font-variant-numeric: tabular-nums; }
.jl.cr span { padding-left: 18px; } .jl b { text-align: right; font-weight: 600; }
.me-line { display: grid; grid-template-columns: minmax(0, 2fr) 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.me-line select, .me-line input { min-width: 0; }
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.rule header { align-items: flex-start; } .rule code { font-size: .75rem; color: var(--muted); }
.rule dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 12px; font-size: .88rem; }
.rule dt { color: var(--muted); font-weight: 700; } .rule dd { margin: 0; overflow-wrap: anywhere; }
.wl-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.wl-bar { padding: 14px 16px; color: #fff; display: flex; flex-direction: column; } .wl-bar small { opacity: .8; }
.fraud.high { border: 1px solid var(--bad); } .fraud.medium { border: 1px solid var(--warn); }
.checks { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.checks li.warn { color: var(--warn); }
.notes { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; max-height: 40vh; overflow: auto; }
.notes li { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; } .notes small { color: var(--muted); margin-left: 8px; } .notes p { margin-top: 4px; white-space: pre-wrap; }
code.wrap { word-break: break-all; white-space: normal; }
.pipeline.extra li { opacity: .92; }
.bank-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.bank-hero label.btn { cursor: pointer; }
.more-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.more-nav a { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); color: var(--fg); text-decoration: none; font-weight: 700; }
.more-nav a.on { background: var(--brand-soft); color: var(--brand-2); }
@media (max-width: 720px) {
  .jl { grid-template-columns: 52px minmax(0, 1fr) 84px 84px; font-size: .8rem; }
  .me-line { grid-template-columns: 1fr 1fr; } .me-line select { grid-column: 1 / -1; }
  .rules { grid-template-columns: 1fr; }
  .tabs button { padding: 7px 10px; }
}

/* receipt corner editor (scan) */
.crop-ov { position: fixed; inset: 0; z-index: 1000; background: #0b1210; color: #fff; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.crop-ov header h3 { margin: 0; color: #fff; } .crop-ov header p { margin: 4px 0 0; color: rgba(255, 255, 255, .75); }
.crop-stage { position: relative; min-height: 0; touch-action: none; }
.crop-stage img, .crop-stage svg { position: absolute; }
.crop-stage img { object-fit: fill; border-radius: 4px; user-select: none; -webkit-user-drag: none; }
.crop-stage svg { overflow: visible; cursor: crosshair; }
.crop-poly { fill: rgba(52, 211, 153, .14); stroke: #34d399; stroke-width: 3; vector-effect: non-scaling-stroke; }
.crop-h { fill: #fff; stroke: #10b981; stroke-width: 3; vector-effect: non-scaling-stroke; }
.crop-act { justify-content: flex-end; gap: 10px; } .crop-act .btn.ghost { color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, .4); }

/* merchant avatars: logo when known, initials otherwise */
.thumb.mono { font-weight: 700; font-size: .82rem; letter-spacing: .02em; color: #fff; border: 0; }
.thumb.mono.t0 { background: #0E5A43; } .thumb.mono.t1 { background: #101C18; } .thumb.mono.t2 { background: #8A6A1F; } .thumb.mono.t3 { background: #2F5D8A; }
.thumb.mono.t4 { background: #7A4E9B; } .thumb.mono.t5 { background: #B5523B; } .thumb.mono.t6 { background: #3F7F6B; } .thumb.mono.t7 { background: #5E6670; }
.thumb.has-logo { background: #fff; border: 1px solid var(--line); padding: 6px; }
.thumb.has-logo img { width: 100%; height: 100%; object-fit: contain; }

/* ===================================================================== */
/* Design 3.0 layer: components on top of the primitives above.           */
/* ===================================================================== */
body { font: 400 15px/1.5 var(--body); font-feature-settings: "cv11", "ss01"; letter-spacing: -.005em; }
h1, h2, h3, h4 { letter-spacing: -.02em; font-weight: 700; }
h3 { font-weight: 600; }
.num, .k-v, .dr-amt, .doc-total b, .tax-cell b, .hero-amt, .hero-stats b, .cr-amt { font-variant-numeric: tabular-nums; }

/* cards: no hard borders in light mode, soft depth; clickable cards lift a little */
.card { border-color: transparent; box-shadow: var(--shadow); border-radius: var(--r); }
:root[data-theme="dark"] .card { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { border-color: var(--line); } }
a.card, .card.tap { display: block; text-decoration: none; color: inherit; transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
a.card:hover, .card.tap:hover { transform: translateY(-1px); box-shadow: var(--shadow), 0 16px 32px -24px rgba(16, 28, 24, .35); }
a.card:active, .card.tap:active { transform: scale(.99); }

/* buttons */
.btn { border-radius: 14px; min-height: 44px; font-weight: 600; transition: transform .12s var(--ease), filter .15s, background .15s; }
.btn.primary { box-shadow: none; }
.btn.secondary { background: var(--surface); color: var(--brand-2); border: 1.5px solid currentColor; }
.btn.big { min-height: 52px; border-radius: 16px; }
.btn.sm { min-height: 36px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; }
.link { font-weight: 600; }

/* chips: small, calm, one meaning per colour */
.chip { border-radius: 8px; padding: 3px 9px; font-weight: 600; font-size: .76rem; }
.chip.n { background: var(--neutral-bg); color: var(--neutral); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.accent { background: var(--accent-soft); color: var(--accent-fg); }
:root[data-theme="dark"] .chip.accent { color: var(--accent); }

/* inputs */
input, select, textarea { border-radius: 12px; background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* logo: emerald square with a champagne corner */
.logo { font-weight: 700; letter-spacing: -.02em; }
.logo i { background: var(--brand); box-shadow: 5px -5px 0 var(--accent); border-radius: 4px; }

/* shell */
.side { background: var(--surface); border-right-color: var(--line); }
.side nav a { font-weight: 500; border-radius: 12px; }
.side nav a.on { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.side nav a.cta { border-radius: 14px; box-shadow: none; font-weight: 600; }
.top { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.view.enter { animation: rise3 .24s var(--ease) both; }
@keyframes rise3 { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.avatar { background: var(--brand-soft); color: var(--brand-2); font-weight: 700; }
.bell .dot { background: var(--accent); }

@media (max-width: 980px) {
  .bottom { background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--line); align-items: start; }
  .bottom a { font-weight: 500; font-size: .69rem; min-height: 48px; }
  .bottom a.on { color: var(--brand-2); font-weight: 700; }
  .bottom a.fab { margin-top: -24px; font-size: 0; gap: 0; }
  .bottom a.fab .ic { width: 62px; height: 62px; padding: 17px; border-radius: 31px; background: var(--brand); color: #fff; border: 5px solid var(--bg); box-shadow: 0 8px 18px -6px rgba(14, 90, 67, .45); transition: transform .15s var(--ease); }
  .bottom a.fab:active .ic { transform: scale(.94); }
}

/* home: hero card, quick actions, pending list */
.hero { position: relative; overflow: hidden; display: block; text-decoration: none; color: #fff; border-radius: 24px; padding: 22px 22px 18px; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); box-shadow: 0 18px 40px -28px rgba(6, 69, 54, .8); transition: transform .18s var(--ease); }
.hero:active { transform: scale(.99); }
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .10), transparent 70%); pointer-events: none; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .9rem; color: rgba(255, 255, 255, .78); }
.hero-badge { font-size: .72rem; font-weight: 700; color: #2a1f05; background: var(--accent); border-radius: 8px; padding: 3px 8px; }
.hero-badge.ok { background: #dcece4; color: #064536; }
.hero-amt { display: block; font-size: 2.35rem; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.hero-sub { font-size: .86rem; color: rgba(255, 255, 255, .78); margin-top: 4px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .16); }
.hero-stats span { display: flex; flex-direction: column; min-width: 0; font-size: .74rem; color: rgba(255, 255, 255, .72); }
.hero-stats b { font-size: 1rem; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); font-size: .8rem; font-weight: 500; }
.quick a span { width: 56px; height: 56px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--fg); transition: transform .15s var(--ease); }
.quick a:first-child span { background: var(--brand-soft); color: var(--brand-2); }
.quick a:active span { transform: scale(.94); }
.pend { padding: 4px 6px; }
.pend > h3 { padding: 12px 12px 6px; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.pend a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; text-decoration: none; color: var(--fg); }
.pend a + a { border-top: 1px solid var(--line); }
.pend a:hover { background: var(--surface-2); }
.pend a > i { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.pend a > i.warn { background: var(--warn-bg); color: var(--warn); } .pend a > i.info { background: var(--info-bg); color: var(--info); } .pend a > i.n { background: var(--neutral-bg); color: var(--neutral); }
.pend a > div { flex: 1; min-width: 0; display: flex; flex-direction: column; } .pend a small { color: var(--muted); font-size: .82rem; }
.foot-note { font-size: .8rem; color: var(--muted); text-align: center; }
.dash-more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font-weight: 600; color: var(--brand-2); }
.dash-more > summary::-webkit-details-marker { display: none; }
.dash-more[open] > summary .ic { transform: rotate(180deg); }
.dash-more > div { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }

/* KPI cards: clickable, calmer */
.kpi::after { display: none; }
.kpi .k-ic { border-radius: 12px; }
.kpi .k-v { font-weight: 700; letter-spacing: -.02em; }

/* period picker incl. custom range */
.period .seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(16, 28, 24, .08); }
.prange { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .prange input { width: auto; min-height: 40px; padding: 8px 10px; }

/* lists */
.doc-row { border-radius: 16px; }
.dr-main b { font-weight: 600; }
.dr-amt b { font-weight: 700; }
.thumb { border: 0; border-radius: 14px; }
.list-card { padding: 4px; }
.day-h { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 6px 4px -6px; } .day-h::first-letter { text-transform: uppercase; }

/* document detail */
.doc-head h2 { font-weight: 700; }
.steps3 { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.steps3 li i { display: block; height: 4px; border-radius: 2px; background: var(--line); }
.steps3 li.done i { background: var(--brand); } .steps3 li.warn i { background: var(--warn); } .steps3 li.info i { background: var(--info); }
.steps3 li span { display: block; font-size: .74rem; margin-top: 6px; color: var(--muted); } .steps3 li.done span { color: var(--fg); font-weight: 600; }
.tax-cell b.pend { color: var(--muted); }
.tax-cell em { font-style: normal; font-size: .72rem; font-weight: 600; color: var(--warn); background: var(--warn-bg); border-radius: 7px; padding: 2px 7px; align-self: flex-start; }
.padron { display: flex; gap: 6px; align-items: center; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.orig-link { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; margin-top: 8px; }

/* theme switch in profile */
.theme-seg { margin-top: 4px; }
@media (max-width: 720px) {
  .hero-amt { font-size: 2.1rem; }
  .quick { gap: 6px; } .quick a { font-size: .74rem; }
}
.docs-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 16px 18px; }
.docs-sum small { display: block; font-size: .76rem; color: var(--muted); } .docs-sum b { font-size: 1.1rem; font-weight: 700; }
.docs-sum p { grid-column: 1 / -1; }
.warn-t { color: var(--warn); }
.day-groups { display: flex; flex-direction: column; gap: 14px; }
/* folded technical sections: open on purpose, or by themselves when something needs attention */
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
details.fold > summary::-webkit-details-marker, .fold-plain > summary::-webkit-details-marker { display: none; }
details.fold > summary h3 { flex: 1; }
details.fold > summary .ic, .fold-plain > summary .ic { transition: transform .2s var(--ease); color: var(--muted); }
details.fold[open] > summary { margin-bottom: 12px; } details.fold[open] > summary .ic, .fold-plain[open] > summary .ic { transform: rotate(180deg); }
.fold-plain > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; color: var(--muted); font-weight: 600; font-size: .88rem; }
.fold-plain[open] > summary { margin-bottom: 10px; }
@media (max-width: 980px) {
  .doc-grid { display: flex; flex-direction: column; gap: 16px; }
  .doc-grid { align-items: stretch; } .doc-right, .doc-left { order: 1; min-width: 0; width: 100%; } .doc-left { order: 2; }
  .preview img { max-height: 420px; object-fit: contain; }
  .preview .noimg { min-height: 120px; }
}
.tip .row { flex-wrap: wrap; } .tip .btn { white-space: normal; max-width: 100%; }
@media (max-width: 980px) { .sticky-actions { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 720px) {
  .sticky-actions { gap: 8px; padding: 8px; }
  .sticky-actions .btn { flex: 1 1 0; min-width: 0; padding-inline: 10px; font-size: .86rem; line-height: 1.2; white-space: normal; }
  .sticky-actions #del { flex: 0 0 44px; padding: 0; font-size: 0; gap: 0; } /* icon only; the label stays for screen readers */
}
@media (max-width: 720px) {
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; }
  .toolbar .search { grid-column: 1 / -1; }
  .toolbar select { min-width: 0; }
  .toolbar #export { width: 44px; padding: 0; font-size: 0; gap: 0; } /* icon only on phones; the label stays for screen readers */
  .docs-sum { padding: 14px 16px; } .docs-sum b { font-size: 1rem; }
}
/* home: one column on phones; on wide screens the money left, what needs you right */
.home-grid { display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 981px) {
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
  .home-grid .hero { grid-column: 1; grid-row: 1; }
  .home-grid .pend { grid-column: 2; grid-row: 1 / span 2; }
  .home-grid .latest { grid-column: 1; grid-row: 2; }
  .home-grid .quick { display: none; } /* the sidebar already holds these */
}
/* step 1 polish (masterplan §54) */
.dr-main b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar .search { flex: 1; min-width: 0; }
.filter-btn { flex: none; white-space: nowrap; } .filter-btn .badge { background: var(--brand); color: #fff; border-radius: 9px; min-width: 18px; height: 18px; font-size: .72rem; display: inline-grid; place-items: center; padding: 0 5px; }
@media (max-width: 720px) { .toolbar { display: flex; } .toolbar .search { grid-column: auto; } }
.chips-row { scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 24px; }
.chips-row .chip-btn { scroll-snap-align: start; white-space: nowrap; }
.sheet h3 { margin: 0 0 14px; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; } .fld > span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.seg.wide { display: flex; flex-wrap: wrap; } .seg.wide button { flex: 1 1 auto; min-height: 40px; }
.row.end { justify-content: flex-end; gap: 8px; margin-top: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 12px; border: 0; background: transparent; color: var(--fg); font: inherit; text-align: left; border-radius: 12px; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); } .menu-item span { display: flex; flex-direction: column; } .menu-item small { color: var(--muted); font-size: .8rem; }
.menu-item.danger { color: var(--bad); }
.del-confirm { margin-top: 8px; padding: 12px; border-radius: 14px; background: var(--bad-bg); } .del-confirm p { margin: 0 0 10px; }
/* the receipt's action row sits in the flow at the end: it never covers figures */
.doc-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.doc-actions .btn.primary { flex: 1; min-height: 50px; }
.pnav b { text-transform: none; } .pnav b::first-letter { text-transform: uppercase; }
.hero-period { border: 0; background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .9); font: inherit; font-size: .86rem; font-weight: 600; border-radius: 10px; padding: 6px 10px; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.hero-period:hover { background: rgba(255, 255, 255, .2); }
a.hero-amt { color: #fff; text-decoration: none; } a.hero-amt:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.sheet .period { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
@media (max-width: 720px) { .filter-btn .lbl { display: none; } .filter-btn { width: 44px; padding: 0; justify-content: center; position: relative; } .filter-btn .badge { position: absolute; top: -4px; right: -4px; } }
/* on/off switch row (scan: "es de salud") */
.switch-row { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); cursor: pointer; max-width: 460px; width: 100%; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-row .sw { flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; transition: background .18s var(--ease); }
.switch-row .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s var(--ease); }
.switch-row input:checked + .sw { background: var(--brand); } .switch-row input:checked + .sw::after { transform: translateX(18px); }
.switch-row input:focus-visible + .sw { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.switch-row span:last-child { display: flex; flex-direction: column; } .switch-row small { color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) { .switch-row .sw, .switch-row .sw::after { transition: none; } }
