:root {
  --bg: #0d0f12;
  --bg-2: #13161b;
  --card: #171a20;
  --card-2: #1d2128;
  --line: #262b33;
  --line-2: #323844;
  --text: #eef0f3;
  --muted: #8c94a1;
  --dim: #5d6573;
  --gold: #e3ad4f;
  --gold-2: #f3cf86;
  --green: #4fd18b;
  --green-bg: rgba(79, 209, 139, .12);
  --red: #ff6b6b;
  --red-bg: rgba(255, 107, 107, .12);
  --amber: #f0b44c;
  --radius: 18px;
  --radius-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.4 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- giriş ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 60% at 50% 0%, rgba(227, 173, 79, .14), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.brand-big { text-align: center; margin-bottom: 18px; }
.brand-big h1 { margin: 12px 0 2px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.brand-big p { margin: 0; color: var(--muted); }
.coin { width: 64px; height: 64px; filter: drop-shadow(0 8px 24px rgba(227, 173, 79, .35)); }
.coin.sm { width: 26px; height: 26px; filter: none; }

/* ---------- form ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; font-size: 16px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field input[type="date"], .field input[type="month"] { -webkit-appearance: none; appearance: none; color-scheme: dark; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error { min-height: 1em; margin: 0; color: var(--red); font-size: 13px; }

.btn { min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card-2); border: 1px solid var(--line-2); transition: transform .12s var(--ease), opacity .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1b1408; border: 0; }
.btn.danger { background: var(--red-bg); color: var(--red); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- üst bar ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: rgba(13, 15, 18, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; min-height: 40px; }
.month-switch { display: flex; align-items: center; justify-content: center; gap: 2px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; font-size: 22px; line-height: 1; color: var(--muted); }
.icon-btn:active { background: var(--card); }
.month-label { font-weight: 700; font-size: 15px; padding: 6px 8px; border-radius: 10px; white-space: nowrap; }
.rate-chip { font-size: 12px; font-weight: 700; color: var(--gold-2); background: rgba(227, 173, 79, .1);
  padding: 6px 9px; border-radius: 999px; white-space: nowrap; }
.rate-chip.stale { color: var(--amber); background: rgba(240, 180, 76, .1); }

/* ---------- içerik ---------- */
.view { flex: 1; padding: 14px 14px calc(100px + var(--safe-b)); max-width: 640px; width: 100%; margin: 0 auto;
  animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 2px 10px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.section-title button { text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--gold); font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 10px; }

.hero { position: relative; overflow: hidden; padding: 20px 18px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(227, 173, 79, .14), transparent 55%), var(--card); }
.hero .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.hero .sub { color: var(--muted); font-weight: 700; margin-top: 2px; }
.pos { color: var(--green); } .neg { color: var(--red); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { padding: 14px; display: block; width: 100%; text-align: left; }
.card + .card.stat { margin-top: 0; }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .val { font-size: 19px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.stat .usd { color: var(--muted); font-size: 13px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.g { background: var(--green); } .dot.r { background: var(--red); } .dot.y { background: var(--gold); }

.alert { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--red-bg); border: 1px solid rgba(255, 107, 107, .25); color: #ffd0d0; text-align: left; width: 100%; margin-bottom: 10px; }
.alert b { color: var(--red); }
.alert .chev { margin-left: auto; color: var(--red); font-size: 20px; }

/* toplam şeridi */
.totalbar { display: flex; justify-content: space-between; align-items: flex-end; }
.totalbar .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.totalbar .big { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.totalbar .usd { color: var(--muted); font-weight: 700; text-align: right; }

/* liste */
.day { margin: 18px 4px 6px; font-size: 12px; color: var(--dim); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 14px; text-align: left; border-top: 1px solid var(--line); transition: background .12s; }
.item:first-child { border-top: 0; }
.item:active { background: var(--card-2); }
.badge { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.badge.g { background: var(--green-bg); color: var(--green); }
.badge.r { background: var(--red-bg); color: var(--red); }
.item .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .a { text-align: right; font-weight: 800; white-space: nowrap; }
.item .a small { display: block; color: var(--muted); font-weight: 700; font-size: 12.5px; }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .e-ico { font-size: 34px; opacity: .5; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* kategoriler */
.bars { display: grid; gap: 12px; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; }
.bar-row .top span:last-child { color: var(--muted); }
.bar { height: 6px; background: var(--bg-2); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), #ff9b8a); border-radius: 99px; transition: width .6s var(--ease); }

/* yıllık tablo */
.ytable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ytable th { text-align: right; font-size: 11px; color: var(--dim); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 0 6px 8px; }
.ytable th:first-child, .ytable td:first-child { text-align: left; }
.ytable td { text-align: right; padding: 9px 6px; border-top: 1px solid var(--line); font-weight: 700; white-space: nowrap; }
.ytable td small { display: block; color: var(--dim); font-size: 11px; }
.ytable tr.cur td { background: rgba(227, 173, 79, .06); }
.ytable tr.zero td { color: var(--dim); }
.ytable tr[data-month] { cursor: pointer; }
.ytable tfoot td { border-top: 1px solid var(--line-2); font-weight: 800; }
.scroll-x { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* kira */
.tenant { padding: 14px 16px; }
.tenant .head { display: flex; align-items: flex-start; gap: 10px; }
.tenant .who { flex: 1; min-width: 0; text-align: left; }
.tenant .who .t { font-weight: 800; font-size: 16px; }
.tenant .who .m { color: var(--muted); font-size: 13px; }
.tenant .amt { text-align: right; font-weight: 800; }
.tenant .amt small { display: block; color: var(--muted); font-size: 12.5px; }
.tenant .foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.tenant .foot .btn { min-height: 42px; flex: 1; }
.tenant .foot .btn.ghost { flex: none; padding: 0 10px; color: var(--gold); }
.pill { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.wait { background: var(--card-2); color: var(--muted); }
.pill.late { background: var(--red-bg); color: var(--red); }
.tenant.late { border-color: rgba(255, 107, 107, .35); }
.paid-info { font-size: 13px; color: var(--muted); flex: 1; }
.rent-progress { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.rent-progress .t { font-weight: 700; }
.rent-progress .m { font-size: 13px; color: var(--muted); }
.rent-progress .m.neg { color: var(--red); }
.note { color: var(--muted); font-size: 13px; margin: 10px 4px 0; }
.ring { width: 46px; height: 46px; flex: none; }
.ring circle { fill: none; stroke-width: 5; }
.ring .bg { stroke: var(--bg-2); }
.ring .fg { stroke: var(--green); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .6s var(--ease); }

/* ---------- alt menü ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: rgba(16, 18, 22, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, .05);
}
.tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--dim); font-size: 11px; font-weight: 700; transition: color .15s; }
.tab svg { width: 24px; height: 24px; fill: currentColor; }
.tab.active { color: var(--gold-2); }
.fab { justify-self: center; width: 56px; height: 56px; margin-top: -22px; border-radius: 20px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(227, 173, 79, .35), inset 0 1px 0 rgba(255, 255, 255, .4); transition: transform .15s var(--ease); }
.fab svg { width: 28px; height: 28px; fill: #1b1408; }
.fab:active { transform: scale(.94); }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2); border-radius: 24px 24px 0 0; border-top: 1px solid var(--line-2);
  padding: 8px 18px calc(18px + var(--safe-b)); transform: translateY(100%); transition: transform .3s var(--ease);
  max-width: 640px; margin: 0 auto;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-handle { width: 40px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 4px auto 12px; }
.sheet h2 { margin: 2px 0 16px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.sheet form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.field { grid-template-columns: minmax(0, 1fr); }
.sheet { overflow-x: hidden; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { min-height: 40px; border-radius: 10px; font-weight: 800; color: var(--muted); transition: background .15s, color .15s; }
.seg button.on.g { background: var(--green-bg); color: var(--green); }
.seg button.on.r { background: var(--red-bg); color: var(--red); }
.seg button.on.y { background: rgba(227, 173, 79, .14); color: var(--gold-2); }

.amount-box { background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 12px; transition: border-color .15s; }
.amount-box:focus-within { border-color: var(--gold); }
.amount-line { display: flex; align-items: center; gap: 10px; }
.amount-line input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 32px; font-weight: 800; letter-spacing: -.02em; padding: 0; }
.amount-line input::placeholder { color: var(--dim); }
.cur-toggle { display: flex; background: var(--card); border-radius: 12px; padding: 3px; flex: none; }
.cur-toggle button { width: 40px; height: 36px; border-radius: 9px; font-weight: 800; font-size: 17px; color: var(--muted); }
.cur-toggle button.on { background: var(--gold); color: #1b1408; }
.conv { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--muted); font-weight: 700; }
.conv .eq { color: var(--text); font-size: 16px; }
.conv button { color: var(--gold); font-weight: 700; font-size: 13px; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 14px; color: var(--muted); }
.chip.on { background: rgba(227, 173, 79, .14); border-color: rgba(227, 173, 79, .5); color: var(--gold-2); }
.chip.add { border-style: dashed; }
.chip .x { margin-left: 6px; color: var(--red); }

.who-grid { display: grid; gap: 10px; }
.who-grid .btn { min-height: 56px; font-size: 17px; }
.hint { color: var(--muted); font-size: 13.5px; margin: -8px 0 4px; }
.settings-list { display: grid; gap: 8px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; width: 100%; text-align: left; font-weight: 700; }
.settings-row span:last-child { color: var(--muted); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #f1f2f4; color: #111; font-weight: 700; font-size: 14px; padding: 11px 16px; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: opacity .2s, transform .25s var(--ease); max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }

.skeleton { height: 80px; border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 50%, var(--card) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
.skeleton + .skeleton { margin-top: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (min-width: 700px) {
  .view { padding-top: 24px; }
  .sheet { border-radius: 24px; bottom: 24px; border: 1px solid var(--line-2); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
