/* Berber Hesap - telefon öncelikli arayüz.
   Beyaz ve açık gri yüzeyler, ince kenarlıklar. Tek vurgu: koyu dolgu.
   Yeşil yalnız gelir, kırmızı yalnız gider anlamında kullanılır. */
:root {
  --bg: #f4f4f3;
  --surface: #ffffff;
  --surface-2: #ececea;
  --ink: #161616;
  --ink-2: #44443f;
  --muted: #7d7d76;
  --line: #e3e3df;
  --line-2: #d2d2cc;
  --fill: #161616;          /* ana vurgu: koyu dolgu */
  --on-fill: #ffffff;
  --on-fill-2: rgba(255, 255, 255, 0.66);
  --in: #1d7a4c;
  --in-soft: #e6f3ec;
  --in-line: #bfe0cd;
  --out: #c0392b;
  --out-soft: #fbeceA;
  --out-line: #f0c9c3;
  --bar: #d6d6d1;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --r: 16px;
  --r-s: 14px;
  --tabbar-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-d: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e; --surface: #181818; --surface-2: #232323; --ink: #f2f2f0; --ink-2: #c9c9c4; --muted: #8b8b85;
    --line: #2a2a2a; --line-2: #3a3a3a; --fill: #f2f2f0; --on-fill: #111111; --on-fill-2: rgba(17, 17, 17, 0.62);
    --in: #5fcf94; --in-soft: rgba(95, 207, 148, 0.12); --in-line: rgba(95, 207, 148, 0.32);
    --out: #ff7b6b; --out-soft: rgba(255, 123, 107, 0.12); --out-line: rgba(255, 123, 107, 0.32);
    --bar: #3a3a3a; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0e; --surface: #181818; --surface-2: #232323; --ink: #f2f2f0; --ink-2: #c9c9c4; --muted: #8b8b85;
  --line: #2a2a2a; --line-2: #3a3a3a; --fill: #f2f2f0; --on-fill: #111111; --on-fill-2: rgba(17, 17, 17, 0.62);
  --in: #5fcf94; --in-soft: rgba(95, 207, 148, 0.12); --in-line: rgba(95, 207, 148, 0.32);
  --out: #ff7b6b; --out-soft: rgba(255, 123, 107, 0.12); --out-line: rgba(255, 123, 107, 0.32);
  --bar: #3a3a3a; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; min-height: 100dvh;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.c-in { color: var(--in); }
.c-out { color: var(--out); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- çerçeve */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); }
.view { padding: calc(env(safe-area-inset-top) + 14px) 16px 8px; max-width: 560px; margin: 0 auto; }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.title { margin: 0; font: 700 30px/1.1 var(--font-d); letter-spacing: -0.02em; }
.subtitle { margin-top: 4px; font-size: 15px; color: var(--muted); }
.sync {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; margin-top: 2px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.sync[data-state="ok"] i { background: var(--in); }
.sync[data-state="wait"] i { background: var(--ink); }
.sync[data-state="err"] i { background: var(--out); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.tab svg { width: 25px; height: 25px; }
.tab.is-on { color: var(--ink); }
.tab.is-on svg { stroke-width: 2.2; }

.h-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 2px 10px; }
.h { margin: 0; font: 650 17px/1.2 var(--font-d); }
.link { border: 0; background: none; padding: 12px 0; min-height: 48px; color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 16px; }

/* ---------- Bugün */
.cash { background: var(--fill); color: var(--on-fill); border-radius: var(--r); padding: 20px 20px 18px; }
.cash-k { font-size: 15px; color: var(--on-fill-2); }
.cash-v { font: 700 44px/1.05 var(--font-d); letter-spacing: -0.03em; margin: 6px 0 10px; }
.cash-s { font-size: 15px; color: var(--on-fill-2); }
.cash-s b { color: var(--on-fill); font-weight: 600; }
.big-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.big {
  min-height: 88px; border-radius: var(--r); font: 700 22px/1 var(--font-d); display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.1s ease;
}
.big:active { transform: scale(0.97); }
.big.in { background: var(--in-soft); color: var(--in); border: 1px solid var(--in-line); }
.big.out { background: var(--out-soft); color: var(--out); border: 1px solid var(--out-line); }
.big span { font-size: 28px; font-weight: 500; margin-top: -2px; }

/* ---------- kayıt satırları */
.list { overflow: hidden; }
.e { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; min-height: 64px; border: 0; background: none; text-align: left; }
.e + .e { border-top: 1px solid var(--line); }
.e:active { background: var(--surface-2); }
.e-main { min-width: 0; }
.e-title { display: block; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.e-amt { font: 650 18px/1.2 var(--font-d); text-align: right; white-space: nowrap; }
.pending-tag { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.empty { text-align: center; padding: 30px 20px; color: var(--muted); font-size: 15px; }
.empty b { display: block; color: var(--ink-2); font-size: 16px; margin-bottom: 4px; }

/* ---------- segment */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-s); background: var(--surface-2); }
.seg button { min-height: 44px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 15px; }
.seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); border-color: var(--line); }

/* ---------- ekleme sayfası */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; min-height: 76px; padding: 12px 14px;
  text-align: left; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); transition: transform 0.1s ease;
}
.tile:active { transform: scale(0.97); }
.tile b { font-weight: 650; font-size: 17px; line-height: 1.2; }
.tile span { font-size: 15px; color: var(--muted); }
.tile.is-on { border: 2px solid var(--ink); padding: 11px 13px; }
.tile.is-on span { color: var(--ink); font-weight: 600; }
.tile.short { min-height: 60px; }
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.label { font-size: 14px; font-weight: 600; color: var(--muted); }
.input, .amount {
  width: 100%; min-width: 0; min-height: 52px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: var(--surface); font-size: 16px; outline: none;
}
.input:focus, .amount:focus-within { border-color: var(--ink); }
.amount { display: flex; align-items: center; gap: 6px; }
.amount span { font: 600 22px/1 var(--font-d); color: var(--muted); }
.amount input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 0; font: 700 26px/1 var(--font-d); font-variant-numeric: tabular-nums; }
input[type="date"].input, input[type="month"].input { -webkit-appearance: none; appearance: none; display: flex; align-items: center; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); font-size: 15px; font-weight: 600; color: var(--ink-2); }
.chip.is-on { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.more { justify-self: start; border: 0; background: none; padding: 10px 0; min-height: 44px; color: var(--ink-2); font-weight: 600; font-size: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px;
  border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface); font-weight: 650; font-size: 16px;
}
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--fill); border-color: var(--fill); color: var(--on-fill); min-height: 60px; font: 700 19px/1 var(--font-d); }
.btn.danger { color: var(--out); border-color: var(--out-line); background: var(--surface); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; border: 0; background: var(--surface-2); color: var(--ink); flex: none; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Rapor */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat { padding: 14px 16px; min-width: 0; }
.stat-k { font-size: 14px; color: var(--muted); }
.stat-v { font: 700 26px/1.15 var(--font-d); letter-spacing: -0.02em; margin-top: 6px; white-space: nowrap; }
.stat-s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.net { margin-top: 10px; padding: 16px; }
.net-v { font: 700 36px/1.1 var(--font-d); letter-spacing: -0.03em; margin-top: 4px; }
.cmp { margin-top: 8px; font-size: 15px; font-weight: 600; }
.net-split { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.cmp small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.chart { padding: 16px 12px 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .b { fill: var(--bar); stroke: none; }
.chart .b.today { fill: var(--fill); }
.chart .t { fill: var(--muted); stroke: none; font-size: 11px; font-family: var(--font); }
.chart .t.today { fill: var(--ink); font-weight: 700; }
.chart .v { fill: var(--ink); stroke: none; font-size: 11px; font-weight: 700; font-family: var(--font); }
.rows { overflow: hidden; }
.r { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 16px; }
.r + .r { border-top: 1px solid var(--line); }
.r-name { font-weight: 600; }
.r-sub { font-size: 13px; color: var(--muted); }
.r-val { text-align: right; font-weight: 650; }
.meter { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--fill); border-radius: 4px; }
.export { display: flex; justify-content: center; margin-top: 12px; }

/* ---------- Kayıtlar */
.daynav { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center; }
.daynav .icon-btn { width: 52px; height: 52px; background: var(--surface); border: 1px solid var(--line); }
.daynav-mid { position: relative; height: 52px; border-radius: var(--r-s); background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; text-align: center; }
.daynav-mid b { display: block; font: 650 16px/1.1 var(--font-d); }
.daynav-mid small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.daynav-mid input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.daysum { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; padding: 12px 6px; margin-top: 10px; }
.daysum div + div { border-left: 1px solid var(--line); }
.daysum small { display: block; font-size: 13px; color: var(--muted); }
.daysum b { font: 700 18px/1.3 var(--font-d); }

/* ---------- Ayar */
.set { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-height: 60px; padding: 10px 16px; border: 0; background: none; text-align: left; }
.set + .set { border-top: 1px solid var(--line); }
.set-t { display: block; font-weight: 600; }
.set-s { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }
.set .chev { width: 18px; height: 18px; color: var(--muted); }
.edit-list { display: grid; gap: 8px; }
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px 48px; gap: 8px; align-items: center; }
.edit-row.two { grid-template-columns: minmax(0, 1fr) 48px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background 0.2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s; }
.switch input:checked + span { background: var(--fill); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--on-fill); }
.foot-note { font-size: 13px; color: var(--muted); text-align: center; margin: 22px 0 6px; }

/* ---------- açılır sayfa */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); animation: fade 0.18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100dvh - env(safe-area-inset-top) - 24px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0; max-width: 600px; margin: 0 auto; animation: up 0.24s cubic-bezier(0.2, 0.9, 0.25, 1);
}
@keyframes up { from { transform: translateY(100%); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.sheet-head h2 { margin: 0; font: 700 22px/1.2 var(--font-d); letter-spacing: -0.01em; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 16px 18px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-body:last-child { padding-bottom: calc(env(safe-area-inset-bottom) + 18px); }
.sheet-foot { flex: none; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); border-top: 1px solid var(--line); background: var(--bg); }
.foot-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; }
.foot-row .btn { min-height: 60px; }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet-backdrop, .toast { animation: none !important; } }

/* ---------- bildirim */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px); padding: 6px 6px 6px 18px; min-height: 52px;
  border-radius: var(--r-s); background: var(--fill); color: var(--on-fill); font-size: 15px; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.45);
  animation: toastIn 0.2s ease-out;
}
.toast:not(:has(button)) { padding-right: 18px; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast button { border: 0; border-radius: 10px; background: color-mix(in srgb, var(--on-fill) 16%, transparent); color: var(--on-fill); font-weight: 700; padding: 0 14px; min-height: 40px; white-space: nowrap; }

/* ---------- kilit ekranı */
.lock {
  position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
}
.lock h1 { margin: 0; font: 700 26px/1.2 var(--font-d); letter-spacing: -0.02em; text-align: center; }
.lock p { margin: 8px 0 0; color: var(--muted); text-align: center; font-size: 15px; min-height: 21px; }
.lock p.err { color: var(--out); }
.lock .name-input { margin-top: 18px; max-width: 280px; text-align: center; }
.dots { display: flex; gap: 18px; margin: 28px 0 30px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.6px solid var(--line-2); transition: background 0.15s, border-color 0.15s; }
.dots i.on { background: var(--ink); border-color: var(--ink); }
.dots.shake { animation: shake 0.36s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad-keys { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; }
.key { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font: 500 28px/1 var(--font-d); color: var(--ink); }
.key:active { background: var(--surface-2); transform: scale(0.95); }
.key.ghost { background: none; border: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.key svg { width: 26px; height: 26px; }
@media (max-height: 640px) { .pad-keys { grid-template-columns: repeat(3, 66px); gap: 12px 22px; } .key { width: 66px; height: 66px; } .dots { margin: 20px 0; } }
