/* Finans – mobil öncelikli, açık/koyu tema */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --border: #e3e6eb; --text: #16181d;
  --muted: #6b7280; --accent: #3b5bdb; --accent-soft: #e7ecff; --pos: #1f9d55; --neg: #d6336c;
  --warn: #e8890c; --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --sidebar: 236px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1d2129; --border: #2a2f3a; --text: #e8eaef;
    --muted: #9aa1ad; --accent: #7c93ff; --accent-soft: #232a45; --pos: #3ccf7f; --neg: #ff6b9a;
    --warn: #ffb547; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .neutral { color: var(--muted); } .warn { color: var(--warn); }
.right { text-align: right; } .nowrap { white-space: nowrap; } .num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* Yerleşim */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface);
  border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.brand { font-weight: 700; font-size: 1.1rem; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: .9rem; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-size: .93rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.sidebar .grow { flex: 1; }
.main { margin-left: var(--sidebar); padding: 24px 28px 48px; max-width: 1280px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 14px 96px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); background: none; border: 0; padding: 4px 0; font-family: inherit; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav .ico { font-size: 1.2rem; line-height: 1.2; }
  .bottom-nav .fab { width: 52px; height: 52px; margin: -22px auto 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.8rem; line-height: 1; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(59,91,219,.4); }
  h1 { font-size: 1.25rem; }
}

/* Kartlar ve ızgaralar */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid > .card + .card { margin-top: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .g4 { grid-template-columns: 1fr 1fr; gap: 10px; } }
.section { margin-top: 14px; }

.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 2px; word-break: break-word; }
.stat .sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 420px) { .stat { padding: 12px; } .stat .value { font-size: 1.1rem; } }

/* Butonlar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--neg); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* Formlar */
label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], input[type=email], select, textarea, input:not([type]) {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 16px; /* iOS zoom engeli */
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=color] { width: 56px; height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: var(--surface); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }
.field { margin-bottom: 12px; }
.field .help { font-size: .75rem; color: var(--muted); margin-top: 3px; }
.field .errorlist, .errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--neg); font-size: .8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.amount-input { font-size: 1.6rem !important; font-weight: 700; padding: 12px 14px !important; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .9rem; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button, .seg label { padding: 6px 12px; border-radius: 9px; color: var(--muted); font-size: .86rem; font-weight: 500; border: 0; background: none; cursor: pointer; margin: 0; font-family: inherit; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg .on, .seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .on.expense { color: var(--neg); } .seg .on.income { color: var(--pos); } .seg .on.transfer { color: var(--accent); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.filters > div { min-width: 130px; flex: 1; }
.filters label { margin-bottom: 2px; }

/* Listeler / tablolar */
.list { list-style: none; margin: 0; padding: 0; }
.list li, .row-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.row-item .meta { flex: 1; min-width: 0; }
.row-item .title { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.row-item .sub { display: block; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
a.row-item { color: var(--text); }
a.row-item:hover { text-decoration: none; background: var(--surface-2); }
.avatar { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 38px; font-size: 1.05rem; background: var(--surface-2); }
.day-head { font-size: .78rem; color: var(--muted); font-weight: 600; padding: 14px 0 4px; text-transform: uppercase; letter-spacing: .04em; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.sub-row td { font-size: .84rem; color: var(--muted); padding-top: 4px; padding-bottom: 4px; }

.bar { display: block; height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--pos); }
.progress.warn > span { background: var(--warn); } .progress.over > span { background: var(--neg); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.pos { color: var(--pos); } .badge.neg { color: var(--neg); } .badge.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li { padding: 10px 14px; border-radius: 10px; margin-bottom: 6px; background: var(--accent-soft); border: 1px solid var(--border); font-size: .9rem; }
.messages .success { border-left: 4px solid var(--pos); } .messages .error { border-left: 4px solid var(--neg); }
.messages .warning { border-left: 4px solid var(--warn); }

.insight { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.insight:last-child { border-bottom: 0; }
.insight .i { font-size: 1.1rem; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.empty .big { font-size: 2rem; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.donut { height: 230px; }

/* Ürün kalemleri */
.items { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: minmax(0, 2.6fr) 0.8fr 0.9fr 1fr 0.8fr 1fr minmax(0, 1.5fr) 34px; gap: 6px; align-items: start; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.item-row input, .item-row select { padding: 8px 9px; font-size: 15px; }
.item-row .lbl { display: none; }
.item-head { display: grid; grid-template-columns: minmax(0, 2.6fr) 0.8fr 0.9fr 1fr 0.8fr 1fr minmax(0, 1.5fr) 34px; gap: 6px; padding: 0 9px; font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.item-row .del { width: 34px; height: 38px; border: 0; background: none; color: var(--neg); font-size: 1.2rem; cursor: pointer; }
.item-row.deleted { opacity: .4; }
.item-row .errorlist { grid-column: 1 / -1; }
@media (max-width: 860px) {
  .item-head { display: none; }
  .item-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .item-row .lbl { display: block; font-size: .7rem; color: var(--muted); margin-bottom: 1px; }
  .item-row .c-name { grid-column: 1 / 6; grid-row: 1; } .item-row .c-del { grid-column: 6; grid-row: 1; display: flex; justify-content: end; align-items: end; }
  .item-row .c-qty { grid-column: span 2; } .item-row .c-unit { grid-column: span 2; } .item-row .c-price { grid-column: span 2; }
  .item-row .c-disc { grid-column: span 2; } .item-row .c-total { grid-column: span 2; } .item-row .c-cat { grid-column: span 2; }
}
.sum-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 0; font-weight: 600; }
.receipt-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.receipt-thumbs img { width: 92px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.receipt-preview img { max-width: 100%; max-height: 70vh; border-radius: 12px; border: 1px solid var(--border); }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 16px; text-align: center; background: var(--surface-2); cursor: pointer; display: block; }
.dropzone:hover { border-color: var(--accent); }
.dropzone .big { font-size: 2.4rem; }

/* Hızlı giriş paneli */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: none; }
.sheet { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 94vw); max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 18px; padding: 18px; display: none; border: 1px solid var(--border); }
.sheet.open, .sheet-backdrop.open { display: block; }
@media (max-width: 860px) {
  .sheet { top: auto; bottom: 0; left: 0; right: 0; transform: none; width: 100%; border-radius: 20px 20px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet .close { background: none; border: 0; font-size: 1.4rem; color: var(--muted); cursor: pointer; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.action-grid a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); font-size: .8rem; text-align: center; }
.action-grid a:hover { background: var(--surface-2); text-decoration: none; }
.action-grid .ico { font-size: 1.4rem; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); }
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 14px; font-size: .9rem; }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
@media (min-width: 861px) { .mobile-more { display: none; } }
