/* Kart Takip — Apple HIG + Liquid Glass (web yaklaşımı) */

:root {
  color-scheme: light dark;
  --font-stack: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter,
                "Helvetica Neue", Arial, sans-serif;

  --label: #000;
  --label-2: rgba(60, 60, 67, .60);
  --label-3: rgba(60, 60, 67, .30);
  --separator: rgba(60, 60, 67, .29);
  --bg: #f2f2f7;            /* grouped page */
  --cell: #fff;             /* grouped cell */
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .20);
  --sheet: #f2f2f7;
  --tint: #0088ff;
  --green: #34c759;
  --red: #ff383c;
  --on-tint: #fff;
  --glass-bg: rgba(255, 255, 255, .58);
  --glass-rim: rgba(255, 255, 255, .55);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, .10);
  --scrim: rgba(0, 0, 0, .35);

  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bar-space: calc(96px + var(--safe-b));
}

@media (prefers-color-scheme: dark) {
  :root {
    --label: #f5f5f7;
    --label-2: rgba(235, 235, 245, .60);
    --label-3: rgba(235, 235, 245, .30);
    --separator: rgba(84, 84, 88, .60);
    --bg: #000;
    --cell: #1c1c1e;
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .36);
    --sheet: #1c1c1e;
    --tint: #0091ff;
    --green: #30d158;
    --red: #ff4245;
    --glass-bg: rgba(40, 40, 44, .55);
    --glass-rim: rgba(255, 255, 255, .14);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, .45);
    --scrim: rgba(0, 0, 0, .55);
  }
  .sheet .group, .sheet .field { --cell: #2c2c2e; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--label);
  font-family: var(--font-stack); font-size: 17px; line-height: 22px; letter-spacing: -.003em;
  font-feature-settings: "cv05", "cv11", "tnum"; -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { border: 0; outline: none; background: none; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--label-3); }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9;
        stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.pos, .row .meta.pos { color: var(--green); }
.neg, .row .meta.neg { color: var(--red); }
.muted { color: var(--label-2); }
.hidden { display: none !important; }

/* ---------- sayfa ---------- */
.page {
  max-width: 680px; margin: 0 auto;
  padding: calc(var(--safe-t) + 20px) 0 var(--bar-space);
}
.page-head { padding: 12px 20px 8px; }
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.subtitle { color: var(--label-2); font-size: 15px; line-height: 20px; margin-top: 2px; }
.section-title {
  font-size: 13px; line-height: 18px; color: var(--label-2); text-transform: uppercase;
  letter-spacing: .02em; padding: 22px 36px 6px; margin: 0; font-weight: 400;
}
.section-foot { font-size: 13px; line-height: 18px; color: var(--label-2); padding: 6px 36px 0; }

/* üst/alt kaydırma kenarı efekti */
.edge-top, .edge-bottom { position: fixed; left: 0; right: 0; pointer-events: none; z-index: 5; }
.edge-top {
  top: 0; height: calc(var(--safe-t) + 24px);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
          mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.edge-bottom {
  bottom: 0; height: calc(var(--safe-b) + 110px);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to top, #000 35%, transparent);
          mask-image: linear-gradient(to top, #000 35%, transparent);
}

/* ---------- cam ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-rim), inset 0 0 0 .5px var(--glass-rim);
}

/* ---------- sekme çubuğu + artı ---------- */
.dock {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: max(14px, var(--safe-b));
  display: flex; justify-content: center; align-items: center; gap: 10px; pointer-events: none;
}
.tabbar { display: flex; gap: 2px; padding: 5px; border-radius: 999px; pointer-events: auto; }
.tabbar a {
  width: 72px; height: 54px; border-radius: 999px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; color: var(--label);
  text-decoration: none; font-size: 10px; line-height: 12px; font-weight: 500;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.tabbar a svg.i { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--tint); background: var(--fill); }
.tabbar a[aria-current="page"] svg.i { fill: currentColor; fill-opacity: .18; }
.fab {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tint); color: var(--on-tint); pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 136, 255, .35), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); opacity: .85; }
@media (max-width: 380px) { .tabbar a { width: 62px; } }

.menu {
  position: fixed; z-index: 40; right: max(16px, calc(50% - 200px));
  bottom: calc(max(14px, var(--safe-b)) + 76px);
  min-width: 230px; border-radius: 22px; padding: 6px; overflow: hidden;
  transform-origin: bottom right; animation: pop .28s var(--ease);
}
.menu button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 16px; min-height: 48px; text-align: left; font-weight: 500;
}
.menu button:active { background: var(--fill-2); }
.menu .sub { display: block; font-size: 13px; line-height: 16px; color: var(--label-2); font-weight: 400; }

/* ---------- yüzen geri düğmesi ---------- */
.float-back {
  color: var(--label);
  position: fixed; z-index: 20; top: calc(var(--safe-t) + 10px); left: 12px;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
}

/* ---------- gruplu liste ---------- */
.group { background: var(--cell); border-radius: 12px; margin: 0 16px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px;
  position: relative; width: 100%; text-align: left;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--separator);
}
button.row:active, a.row:active { background: var(--fill); }
a.row { color: inherit; text-decoration: none; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 15px; line-height: 20px; color: var(--label-2);
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .value .meta { text-align: right; }
.row .chev { color: var(--label-3); }
.row .chev svg.i { width: 16px; height: 16px; stroke-width: 2.4; }
.row .check {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 1.5px solid var(--label-3); color: transparent;
}
.row[aria-pressed="true"] .check { background: var(--tint); border-color: var(--tint); color: #fff; }
.row .check svg.i { width: 14px; height: 14px; stroke-width: 3; }

/* ---------- form alanları ---------- */
.field { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; position: relative; }
.field + .field::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--separator);
}
.field label { flex: none; width: 112px; color: var(--label); }
.field input, .field textarea { flex: 1; padding: 13px 0; text-align: right; }
.field input[type="date"] { text-align: right; -webkit-appearance: none; appearance: none; min-height: 22px; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: right; }
.field.big input { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -.01em; }

.search {
  margin: 4px 16px 0; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px;
  background: var(--fill); border-radius: 12px; color: var(--label-2);
}
.search svg.i { width: 18px; height: 18px; }
.search input { flex: 1; color: var(--label); height: 100%; }

/* ---------- haplar ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none;
  scroll-padding: 16px;
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; min-height: 36px; padding: 7px 14px; border-radius: 999px;
  background: var(--fill); font-size: 15px; line-height: 20px; font-weight: 500; white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.chip:active { opacity: .7; }
.chip[aria-pressed="true"] { background: var(--label); color: var(--bg); }
.picker-step { font-size: 13px; color: var(--label-2); padding: 12px 20px 0; }

/* ---------- düğmeler ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 14px; font-weight: 600;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.btn:active { opacity: .8; transform: scale(.98); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn-filled { background: var(--tint); color: var(--on-tint); }
.btn-gray { background: var(--fill); color: var(--tint); }
.btn-plain { color: var(--tint); min-height: 44px; padding: 0 8px; font-weight: 400; }
.btn-danger { background: var(--fill); color: var(--red); }
.btn-block { display: flex; width: calc(100% - 32px); margin: 0 16px; }
.btn-row { display: flex; gap: 10px; margin: 20px 16px 0; }
.btn-row .btn { flex: 1; }
.stepper { display: inline-flex; align-items: center; background: var(--fill); border-radius: 10px; }
.stepper button { width: 38px; height: 34px; display: grid; place-items: center; color: var(--label); }
.stepper button svg.i { width: 16px; height: 16px; stroke-width: 2.4; }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; margin: 0 16px; }
.seg button { flex: 1; min-height: 34px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--cell); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }

/* ---------- özet ---------- */
.hero { padding: 8px 20px 4px; }
.hero .label { font-size: 15px; color: var(--label-2); }
.hero .amount { font-size: 52px; line-height: 58px; font-weight: 700; letter-spacing: -.022em;
                font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; background: var(--green); border-radius: 3px; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
         background: var(--fill); color: var(--label-2); }
.badge.ok { color: var(--green); }
.tip { margin: 12px 16px 0; padding: 14px 16px; border-radius: 14px; background: var(--cell);
       display: flex; gap: 12px; align-items: flex-start; }
.tip .main { flex: 1; font-size: 15px; line-height: 20px; }
.tip b { display: block; font-size: 17px; margin-bottom: 2px; }

/* ---------- boş durum ---------- */
.empty { text-align: center; padding: 56px 32px; color: var(--label-2); }
.empty svg.i { width: 56px; height: 56px; color: var(--label-3); stroke-width: 1.4; }
.empty h3 { color: var(--label); font-size: 20px; line-height: 25px; font-weight: 600; margin: 12px 0 4px; }
.empty p { margin: 0; font-size: 15px; line-height: 20px; }
.skeleton { height: 52px; margin: 0 16px 1px; border-radius: 12px; background: var(--fill);
            animation: pulse 1.2s ease-in-out infinite; }

/* ---------- sayfa (sheet) ---------- */
#overlay:empty { display: none; }
.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); animation: fade .3s var(--ease); }
.sheet {
  position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 680px;
  height: calc(100dvh - var(--safe-t) - 12px); background: var(--sheet);
  border-radius: 20px 20px 0 0; display: flex; flex-direction: column; overflow: hidden;
  animation: up .38s var(--ease); box-shadow: 0 -4px 30px rgba(0,0,0,.15);
}
.sheet.closing { animation: down .28s var(--ease) forwards; }
.scrim.closing { animation: fade .28s var(--ease) reverse forwards; }
.sheet-grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 6px auto 0; flex: none; }
.sheet-bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 2px 8px 6px; flex: none;
}
.sheet-bar h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-bar .right { justify-self: end; }
.sheet-bar .right .btn { min-height: 36px; padding: 0 16px; border-radius: 999px; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
              padding-bottom: calc(var(--safe-b) + 32px); overscroll-behavior: contain; }
.sheet .group { --cell: #fff; }
@media (prefers-color-scheme: dark) { .sheet .group { --cell: #2c2c2e; } }

.dialog {
  position: fixed; z-index: 41; left: 8px; right: 8px; bottom: max(8px, var(--safe-b));
  margin: 0 auto; max-width: 420px; animation: up .3s var(--ease);
}
.dialog .box { border-radius: 16px; overflow: hidden; margin-bottom: 8px; text-align: center; }
.dialog .msg { padding: 16px 20px; font-size: 13px; line-height: 18px; color: var(--label-2); }
.dialog button { display: block; width: 100%; min-height: 56px; font-size: 20px; border-top: .5px solid var(--separator); }
.dialog .danger { color: var(--red); }
.dialog .cancel { border: 0; border-radius: 16px; font-weight: 600; color: var(--tint); }

/* ---------- bildirim ---------- */
#toast {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 10px);
  transform: translate(-50%, -140%); max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  transition: transform .4s var(--ease), opacity .4s var(--ease); opacity: 0; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- giriş ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .card { width: 100%; max-width: 360px; text-align: center; }
.login .logo { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 18px; display: block; }
.login h1 { font-size: 28px; line-height: 34px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.015em; }
.login p { color: var(--label-2); margin: 0 0 24px; font-size: 15px; }
.login .group { margin: 0 0 14px; }
.login .field input { text-align: left; }
.login .btn { width: 100%; }
.login .err { color: var(--red); font-size: 15px; min-height: 20px; margin-top: 10px; }

@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes pulse { 50% { opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .sheet, .dialog { animation: fade .2s linear !important; }
}

@media (min-width: 900px) {
  .page { padding-top: 48px; }
}
