/* ==========================================================================
   KPV_SOFT — arayuz stilleri
   Yon (LTR/RTL) mantiksal ozelliklerle yonetilir: Arapca icin ekstra kod yok.
   ========================================================================== */

:root {
  --bg:            #F4F4F0;
  --surface:       #FFFFFF;
  --surface-2:     #FAFAF7;
  --surface-3:     #EFEFEA;
  --border:        #E3E3DC;
  --border-strong: #CBCBC1;
  --text:          #1A1A17;
  --text-dim:      #6A6A61;
  --text-faint:    #94948B;

  --primary:       #0D5C63;
  --primary-hover: #0A4A50;
  --primary-soft:  #E4F0F0;
  --on-primary:    #FFFFFF;

  --pos:           #14663F;   /* alacak / lehte */
  --pos-soft:      #E3F1E9;
  --neg:           #A63028;   /* borc / aleyhte */
  --neg-soft:      #F8E7E5;
  --warn:          #8A5A08;
  --warn-soft:     #FBF0DA;

  --radius:   8px;
  --radius-s: 5px;
  --shadow:   0 1px 2px rgba(20,20,15,.06), 0 4px 14px rgba(20,20,15,.06);
  --shadow-l: 0 8px 34px rgba(20,20,15,.18);

  --sidebar: 236px;
  --header:  56px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Noto Sans", "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  --bg:            #131519;
  --surface:       #1A1D22;
  --surface-2:     #202429;
  --surface-3:     #272C33;
  --border:        #2C313A;
  --border-strong: #3C424C;
  --text:          #E7E7E2;
  --text-dim:      #9AA0A8;
  --text-faint:    #6E747C;

  --primary:       #45A5AC;
  --primary-hover: #58B8BF;
  --primary-soft:  #14343A;
  --on-primary:    #08282C;

  --pos:           #55BE8B;
  --pos-soft:      #14301F;
  --neg:           #EC8078;
  --neg-soft:      #341A18;
  --warn:          #D7A03A;
  --warn-soft:     #33280F;

  --shadow:   0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --shadow-l: 0 8px 34px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Rakamlar sutunlarda hizali dursun — muhasebede sart */
.num, table td, table th, input[type="number"], .amount, .money {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* Satir ici simgeler icin ortak boyut (grafik SVG'si haric) */
svg:not(.chart) { width: 16px; height: 16px; flex: 0 0 auto; vertical-align: -3px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- Acilis ---------------- */
.boot { display: grid; place-items: center; height: 100vh; }
.boot-spin {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Giris ekrani
   ========================================================================== */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-l); padding: 30px 28px 26px;
}
.login-logo {
  width: 46px; height: 46px; border-radius: 12px; background: var(--primary);
  color: var(--on-primary); display: grid; place-items: center;
  font-size: 22px; font-weight: 700; margin-bottom: 16px;
}
.login-card h1 { font-size: 19px; margin-bottom: 3px; }
.login-card .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.login-langs { display: flex; gap: 6px; margin-bottom: 20px; }
.login-langs button {
  flex: 1; padding: 7px 4px; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius-s); cursor: pointer; font-size: 12.5px; color: var(--text-dim);
}
.login-langs button[aria-pressed="true"] {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600;
}
.login-hint {
  margin-top: 16px; font-size: 12px; color: var(--text-faint);
  border-top: 1px solid var(--border); padding-top: 14px; text-align: center;
}

/* ==========================================================================
   Ana yerlesim
   ========================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  height: var(--header); display: flex; align-items: center; gap: 10px;
  padding-inline: 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--primary);
  color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: 15px;
  flex: 0 0 auto;
}
.brand-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); padding: 12px 10px 5px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-s);
  color: var(--text-dim); font-size: 13.5px; text-decoration: none; margin-bottom: 1px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.nav a.on svg { opacity: 1; }

.side-foot { border-top: 1px solid var(--border); padding: 10px; flex: 0 0 auto; }
.surum { font-size: 10.5px; color: var(--text-faint); text-align: center;
         padding-top: 6px; font-variant-numeric: tabular-nums; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border-radius: var(--radius-s); width: 100%; background: none; border: 0;
  cursor: pointer; text-align: start;
}
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 27px; height: 27px; border-radius: 50%; background: var(--surface-3);
  color: var(--text-dim); display: grid; place-items: center; font-size: 11.5px; font-weight: 650;
  flex: 0 0 auto; border: 1px solid var(--border);
}
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .who b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; font-size: 11px; color: var(--text-faint); }
.user-chip > svg { width: 14px; height: 14px; opacity: .45; }
[dir="rtl"] .user-chip > svg, [dir="rtl"] .nav a > svg.chev { transform: scaleX(-1); }

/* ---------------- Ust cubuk ---------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding-inline: 18px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; flex: 0 0 auto; }
.topbar .grow { flex: 1; }
.page { padding: 20px; max-width: 1500px; width: 100%; }

.menu-btn { display: none; }

/* ---------------- Dil geçişi (üst çubuk) ---------------- */
.lang-switch {
  display: flex; gap: 1px; flex: 0 0 auto;
  background: var(--surface-3); border-radius: var(--radius-s); padding: 2px;
}
.lang-switch button {
  border: 0; background: none; cursor: pointer; padding: 4px 9px;
  border-radius: 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
  color: var(--text-faint); transition: background .12s, color .12s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button.on {
  background: var(--surface); color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* ==========================================================================
   Bilesenler
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h2 { font-size: 14px; }
.card-head .grow { flex: 1; }
/* Baslikta filtre satiri varsa kalan genisligi o alsin (sikisip alt alta dusmesin) */
.card-head > .row { flex: 1 1 auto; justify-content: flex-end; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--radius-s); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px;
  font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--neg); border-color: var(--border-strong); }
.btn-danger:hover:not(:disabled) { background: var(--neg-soft); border-color: var(--neg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-icon { padding: 6px; }
.btn-icon svg { width: 16px; height: 16px; }

.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* Filtre satirlarindaki alanlar tam genislik kaplamasin.
   Form alanlari (.field icindekiler) etkilenmez.
   Tur secicisi de yazilir; aksi halde asagidaki `input[type=...] { width:100% }`
   kurali ayni ozgullukte olup kaynak sirasina gore one gecer. */
.row > input[type="text"], .row > input[type="date"], .row > input[type="search"],
.row > input[type="number"], .row > select,
.card-head > input[type="text"], .card-head > input[type="date"],
.card-head > input[type="search"], .card-head > select { width: auto; }
.row > input[type="date"], .card-head > input[type="date"] { min-width: 140px; }
.row > input[type="search"], .card-head > input[type="search"] { min-width: 180px; }

/* ---------------- Form ---------------- */
.field { margin-bottom: 13px; }
.field > label { display: block; font-size: 12.5px; font-weight: 550; margin-bottom: 5px; color: var(--text-dim); }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.field .opt { font-weight: 400; color: var(--text-faint); }

input[type="text"], input[type="password"], input[type="date"], input[type="number"],
input[type="email"], input[type="search"], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-s); background: var(--surface); color: var(--text);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
input:disabled, select:disabled { background: var(--surface-3); color: var(--text-dim); cursor: not-allowed; }
textarea { min-height: 62px; resize: vertical; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%236A6A61' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
  padding-inline-end: 28px;
}
[dir="rtl"] select { background-position: left 9px center; padding-inline-end: 10px; padding-inline-start: 28px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.money-input { position: relative; }
.money-input .cur {
  position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--text-faint); pointer-events: none;
}
.money-input input { padding-inline-end: 46px; text-align: end; }

/* ---------------- Tablo ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: start; font-weight: 600; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint); padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0; white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
tfoot td {
  padding: 10px 12px; border-top: 2px solid var(--border-strong);
  font-weight: 650; background: var(--surface-2);
}
.t-end { text-align: end; }
.t-center { text-align: center; }
.t-nowrap { white-space: nowrap; }
.t-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-dim { color: var(--text-dim); }
.t-sm { font-size: 12px; }
.t-strong { font-weight: 600; }
.t-mono { font-family: var(--mono); font-size: 12px; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero { color: var(--text-faint); }

.badge {
  display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 11px;
  font-weight: 600; background: var(--surface-3); color: var(--text-dim); white-space: nowrap;
}
.badge.pos { background: var(--pos-soft); color: var(--pos); }
.badge.neg { background: var(--neg-soft); color: var(--neg); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.pri { background: var(--primary-soft); color: var(--primary); }

.empty { padding: 44px 20px; text-align: center; color: var(--text-faint); }
.empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: 10px; }

/* ---------------- Istatistik kartlari ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 13px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 15px; box-shadow: var(--shadow);
}
.stat .lbl { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.stat .lbl svg { width: 14px; height: 14px; opacity: .65; }
.stat .val { font-size: 21px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.stat.accent { border-inline-start: 3px solid var(--primary); }
.stat.accent-pos { border-inline-start: 3px solid var(--pos); }
.stat.accent-neg { border-inline-start: 3px solid var(--neg); }

.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }

/* ---------------- Grafik ---------------- */
.chart { width: 100%; height: 210px; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); padding: 0 16px 14px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-inline-end: 5px; }

/* ---------------- Modal ---------------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15,15,12,.45); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .13s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-l); width: 100%; max-width: 540px;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .15s;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal.wide { max-width: 780px; }
.modal-head {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
}
.modal-head h2 { font-size: 15px; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 13px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 9px; justify-content: flex-end; flex: 0 0 auto; background: var(--surface-2);
  border-radius: 0 0 12px 12px;
}
.form-error {
  background: var(--neg-soft); color: var(--neg); padding: 9px 12px;
  border-radius: var(--radius-s); font-size: 12.5px; margin-bottom: 14px;
}
.form-warn {
  background: var(--warn-soft); color: var(--warn); padding: 9px 12px;
  border-radius: var(--radius-s); font-size: 12.5px; margin-bottom: 14px;
}

/* ---------------- Bildirim ---------------- */
.toasts {
  position: fixed; inset-block-end: 18px; inset-inline-end: 18px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--primary);
  border-radius: var(--radius-s); box-shadow: var(--shadow-l); padding: 10px 14px;
  font-size: 13px; max-width: 380px; animation: slide .18s; pointer-events: auto;
}
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }
.toast.ok  { border-inline-start-color: var(--pos); }
.toast.err { border-inline-start-color: var(--neg); }

/* ---------------- Ac/kapa menu ---------------- */
.pop { position: relative; }
.pop-menu {
  position: absolute; inset-block-end: calc(100% + 6px); inset-inline-start: 0;
  min-width: 190px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-l); padding: 5px; z-index: 60;
}
.pop-menu.down { inset-block-end: auto; inset-block-start: calc(100% + 6px); inset-inline-start: auto; inset-inline-end: 0; }
.pop-menu button, .pop-menu a {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px;
  border: 0; background: none; border-radius: var(--radius-s); cursor: pointer;
  font-size: 13px; text-align: start; color: var(--text); text-decoration: none;
}
.pop-menu button:hover, .pop-menu a:hover { background: var(--surface-3); text-decoration: none; }
.pop-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }
.pop-menu .sect { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); padding: 7px 10px 3px; font-weight: 600; }

/* ---------------- Sekmeler ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  padding: 9px 14px; border: 0; background: none; cursor: pointer; font-size: 13.5px;
  color: var(--text-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------------- Ozet satirlari ---------------- */
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 7px 16px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; font-weight: 500; }

.rep-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 13px; }
.rep-item {
  display: block; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.rep-item:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.rep-item h3 { font-size: 14px; margin-bottom: 5px; color: var(--primary); }
.rep-item p { margin: 0; font-size: 12.5px; color: var(--text-dim); }

/* ---------------- Yazdirma basligi (sadece baskida) ---------------- */
.print-head { display: none; }

@media print {
  @page { margin: 12mm; }
  .sidebar, .topbar, .no-print, .toasts, .btn, .tabs { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .card + .card { margin-top: 10px; }
  .card-head { border-bottom: 1px solid #999; padding: 0 0 6px; }
  .card-body { padding: 0; }
  body { background: #fff; color: #000; font-size: 11px; }
  thead th { background: #eee !important; color: #000; border-bottom: 1px solid #999;
             -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tbody td { padding: 4px 6px; border-bottom: 1px solid #ddd; }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  tr { break-inside: avoid; }
  .print-head { display: block; margin-bottom: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; }
  .print-head h1 { font-size: 15px; margin-bottom: 2px; }
  .print-head .meta { font-size: 10px; color: #444; }
  .stat { border: 1px solid #ccc; box-shadow: none; }
  .pos { color: #0a5c33 !important; }
  .neg { color: #96271f !important; }
  a { color: #000; text-decoration: none; }
}

/* ---------------- Kucuk ekran ---------------- */
@media (max-width: 980px) {
  .cols2, .cols-2-1 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }

  /* Ust cubuk sabit yukseklikte kalirsa dugmeler tasar */
  .topbar {
    height: auto; min-height: var(--header);
    flex-wrap: wrap; padding-block: 8px; padding-inline: 12px; row-gap: 8px;
  }
  .topbar h1 { font-size: 15px; }
  .topbar .grow { flex-basis: 0; }

  /* Kucuk ekranda ozet kartlari ikiserli sigsin */
  .stats { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 9px; }
  .stat { padding: 11px 12px; }
  .stat .val { font-size: 17px; }

  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 90;
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-l);
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 80; }
}
