/* Cebimde: çizgili hesap defteri. Soğuk kâğıt, tükenmez mavisi, solda kırmızı kenar çizgisi. */
:root {
  --paper: #F3F5FA;
  --page: #FFFFFF;
  --ink: #1A2550;
  --ink-soft: #5A6590;
  --line: #D9E0EF;
  --margin: #E7A6A0;
  --blue: #2B4ACB;
  --btn: #2B4ACB;
  --red: #C0332A;
  --green: #17805A;
  --wash: #EAF0FF;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12172B;
    --page: #1A2140;
    --ink: #E9EDFB;
    --ink-soft: #9CA7CE;
    --line: #2D3761;
    --margin: #8E4A4A;
    --blue: #9DB1FF;
    --red: #FF8F85;
    --green: #62D4A5;
    --wash: #232C55;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--blue); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot, .empty { padding: 3rem 1.25rem; text-align: center; color: var(--ink-soft); }
.empty b { display: block; color: var(--ink); font-size: 1.0625rem; margin-bottom: .25rem; }

/* Üst şerit ve bölümler */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; padding: .625rem 1rem; padding-top: calc(.625rem + env(safe-area-inset-top)); background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; border-radius: 8px; }
.me { margin-left: auto; width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; background: var(--wash); color: var(--blue); font-weight: 700; text-decoration: none; }
.me[aria-current] { background: var(--btn); color: #fff; }
.tabs { display: flex; }
.tabs a { flex: 1; text-align: center; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .875rem; padding: .75rem .25rem; border-top: 3px solid transparent; }
.tabs a[aria-current] { color: var(--blue); border-color: var(--blue); }
@media (max-width: 719px) {
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--page); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  main { padding-bottom: 5.5rem !important; }
}
@media (min-width: 720px) {
  .tabs { gap: .25rem; margin-left: 1rem; }
  .tabs a { flex: none; padding: .5rem .875rem; border-top: 0; border-radius: 999px; font-size: .9375rem; }
  .tabs a[aria-current] { background: var(--wash); }
}
main { max-width: 40rem; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* Sayfa başı: ay seçici ve o sayfanın ana eylemi */
.head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 2.75rem; margin-bottom: 1rem; }
.head h1 { font-size: 1.375rem; letter-spacing: -.01em; }
.month { display: flex; align-items: center; gap: .125rem; }
.month b { min-width: 7.25rem; text-align: center; font-size: 1.125rem; }
.month button { width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: none; font-size: 1.5rem; line-height: 1; color: var(--blue); }
.month button:hover { background: var(--wash); }
.back { display: inline-block; margin-bottom: .75rem; font-weight: 600; text-decoration: none; }
h2 { font-size: 1rem; margin: 1.75rem 0 .5rem; display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
h2 small { font-weight: 500; font-size: .875rem; color: var(--ink-soft); }

.btn { border: 1px solid var(--line); background: var(--page); border-radius: 999px; padding: .625rem 1.125rem; font-weight: 700; white-space: nowrap; }
.btn.primary { background: var(--btn); border-color: var(--btn); color: #fff; }
.btn.quiet { border-color: transparent; background: none; color: var(--red); padding-inline: .25rem; }
.btn:disabled { opacity: .6; }

/* Ay hesabı: defterin dibindeki toplama. Sonucun altına çift çizgi çekilir. */
.sum { background: var(--page); border: 1px solid var(--line); border-radius: 14px; padding: .5rem 1.125rem 1rem; }
.sum div { display: flex; justify-content: space-between; align-items: baseline; padding: .5rem 0; color: var(--ink-soft); }
.sum div b { color: var(--ink); font-size: 1.125rem; font-weight: 600; }
.sum .total { margin-top: .25rem; border-top: 1.5px solid var(--ink); border-bottom: 4px double var(--ink); padding: .625rem 0; color: var(--ink); font-weight: 700; }
.sum .total b { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; }
.sum .total.neg b, .neg { color: var(--red); }
.pos { color: var(--green); }
.note { margin-top: .75rem; font-size: .875rem; color: var(--ink-soft); }
.note b { color: var(--ink); }
.note.flat { margin-top: 0; }

/* Defter satırları: solda tarih sütunu, kırmızı kenar çizgisi, sağda tutar */
.ledger { background: var(--page); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ledger li + li { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; align-items: stretch; width: 100%; border: 0; background: none; padding: 0; text-align: left; }
a.row { text-decoration: none; color: inherit; }
button.row:hover, a.row:hover { background: var(--wash); }
.row > * { padding: .75rem 0; align-self: center; }
.row .date { align-self: stretch; display: flex; flex-direction: column; justify-content: center; align-items: center; border-right: 1.5px solid var(--margin); font-weight: 700; line-height: 1.15; }
.row .date small { font-weight: 500; font-size: .75rem; color: var(--ink-soft); }
.row .what { padding-inline: .875rem .5rem; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.row .what small { display: block; font-weight: 400; font-size: .8125rem; color: var(--ink-soft); }
.row .amt { padding-right: .875rem; text-align: right; font-weight: 700; white-space: nowrap; }
.row .amt small { display: block; font-weight: 500; font-size: .75rem; color: var(--ink-soft); }
.row .amt .chip { margin-top: .25rem; }
.chip { border: 1px solid var(--blue); color: var(--blue); background: none; border-radius: 999px; padding: .25rem .75rem; font-size: .8125rem; font-weight: 700; }
.chip.done { border-color: transparent; background: var(--wash); color: var(--ink-soft); }
.paused { opacity: .55; }

/* Kategori çubukları ve son 6 ay */
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .125rem .75rem; padding: .5rem 0; }
.bars i { grid-column: 1 / -1; height: .5rem; border-radius: 4px; background: var(--wash); overflow: hidden; }
.bars i::after { content: ""; display: block; height: 100%; width: var(--w); background: var(--blue); border-radius: 4px; }
.bars b { font-weight: 600; }
.months { display: grid; grid-template-columns: repeat(6, 1fr); gap: .25rem; background: var(--page); border: 1px solid var(--line); border-radius: 14px; padding: 1rem .5rem .5rem; }
.months button { border: 0; background: none; padding: 0 0 .375rem; border-radius: 8px; font-size: .8125rem; color: var(--ink-soft); }
.months button[aria-current] { color: var(--ink); font-weight: 700; background: var(--wash); }
.months span { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 5rem; margin-bottom: .375rem; }
.months i { width: .625rem; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--green); }
.months i + i { background: var(--red); }
.legend { display: flex; gap: 1rem; margin-top: .5rem; font-size: .8125rem; color: var(--ink-soft); }
.legend i { display: inline-block; width: .625rem; height: .625rem; border-radius: 2px; background: var(--green); margin-right: .375rem; }
.legend span + span i { background: var(--red); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pair > * { background: var(--page); border: 1px solid var(--line); border-radius: 14px; padding: .75rem 1rem; color: var(--ink-soft); font-size: .875rem; text-decoration: none; }
.pair b { display: block; font-size: 1.125rem; }
.seg { display: flex; background: var(--wash); border-radius: 999px; padding: 3px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span, .seg button { display: block; width: 100%; text-align: center; padding: .5rem .75rem; border: 0; background: none; border-radius: 999px; font-weight: 600; color: var(--ink-soft); }
.seg input:checked + span, .seg button[aria-pressed="true"] { background: var(--page); color: var(--ink); box-shadow: 0 1px 2px rgb(26 37 80 / .18); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); }
.filter { margin-bottom: .75rem; }

/* Formlar: telefonda alttan açılan sayfa, geniş ekranda ortada */
.field { display: block; margin-top: .875rem; }
.field > span { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .25rem; }
.field small { display: block; margin-top: .25rem; font-size: .8125rem; color: var(--ink-soft); }
.field input, .field select { width: 100%; padding: .6875rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--page); min-height: 2.875rem; }
.field input:focus, .field select:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: .625rem; margin-top: 1rem; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--btn); }
.error { margin-top: .875rem; color: var(--red); font-weight: 600; font-size: .9375rem; }
.sheet { border: 0; padding: 0; width: 100%; max-width: 28rem; background: var(--page); color: var(--ink); border-radius: 18px; }
.sheet::backdrop { background: rgb(18 23 43 / .5); }
.sheet form { padding: 1.125rem 1.125rem calc(1.125rem + env(safe-area-inset-bottom)); }
.sheet header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.sheet header h2 { margin: 0; font-size: 1.1875rem; }
.sheet header button { width: 2.25rem; height: 2.25rem; border: 0; border-radius: 50%; background: var(--wash); font-size: 1.25rem; line-height: 1; }
.sheet footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.sheet footer .primary { margin-left: auto; }
@media (max-width: 719px) {
  .sheet { max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; }
}

/* Giriş */
.auth { max-width: 24rem; margin: 0 auto; padding: 3rem 1.25rem; }
.auth .brand { font-size: 1.75rem; margin-bottom: .5rem; }
.auth .brand svg { width: 40px; height: 40px; border-radius: 11px; }
.auth > p { color: var(--ink-soft); margin-bottom: 1.5rem; }
.auth .btn { width: 100%; margin-top: 1.25rem; padding-block: .8125rem; }
.auth .switch { margin-top: 1.25rem; text-align: center; color: var(--ink-soft); }
.auth .switch button { border: 0; background: none; color: var(--blue); font-weight: 700; padding: .25rem; }

.card { background: var(--page); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.125rem; }
.card .btn { margin-top: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tags li { display: flex; align-items: center; gap: .125rem; background: var(--wash); border-radius: 999px; padding: .25rem .25rem .25rem .75rem; font-size: .9375rem; }
.tags button { width: 1.75rem; height: 1.75rem; border: 0; border-radius: 50%; background: none; color: var(--ink-soft); font-size: 1.125rem; line-height: 1; }
.tags button:hover { color: var(--red); }
.inline { display: flex; gap: .5rem; margin-top: .75rem; }
.inline input { flex: 1; min-width: 0; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--page); }
.inline .btn { margin: 0; padding: .5rem 1rem; }
.balance { font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.actions .btn { margin: 0; }
.toast { position: fixed; left: 50%; bottom: calc(5.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--paper); padding: .625rem 1rem; border-radius: 999px; font-weight: 600; font-size: .9375rem; max-width: calc(100vw - 2rem); }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(1rem); opacity: 0; } }
}
