:root {
  --bg: #F4F5F7; --card: #FFFFFF; --line: #E5E7EB; --line2: #F1F2F4;
  --text: #111827; --muted: #4B5563; --soft: #6B7280;
  --navy: #1E3A8A; --navy-dark: #172554; --navy-soft: #E0E7FF; --navy-tint: #DBEAFE;
  --orange: #C2410C; --orange-dark: #7C2D12; --orange-soft: #FFEDD5; --orange-bar: #EA580C;
  --green: #15803D; --green-soft: #DCFCE7; --green-text: #166534;
  --amber: #B45309; --amber-soft: #FEF3C7; --amber-text: #92400E;
  --red: #B91C1C; --red-soft: #FEE2E2;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif; font-size: 15px; line-height: 1.35; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }

#view { max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(100px + var(--safe-b)); min-height: 100vh; }
#view.no-tabbar { padding-bottom: calc(24px + var(--safe-b)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* Başlık */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; }
.title { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.back { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--navy); display: inline-flex; align-items: center; min-height: 32px; }
.pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 12.5px; font-weight: 700; color: var(--navy); text-decoration: none; white-space: nowrap; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; cursor: pointer; flex: none; }

/* Kartlar */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.hero { border-radius: 20px; padding: 20px; color: #fff; display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.hero.bg-navy { background: var(--navy); }
.hero.bg-orange { background: var(--orange-dark); }
.hero .lbl { font-size: 13px; font-weight: 600; opacity: .92; color: #E5ECFF; }
.hero.bg-orange .lbl, .hero.bg-orange .soft { color: #FED7AA; }
.hero .big, .hero b { color: #fff; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
.hero .soft { color: var(--navy-tint); font-size: 14px; }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: var(--navy); }
.hero .bar { background: rgba(255,255,255,.22); }
.hero .bar > div { background: #FDBA74; }
.stat { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 21px; font-weight: 800; letter-spacing: -0.3px; }
.stat .s { font-size: 12px; color: var(--muted); }
.h2 { font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.green { color: var(--green); } .orange { color: var(--orange); } .navy { color: var(--navy); } .red { color: var(--red); }

/* Uyarı kartı */
.notice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--amber-soft); color: var(--amber-text); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.notice.blue { background: var(--navy-soft); color: var(--navy); }

/* Liste */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line2); text-decoration: none; color: var(--text); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.badge { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex: none; }
.item .t { font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .d { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.item .amt b { font-size: 14.5px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.chip.ok { background: var(--green-soft); color: var(--green-text); }
.chip.warn { background: var(--amber-soft); color: var(--amber-text); }
.chip.blue { background: var(--navy-soft); color: var(--navy); }
.chip.gray { background: #F1F5F9; color: #374151; }
.chip.red { background: var(--red-soft); color: #991B1B; }
.empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* Butonlar */
.btn { height: 50px; border-radius: 14px; border: 0; background: var(--navy); color: #fff; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; cursor: pointer; text-decoration: none; width: 100%; }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--card); color: var(--navy); border: 1px solid #CBD5E1; }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid #FCA5A5; }
.btn.orange-btn { background: var(--orange-dark); }
.btn.sm { height: 44px; font-size: 14px; border-radius: 12px; }
.btn.wa { background: #15803D; }
.link-btn { background: none; border: 0; color: var(--navy); font-weight: 700; font-size: 14px; padding: 0; min-height: 36px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.dashed { border: 1.5px dashed #94A3B8; background: transparent; color: var(--navy); }

/* Segment ve çipler */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #E5E7EB; border-radius: 12px; padding: 4px; }
.seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 650; font-size: 14px; color: #374151; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--navy); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 800; }
.seg.small button { height: 36px; font-size: 13px; padding: 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { height: 42px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13.5px; font-weight: 650; color: #374151; cursor: pointer; }
.chips button.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Form */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.input { height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--card); font-size: 16px; color: var(--text); width: 100%; min-width: 0; }
.input:focus { outline: 2px solid #93C5FD; border-color: #60A5FA; }
.money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.money .input { font-weight: 800; font-size: 17px; }
.money .derived .input { background: #F8FAFC; color: var(--navy); }
.money .derived .lt::after { content: 'hesap'; font-size: 10.5px; font-weight: 800; color: var(--navy); background: var(--navy-soft); padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.tag { font-size: 10.5px; font-weight: 800; color: var(--navy); background: var(--navy-soft); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.bigamt { display: flex; align-items: center; gap: 6px; }
.bigamt span { font-size: 34px; font-weight: 800; color: var(--soft); }
.bigamt input { border: 0; outline: none; background: transparent; font-size: 34px; font-weight: 800; width: 100%; min-width: 0; padding: 0; }
.checkrow { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: 15px; font-weight: 550; cursor: pointer; }
.checkrow input { width: 22px; height: 22px; accent-color: var(--navy); margin: 0; flex: none; }

/* Dekont */
.drop { border: 1.5px dashed #94A3B8; border-radius: 16px; padding: 12px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 76px; height: 96px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #F1F5F9; display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .kind { position: absolute; left: 4px; bottom: 4px; font-size: 9px; font-weight: 800; padding: 1px 4px; border-radius: 4px; background: var(--red-soft); color: #991B1B; }
.thumb .x { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 999px; border: 0; background: rgba(17,24,39,.75); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.readout { border-radius: 12px; padding: 10px 12px; font-size: 13.5px; background: var(--green-soft); color: var(--green-text); font-weight: 600; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.readout.wait { background: var(--navy-soft); color: var(--navy); }
.readout.warn { background: var(--amber-soft); color: var(--amber-text); }
.spinner { width: 16px; height: 16px; border-radius: 999px; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Kategori çubukları */
.catrow { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.catrow .n { width: 78px; font-size: 13px; font-weight: 650; }
.catrow .b { flex: 1; height: 8px; border-radius: 999px; background: var(--orange-soft); overflow: hidden; }
.catrow .b > div { height: 100%; background: var(--orange-bar); border-radius: 999px; }
.catrow .v { width: 60px; text-align: right; font-size: 13px; font-weight: 800; }

/* Alt menü */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.97); border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: center; padding: 8px 8px calc(8px + var(--safe-b)); z-index: 20; backdrop-filter: blur(8px); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 60px; min-height: 48px; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); }
.tabbar a.on { color: var(--navy); font-weight: 800; }
.tabbar a.plus { width: 52px; height: 52px; min-width: 52px; border-radius: 16px; background: var(--navy); color: #fff; }
.tabbar svg { width: 22px; height: 22px; }

/* Alt sayfa (sheet) */
.overlay { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); max-height: 92vh; overflow: auto; animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: #CBD5E1; margin: -6px auto 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }

.preview-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.howto { font-size: 14px; line-height: 1.5; }
.howto ol { margin: 6px 0 0; padding-left: 20px; }
