/* Buffalo Kasa — arayüz
   Fikir: kasa çekmecesi. Üç para birimi = üç bölme.
   Yazı: Bahnschrift (Windows'ta yerleşik, DIN ailesi) başlık ve rakamlarda; Segoe UI metinde. */

:root {
  --bg: #e6eae7;
  --surface: #ffffff;
  --sunken: #f3f5f4;
  --ink: #16211d;
  --muted: #5b6863;
  --faint: #8b9792;
  --line: #d2d9d5;
  --line-strong: #b9c3be;

  --side: #18181b;
  --side-2: #222226;
  --side-ink: #ececee;
  --side-dim: #9b9ba3;
  --brand: #e5333a;      /* logodaki neon kırmızı */
  --brand-glow: rgba(255, 60, 66, .55);
  --brass: #b8862b;
  --brass-soft: #f4e8cf;

  --gelir: #1f7046;
  --gelir-soft: #e3f1e8;
  --gider: #ae342b;
  --gider-soft: #f8e5e2;

  --try: #8d5d0f;
  --try-soft: #f7efdf;
  --eur: #284b82;
  --eur-soft: #e5ecf7;
  --gbp: #6a2c51;
  --gbp-soft: #f3e6ee;

  --display: "Bahnschrift", "DIN Alternate", "D-DIN", "Segoe UI", system-ui, sans-serif;
  --text: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --r-s: 4px;
  --r-m: 7px;
  --r-l: 12px;
  --focus: 0 0 0 3px rgba(229, 51, 58, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num, td.amt, .amt { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── Giriş ───────── */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 46%) 1fr;
}
.auth-side {
  background: var(--side);
  color: var(--side-ink);
  padding: 56px 56px 40px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-side::after {
  /* kasa fişi delikleri gibi tırtıklı kenar */
  content: ""; position: absolute; top: 0; right: -9px; bottom: 0; width: 18px;
  background: radial-gradient(circle at 9px 9px, var(--bg) 6px, transparent 6.5px) 0 0 / 18px 18px repeat-y;
}
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 80%;
  font-size: clamp(64px, 9vw, 128px);
  line-height: .86;
  letter-spacing: -.02em;
  margin: 0;
  color: #f3efe4;
}
.wordmark small {
  display: block;
  font-size: .22em; font-weight: 400; font-stretch: 100%;
  letter-spacing: .02em; color: var(--side-dim); margin-top: 14px;
}
.auth-side p { color: var(--side-dim); max-width: 34ch; margin: 0; }
.auth-top { color: var(--side-dim); font-size: 14px; }
.auth-logo { width: min(340px, 70%); aspect-ratio: 1; align-self: center; mix-blend-mode: screen; }
.auth-logo[hidden] { display: none; }
.auth-date { font-family: var(--display); font-size: 20px; color: var(--side-ink); }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: min(380px, 100%); }
.auth-form h2 { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0 0 6px; }
.auth-form > p { color: var(--muted); margin: 0 0 28px; }
.auth-form .field { margin-bottom: 16px; }
.auth-form .btn { width: 100%; height: 52px; font-size: 17px; margin-top: 8px; }
.auth-error { color: var(--gider); min-height: 22px; margin-top: 12px; font-size: 14px; }

/* ───────── İskelet ───────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 26px 0 18px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 18px; }
.brand img { width: 56px; height: 56px; border-radius: 50%; flex: none; }
.brand .wordmark { font-size: 30px; color: #fff; }
.brand .wordmark small { font-size: 13px; margin-top: 4px; letter-spacing: .01em; }
.nav { margin-top: 34px; display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-m);
  text-decoration: none; color: var(--side-dim);
  font-size: 15.5px;
}
.nav a svg { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { color: var(--side-ink); background: rgba(255,255,255,.05); }
.nav a.on { color: #fff; background: rgba(255,255,255,.08); box-shadow: inset 3px 0 0 var(--brand); }
.nav a.on svg { color: var(--brand); filter: drop-shadow(0 0 4px var(--brand-glow)); }
.side-foot { margin-top: auto; padding: 0 24px; font-size: 13px; color: var(--side-dim); }
.side-foot .who { color: var(--side-ink); font-size: 14.5px; margin-bottom: 2px; }
.side-foot button { background: none; border: 0; padding: 0; color: var(--side-dim); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.side-foot button:hover { color: #fff; }
.side-foot .backup-line { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 32px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.top h1 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0; letter-spacing: -.005em; }
.top .date { color: var(--muted); font-size: 14px; }
.top .grow { flex: 1; }
.rate-chip {
  display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-m);
  background: var(--surface); cursor: pointer; padding: 0; overflow: hidden; height: 44px;
}
.rate-chip span { display: flex; align-items: center; gap: 6px; padding: 0 12px; font-family: var(--display); font-size: 16px; }
.rate-chip span + span { border-left: 1px solid var(--line); }
.rate-chip b { font-weight: 600; }
.rate-chip .eur b { color: var(--eur); } .rate-chip .gbp b { color: var(--gbp); }
.rate-chip:hover { border-color: var(--ink); }
.rate-chip.missing { border-color: var(--brass); background: var(--brass-soft); }
.rate-chip.missing span { color: #6d4e12; font-family: var(--text); font-size: 14.5px; font-weight: 600; }

.view { padding: 28px 32px 64px; max-width: 1320px; width: 100%; }

/* ───────── Düğmeler & form ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: var(--r-m);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--side); border-color: var(--side); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.in { background: var(--gelir); border-color: var(--gelir); color: #fff; }
.btn.out { background: var(--gider); border-color: var(--gider); color: #fff; }
.btn.in:hover, .btn.out:hover { filter: brightness(.92); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--sunken); }
.btn.danger { color: var(--gider); }
.btn.danger:hover { border-color: var(--gider); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn .k { font-weight: 400; opacity: .7; font-size: 12.5px; font-family: var(--display); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-s);
  background: var(--surface); width: 100%;
}
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.input.big { height: 64px; font-family: var(--display); font-size: 34px; font-weight: 600; padding: 0 16px; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.hint { font-size: 13px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: center; font-size: 14.5px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--side); }

/* Seçici (segment) */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; height: 36px; padding: 0 14px; border-radius: 5px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14.5px; }
.seg button:hover { color: var(--ink); background: var(--sunken); }
.seg button.on { background: var(--ink); color: #fff; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; height: 48px; font-size: 16px; }
.seg .on.c-TRY { background: var(--try); } .seg .on.c-EUR { background: var(--eur); } .seg .on.c-GBP { background: var(--gbp); }
.seg .on.t-gelir { background: var(--gelir); } .seg .on.t-gider { background: var(--gider); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ───────── Çekmeceler (ana ekran) ───────── */
.drawers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; background: #c9d1cd; border-radius: var(--r-l); padding: 10px; gap: 10px; box-shadow: inset 0 2px 0 rgba(0,0,0,.06); }
.drawer {
  --c: var(--try); --soft: var(--try-soft);
  background: var(--surface);
  border-radius: 8px;
  padding: 30px 24px 20px;
  position: relative;
  border-top: 5px solid var(--c);
  min-height: 188px;
  display: flex; flex-direction: column;
}
.drawer.EUR { --c: var(--eur); --soft: var(--eur-soft); }
.drawer.GBP { --c: var(--gbp); --soft: var(--gbp-soft); }
.drawer::before {
  /* çekmece kulpu */
  content: ""; position: absolute; top: 10px; left: 50%; width: 54px; height: 7px; margin-left: -27px;
  border-radius: 0 0 6px 6px; background: var(--soft); box-shadow: inset 0 -1px 0 rgba(0,0,0,.08);
}
.drawer .cur { display: flex; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: 14px; }
.drawer .sym { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--c); }
.drawer .bal { font-family: var(--display); font-weight: 600; font-size: clamp(30px, 3.2vw, 44px); line-height: 1.1; margin: 10px 0 auto; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.drawer .bal.neg { color: var(--gider); }
.drawer .moves { display: flex; gap: 18px; margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: 14px; color: var(--muted); }
.drawer .moves b { font-family: var(--display); font-weight: 600; font-size: 16px; }
.drawer .moves .p { color: var(--gelir); } .drawer .moves .m { color: var(--gider); }
.drawer .tl { font-size: 13px; color: var(--faint); margin-top: 4px; }

.grid2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; margin-top: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.panel > h3, .panel-h { margin: 0; padding: 16px 20px; font-family: var(--display); font-weight: 600; font-size: 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel-h .grow { flex: 1; }
.panel-b { padding: 18px 20px; }

.ledger { width: 100%; border-collapse: collapse; }
.ledger td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.ledger tr:last-child td { border-bottom: 0; }
.ledger td:last-child { text-align: right; font-family: var(--display); font-size: 17px; font-variant-numeric: tabular-nums; }
.ledger tr.total td { padding-top: 14px; font-weight: 700; }
.ledger tr.total td:last-child { font-size: 22px; }

/* ───────── Tablolar ───────── */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 11px 14px; border-bottom: 1px solid var(--line-strong); background: var(--sunken); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fafbfa; }
table.t .r, table.t th.r { text-align: right; }
table.t td.amt { font-size: 16px; text-align: right; }
table.t tr.click { cursor: pointer; }
table.t td.act { text-align: right; white-space: nowrap; width: 1%; }
table.t tfoot td { font-weight: 700; background: var(--sunken); border-top: 1px solid var(--line-strong); }
.p { color: var(--gelir); } .m { color: var(--gider); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.cur-tag { display: inline-block; min-width: 18px; font-family: var(--display); font-weight: 700; margin-left: 3px; }
.cur-tag.TRY { color: var(--try); } .cur-tag.EUR { color: var(--eur); } .cur-tag.GBP { color: var(--gbp); }
.badge { display: inline-block; font-size: 12.5px; padding: 2px 8px; border-radius: 4px; background: var(--sunken); color: var(--muted); font-weight: 600; white-space: nowrap; }
.badge.gelir { background: var(--gelir-soft); color: var(--gelir); }
.badge.gider { background: var(--gider-soft); color: var(--gider); }
.badge.warn { background: var(--brass-soft); color: #7a5512; }
.badge.link { background: #eef1ef; color: var(--muted); font-weight: 500; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar .input { width: auto; height: 42px; }
.toolbar input[type=date].input { width: 160px; }
.toolbar .search { width: 220px; }

.strip { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 16px; overflow: hidden; flex-wrap: wrap; }
.strip > div { flex: 1 1 200px; padding: 14px 18px; border-left: 4px solid var(--c, var(--line)); }
.strip > div + div { border-left-width: 4px; box-shadow: -1px 0 0 var(--line); }
.strip .c-TRY { --c: var(--try); } .strip .c-EUR { --c: var(--eur); } .strip .c-GBP { --c: var(--gbp); }
.strip .h { font-size: 13px; color: var(--muted); font-weight: 600; }
.strip .v { font-family: var(--display); font-size: 15px; display: flex; gap: 14px; flex-wrap: wrap; margin-top: 2px; }
.strip .v b { font-weight: 600; font-size: 17px; }

.page-h { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.01em; }
.page-h .grow { flex: 1; }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

.notice { display: flex; gap: 14px; align-items: center; background: var(--brass-soft); border: 1px solid #e2cc9c; color: #5e4510; padding: 12px 16px; border-radius: var(--r-m); margin-bottom: 18px; font-size: 14.5px; }
.notice .grow { flex: 1; }

.balances { display: flex; gap: 22px; flex-wrap: wrap; }
.balances .b { font-family: var(--display); }
.balances .b .l { font-family: var(--text); font-size: 12.5px; color: var(--muted); display: block; }
.balances .b strong { font-size: 22px; font-weight: 600; }

/* ───────── Rapor: Z raporu fişi ───────── */
.report { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.receipt {
  background: #fffefb;
  padding: 28px 26px 34px;
  font-family: var(--display);
  position: relative;
  box-shadow: 0 1px 0 var(--line-strong), 0 10px 24px -16px rgba(22, 33, 29, .35);
  --tooth: 10px;
  -webkit-mask: radial-gradient(circle at 50% 100%, transparent 5.5px, #000 6px) 0 100% / var(--tooth) 8px repeat-x, linear-gradient(#000, #000) 0 0 / 100% calc(100% - 7px) no-repeat;
  mask: radial-gradient(circle at 50% 100%, transparent 5.5px, #000 6px) 0 100% / var(--tooth) 8px repeat-x, linear-gradient(#000, #000) 0 0 / 100% calc(100% - 7px) no-repeat;
}
.receipt h4 { text-align: center; font-size: 22px; font-weight: 700; margin: 0; letter-spacing: .04em; }
.receipt .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.receipt hr { border: 0; border-top: 1.5px dashed var(--line-strong); margin: 16px 0; }
.receipt .ln { display: flex; align-items: baseline; gap: 6px; font-size: 16px; padding: 3px 0; }
.receipt .ln .dots { flex: 1; border-bottom: 1.5px dotted var(--line-strong); transform: translateY(-4px); }
.receipt .ln .v { font-variant-numeric: tabular-nums; }
.receipt .ln.small { font-size: 14px; color: var(--muted); }
.receipt .ln.big { font-size: 24px; font-weight: 700; padding-top: 6px; }
.receipt .ln.big .v.neg { color: var(--gider); }
.receipt .foot { text-align: center; font-size: 12.5px; color: var(--faint); margin-top: 18px; font-family: var(--text); }

.share { display: inline-block; height: 6px; border-radius: 3px; background: currentColor; opacity: .55; vertical-align: middle; }

/* ───────── Modal ───────── */
dialog.modal {
  border: 0; padding: 0; border-radius: var(--r-l); width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); color: var(--ink); background: var(--surface);
  box-shadow: 0 30px 60px -20px rgba(10, 25, 20, .45);
}
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(22, 33, 29, .5); }
dialog.modal[open] { animation: pop .16s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-h { padding: 20px 24px 0; display: flex; align-items: center; gap: 12px; }
.modal-h h3 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 22px; flex: 1; }
.modal-h .x { border: 0; background: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 22px; color: var(--muted); line-height: 1; }
.modal-h .x:hover { background: var(--sunken); color: var(--ink); }
.modal-b { padding: 18px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-f { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); background: var(--sunken); border-radius: 0 0 var(--r-l) var(--r-l); }
.modal-f .grow { flex: 1; }
.modal .err { color: var(--gider); font-size: 14px; min-height: 0; }
.modal.t-gelir .modal-h h3 { color: var(--gelir); }
.modal.t-gider .modal-h h3 { color: var(--gider); }

/* ───────── Bildirim ───────── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r-m);
  font-weight: 600; z-index: 100; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
  animation: toast .2s ease-out;
}
.toast.error { background: var(--gider); }
@keyframes toast { from { transform: translate(-50%, 10px); opacity: 0; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); }

.mobile-bar { display: none; }

/* ───────── Duyarlı ───────── */
@media (max-width: 1100px) {
  .grid2, .report { grid-template-columns: 1fr; }
  .receipt { max-width: 420px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .mobile-bar { display: inline-flex; }
  .top { padding: 12px 16px; }
  .top h1 { font-size: 21px; }
  .top .date { display: none; }
  .view { padding: 18px 16px 80px; }
  .drawers { grid-template-columns: 1fr; }
  .drawer { min-height: 0; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 36px 28px; min-height: 0; gap: 24px; }
  .auth-side::after { display: none; }
  .quick .k { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───────── Yazdırma ───────── */
@media print {
  body { background: #fff; }
  .side, .top, .toolbar, .no-print, .btn { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; }
  .report { grid-template-columns: 300px 1fr; }
  .receipt { box-shadow: none; border: 1px solid #999; -webkit-mask: none; mask: none; }
  .table-wrap, .panel { border-color: #999; }
  table.t th { position: static; }
}
