:root {
  --bg: #f4f6f8; --card: #fff; --text: #17202a; --muted: #667085; --line: #e4e7ec;
  --brand: #0f766e; --brand-soft: #e6f4f2; --red: #c62828; --red-soft: #fdecec;
  --green: #18794e; --green-soft: #e7f6ee; --amber: #b54708; --amber-soft: #fef4e6;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418; --card: #182027; --text: #e7ecef; --muted: #98a2b3; --line: #2a343d;
    --brand: #2bb3a3; --brand-soft: #123a36; --red: #f07070; --red-soft: #3a1c1c;
    --green: #4cc38a; --green-soft: #15302a; --amber: #f0a35e; --amber-soft: #3a2a17;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.splash { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* yerleşim */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--brand); color: #fff; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 17px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who { font-size: 13px; opacity: .85; white-space: nowrap; }
.topbar .back { background: none; border: 0; color: #fff; font-size: 22px; padding: 0 6px 0 0; cursor: pointer; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 96px; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; max-width: 140px; text-align: center; text-decoration: none; color: var(--muted); font-size: 11.5px; padding: 8px 2px 7px; position: relative; }
.nav a .ic { display: block; font-size: 21px; line-height: 1.2; }
.nav a.on { color: var(--brand); font-weight: 600; }
.nav a .dot { position: absolute; top: 5px; left: 50%; margin-left: 9px; background: var(--red); color: #fff; border-radius: 9px; font-size: 10px; min-width: 16px; padding: 0 4px; line-height: 16px; }

/* kartlar */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); }
.card h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .sp { flex: 1; }
.page-title { display: flex; align-items: center; gap: 8px; margin: 2px 0 14px; flex-wrap: wrap; }
.page-title h2 { font-size: 20px; margin: 0; flex: 1; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .l { font-size: 12.5px; color: var(--muted); }
.stats.tight .v { font-size: 15px; }
.stat .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero { border-radius: var(--radius); padding: 20px; margin-bottom: 14px; color: #fff; background: linear-gradient(135deg, #0f766e, #115e59); }
.hero.debt { background: linear-gradient(135deg, #b42318, #912018); }
.hero .l { opacity: .85; font-size: 14px; }
.hero .v { font-size: 34px; font-weight: 800; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.hero .s { font-size: 13.5px; opacity: .9; }
.iban { margin-top: 12px; background: rgba(255,255,255,.14); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.iban code { font-size: 14px; letter-spacing: .3px; word-break: break-all; flex: 1; font-family: inherit; font-weight: 600; }
.iban button { background: #fff; color: #0f766e; border: 0; border-radius: 8px; padding: 6px 10px; font-weight: 600; cursor: pointer; }

/* listeler */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.list > li.click { cursor: pointer; }
.list .main { flex: 1; min-width: 0; }
.list .t { font-weight: 600; overflow-wrap: anywhere; }
.list .s { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.list .amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.list .amt small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; flex: none; background: var(--brand-soft); color: var(--brand); font-size: 14px; }
.pos { color: var(--green); } .neg { color: var(--red); } .muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; font-size: 14.5px; }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; vertical-align: middle; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.gray { background: var(--line); color: var(--muted); }

/* düğmeler */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 14.5px; text-decoration: none; color: var(--text); min-height: 40px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--red); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .actions { grid-template-columns: repeat(4, 1fr); } }
.actions .btn { min-height: 54px; flex-direction: column; gap: 2px; font-size: 13.5px; }
.actions .btn .ic { font-size: 20px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 14px; cursor: pointer; white-space: nowrap; font-size: 14px; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 4px 6px; color: var(--muted); border-radius: 8px; }

/* formlar */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
label.f small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input:not([type=checkbox]), select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); min-height: 44px; font-size: 16px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label.check { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-size: 15px; }
label.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px; padding-bottom: max(18px, env(safe-area-inset-bottom)); animation: up .18s ease-out; }
@media (min-width: 600px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.modal h3 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; }
.modal h3 span { flex: 1; }
.modal .foot { display: flex; gap: 10px; margin-top: 6px; }
.modal .foot .btn { flex: 1; }
.err { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); background: #17202a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14.5px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* giriş */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.login .box { width: 100%; max-width: 380px; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 10px; display: block; }
.login h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.login p.sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14.5px; }

/* grafik ve çubuklar */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 8px; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars .b { width: 42%; max-width: 14px; border-radius: 3px 3px 0 0; min-height: 1px; }
.bars .b.in { background: var(--brand); } .bars .b.out { background: #e5484d; }
.bars .lbl { font-size: 10.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.meter { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin-top: 5px; }
.meter > div { height: 100%; background: #e5484d; border-radius: 6px; }
.cat-row { padding: 7px 0; }
.cat-row .h { display: flex; justify-content: space-between; font-size: 14px; gap: 10px; }
.ann { border-left: 4px solid var(--brand); }
.ann.imp { border-left-color: var(--red); }
.ann .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.ann .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.pw-box { font-size: 30px; font-weight: 800; letter-spacing: 4px; text-align: center; background: var(--brand-soft); color: var(--brand); border-radius: 12px; padding: 14px; margin: 8px 0 14px; }
.menu-list a { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 600; }
.menu-list a:first-child { border-top: 0; }
.menu-list a .ic { font-size: 22px; width: 30px; text-align: center; }
.menu-list a .d { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.search { margin-bottom: 12px; }

/* ek modüller */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.opt { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.opt.mine { font-weight: 600; }
.alert { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--card); }
.menu-list .sec { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 14px 2px 2px; font-weight: 700; }
.menu-list .sec:first-child { padding-top: 0; }
.menu-list .sec + a { border-top: 0; }
.thumb { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--bg); margin-top: 8px; }

/* yazdırma görünümü (makbuz, ekstre, tutanak, rapor) */
#print-root { display: none; }
body.printing #app, body.printing #modal-root, body.printing #toast { display: none; }
body.printing { background: #fff; }
body.printing #print-root { display: block; background: #fff; color: #111; min-height: 100vh; }
.pr-bar { position: sticky; top: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: #0f766e; z-index: 5; }
.pr-bar .btn { color: #17202a; background: #fff; border-color: #fff; }
.pr-bar .btn.primary { background: #134e4a; color: #fff; border-color: #134e4a; }
.pr-hint { color: #e6f4f2; font-size: 12.5px; }
.doc { max-width: 820px; margin: 0 auto; padding: 24px 18px 40px; font: 13.5px/1.55 "Segoe UI", Arial, sans-serif; color: #111; background: #fff; color-scheme: light; }
.doc h1 { font-size: 18px; text-align: center; margin: 18px 0 4px; letter-spacing: .3px; }
.doc h2 { font-size: 14.5px; margin: 18px 0 6px; }
.doc .c { text-align: center; color: #444; margin-top: 0; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; border-bottom: 2px solid #0f766e; padding-bottom: 8px; }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.doc th, .doc td { border: 1px solid #9aa4ae; padding: 5px 7px; text-align: left; vertical-align: top; }
.doc th { background: #f1f5f4; }
.doc .r, .doc th.r { text-align: right; white-space: nowrap; }
.doc .muted { color: #555; font-size: 12px; }
.doc .signs { display: flex; justify-content: space-around; gap: 20px; margin-top: 46px; text-align: center; flex-wrap: wrap; }
.doc .signs > div { min-width: 160px; }
.doc .signs .line { border-bottom: 1px solid #111; height: 40px; margin-bottom: 4px; }
@media print {
  .pr-bar { display: none !important; }
  .doc { max-width: none; padding: 0; }
  @page { margin: 14mm; }
}
