@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  --navy: #092943;
  --navy-2: #103a59;
  --ink: #102a3f;
  --muted: #6f8190;
  --bg: #f3f7f8;
  --card: #ffffff;
  --line: #dfe9ec;
  --sea: #12a897;
  --sea-dark: #087f76;
  --blue: #2c72dd;
  --blue-soft: #e9f1ff;
  --green-soft: #e1f7f1;
  --red: #d64b5b;
  --red-soft: #fff0f1;
  --amber: #c88216;
  --amber-soft: #fff5dc;
  --shadow: 0 12px 35px rgba(11, 43, 67, .09);
  --radius: 20px;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: #dbe5e8; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.app-shell { min-height: 100vh; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; height: calc(68px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; background: rgba(243,247,248,.88); backdrop-filter: blur(18px); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--navy); text-decoration: none; }
.brand-mark { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 12px 12px 12px 5px; background: var(--navy); color: white; font-family: Manrope,sans-serif; font-size: 12px; font-weight: 800; letter-spacing: -1px; box-shadow: inset -7px -7px 0 rgba(18,168,151,.28); }
.brand > span:last-child { display: grid; line-height: 1; }
.brand b { font-family: Manrope,sans-serif; font-size: 15px; letter-spacing: .7px; }
.brand small { margin-top: 4px; color: var(--sea-dark); font-size: 9px; font-weight: 700; letter-spacing: 2.3px; }
.avatar { width: 38px; height: 38px; border: 2px solid white; border-radius: 50%; background: #d6eee9; color: var(--navy); font-size: 11px; font-weight: 800; box-shadow: 0 3px 10px rgba(9,41,67,.11); cursor: pointer; }

main { width: min(100%, 780px); margin: 0 auto; }
.screen { display: none; padding: 13px 18px 32px; animation: screen-in .25s ease both; }
.screen.active { display: block; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }
.eyebrow { margin: 0 0 6px; color: var(--sea-dark); font-size: 11px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
h1, h2, h3 { font-family: Manrope, sans-serif; }
.screen-title { margin: 0; color: var(--navy); font-size: 29px; line-height: 1.15; letter-spacing: -.8px; }
.screen-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 13px; }
.section-head h2 { margin: 0; color: var(--navy); font-size: 18px; letter-spacing: -.3px; }
.text-btn { border: 0; background: none; color: var(--sea-dark); font-size: 13px; font-weight: 700; cursor: pointer; }

.hero-card { position: relative; overflow: hidden; margin-top: 21px; padding: 21px; border-radius: 25px; background: var(--navy); color: white; box-shadow: 0 17px 35px rgba(9,41,67,.2); }
.hero-card::before, .hero-card::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.hero-card::before { width: 180px; height: 180px; right: -75px; top: -85px; }
.hero-card::after { width: 105px; height: 105px; right: -32px; top: -38px; background: rgba(18,168,151,.14); }
.hero-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; }
.hero-top span { color: #b9cbd6; font-size: 12px; }
.hero-top h2 { margin: 5px 0 0; font-size: 30px; letter-spacing: -1px; }
.period-pill { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 20px; color: white !important; background: rgba(255,255,255,.08); font-size: 11px !important; font-weight: 600; }
.period-pill svg { width: 13px; height: 13px; }
.balance-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 21px; padding-top: 17px; border-top: 1px solid rgba(255,255,255,.13); }
.balance-item { display: grid; grid-template-columns: 30px 1fr; column-gap: 8px; align-items: center; }
.balance-icon { display: grid; grid-row: 1/3; width: 29px; height: 29px; place-items: center; border-radius: 9px; background: rgba(255,255,255,.1); }
.balance-icon svg { width: 16px; height: 16px; }
.balance-item small { color: #a9c1cf; font-size: 10px; }
.balance-item strong { margin-top: 2px; font-family: Manrope,sans-serif; font-size: 14px; }
.balance-item.in strong { color: #76e2cf; }
.balance-item.out strong { color: #ffb9bf; }

.quick-grid { display: grid; grid-template-columns: 1.18fr .82fr; gap: 12px; margin-top: 18px; }
.quick-card { min-width: 0; min-height: 124px; padding: 16px; border: 0; border-radius: var(--radius); text-align: left; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s ease; }
.quick-card:active { transform: scale(.98); }
.quick-card.scan { position: relative; overflow: hidden; background: var(--sea); color: white; }
.quick-card.scan::after { content: ""; position: absolute; right: -25px; bottom: -35px; width: 100px; height: 100px; border: 16px solid rgba(255,255,255,.09); border-radius: 50%; }
.quick-card.add { background: white; color: var(--navy); }
.quick-icon { display: grid; width: 39px; height: 39px; margin-bottom: 17px; place-items: center; border-radius: 13px; background: rgba(255,255,255,.19); }
.add .quick-icon { background: var(--blue-soft); color: var(--blue); }
.quick-card strong { position: relative; z-index: 1; display: block; font-family: Manrope,sans-serif; font-size: 14px; line-height: 1.2; }
.quick-card small { position: relative; z-index: 1; display: block; margin-top: 5px; color: rgba(255,255,255,.72); font-size: 10px; }
.quick-card.add small { color: var(--muted); }

.card { border: 1px solid rgba(223,233,236,.8); border-radius: var(--radius); background: var(--card); box-shadow: 0 8px 26px rgba(11,43,67,.055); }
.transaction-list { overflow: hidden; }
.transaction-row { display: grid; grid-template-columns: 43px 1fr auto; gap: 12px; align-items: center; width: 100%; min-height: 76px; padding: 13px 14px; border: 0; border-bottom: 1px solid #edf2f4; background: transparent; text-align: left; cursor: pointer; }
.transaction-row:last-child { border-bottom: 0; }
.tx-icon { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 14px; }
.tx-icon.income { background: var(--green-soft); color: var(--sea-dark); }
.tx-icon.expense { background: var(--red-soft); color: var(--red); }
.tx-icon svg { width: 20px; height: 20px; }
.tx-copy { min-width: 0; }
.tx-copy strong, .tx-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-copy strong { color: var(--ink); font-size: 14px; }
.tx-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.tx-amount { text-align: right; }
.tx-amount strong, .tx-amount small { display: block; }
.tx-amount strong { font-family: Manrope,sans-serif; font-size: 13px; }
.tx-amount strong.income { color: var(--sea-dark); }
.tx-amount strong.expense { color: var(--ink); }
.tx-amount small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.status-strip { display: flex; align-items: center; gap: 11px; margin-top: 14px; padding: 13px 14px; border: 1px solid #cde8e3; border-radius: 15px; background: #ecf8f5; color: var(--sea-dark); }
.status-strip svg { flex: 0 0 auto; width: 18px; height: 18px; }
.status-strip div { flex: 1; }
.status-strip strong { display: block; font-size: 12px; }
.status-strip small { display: block; margin-top: 2px; color: #51827a; font-size: 10px; }

.toolbar { display: flex; gap: 9px; margin-top: 21px; }
.search-wrap { position: relative; flex: 1; }
.search-wrap svg { position: absolute; top: 50%; left: 13px; width: 18px; height: 18px; color: var(--muted); transform: translateY(-50%); }
.search-wrap input { width: 100%; height: 46px; padding: 0 12px 0 40px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: white; color: var(--ink); }
.search-wrap input:focus { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(18,168,151,.1); }
.icon-btn { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; margin: 13px -18px 17px; padding: 0 18px 3px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display:none; }
.filter-chip { flex: 0 0 auto; padding: 8px 13px; border: 1px solid var(--line); border-radius: 20px; background: white; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.filter-chip.active { border-color: var(--navy); background: var(--navy); color: white; }
.month-heading { margin: 20px 2px 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; }

.documents-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.document-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 7px 20px rgba(11,43,67,.05); cursor: pointer; }
.doc-preview { position: relative; display: grid; height: 116px; place-items: center; overflow: hidden; background: #e9eff1; color: var(--navy); }
.doc-preview img { width: 100%; height: 100%; object-fit: cover; }
.doc-preview > svg { width: 37px; height: 37px; opacity: .6; }
.doc-type { position: absolute; top: 9px; left: 9px; padding: 5px 7px; border-radius: 7px; background: rgba(9,41,67,.87); color: white; font-size: 8px; font-weight: 800; letter-spacing: .7px; }
.doc-body { padding: 12px; }
.doc-body strong { display: block; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.doc-body small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }

.empty-state { padding: 38px 24px; text-align: center; }
.empty-state .empty-icon { display: grid; width: 60px; height: 60px; margin: 0 auto 13px; place-items: center; border-radius: 20px; background: var(--blue-soft); color: var(--blue); }
.empty-state h3 { margin: 0; color: var(--navy); font-size: 16px; }
.empty-state p { max-width: 290px; margin: 8px auto 17px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.menu-card { overflow: hidden; margin-top: 20px; }
.menu-row { display: grid; grid-template-columns: 42px 1fr 18px; gap: 12px; align-items: center; width: 100%; min-height: 68px; padding: 11px 14px; border: 0; border-bottom: 1px solid #edf2f4; background: white; text-align: left; cursor: pointer; }
.menu-row:last-child { border-bottom: 0; }
.menu-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: var(--blue-soft); color: var(--blue); }
.menu-row:nth-child(2) .menu-icon { background: var(--green-soft); color: var(--sea-dark); }
.menu-row:nth-child(3) .menu-icon { background: var(--amber-soft); color: var(--amber); }
.menu-row strong { display:block; font-size: 13px; }
.menu-row small { display:block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.menu-row > svg { width: 16px; color: #9fb0bb; }
.legal-note { margin-top: 18px; padding: 15px; border-radius: 15px; background: #e9eff1; color: var(--muted); font-size: 10px; line-height: 1.55; }
.app-version { margin: 20px 0; color: #9babb5; font-size: 10px; text-align: center; }

.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: 1fr 1fr 1.05fr 1fr 1fr; align-items: end; height: calc(74px + env(safe-area-inset-bottom)); padding: 7px 8px env(safe-area-inset-bottom); border-top: 1px solid rgba(218,229,233,.9); background: rgba(255,255,255,.96); box-shadow: 0 -9px 28px rgba(12,43,66,.07); backdrop-filter: blur(18px); }
.nav-item { display: grid; justify-items: center; gap: 4px; height: 54px; padding: 7px 2px 4px; border: 0; background: transparent; color: #84949f; cursor: pointer; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item span { font-size: 9px; font-weight: 700; }
.nav-item.active { color: var(--sea-dark); }
.scan-fab { display: grid; justify-items: center; align-self: center; gap: 2px; margin-top: -29px; border: 0; background: transparent; color: var(--navy); cursor: pointer; }
.scan-fab > span { display: grid; width: 56px; height: 56px; place-items: center; border: 4px solid white; border-radius: 20px; background: var(--sea); color: white; box-shadow: 0 8px 20px rgba(18,168,151,.35); }
.scan-fab svg { width: 23px; height: 23px; }
.scan-fab small { font-size: 9px; font-weight: 800; }

.modal-layer { position: fixed; z-index: 80; inset: 0; display: none; align-items: flex-end; justify-content: center; }
.modal-layer.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,21,34,.55); backdrop-filter: blur(3px); animation: fade-in .2s ease; }
.sheet { position: relative; z-index: 1; width: min(100%, 620px); max-height: 92vh; overflow-y: auto; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: white; box-shadow: 0 -15px 50px rgba(5,30,48,.25); animation: sheet-up .3s cubic-bezier(.2,.75,.2,1) both; }
@keyframes fade-in { from { opacity:0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-handle { width: 42px; height: 4px; margin: 3px auto 18px; border-radius: 4px; background: #d7e0e4; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 19px; }
.sheet-head h2 { margin: 0; color: var(--navy); font-size: 21px; letter-spacing: -.4px; }
.close-btn { display: grid; width: 35px; height: 35px; place-items: center; border: 0; border-radius: 50%; background: #edf2f4; color: var(--muted); cursor: pointer; }
.close-btn svg { width: 18px; height: 18px; }
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 14px; background: #edf2f4; }
.type-toggle button { height: 41px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.type-toggle button.active[data-value="income"] { background: white; color: var(--sea-dark); box-shadow: 0 2px 8px rgba(11,43,67,.08); }
.type-toggle button.active[data-value="expense"] { background: white; color: var(--red); box-shadow: 0 2px 8px rgba(11,43,67,.08); }
.amount-field { display: flex; align-items: center; justify-content: center; margin: 22px 0; }
.amount-field input { width: 190px; border: 0; outline: none; color: var(--navy); background: transparent; font-family: Manrope,sans-serif; font-size: 36px; font-weight: 800; text-align: center; }
.amount-field span { color: var(--navy); font-family: Manrope,sans-serif; font-size: 29px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1/-1; }
.field label { color: var(--muted); font-size: 10px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: white; color: var(--ink); font-size: 13px; }
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(18,168,151,.1); }
.attach-zone { display: flex; align-items: center; gap: 11px; min-height: 61px; padding: 11px; border: 1px dashed #b7c9d1; border-radius: 14px; background: #f8fafb; cursor: pointer; }
.attach-zone .attach-icon { display: grid; flex: 0 0 auto; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--blue-soft); color: var(--blue); }
.attach-zone strong { display: block; font-size: 11px; }
.attach-zone small { display: block; overflow: hidden; max-width: 250px; margin-top: 3px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.primary-btn, .secondary-btn, .danger-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; margin-top: 18px; border-radius: 14px; font-size: 13px; font-weight: 800; cursor: pointer; }
.primary-btn { border: 0; background: var(--sea); color: white; box-shadow: 0 8px 20px rgba(18,168,151,.2); }
.secondary-btn { border: 1px solid var(--line); background: white; color: var(--navy); box-shadow: none; }
.danger-btn { border: 1px solid #ffd9dc; background: var(--red-soft); color: var(--red); box-shadow: none; }
.scan-intro { text-align: center; }
.scanner-visual { position: relative; display: grid; width: 150px; height: 150px; margin: 9px auto 22px; place-items: center; border-radius: 31px; background: #e4f5f2; color: var(--sea-dark); }
.scanner-visual::before, .scanner-visual::after { content:""; position:absolute; width:30px; height:30px; border-color:var(--sea); border-style:solid; }
.scanner-visual::before { top:15px; left:15px; border-width:3px 0 0 3px; border-radius:9px 0 0; }
.scanner-visual::after { right:15px; bottom:15px; border-width:0 3px 3px 0; border-radius:0 0 9px; }
.scanner-visual svg { width: 61px; height: 61px; }
.scan-intro h3 { margin: 0; color: var(--navy); font-size: 18px; }
.scan-intro p { margin: 8px auto 20px; max-width: 330px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.file-preview-large { display: grid; min-height: 185px; margin-bottom: 17px; place-items: center; overflow: hidden; border-radius: 17px; background: #e9eff1; color: var(--navy); }
.file-preview-large img { width: 100%; max-height: 280px; object-fit: contain; }
.file-preview-large iframe { width: 100%; height: 280px; border: 0; }
.file-preview-large svg { width: 50px; height: 50px; opacity: .5; }
.document-detail { text-align: center; }
.document-detail h3 { margin: 12px 0 4px; color: var(--navy); font-size: 17px; }
.document-detail p { margin: 0; color: var(--muted); font-size: 11px; }
.detail-amount { margin: 15px 0 2px; color: var(--navy); font-family: Manrope,sans-serif; font-size: 25px; font-weight: 800; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-actions > button { margin-top: 13px; }

.toast-region { position: fixed; z-index: 100; right: 15px; bottom: calc(88px + env(safe-area-inset-bottom)); left: 15px; display: grid; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; max-width: 420px; padding: 12px 16px; border-radius: 13px; background: var(--navy); color: white; box-shadow: 0 10px 30px rgba(5,30,48,.25); font-size: 11px; font-weight: 600; animation: toast-in .25s ease both; }
.toast svg { width: 16px; height: 16px; color: #79e2d2; }
@keyframes toast-in { from { opacity:0; transform:translateY(10px); } }

@media (min-width: 700px) {
  body { background: #dce7e9; }
  .app-shell { width: min(100%, 780px); margin: 0 auto; background: var(--bg); box-shadow: 0 0 50px rgba(9,41,67,.12); }
  .bottom-nav { left: 50%; width: min(100%,780px); transform: translateX(-50%); }
  .topbar { padding-right: 25px; padding-left: 25px; }
  .screen { padding-right: 25px; padding-left: 25px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .documents-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 360px) {
  .screen { padding-right: 14px; padding-left: 14px; }
  .hero-card { padding: 18px; }
  .hero-top h2 { font-size: 27px; }
  .quick-card { min-height: 118px; padding: 14px; }
  .nav-item span, .scan-fab small { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
