:root {
  --bg: #F5F2EA;
  --card: #FFFFFF;
  --ink: #11162A;
  --ink2: #5B6072;
  --line: #E6E1D5;
  --gold: #BFA46F;
  --gold-d: #9C8350;
  --navy: #11162A;
  --green: #2E7D5B;
  --green-bg: #E5F2EB;
  --red: #B54A3C;
  --red-bg: #F8E6E2;
  --amber: #A77A1F;
  --amber-bg: #F7EED9;
  --r: 18px;
  --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(--ink); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Giriş ---------- */
.login {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; background: var(--navy); color: #fff; text-align: center;
}
.login-logo { width: 88px; height: 88px; border-radius: 22px; }
.login h1 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: 32px; margin: 18px 0 4px; }
.login p { color: #A9ADBD; margin: 0 0 28px; }
.login form { width: 100%; max-width: 320px; display: grid; gap: 12px; }
.login input { background: #1D2338; border: 1px solid #2C3350; color: #fff; text-align: center; }
.err { color: #F0A090; min-height: 20px; font-size: 14px; }

/* ---------- Üst bar ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  padding: calc(var(--safe-t) + 12px) 18px 12px;
  background: rgba(245, 242, 234, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: space-between;
}
.top-title { font-family: "Cormorant Garamond", Georgia, serif; font-size: 30px; font-weight: 600; letter-spacing: -.2px; }
.icon-btn { background: none; border: 0; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; }
.icon-btn svg { fill: currentColor; stroke: none; }
.icon-btn:active { background: var(--line); }

main { padding: 4px 16px calc(var(--safe-b) + 100px); max-width: 640px; margin: 0 auto; }

/* ---------- Alt menü ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(var(--safe-b) + 6px);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button {
  background: none; border: 0; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #9A9DAA; font-size: 11px; font-weight: 500;
}
.tabs button.on { color: var(--navy); }
.tabs button.on svg { stroke: var(--gold-d); }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--safe-b) + 76px); z-index: 21;
  width: 58px; height: 58px; border-radius: 29px; border: 0;
  background: var(--navy); color: var(--gold); display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(17, 22, 42, .28);
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:active { transform: scale(.94); }

/* ---------- Kartlar ---------- */
.hero {
  background: var(--navy); color: #fff; border-radius: 24px; padding: 20px 20px 18px; margin-bottom: 12px;
}
.hero .lbl { color: #A9ADBD; font-size: 13px; }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.6px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero .sub { color: var(--gold); font-size: 13px; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #262C45; }
.hero-row .lbl { font-size: 12px; }
.hero-row .v { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: var(--r); padding: 14px; }
.stat .lbl { color: var(--ink2); font-size: 12.5px; }
.stat .v { font-size: 19px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat .usd { color: var(--ink2); font-size: 12px; margin-top: 1px; }
.stat.pos .v { color: var(--green); }
.stat.neg .v { color: var(--red); }

.sec-h { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 4px 8px; }
.sec-h h3 { margin: 0; font-size: 16px; }
.sec-h span { color: var(--ink2); font-size: 13px; }

.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left;
}
.row:last-child { border-bottom: 0; }
.row:active { background: #FAF8F3; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--ink2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .amt small { display: block; font-weight: 400; color: var(--ink2); font-size: 12px; }
.av {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: #F1ECE0; color: var(--gold-d); font-weight: 700; font-size: 15px;
}

.chip { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 600; }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.part { background: var(--amber-bg); color: var(--amber); }
.chip.wait { background: #ECEDF2; color: #555B70; }
.chip.late { background: var(--red-bg); color: var(--red); }

.empty { text-align: center; color: var(--ink2); padding: 36px 20px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- Segment / filtre ---------- */
.seg { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 7px 14px; font-size: 13.5px; font-weight: 500;
}
.seg button.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Alt panel (sheet) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(17, 22, 42, .42); animation: fade .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(var(--safe-b) + 20px); max-width: 640px; margin: 0 auto;
  animation: up .26s cubic-bezier(.2, .9, .3, 1);
}
.grab { width: 40px; height: 5px; border-radius: 3px; background: #CFC9BA; margin: 0 auto; }
.sheet-bar {
  position: sticky; top: -8px; z-index: 2; margin: -8px -18px 12px; padding: 10px 12px 8px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: var(--bg);
}
.sheet-back { justify-self: start; border: 0; background: none; color: var(--gold-d); font-weight: 600; font-size: 16px; padding: 6px 8px; }
.sheet-x {
  justify-self: end; width: 36px; height: 36px; border-radius: 18px; border: 0;
  background: #E9E4D8; color: var(--ink); font-size: 16px; display: grid; place-items: center;
}
.sheet-x:active, .sheet-back:active { opacity: .6; }
.stat.warn .v { color: var(--amber); }
.sheet h2 { margin: 0 0 14px; font-size: 21px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

.f { margin-bottom: 12px; }
.f label { display: block; font-size: 12.5px; color: var(--ink2); margin: 0 0 5px 4px; font-weight: 500; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px;
  padding: 13px 14px; font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 64px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f2 > .f { min-width: 0; }

.rates { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rates button {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 0; font-weight: 700; font-size: 16px;
}
.rates button.on { border-color: var(--navy); background: var(--navy); color: var(--gold); }

.calc { background: var(--navy); color: #fff; border-radius: var(--r); padding: 14px 16px; margin: 4px 0 14px; }
.calc .line { display: flex; justify-content: space-between; padding: 5px 0; font-variant-numeric: tabular-nums; }
.calc .line span:first-child { color: #A9ADBD; }
.calc .line.me span:last-child { color: var(--gold); font-weight: 700; font-size: 18px; }
.calc .line.total { border-bottom: 1px solid #262C45; padding-bottom: 9px; margin-bottom: 4px; }
.calc .line.total span:last-child { font-weight: 700; }

.btn { border: 0; border-radius: 14px; padding: 14px; font-weight: 600; font-size: 16px; width: 100%; }
.btn.primary { background: var(--gold); color: var(--navy); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--red); }
.btn:active { opacity: .85; }
.btns { display: grid; gap: 8px; margin-top: 8px; }
.btn-sm { border: 0; background: #F1ECE0; color: var(--gold-d); font-weight: 600; border-radius: 10px; padding: 7px 12px; font-size: 13.5px; }

.kv { background: var(--card); border-radius: var(--r); padding: 4px 14px; margin-bottom: 12px; }
.kv .line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.kv .line:last-child { border-bottom: 0; }
.kv .line span:first-child { color: var(--ink2); }
.kv .line span:last-child { font-weight: 600; text-align: right; }

.bar { height: 8px; background: #ECE7DB; border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }

.menu-list .row { font-weight: 500; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 90px); transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 60; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Rapor tablosu + yazdırma ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl td.n, .tbl th.n { text-align: right; }
.tbl-wrap { background: var(--card); border-radius: var(--r); padding: 6px 10px; overflow-x: auto; }
.print-only { display: none; }

@media print {
  .tabs, .fab, .top, .no-print, .toast { display: none !important; }
  body, main { background: #fff; padding: 0; }
  .print-only { display: block; }
  .stat, .list, .tbl-wrap, .kv { border: 1px solid #ddd; }
  .hero { background: #fff; color: #000; border: 1px solid #ddd; }
}
