:root {
  --ink: #1B1D22; --ink2: #4B5058; --muted: #8A8F98; --line: #E7E5E0;
  --bg: #F4F3EF; --card: #FFFFFF; --accent: #FF6A4D; --accent-d: #E5502F;
  --ok: #1F8A4C; --ok-bg: #E6F4EC; --warn: #B7791F; --warn-bg: #FDF3E1;
  --bad: #C8372D; --bad-bg: #FBE9E7; --today: #FF6A4D; --today-bg: #FFEDE8;
  --r: 14px;
  --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);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body { padding-bottom: calc(72px + var(--safe-b)); }
button, input, select, textarea { font: inherit; color: inherit; }
#app { max-width: 640px; margin: 0 auto; }

/* Üst bölüm */
.top { background: var(--ink); color: #fff; padding: calc(14px + var(--safe-t)) 16px 18px; }
.top h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.2px; }
.monthbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.monthbar button { background: rgba(255,255,255,.1); border: 0; color: #fff; width: 38px; height: 38px; border-radius: 10px; font-size: 20px; }
.monthbar .title { text-align: center; flex: 1; }
.monthbar .title small { display: block; color: #A9ADB5; font-size: 12px; margin-top: 1px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: rgba(255,255,255,.07); border-radius: 12px; padding: 10px 10px 9px; }
.stat label { display: block; font-size: 11.5px; color: #A9ADB5; text-transform: uppercase; letter-spacing: .4px; }
.stat b { display: block; font-size: 16px; font-weight: 650; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.rem b { color: var(--accent); }
.progress { height: 6px; background: rgba(255,255,255,.12); border-radius: 6px; margin-top: 12px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.progress-label { font-size: 12px; color: #A9ADB5; margin-top: 6px; display: flex; justify-content: space-between; }

/* Filtre çipleri */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 12px; font-size: 13.5px; color: var(--ink2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* Bölümler ve satırlar */
.section { margin: 14px 12px 0; }
.section-h { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 6px; font-size: 13px; color: var(--ink2); font-weight: 600; }
.section-h .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.section-h small { font-weight: 500; color: var(--muted); }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }
.row:first-child { border-top: 0; }
.row:active { background: #FAF9F6; }
.row .ic { width: 26px; height: 26px; border-radius: 50%; flex: none; border: 2px solid var(--line); display: grid; place-items: center; }
.row.paid .ic { background: var(--ok); border-color: var(--ok); }
.row.paid .ic::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.row.overdue .ic { border-color: var(--bad); }
.row.today .ic { border-color: var(--today); }
.row.soon .ic { border-color: var(--warn); }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.paid .name { color: var(--ink2); }
.row .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; flex: none; }
.row .amt { font-weight: 650; font-variant-numeric: tabular-nums; }
.row .amt.na { color: var(--muted); font-weight: 500; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px; margin-top: 3px; }
.pill.paid { background: var(--ok-bg); color: var(--ok); }
.pill.overdue { background: var(--bad-bg); color: var(--bad); }
.pill.today { background: var(--today-bg); color: var(--accent-d); }
.pill.soon { background: var(--warn-bg); color: var(--warn); }
.pill.later { background: #F1F0EC; color: var(--muted); }
.pill.off { background: #F1F0EC; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.fab { position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(84px + var(--safe-b)); width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; border: 0; font-size: 28px; line-height: 1; box-shadow: 0 6px 18px rgba(255,106,77,.4); z-index: 5; }

/* Alt sekmeler */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: var(--safe-b); z-index: 10; }
.tabs a { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ink); }
.tabs a.on svg { stroke: var(--accent); }

/* Alt sayfa (sheet) */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15,16,20,.45); animation: fade .15s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; background: var(--bg); border-radius: 18px 18px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 8px 16px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
.sheet .grab { width: 38px; height: 5px; background: #D4D2CC; border-radius: 3px; margin: 2px auto 10px; }
.sheet h2 { margin: 0 0 2px; font-size: 19px; }
.sheet .meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: .6 } to { transform: none; opacity: 1 } }
@keyframes fade { from { opacity: 0 } }

/* Formlar */
.form { background: var(--card); border-radius: var(--r); padding: 4px 14px; margin-bottom: 12px; }
.f { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 48px; }
.f:first-child { border-top: 0; }
.f > label { color: var(--ink2); flex: none; font-size: 14.5px; }
.f input, .f select { border: 0; background: transparent; text-align: right; min-width: 0; flex: 1; padding: 4px 0; font-size: 16px; outline: none; }
.f input[type=date], .f input[type=month], .f input[type=time] { -webkit-appearance: none; appearance: none; text-align: right; }
.f select { direction: rtl; }
.f select option { direction: ltr; }
.f.col { flex-direction: column; align-items: stretch; gap: 6px; }
.f textarea { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 60px; resize: vertical; font-size: 16px; outline: none; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #D9D7D1; border-radius: 28px; transition: .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.seg { display: flex; background: #ECEAE5; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 4px; border-radius: 8px; font-size: 13.5px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.form-title { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 16px 4px 6px; font-weight: 600; }

.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font-weight: 650; font-size: 16px; background: var(--ink); color: #fff; margin-top: 8px; }
.btn.accent { background: var(--accent); }
.btn.ok { background: var(--ok); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.danger { background: var(--card); color: var(--bad); }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 8px; } .btn-row .btn { flex: 1; }

.paidbox { background: var(--ok-bg); color: var(--ok); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-weight: 600; }
.paidbox small { display: block; font-weight: 500; color: #3E7A57; margin-top: 2px; }

/* Sayfa başlığı (diğer sekmeler) */
.page-top { background: var(--ink); color: #fff; padding: calc(14px + var(--safe-t)) 16px 16px; display: flex; align-items: center; justify-content: space-between; }
.page-top h1 { margin: 0; font-size: 20px; }
.page-top button { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 14px; }
.filters { display: flex; gap: 8px; padding: 12px 12px 0; }
.filters select { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 10px; font-size: 15px; }
.month-h { display: flex; justify-content: space-between; padding: 0 6px 6px; font-size: 13px; font-weight: 600; color: var(--ink2); }

.info { background: var(--card); border-radius: var(--r); padding: 12px 14px; font-size: 14px; color: var(--ink2); margin-bottom: 10px; }
.info.warn { background: var(--warn-bg); color: #7A5310; }
.color-in { width: 34px; height: 30px; border: 0; padding: 0; background: none; flex: none !important; }

/* Giriş */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 380px; margin: 0 auto; }
.login .logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 14px; display: block; }
.login h1 { text-align: center; margin: 0 0 22px; font-size: 22px; }
.login input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 14px; font-size: 16px; outline: none; }
.login .err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 8px 2px 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

/* --- Ana sayfa: gün, takvim, liste --- */
.sec-title { font-size: 13px; font-weight: 700; color: var(--ink2); text-transform: uppercase; letter-spacing: .4px; padding: 6px 6px 8px; }
.dayhead { display: flex; align-items: center; gap: 8px; padding: 2px 0 10px; }
.dayhead button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 22px; color: var(--ink); flex: none; }
.dayhead .t { flex: 1; text-align: center; }
.dayhead .t b { display: block; font-size: 18px; }
.dayhead .t small { color: var(--muted); font-size: 13px; }
.dayhead .t u { color: var(--accent-d); text-decoration: none; font-weight: 600; cursor: pointer; }
.sub-h { font-size: 13px; font-weight: 600; padding: 14px 6px 6px; color: var(--ink2); }
.sub-h.bad { color: var(--bad); }
.none { padding: 16px 14px; color: var(--muted); font-size: 14px; text-align: center; }
.gdot, .dot-l { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot-l { width: 12px; height: 12px; margin: 0; flex: none; }
.chev { color: var(--muted); font-size: 22px; flex: none; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); padding: 8px 6px 10px; gap: 2px; }
.cal-h { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 0 6px; }
.cal-d { border: 0; background: none; border-radius: 10px; padding: 5px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 46px; cursor: pointer; }
.cal-d .n { width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 50%; font-size: 14.5px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.cal-d.has .n { color: var(--ink); font-weight: 650; }
.cal-d.is-today .n { background: var(--accent); color: #fff; font-weight: 700; }
.cal-d.sel { background: #F1F0EC; box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-d .dots { display: flex; gap: 2px; height: 6px; align-items: center; }
.cal-d .dots b { font-size: 9px; color: var(--muted); line-height: 6px; }
.cal-d i, .legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: #C9C6BF; }
.cal-d i.paid, .legend i.paid { background: var(--ok); }
.cal-d i.overdue, .legend i.overdue { background: var(--bad); }
.cal-d i.today, .legend i.today { background: var(--accent); }
.cal-d i.soon { background: var(--warn); }
.legend { display: flex; justify-content: center; gap: 14px; font-size: 12px; color: var(--muted); padding: 8px 0 0; }
.legend i { margin-right: 5px; vertical-align: 0; }
.agenda-h { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink2); padding: 12px 6px 6px; }
.agenda-h:first-of-type { padding-top: 0; }
.agenda-h.today { color: var(--accent-d); }

/* Türkçe tarih / ay seçiciler */
.dpick { position: relative; flex: 1; text-align: right; font-size: 16px; min-height: 26px; }
.dpick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.mpick { display: flex; gap: 6px; justify-content: flex-end; flex: 1; }
.f .mpick select { flex: none; width: auto; direction: ltr; text-align: right; }

/* Kalemler: grup → kategori → kalem */
.link-h { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.section-h .link-h { font-weight: 600; font-size: 13px; color: var(--ink2); }
.section-h .link-h small { font-weight: 500; color: var(--muted); }
.mini { border: 1px solid var(--line); background: var(--card); color: var(--ink2); border-radius: 8px; padding: 4px 9px; font-size: 12.5px; font-weight: 600; }
.cat-h { display: flex; justify-content: space-between; align-items: center; background: #F7F6F2; padding: 8px 14px; border-top: 1px solid var(--line); }
.cat-h:first-child { border-top: 0; }
.cat-h .link-h { font-weight: 650; font-size: 14px; color: var(--ink); }
.none.sm { padding: 10px 14px; font-size: 13px; text-align: left; }
.none a { color: var(--accent-d); font-weight: 600; }
