/* =====================================================================
   Tealer3D — arayüz teması
   Tasarım jetonları (açık/koyu), kabuk (yan menü, üst çubuk, alt sekme),
   bileşenler ve mobil uyum (tablolar telefonda karta dönüşür).
   ===================================================================== */

/* ---------- Jetonlar ---------- */
:root, [data-bs-theme="light"] {
  --accent: #0d9488;
  --accent-600: #0b7f75;
  --accent-soft: rgba(13, 148, 136, .10);
  --accent-ring: rgba(13, 148, 136, .28);

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --line: #e6e8ec;
  --line-strong: #d5d9e0;
  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #8a93a3;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .04);
  --radius: 14px;
  --radius-sm: 10px;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Bootstrap'i temaya bağla */
  --bs-primary: var(--accent);
  --bs-primary-rgb: 13, 148, 136;
  --bs-link-color: var(--accent-600);
  --bs-link-color-rgb: 11, 127, 117;
  --bs-link-hover-color: var(--accent);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-3);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .925rem;
  color-scheme: light;
}
[data-bs-theme="dark"] {
  --accent: #14b8a6;
  --accent-600: #2dd4bf;
  --accent-soft: rgba(20, 184, 166, .14);
  --accent-ring: rgba(20, 184, 166, .35);

  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --line: #262b35;
  --line-strong: #333a47;
  --ink: #e7eaf0;
  --ink-2: #b3bac7;
  --ink-3: #7c8595;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);

  --bs-primary-rgb: 20, 184, 166;
  --bs-link-color-rgb: 45, 212, 191;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-3);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-emphasis-color: #fff;
  color-scheme: dark;
}

/* ---------- Temel ---------- */
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { text-underline-offset: 2px; }
code { color: var(--accent-600); font-size: .85em; }
::selection { background: var(--accent-ring); }
.text-muted { color: var(--ink-3) !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
h1, h2, h3, .h5, .h6 { letter-spacing: -.01em; }

/* ---------- Kabuk ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 1rem; box-shadow: 0 4px 12px var(--accent-ring); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.nav-group { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-weight: 500; margin-bottom: 1px; }
.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; color: var(--ink-3); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-600); }
.nav-item.active i { color: var(--accent); }
.nav-item.nav-pos:not(.active) i { color: var(--accent); }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.2; }
.sidebar-foot .who b { display: block; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who small { color: var(--ink-3); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-600); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }

.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; text-decoration: none; flex: 0 0 auto; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.page { padding: 20px; width: 100%; max-width: 1480px; }

/* Sayfa üstündeki eylem/filtre satırları her zaman sarılsın */
.page > .d-flex, .page > form.d-flex, .card-header.d-flex { flex-wrap: wrap; }
.page > .d-flex { row-gap: 8px; }

/* ---------- Bileşenler ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: 12px 16px; row-gap: 6px; }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-body { padding: 16px; }
.card > .table-responsive:last-child, .card > .table:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.card.card-body { padding: 18px; }

.stat { padding: 16px 18px; height: 100%; }
.stat .label { color: var(--ink-3); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.stat small { font-size: .78rem; }

.btn { border-radius: 10px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-sm { border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-600); --bs-btn-hover-border-color: var(--accent-600); --bs-btn-active-bg: var(--accent-600); --bs-btn-active-border-color: var(--accent-600); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #04211e; --bs-btn-hover-color: #04211e; --bs-btn-active-color: #04211e; }
.btn-outline-primary { --bs-btn-color: var(--accent-600); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-strong); --bs-btn-active-bg: var(--surface-2); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: var(--ink-3); }
.btn-success { --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a; --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; }
.btn-group > .btn.active { background: var(--surface-2); color: var(--ink); border-color: var(--ink-3); }
.btn-check:checked + .btn-outline-primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.form-control, .form-select { border-radius: 10px; border-color: var(--line-strong); background-color: var(--surface); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-label { font-size: .8rem; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.input-group-text { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink-3); }
.form-control-color { padding: 4px; height: calc(1.5em + .75rem + 2px); }

.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--surface-2); --bs-table-border-color: var(--line); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table-sm > :not(caption) > * > * { padding: .45rem .6rem; }
.table td, .table th { vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); border-bottom-color: var(--line); white-space: nowrap; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tfoot th, .table tfoot td { border-top: 1px solid var(--line-strong); }
.table-hover tbody tr[onclick] { cursor: pointer; }

.badge { font-weight: 600; border-radius: 6px; padding: .35em .55em; }
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; }
.list-group-item { background: transparent; border-color: var(--line); }

.color-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); vertical-align: -1px; margin-right: .35rem; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 9px; background: var(--surface-2); }
.thumb-lg { width: 100%; max-height: 280px; object-fit: contain; border-radius: 12px; background: var(--surface-2); }

.viewer { width: 100%; height: 420px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #3a3f4b, #16181d); position: relative; overflow: hidden; touch-action: none; }
.viewer .viewer-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aab; font-size: .9rem; pointer-events: none; text-align: center; padding: 16px; }

.cost-box dt { font-weight: 400; color: var(--ink-3); }
.cost-box dd { text-align: right; font-variant-numeric: tabular-nums; margin-bottom: .3rem; }
.cost-box .total { font-size: 1.2rem; font-weight: 700; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 1.5rem 1rem; border: 2px dashed var(--line-strong); border-radius: 12px; cursor: pointer; text-align: center; color: var(--ink-3); transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

/* Onay penceresi */
.confirm-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 16, .5); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 16px; backdrop-filter: blur(2px); }
.confirm-backdrop.show { display: flex; }
.confirm-box { width: 100%; max-width: 420px; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }

/* Giriş / kurulum */
.auth-page { display: flex; min-height: 100vh; min-height: 100dvh; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 28px !important; border-radius: 18px; box-shadow: var(--shadow); }
.auth-card .brand { margin-bottom: 18px; }
.auth-card .form-control { height: 46px; }
.auth-card .btn { height: 46px; }

/* Kutu içerik matrisi */
.box-matrix { font-size: .85rem; }
.box-matrix th, .box-matrix td { white-space: nowrap; }
.box-matrix input { min-width: 54px; padding: .15rem .25rem; }
.box-matrix .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }

/* Kanal kârlılık tablosu: dar ekranda ikincil sütunlar gizlenir */
@media (max-width: 1199.98px) {
  .ch-table th:nth-child(3), .ch-table td:nth-child(3),
  .ch-table th:nth-child(5), .ch-table td:nth-child(5),
  .ch-table th:nth-child(6), .ch-table td:nth-child(6),
  .ch-table th:nth-child(9), .ch-table td:nth-child(9),
  .ch-table th:nth-child(13), .ch-table td:nth-child(13) { display: none; }
}

/* Panel: kanal bazında net kâr çubukları */
:root { --bar-pos: #0d9488; --bar-neg: #a8a29e; --bar-track: rgba(0,0,0,.04); --bar-zero: rgba(0,0,0,.35); }
[data-bs-theme="dark"] { --bar-pos: #0f9f8f; --bar-neg: #78716c; --bar-track: rgba(255,255,255,.05); --bar-zero: rgba(255,255,255,.4); }
.chbars { display: flex; flex-direction: column; gap: 6px; }
.chbar { display: grid; grid-template-columns: minmax(80px, 28%) 1fr auto; align-items: center; gap: 10px; padding: 5px 6px; margin: 0 -6px; border-radius: 8px; cursor: default; outline: none; }
.chbar:hover, .chbar:focus-visible { background: var(--surface-2); }
.chbar-name { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chbar-track { position: relative; height: 18px; background: var(--bar-track); border-radius: 3px; }
.chbar-fill { position: absolute; top: 0; bottom: 0; background: var(--bar-pos); border-radius: 0 4px 4px 0; }
.chbar-fill.neg { background: var(--bar-neg); border-radius: 4px 0 0 4px; }
.chbar-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--bar-zero); }
.chbar-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 92px; }
.chbar-val small { color: var(--ink-3); margin-left: 6px; font-size: .75rem; }
.chtip { position: fixed; z-index: 1080; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 10px; font-size: .8rem; min-width: 170px; pointer-events: none; }
.chtip div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.chtip div span:first-child { color: var(--ink-3); }

/* Barkod etiketleri (baskı: her zaman siyah-beyaz) */
.labels { display: flex; flex-wrap: wrap; gap: 2mm; }
.blabel { border: 1px dashed #bbb; padding: 1.5mm; text-align: center; background: #fff; color: #000; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.blabel .l-name { font-size: 8pt; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blabel .l-meta { font-size: 7pt; line-height: 1.1; }
.blabel .l-cont { font-size: 6.5pt; white-space: normal; line-height: 1.05; }
.blabel svg { max-width: 100%; height: auto; }

/* ---------- Alt sekme çubuğu (telefon) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; font-weight: 500; color: var(--ink-3); text-decoration: none; background: none; border: 0; padding: 0; }
.tabbar i { font-size: 1.3rem; line-height: 1; }
.tabbar .active { color: var(--accent-600); }
.tabbar .tab-pos i { width: 46px; height: 46px; margin-top: -18px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px var(--accent-ring); font-size: 1.35rem; }
.tabbar .tab-pos { color: var(--ink-2); }

/* ---------- Mobil ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 1050; transform: translateX(-102%); transition: transform .22s ease; box-shadow: none; width: min(86vw, 300px); }
  body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.3); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(10,12,16,.45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }
  .nav-item { padding: 11px 12px; font-size: .95rem; }
  .topbar { padding: 0 10px 0 6px; }
  .page { padding: 14px 12px calc(var(--tabbar-h) + var(--safe-b) + 18px); }
  .position-sticky { position: static !important; }   /* maliyet kutuları telefonda akışta kalsın */
}
@media (max-width: 767.98px) {
  body { --bs-body-font-size: .95rem; }
  .page-title { font-size: 1.05rem; }
  .card { border-radius: 12px; }
  .card.card-body { padding: 14px; }
  .card-body { padding: 14px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 1.3rem; }
  .row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .75rem; }
  /* iOS yakınlaştırmasın, dokunma hedefleri büyüsün */
  .form-control, .form-select, .form-control-sm, .form-select-sm, .input-group-sm > .form-control, .input-group-sm > .form-select { font-size: 16px; min-height: 42px; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .btn-link.p-0, .btn-link.py-0 { min-height: 0; }
  .page > form.d-flex > .form-control, .page > form.d-flex > .form-select { max-width: none !important; flex: 1 1 140px; }
  .viewer { height: 320px; }
  .chbar { grid-template-columns: minmax(70px, 30%) 1fr auto; }
  .chbar-val { min-width: 78px; }

  /* ---- Tablolar telefonda karta dönüşür (app.js etiketleri ekler) ----
     Kart: üstte başlık (+ sağda küçük resim), altında iki sütunlu etiket/değer ızgarası */
  .table-responsive:has(> table.stack) { overflow: visible; }
  table.stack, table.stack > tbody, table.stack > tfoot { display: block; width: 100%; }
  table.stack > thead { display: none; }
  table.stack > tbody { padding: 10px; }
  table.stack > tbody > tr { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow-sm); }
  table.stack > tbody > tr:last-child { margin-bottom: 0; }
  table.stack > tbody > tr > td { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 0 !important; border: 0 !important; text-align: left; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  table.stack > tbody > tr > td::before { content: attr(data-label); color: var(--ink-3); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
  table.stack > tbody > tr > td.num { font-weight: 600; }
  table.stack > tbody > tr > td.stack-title { order: -1; grid-column: 1 / -1; font-weight: 600; font-size: 1rem; padding-bottom: 8px !important; border-bottom: 1px solid var(--line) !important; }
  table.stack > tbody > tr:has(> td.stack-thumb) > td.stack-title { padding-right: 56px !important; min-height: 44px; justify-content: center; }
  table.stack > tbody > tr > td.stack-title::before, table.stack > tbody > tr > td.stack-nolabel::before, table.stack > tbody > tr > td.stack-thumb::before { display: none; }
  table.stack > tbody > tr > td.stack-thumb { position: absolute; top: 10px; right: 12px; }
  table.stack > tbody > tr > td.stack-nolabel { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  table.stack > tbody > tr > td.stack-full { grid-column: 1 / -1; align-items: center; text-align: center; }
  table.stack > tbody > tr > td.stack-input { grid-column: 1 / -1; }
  table.stack > tbody > tr > td.stack-input > * { width: 100%; }
  table.stack > tbody > tr > td:empty { display: none; }
  table.stack > tbody > tr > td .text-nowrap { white-space: normal !important; }
  table.stack > tbody > tr > td > .d-flex, table.stack > tbody > tr > td > form { max-width: 100%; }
  table.stack > tfoot { padding: 0 10px 10px; }
  table.stack > tfoot > tr { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
  table.stack > tfoot > tr > * { display: block; padding: 0 !important; border: 0 !important; font-weight: 600; text-align: right; }
  table.stack > tfoot > tr > *:empty { display: none; }
  .card:has(> .table-responsive > table.stack), .card:has(> table.stack) { background: transparent; border: 0; box-shadow: none; }
  .card:has(> .table-responsive > table.stack) > .card-header, .card:has(> table.stack) > .card-header { border: 0; padding: 4px 2px 0; background: transparent; }
  .card:has(> .table-responsive > table.stack) > .table-responsive > table.stack > tbody,
  .card:has(> table.stack) > table.stack > tbody { padding: 8px 0 0; }
  .card:has(> .table-responsive > table.stack) > .table-responsive > table.stack > tfoot,
  .card:has(> table.stack) > table.stack > tfoot { padding: 8px 0 0; }
  .card:has(> .table-responsive > table.stack) > .card-body, .card:has(> table.stack) > .card-body { padding: 8px 2px; }

  /* İstatistik kartları telefonda ikişer */
  .row > [class*="col-md-"]:has(> .card.stat), .row > [class*="col-lg-"]:has(> .card.stat) { flex: 0 0 50%; max-width: 50%; }
}

/* ---------- Baskı ---------- */
@media print {
  body { background: #fff; }
  .page { padding: 0 !important; max-width: none; }
  .blabel { border-color: transparent; page-break-inside: avoid; }
  .card { border: 0; box-shadow: none; }
}

/* ---------- Panel: hızlı eylemler, KPI simgeleri, satır listeleri ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 767.98px) {
  .quick { display: grid; grid-template-columns: repeat(6, 1fr); }
  .quick .btn { grid-column: span 2; flex-direction: column; gap: 2px; font-size: .78rem; padding: 10px 4px; min-height: 64px; }
  .quick .btn:nth-child(-n+2) { grid-column: span 3; font-size: .9rem; }
  .quick .btn i { font-size: 1.2rem; }
}
.stat { position: relative; }
.stat-ico { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-600); display: flex; align-items: center; justify-content: center; font-size: .95rem; }
.rowlist { display: flex; flex-direction: column; }
.rl-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.rl-item:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.rl-item:hover { background: var(--surface-2); }
.rl-main { flex: 1; min-width: 0; }
.rl-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-sub { font-size: .78rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rl-end small { font-size: .75rem; color: var(--ink-3); }
.rl-empty { padding: 18px 16px; color: var(--ink-3); text-align: center; font-size: .9rem; }
.stat:has(.stat-ico) .label { padding-right: 38px; }

/* Telefonda: düğme grupları yatay kaydırılır; teklif belgesi tablosu sıkışır */
@media (max-width: 767.98px) {
  .page > .d-flex > .btn-group { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .page > .d-flex > .btn-group::-webkit-scrollbar { display: none; }
  .page > .d-flex > .btn-group > .btn { white-space: nowrap; flex: 0 0 auto; }
  .quote-table { font-size: .82rem; }
  .quote-table > :not(caption) > * > * { padding: .45rem .3rem; }
  .quote-table thead th:first-child, .quote-table tbody td:first-child { display: none; }
  .quote-table tfoot td[colspan], .quote-table tfoot th[colspan] { text-align: right; }
  .quote-table td:nth-child(2) { white-space: normal; }
  .quote-table tfoot td[colspan], .quote-table tfoot th[colspan] { white-space: nowrap; }
}
@media print {
  .quote-doc { box-shadow: none; }
  .quote-doc .card-body { padding: 0; }
}
