@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────────
   Arayüz tek renkli (siyah/beyaz); renk yalnızca veriye — kişilere ve kartlara — ait.
   Kişi/kart renkleri (--s1…--s8) her iki yüzey için doğrulanmış sabit sıradır. */
:root {
  color-scheme: light;
  --bg:        #f5f6f8;
  --surface:   #ffffff;
  --surface-2: #f2f3f6;
  --surface-3: #e7e9ee;
  --line:      #e7e9ee;
  --line-2:    #d6d9e1;
  --text:      #10131a;
  --text-2:    #4a5163;
  --text-3:    #8a90a0;
  --primary:   #10131a;
  --on-primary:#ffffff;
  --danger:    #d43c4b;
  --warn:      #b7791f;
  --ok:        #13915c;
  --focus:     rgba(16, 19, 26, .16);
  --overlay:   rgba(12, 14, 20, .32);
  --shadow:    0 1px 2px rgba(16, 19, 26, .04), 0 10px 30px rgba(16, 19, 26, .06);
  --shadow-lg: 0 24px 60px rgba(16, 19, 26, .18);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --cash: #9aa0ae;
  /* sync.js mesaj renkleri */
  --income: var(--ok);
  --expense: var(--danger);

  --r-xl: 24px;
  --r-lg: 20px;
  --r:    14px;
  --r-sm: 10px;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:        #0b0c10;
    --surface:   #14161c;
    --surface-2: #1b1e26;
    --surface-3: #252934;
    --line:      #22252e;
    --line-2:    #323643;
    --text:      #eef0f4;
    --text-2:    #a7adbb;
    --text-3:    #6c7283;
    --primary:   #eef0f4;
    --on-primary:#0b0c10;
    --danger:    #f06b78;
    --warn:      #e3a646;
    --ok:        #3fcf8e;
    --focus:     rgba(238, 240, 244, .2);
    --overlay:   rgba(0, 0, 0, .55);
    --shadow:    0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .55);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --cash: #5d6373;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #0b0c10;
  --surface:   #14161c;
  --surface-2: #1b1e26;
  --surface-3: #252934;
  --line:      #22252e;
  --line-2:    #323643;
  --text:      #eef0f4;
  --text-2:    #a7adbb;
  --text-3:    #6c7283;
  --primary:   #eef0f4;
  --on-primary:#0b0c10;
  --danger:    #f06b78;
  --warn:      #e3a646;
  --ok:        #3fcf8e;
  --focus:     rgba(238, 240, 244, .2);
  --overlay:   rgba(0, 0, 0, .55);
  --shadow:    0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 32px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .55);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --cash: #5d6373;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
.num, .amount, dd, td { font-variant-numeric: tabular-nums; }

.ic {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

:focus-visible { outline: 2px solid var(--text-2); outline-offset: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn .ic { width: 18px; height: 18px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); padding: 0 10px; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }

.link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
}
.link:hover { color: var(--text); }

/* Segmented control — buton ya da radio ile */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 11px;
}
.seg button, .seg label {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background .15s, color .15s;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg button.active, .seg label.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line);
}
.seg label:has(input:focus-visible) { outline: 2px solid var(--text-2); outline-offset: 1px; }
.seg-full { display: flex; }
.seg-full > * { flex: 1; }

/* Chips — radio ile seçilebilir */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { background: var(--surface-2); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.active, .chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.chip:has(input:focus-visible) { outline: 2px solid var(--text-2); outline-offset: 2px; }
.chip .count { color: inherit; opacity: .6; font-weight: 500; }

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c, var(--cash));
}
.chip .dot { box-shadow: 0 0 0 2px var(--surface); }

/* ── Header + nav ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
/* Bulanık zemin sözde öğede: backdrop-filter başlığa verilirse içindeki sabit alt menünün
   konum kutusu başlık olur ve menü ekranın altına değil başlığa yapışır */
.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.03em; }
.header-actions { display: flex; align-items: center; gap: 6px; }
.btn-add { display: none; }

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabs a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border-radius: 12px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.tabs a .ic { width: 22px; height: 22px; }
.tabs a.active { color: var(--text); }
.tabs a.active .ic { stroke-width: 2.1; }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  z-index: 31;
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border: none;
  border-radius: 18px;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-lg);
  transition: transform .15s;
}
.fab:active { transform: scale(.95); }
.fab .ic { width: 26px; height: 26px; stroke-width: 2.2; }

/* ── Layout ── */
.app-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom));
}
.view { display: flex; flex-direction: column; gap: 16px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.view-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
.view-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.panel-note { font-size: 13px; color: var(--text-3); }
.grid-2 { display: grid; gap: 16px; }

.empty {
  color: var(--text-3);
  font-size: 14px;
  text-align: center;
  padding: 24px 8px;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-2);
}
.empty-state .ic { width: 36px; height: 36px; color: var(--text-3); stroke-width: 1.5; }
.empty-state strong { color: var(--text); font-size: 16px; }
.footnote { font-size: 13px; color: var(--text-3); line-height: 1.55; padding: 0 4px; }

/* ── Month switch ── */
.month-switch { display: inline-flex; align-items: center; gap: 2px; }
.month-name {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  min-width: 104px;
  text-align: center;
}
.month-name:hover { background: var(--surface-2); }

/* ── Hero ── */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 20px 20px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 70%;
  aspect-ratio: 1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--text) 6%, transparent), transparent);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hero-label { font-size: 14px; color: var(--text-2); font-weight: 500; }
.hero-amount {
  margin: 14px 0 18px;
  font-size: clamp(40px, 11vw, 56px);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1;
}
.hero-amount .cur { font-size: .52em; font-weight: 600; color: var(--text-3); margin-right: .12em; vertical-align: .55em; letter-spacing: 0; }
.hero-amount .dec { font-size: .5em; font-weight: 600; color: var(--text-3); letter-spacing: -.02em; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.hero-stats > div { min-width: 0; padding-right: 8px; }
.hero-stats > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.hero-stats dt { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.hero-stats dd { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Payment rows (Özet + Akış) ── */
.pay-list { list-style: none; margin: 0; padding: 0; }
.pay {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.pay + .pay { border-top: 1px solid var(--line); }
.pay.clickable { cursor: pointer; border-radius: 12px; outline: none; }
.pay.past { opacity: .5; }
.date-badge {
  width: 46px; height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--surface-2);
}
.date-badge .d { font-size: 18px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.date-badge .w { font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.pay-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pay-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.pay-sub { font-size: 13px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pay-sub .who { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pay-amt { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.pay-amt .ic { width: 16px; height: 16px; color: var(--text-3); transition: transform .2s; }
.pay.open .pay-amt .ic { transform: rotate(180deg); }

.items {
  grid-column: 1 / -1;
  list-style: none;
  margin: 4px 0 0;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.items li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  font-size: 14px;
}
.items .who { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.items .no { color: var(--text-3); font-size: 12px; }
.items .amount { font-weight: 600; text-align: right; }

/* ── People summary ── */
.people-sum { list-style: none; margin: 0; padding: 0; }
.people-sum li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
}
.people-sum li + li { border-top: 1px solid var(--line); }
.people-sum .name { font-weight: 600; }
.people-sum .sub { font-size: 13px; color: var(--text-3); }
.people-sum .amount { font-weight: 600; text-align: right; }

.avatar {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 60%, transparent);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }

/* ── Chart ── */
.chart-panel .panel-head { flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -2px 0 6px; min-height: 4px; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.leg .sw { width: 9px; height: 9px; border-radius: 3px; }
.chart { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .col { transition: opacity .12s; }
.chart .col.hover { opacity: .78; }
.chart .cf-hit { cursor: pointer; outline: none; }

.chart-tooltip {
  position: fixed;
  z-index: 60;
  min-width: 170px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  pointer-events: none;
}
.chart-tooltip .tt-date  { display: block; color: var(--text-2); font-size: 12px; margin-bottom: 6px; }
.chart-tooltip .tt-row   { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-row + .tt-row { margin-top: 3px; }
.chart-tooltip .tt-key   { width: 10px; height: 2px; border-radius: 1px; flex-shrink: 0; }
.chart-tooltip strong    { font-weight: 600; }
.chart-tooltip .tt-name  { color: var(--text-2); font-size: 12px; }
.chart-tooltip .tt-total { display: block; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ── Flow (Akış) ── */
.flow { display: flex; flex-direction: column; gap: 22px; }
.month-block { scroll-margin-top: 80px; }
.month-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 8px;
}
.month-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.month-head .total { font-size: 17px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.month-split { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0 4px 10px; font-size: 13px; color: var(--text-2); }
.month-split span { display: inline-flex; align-items: center; gap: 6px; }
.month-block .panel { padding: 6px 14px; }
.month-block.focus .panel { box-shadow: 0 0 0 2px var(--text-3), var(--shadow); }
.month-empty { font-size: 14px; color: var(--text-3); padding: 10px 0; }

.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.plan-table th, .plan-table td { padding: 11px 16px; text-align: left; white-space: nowrap; }
.plan-table th {
  position: sticky; top: 0;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.plan-table th .dot { margin-right: 6px; vertical-align: 1px; }
.plan-table td { border-top: 1px solid var(--line); }
.plan-table .num { text-align: right; }
.plan-table .total { font-weight: 700; }
.plan-table tbody tr.zero { color: var(--text-3); }
.plan-table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line-2); }
.plan-table .d-short { display: none; }

/* ── Purchases ── */
.list-panel { padding: 4px 0; overflow: hidden; }
.purchase {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .12s;
  outline: none;
}
.purchase + .purchase { border-top: 1px solid var(--line); }
.purchase:hover, .purchase:focus-visible { background: var(--surface-2); }
.purchase.done { opacity: .55; }
.p-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.p-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--text-3); }
.p-meta > * + *::before { content: "·"; margin-right: 8px; color: var(--text-3); }
.p-meta .card-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.bar { flex: 1; max-width: 220px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--text-2); }
.p-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.p-side .amount { font-weight: 700; font-size: 15px; white-space: nowrap; }
.p-side .amount small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.p-side .sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 4px;
}
.section-toggle .ic { width: 16px; height: 16px; transition: transform .2s; }
.section-toggle.open .ic { transform: rotate(180deg); }
.purchase-groups { display: flex; flex-direction: column; gap: 12px; }

/* ── Credit cards ── */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.cc {
  --c: var(--s1);
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.586;
  border-radius: 20px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  text-align: left;
  border: none;
  cursor: pointer;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 60%, transparent) 0%, transparent 60%),
    linear-gradient(140deg, color-mix(in srgb, var(--c) 74%, #0b0c10) 0%, color-mix(in srgb, var(--c) 36%, #0b0c10) 100%);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--c) 28%, transparent), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform .18s ease;
}
.cc:hover { transform: translateY(-2px); }
.cc::after {
  content: "";
  position: absolute;
  right: -18%; bottom: -46%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 0 0 28px rgba(255, 255, 255, .03);
  pointer-events: none;
}
.cc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cc-name { font-size: 18px; font-weight: 700; letter-spacing: -.02em; text-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.cc-days { font-size: 12px; font-weight: 500; opacity: .85; text-align: right; line-height: 1.4; }
.cc-chip {
  width: 34px; height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, .18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.cc-chiprow { display: flex; align-items: center; gap: 10px; }
.cc-mid .lbl { font-size: 12px; opacity: .8; }
.cc-mid .val { font-size: 24px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.cc-bottom { display: flex; flex-direction: column; gap: 7px; }
.cc-bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.cc-bar > span { display: block; height: 100%; border-radius: 3px; background: #fff; }
.cc-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; opacity: .9; font-variant-numeric: tabular-nums; }
.cc-alert { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: 11px; font-weight: 600; }
.cc-add {
  aspect-ratio: 1.586;
  border-radius: 20px;
  border: 1.5px dashed var(--line-2);
  background: transparent;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.cc-add:hover { background: var(--surface); color: var(--text); }
.cc-add .ic { width: 26px; height: 26px; }
.cc-preview { cursor: default; aspect-ratio: auto; min-height: 150px; }
.cc-preview:hover { transform: none; }

/* ── Sheets (dialog) ── */
dialog.sheet {
  width: min(560px, calc(100% - 32px));
  max-height: min(90dvh, 880px);
  padding: 0;
  border: none;
  border-radius: var(--r-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; animation: pop .2s ease; }
dialog.sheet::backdrop { background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.sheet-form { display: flex; flex-direction: column; width: 100%; max-height: inherit; min-height: 0; }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px 22px;
}
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 22px 20px;
  overflow-y: auto;
  min-height: 0;
}
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.inline-add input, .people-edit input, .modal-box input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 16px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .inline-add input:focus, .people-edit input:focus, .modal-box input:focus {
  border-color: var(--text-3);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--focus);
}
.field input::placeholder, .inline-add input::placeholder, .modal-box input::placeholder { color: var(--text-3); }
.field input.invalid { border-color: var(--danger); }
.field-label small { font-weight: 500; color: var(--text-3); }
.field textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
}
.field textarea:focus { border-color: var(--text-3); background: var(--surface); box-shadow: 0 0 0 4px var(--focus); }

.amount-input {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 64px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.amount-input:focus-within { border-color: var(--text-3); background: var(--surface); box-shadow: 0 0 0 4px var(--focus); }
.amount-input .cur { font-size: 22px; font-weight: 600; color: var(--text-3); }
.amount-input input {
  flex: 1;
  min-width: 0;
  height: 100% !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 28px !important;
  font-weight: 700;
  letter-spacing: -.02em;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.amount-input.sm { height: 50px; }
.amount-input.sm .cur { font-size: 17px; }
.amount-input.sm input { font-size: 18px !important; font-weight: 600; }

.inline-input { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.inline-input input {
  width: 84px !important;
  height: 36px !important;
  padding: 0 12px !important;
  border-radius: 10px !important;
  font-size: 15px !important;
}

.preview {
  border-radius: 14px;
  background: var(--surface-2);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
}
.preview:empty { display: none; }
.preview .big { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.preview .warn { color: var(--danger); font-weight: 500; }
.hint { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.hint:empty { display: none; }
.warn-text { color: var(--danger); }

/* ── Banka e-postaları ── */
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.steps strong { color: var(--text); font-weight: 600; }
.steps code, .copy-row code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
#inboxSetup { display: flex; flex-direction: column; gap: 14px; }
#inboxSetup[hidden] { display: none; }
.copy-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.copy-row-lg { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 10px 10px 14px; }
.copy-row-lg code { font-size: 15px; font-weight: 600; }
.copy-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.inbox-panel { padding: 16px 0 4px; }
.inbox-panel .panel-head { padding: 0 18px; margin-bottom: 4px; }
.inbox-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 18px; }
.inbox-item + .inbox-item { border-top: 1px solid var(--line); }
.inbox-reason { font-size: 12px; color: var(--danger); }
.inbox-actions { display: flex; gap: 6px; }
.inbox-body {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}
.inbox-body a { color: var(--text); text-decoration: underline; }
.inbox-from { font-size: 12px; color: var(--text-3); }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.cc-num { font-size: 13px; font-weight: 600; letter-spacing: .12em; opacity: .9; font-variant-numeric: tabular-nums; }

.people-edit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.people-edit li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; }
.people-edit .sub { font-size: 12px; color: var(--text-3); grid-column: 2; margin-top: -4px; }
.inline-add { display: flex; gap: 8px; }
.inline-add .btn { height: 46px; }

.settings-group { display: flex; flex-direction: column; gap: 8px; }
.group-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.row-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.row-btn:hover { background: var(--surface-3); }
.row-btn.row-static { cursor: default; }
.row-btn.row-static:hover { background: var(--surface-2); }
.row-btn > .ic { color: var(--text-2); }
.row-text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.row-text strong { font-size: 15px; font-weight: 600; }
.row-text small { font-size: 13px; color: var(--text-3); }
#authBtn.auth-active { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  z-index: 70;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast .22s ease;
  white-space: nowrap;
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Auth modal (sync.js) ── */
.modal-wrap {
  position: fixed; inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-box {
  position: relative;
  width: min(400px, 100%);
  padding: 20px 22px 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.modal-desc { color: var(--text-2); font-size: 14px; margin: 0 0 12px; }
.modal-box form { display: flex; flex-direction: column; gap: 10px; }
.modal-box form .btn { height: 46px; }
.auth-tabs { display: flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 11px; margin-bottom: 14px; }
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-2);
  padding: 7px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.auth-msg { font-size: 13px; margin: 8px 0 0; min-height: 18px; }
.auth-forgot { border: none; background: transparent; color: var(--text-3); font-size: 13px; padding: 4px 0; }
.auth-forgot:hover { color: var(--text); }
.auth-user-email { font-weight: 600; margin: 0 0 16px; }

/* ── Responsive ── */
@media (max-width: 639px) {
  dialog.sheet {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  dialog.sheet[open] { animation: slide-up .25s cubic-bezier(.2, .8, .2, 1); }
  .sheet-head::before {
    content: "";
    position: absolute;
    left: 50%; top: 8px;
    width: 38px; height: 4px;
    border-radius: 2px;
    background: var(--line-2);
    transform: translateX(-50%);
  }
  .sheet-head { position: relative; padding-top: 22px; }
  .plan-table th, .plan-table td { padding: 10px 10px; font-size: 13px; }
  .plan-table .d-long { display: none; }
  .plan-table .d-short { display: inline; }
  .items li { grid-template-columns: 1fr auto; }
  .items .who { grid-column: 1 / -1; }
  .items .no { display: none; }
  .hero-stats dd { font-size: 14px; }
  .hero-stats > div + div { padding-left: 10px; }
}
@media (max-width: 420px) {
  .hero-stats dd { font-size: 13px; letter-spacing: -.01em; }
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }

@media (min-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  .app-header { padding: 14px 24px; }
  .brand { margin-right: 0; flex: 1; }
  .header-actions { flex: 1; justify-content: flex-end; }
  .btn-add { display: inline-flex; }
  .fab { display: none; }
  .tabs {
    position: static;
    display: flex;
    gap: 2px;
    padding: 4px;
    border-radius: 13px;
    border: none;
    background: var(--surface-2);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .tabs a { flex-direction: row; gap: 8px; padding: 7px 14px; font-size: 14px; border-radius: 10px; color: var(--text-2); }
  .tabs a .ic { width: 18px; height: 18px; }
  .tabs a:hover { color: var(--text); }
  .tabs a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }
  .app-main { padding: 16px 24px 56px; }
  .view { gap: 20px; }
  .hero { padding: 26px 28px 22px; }
  .hero-stats dd { font-size: 17px; }
  .grid-2 { grid-template-columns: 1fr 1fr; gap: 20px; }
  .panel { padding: 20px 22px; }
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .toast { bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
