/* ==========================================================================
   NetStore — Tasarım sistemi "AURORA"
   Stok, Satış, Müşteri, Borç & Tahsilat Yönetimi

   Üç katmanlı yüzey dili:
     0 — zemin: yavaşça sürüklenen aurora ışık lekeleri + ince ızgara dokusu
     1 — cam paneller: bulanık arka plan, gradyan saç teli kenarlık
     2 — vurgu: mor→fuşya gradyan, yalnızca anlam taşıyan yerde

   Renk bütçesi değişmedi: ~%80 nötr yüzey / ~%20 anlamlı vurgu. Gradyanlar
   veriyi değil kabuğu boyar; grafik ve durum renkleri hâlâ tek başına anlamlı.
   Tüm hareketler `prefers-reduced-motion` altında kapanır (bkz. 17. bölüm).
   ========================================================================== */

/* Yazı tipleri depoda tutuluyor — internetsiz açılışta da doğru çizilsin.
   Bkz. css/fonts.css ve fonts/ klasörü. */
@import url('fonts.css');

/* --------------------------------------------------------------------------
   1. Tokenlar
   -------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Yüzeyler — zemin biraz daha derin, paneller hafif mavi-mor kayışlı */
  --bg:            #070B16;
  --bg-deep:       #04070F;
  --surface:       #0F1626;
  --surface-2:     #151D31;
  --surface-3:     #1C2540;
  --surface-hover: #212C4A;

  /* Cam paneller — arkasındaki aurora sızsın diye yarı saydam */
  --glass:         rgba(15, 22, 38, 0.72);
  --glass-strong:  rgba(11, 16, 30, 0.95);
  --glass-soft:    rgba(28, 37, 64, 0.55);

  /* Kenarlıklar — ince, düşük kontrast */
  --border:        rgba(148, 163, 184, 0.11);
  --border-strong: rgba(148, 163, 184, 0.20);
  --border-accent: rgba(139, 92, 246, 0.45);

  /* Vurgu */
  --accent:        #8B5CF6;
  --accent-2:      #D946EF;
  --accent-3:      #22D3EE;
  --accent-hover:  #A78BFA;
  --accent-soft:   rgba(139, 92, 246, 0.15);
  --accent-glow:   rgba(139, 92, 246, 0.45);

  /* Gradyanlar — kabuk ve vurgu yüzeyleri */
  --g-accent:  linear-gradient(135deg, #7C3AED 0%, #9333EA 45%, #C026D3 100%);
  --g-accent-l:linear-gradient(135deg, #A78BFA 0%, #C084FC 45%, #E879F9 100%);
  --g-success: linear-gradient(135deg, #34D399 0%, #059669 100%);
  --g-danger:  linear-gradient(135deg, #FB7185 0%, #E11D48 100%);
  --g-warning: linear-gradient(135deg, #FBBF24 0%, #F97316 100%);
  --g-info:    linear-gradient(135deg, #60A5FA 0%, #2563EB 100%);
  --g-hairline:linear-gradient(135deg,
                 rgba(255,255,255,0.14) 0%,
                 rgba(255,255,255,0.03) 38%,
                 rgba(139,92,246,0.00) 62%,
                 rgba(217,70,239,0.16) 100%);
  --g-sheen:   linear-gradient(100deg,
                 transparent 20%,
                 rgba(255,255,255,0.10) 42%,
                 rgba(255,255,255,0.16) 50%,
                 rgba(255,255,255,0.10) 58%,
                 transparent 80%);

  /* Anlam renkleri */
  --success:       #22C55E;
  --success-soft:  rgba(34, 197, 94, 0.14);
  --danger:        #F43F5E;
  --danger-soft:   rgba(244, 63, 94, 0.14);
  --warning:       #F59E0B;
  --warning-soft:  rgba(245, 158, 11, 0.14);
  --info:          #3B82F6;
  --info-soft:     rgba(59, 130, 246, 0.14);

  /* Grafik serileri — CVD + kontrast doğrulanmış */
  --series-1:      #A78BFA;
  --series-2:      #34D399;
  /* Radyal ölçek yayının açık ucu. Koyu zeminde soluk nane okunur;
     aydınlıkta beyaz kartın üzerinde kaybolduğu için orada koyulaşır. */
  --gauge-to:      #A7F3D0;
  --grid:          rgba(148, 163, 184, 0.12);
  --axis-ink:      #64748B;
  --chart-surface: #0F1626;

  /* Yazı */
  --text:          #F8FAFC;
  --text-2:        #94A3B8;
  /* Üçüncül yazı yalnızca süsleme değil: mobilde tablo etiketleri, kart alt
     başlıkları ve tarih satırları bu tonu kullanıyor. #64748B yüzeyde 3.79:1
     kalıyordu; WCAG AA'nın 4.5:1 eşiğini geçecek kadar açıldı (5.20:1). */
  --text-3:        #7A8BA3;

  /* Biçim */
  --r-2xl: 26px;
  --r-xl: 20px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;

  /* Gölgeler — siyah değil, lacivere çalan; vurgu gölgesi renkli */
  --shadow-sm: 0 1px 2px rgba(3, 7, 18, 0.45);
  --shadow:    0 8px 24px -8px rgba(3, 7, 18, 0.65);
  --shadow-lg: 0 26px 54px -22px rgba(3, 7, 18, 0.85);
  --shadow-glow: 0 18px 46px -20px var(--accent-glow);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.32, 0.48, 1);
  --t: 180ms var(--ease);
  --t-slow: 420ms var(--ease-out);

  --sidebar-w: 264px;
  --topbar-h: 70px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   2. Temel
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04';
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.018em; line-height: 1.25; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { flex: none; }

img { max-width: 100%; }

::selection { background: rgba(139, 92, 246, 0.35); color: #fff; }

/* Para ve sayılar hizalı dursun */
.num, .money, td.num, th.num { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(139,92,246,0.45), rgba(217,70,239,0.32));
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(167,139,250,0.75), rgba(232,121,249,0.55));
  background-clip: padding-box;
}

:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   3. Zemin — aurora ışık lekeleri
   Sabit konumlu, tıklanamaz, `.app`'in altında durur. Lekeler çok yavaş
   (30-45 sn) sürüklenir; hareket fark edilmez ama ekran "ölü" durmaz.
   -------------------------------------------------------------------------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(76, 29, 149, 0.30), transparent 60%),
    var(--bg);
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.40;
  will-change: transform;
}
.aurora-blob.a1 {
  width: 46vw; height: 46vw; min-width: 380px; min-height: 380px;
  top: -14vw; inset-inline-start: -8vw;
  background: radial-gradient(circle at 35% 35%, #7C3AED, transparent 70%);
  animation: drift-a 38s var(--ease) infinite alternate;
}
.aurora-blob.a2 {
  width: 40vw; height: 40vw; min-width: 320px; min-height: 320px;
  top: 8vh; inset-inline-end: -10vw;
  background: radial-gradient(circle at 60% 40%, #C026D3, transparent 70%);
  opacity: 0.30;
  animation: drift-b 45s var(--ease) infinite alternate;
}
.aurora-blob.a3 {
  width: 52vw; height: 38vw; min-width: 340px; min-height: 260px;
  bottom: -16vh; inset-inline-start: 22vw;
  background: radial-gradient(circle at 50% 50%, #0891B2, transparent 72%);
  opacity: 0.22;
  animation: drift-c 52s var(--ease) infinite alternate;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(7vw, 6vh, 0) scale(1.14); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to   { transform: translate3d(-6vw, 9vh, 0) scale(0.92); }
}
@keyframes drift-c {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(9vw, -7vh, 0) scale(1.18); }
}

/* İnce ızgara dokusu — panellerin "havada durduğu" hissini verir */
.aurora-grid {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(130% 100% at 50% 0%, #000 12%, transparent 72%);
  -webkit-mask-image: radial-gradient(130% 100% at 50% 0%, #000 12%, transparent 72%);
}

/* --------------------------------------------------------------------------
   4. Kabuk (shell)
   -------------------------------------------------------------------------- */

/* `position: relative` gerekli: aksi hâlde içerik, konumlandırılmış
   `.aurora` katmanının ALTINDA boyanır. Ama `z-index` VERİLMEZ — bir yığın
   bağlamı kurmak, kenar çubuğunun z-index 60'ını bu bağlamın içine hapseder
   ve dışarıdaki `.scrim` (55) çekmecenin ÜSTÜNE boyanırdı: mobil menü
   tıklanamaz hâle geliyordu. */
.app { min-height: 100vh; position: relative; }

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
}
/* kenarda ince ışık teli */
.sidebar::after {
  content: '';
  position: absolute; inset-block: 0; inset-inline-end: -1px;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--accent-glow) 22%, rgba(217,70,239,0.30) 58%, transparent);
  opacity: 0.6;
  pointer-events: none;
}

.sidebar-head {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

/* Marka amblemi. Kendi beyaz zemini ve kırmızı hâlesi olan yuvarlak bir
   rozet olduğu için altına ayrıca bir kutu çizilmiyor — yalnızca yumuşak
   bir hâle ve üstüne gelince hafif bir dönüş. */
.brand-mark {
  width: 36px; height: 36px;
  flex: none;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(139, 92, 246, 0.55));
  transition: transform 500ms var(--spring);
}
.sidebar-head:hover .brand-mark { transform: rotate(-8deg) scale(1.08); }

.brand-name {
  font-size: 16px; font-weight: 750; letter-spacing: -0.025em;
  background: linear-gradient(120deg, #fff 10%, #C4B5FD 55%, #F0ABFC 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.brand-sub {
  font-size: 10.5px; color: var(--text-3); letter-spacing: 0.10em;
  text-transform: uppercase; font-weight: 700;
}

/* çekmece kapatma düğmesi: yalnızca mobil/tablette görünür.
   .icon-btn sonra tanımlandığı için burada özgüllük gerekiyor. */
.sidebar .nav-close { display: none; margin-inline-start: auto; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 10px 7px;
}
.sidebar-nav > .nav-group-label:first-child { padding-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: color var(--t), transform 220ms var(--ease-out), background var(--t);
  position: relative;
  isolation: isolate;
}
.nav-item svg { width: 17px; height: 17px; opacity: 0.82; transition: transform 300ms var(--spring), opacity var(--t); }

/* hover zemini ayrı katmanda: aktif gradyanla çakışmasın */
.nav-item::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--surface-3);
  opacity: 0;
  transition: opacity var(--t);
  z-index: -1;
}
.nav-item:hover { color: var(--text); }
.nav-item:hover::before { opacity: 1; }
.nav-item:hover svg { opacity: 1; transform: scale(1.12); }

.nav-item.active {
  background: var(--g-accent);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 10px 24px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.nav-item.active::before { opacity: 0; }
.nav-item.active svg { opacity: 1; }
/* aktif satırın dış kenarındaki ışık çubuğu */
.nav-item.active::after {
  content: '';
  position: absolute;
  inset-inline-start: -12px;
  top: 50%;
  width: 3px; height: 20px;
  border-radius: 99px;
  background: linear-gradient(180deg, #C4B5FD, #E879F9);
  box-shadow: 0 0 12px 1px var(--accent-glow);
  transform: translateY(-50%);
  animation: rail-in 320ms var(--spring) both;
}
@keyframes rail-in {
  from { height: 0; opacity: 0; }
  to   { height: 20px; opacity: 1; }
}

.nav-badge {
  margin-inline-start: auto;
  font-size: 11px;
  font-weight: 750;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  display: grid; place-items: center;
  background: var(--danger-soft);
  color: var(--danger);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.25), 0 0 12px -2px rgba(244, 63, 94, 0.55);
}
.nav-item.active .nav-badge {
  background: rgba(255,255,255,0.22); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28);
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); flex: none; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  background: var(--glass-soft);
  border: 1px solid var(--border);
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.user-chip:hover {
  background: var(--surface-3);
  border-color: var(--border-accent);
  transform: translateY(-1px);
}
.user-chip .chip-caret { margin-inline-start: auto; color: var(--text-3); display: grid; transition: transform var(--t); }
.user-chip .chip-caret svg { width: 15px; height: 15px; }
.user-chip:hover .chip-caret { transform: translateX(2px); color: var(--accent-hover); }

.avatar {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--g-accent);
  color: #fff;
  font-weight: 750; font-size: 12.5px;
  box-shadow: 0 6px 16px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.22);
  flex: none;
}
.user-chip .name { font-size: 13px; font-weight: 650; }
.user-chip .role {
  font-size: 11.5px; color: var(--text-3);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- ana alan --- */

.main { margin-inline-start: var(--sidebar-w); min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
/* alt kenardaki ışık teli */
.topbar::after {
  content: '';
  position: absolute; inset-inline: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow) 30%, rgba(217,70,239,0.34) 62%, transparent);
  opacity: 0.7;
  pointer-events: none;
}

.hamburger { display: none; }

/* Başlık daralabilsin: dar ekranda dil seçici + ikonlar sabit genişlikte
   kaldığı için taşmayı başlık üstlenir, kesip üç nokta koyar. */
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1,
.topbar-title .crumb {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-title h1 { font-size: 18.5px; letter-spacing: -0.026em; }
.topbar-title .crumb {
  font-size: 11.5px; color: var(--text-3); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.topbar-actions { margin-inline-start: auto; flex: none; display: flex; align-items: center; gap: 9px; }

.search {
  position: relative;
  width: 272px;
}
.search-lens {
  position: absolute; inset-inline-start: 12px; top: 20px; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; display: block;
  transition: color var(--t);
}
.search-lens svg { width: 15px; height: 15px; }
.search:focus-within .search-lens { color: var(--accent-hover); }
.search input {
  width: 100%;
  height: 40px;
  padding-inline: 36px 12px;
  border-radius: var(--r-md);
  background: var(--glass-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.search input::placeholder { color: var(--text-3); }
.search input:hover { border-color: var(--border-strong); }
.search input:focus {
  outline: none;
  border-color: var(--border-accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14);
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--glass-soft);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: background var(--t), color var(--t), border-color var(--t),
              transform 220ms var(--spring), box-shadow var(--t);
  position: relative;
  overflow: hidden;
}
.icon-btn svg { width: 17px; height: 17px; transition: transform 300ms var(--spring); }
.icon-btn:hover {
  background: var(--surface-3); color: var(--text);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -10px var(--accent-glow);
}
.icon-btn:hover svg { transform: scale(1.12); }
.icon-btn:active { transform: translateY(0) scale(0.96); }

.icon-btn .dot {
  position: absolute; top: 9px; inset-inline-end: 10px;
  width: 7px; height: 7px; border-radius: 99px;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface), 0 0 10px 0 rgba(244, 63, 94, 0.9);
}
/* bildirim noktası nefes alır */
.icon-btn .dot::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 99px;
  border: 1px solid rgba(244, 63, 94, 0.55);
  animation: ping 2.4s var(--ease-out) infinite;
}
@keyframes ping {
  0%   { transform: scale(0.7); opacity: 0.9; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* üst barın alt kenarındaki okuma göstergesi */
.scroll-bar {
  position: absolute;
  inset-inline: 0; bottom: -1px;
  height: 2px;
  background: var(--g-accent-l);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
  z-index: 1;
  pointer-events: none;
}
html[dir='rtl'] .scroll-bar { transform-origin: right center; }

.page { padding: 28px; max-width: 1600px; }

/* --- mobil örtü ---

   Örtüde `backdrop-filter` YOK: Chromium'da bir örtünün backdrop-filter'ı
   kendi üstündeki çekmeceyi de bulanıklaştırıyor (örtü bir "backdrop root"
   kuruyor), yani menü yazıları okunmaz hâle geliyordu. Bulanıklık bu yüzden
   arkada kalan içeriğin kendisine uygulanır — çekmece net kalır. */
.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: radial-gradient(120% 90% at 50% 0%, rgba(30, 12, 60, 0.62), rgba(2, 6, 16, 0.80));
  opacity: 0; visibility: hidden;
  transition: opacity 240ms var(--ease), visibility 240ms var(--ease);
}
body.nav-open .scrim { opacity: 1; visibility: visible; }

/* Çekmece açıkken arkadaki sayfa geri çekilir. `.main` kenar çubuğunun
   kardeşi olduğu için menü bundan etkilenmez. */
.main { transition: filter 260ms var(--ease); }
body.nav-open .main { filter: blur(3px) saturate(0.85); }

@media (prefers-reduced-motion: reduce) {
  body.nav-open .main { filter: none; }
}

/* --------------------------------------------------------------------------
   5. Kartlar
   Saç teli gradyan kenarlık (padding-box / border-box hilesi), üstte ince
   ışık çizgisi ve imleci izleyen yumuşak bir hâle.
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--g-hairline) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: box-shadow var(--t-slow), transform var(--t-slow);
  isolation: isolate;
}

/* imleç hâlesi — motion.js `--mx/--my` yazar */
.card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%),
              rgba(139, 92, 246, 0.10), transparent 60%);
  opacity: 0;
  transition: opacity var(--t-slow);
  pointer-events: none;
  z-index: 0;
}
.card:hover::before { opacity: 1; }
.card:hover { box-shadow: var(--shadow); }
.card > * { position: relative; z-index: 1; }

.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; letter-spacing: -0.02em; }
.card-head .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-head .head-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.card-body { padding: 20px; }
.card-body.tight { padding: 14px 20px; }
.card-body.flush { padding: 0; }

/* Varsayılan tek sütun minmax(0,1fr): grid öğeleri içeriklerinden (örn. geniş
   tabloların min-width'i) daha dar olabilsin, aksi hâlde sayfa yatayda taşar. */
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; }
.grid-detail { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); align-items: start; }

/* --------------------------------------------------------------------------
   6. İstatistik kartı (KPI)
   -------------------------------------------------------------------------- */

.stat {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--g-hairline) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  padding: 19px 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 320ms var(--ease-out), box-shadow 320ms var(--ease-out);
  isolation: isolate;
}

/* üstteki ince renk çubuğu — üstüne gelince kartı boydan boya geçer */
.stat::before {
  content: '';
  position: absolute; top: 0; inset-inline-start: 0;
  height: 2px; width: 42px;
  background: var(--g-accent-l);
  border-radius: 99px;
  opacity: 0.65;
  transition: width 520ms var(--ease-out), opacity var(--t);
}
/* imleç hâlesi */
.stat::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%),
              rgba(139, 92, 246, 0.13), transparent 62%);
  opacity: 0;
  transition: opacity var(--t-slow);
  pointer-events: none;
  z-index: -1;
}
.stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 44px -24px rgba(3, 7, 18, 0.9), 0 0 0 1px var(--border-accent);
}
.stat:hover::before { width: 100%; opacity: 1; }
.stat:hover::after { opacity: 1; }

/* renk ailesine göre üst çubuk */
.stat.tone-success::before { background: var(--g-success); }
.stat.tone-danger::before  { background: var(--g-danger); }
.stat.tone-warning::before { background: var(--g-warning); }
.stat.tone-info::before    { background: var(--g-info); }

.stat-top { display: flex; align-items: flex-start; gap: 13px; }

.stat-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: transform 380ms var(--spring), box-shadow var(--t);
}
.stat-icon svg { width: 19px; height: 19px; }
.stat:hover .stat-icon { transform: translateY(-1px) rotate(-5deg) scale(1.06); }

.stat-icon.accent  { background: var(--g-accent);  color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2); }
.stat-icon.success { background: var(--g-success); color: #04240F; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(16,185,129,0.6), inset 0 1px 0 rgba(255,255,255,0.22); }
.stat-icon.danger  { background: var(--g-danger);  color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(225,29,72,0.6), inset 0 1px 0 rgba(255,255,255,0.22); }
.stat-icon.warning { background: var(--g-warning); color: #291701; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(249,115,22,0.6), inset 0 1px 0 rgba(255,255,255,0.28); }
.stat-icon.info    { background: var(--g-info);    color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(37,99,235,0.6), inset 0 1px 0 rgba(255,255,255,0.22); }

.stat-label {
  font-size: 12.5px; font-weight: 650; color: var(--text-2);
  letter-spacing: -0.005em;
}
.stat-value {
  font-size: 29px; font-weight: 750; letter-spacing: -0.038em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  line-height: 1.12;
  background: linear-gradient(175deg, #FFFFFF 30%, #B7C0D4 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.stat-desc { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.stat-foot {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-top: auto;
}

.trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px 3px 7px;
  border-radius: 99px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.trend svg { width: 13px; height: 13px; }
.trend.up   { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,0.28); }
.trend.down { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(244,63,94,0.28); }
.trend.warn { background: var(--warning-soft); color: var(--warning); border-color: rgba(245,158,11,0.28); }
.trend.flat { background: var(--surface-3);    color: var(--text-2);  border-color: var(--border); }

.spark { flex: none; opacity: 0.95; overflow: visible; }

/* mini oransal çubuk (grafik yerine oran gösterimi) */
.meter { width: 100%; }
.meter-track {
  height: 7px; border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  display: flex;
  gap: 2px; /* yüzey boşluğu ile ayır */
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
}
.meter-fill {
  height: 100%; border-radius: 99px;
  position: relative;
  overflow: hidden;
  transition: width 900ms var(--ease-out);
  box-shadow: 0 0 12px -2px currentColor;
}
/* dolgunun üstünde yavaşça geçen parıltı */
.meter-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--g-sheen);
  transform: translateX(-100%);
  animation: sheen 3.4s var(--ease) infinite;
}
@keyframes sheen {
  0%   { transform: translateX(-100%); }
  55%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.meter-legend {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--text-3); margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   6b. Özet şeridi — dört küçük ölçü, tek satırda
   -------------------------------------------------------------------------- */

.pulse-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.pulse-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  min-width: 0;
  border-inline-start: 1px solid var(--border);
  transition: background var(--t);
}
.pulse-cell:first-child { border-inline-start: 0; }
.pulse-cell:hover { background: var(--surface-2); }

.pulse-ico {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; flex: none;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.20);
  transition: transform 340ms var(--spring);
}
.pulse-ico svg { width: 17px; height: 17px; }
.pulse-cell:hover .pulse-ico { transform: translateY(-2px) scale(1.06); }

.pulse-ico.accent  { background: var(--g-accent);  box-shadow: 0 8px 18px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.20); }
.pulse-ico.success { background: var(--g-success); color: #04240F; box-shadow: 0 8px 18px -10px rgba(16,185,129,0.6), inset 0 1px 0 rgba(255,255,255,0.24); }
.pulse-ico.warning { background: var(--g-warning); color: #291701; box-shadow: 0 8px 18px -10px rgba(249,115,22,0.6), inset 0 1px 0 rgba(255,255,255,0.28); }
.pulse-ico.info    { background: var(--g-info);    box-shadow: 0 8px 18px -10px rgba(37,99,235,0.6), inset 0 1px 0 rgba(255,255,255,0.20); }
.pulse-ico.danger  { background: var(--g-danger);  box-shadow: 0 8px 18px -10px rgba(225,29,72,0.6), inset 0 1px 0 rgba(255,255,255,0.22); }

.pulse-val {
  font-size: 19px; font-weight: 750; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pulse-lab { font-size: 11.5px; color: var(--text-3); font-weight: 600; margin-top: 1px; }

@media (max-width: 1024px) { .pulse-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pulse-cell:nth-child(3) { border-inline-start: 0; }
  .pulse-cell:nth-child(n+3) { border-top: 1px solid var(--border); } }
@media (max-width: 460px) { .pulse-strip { grid-template-columns: minmax(0, 1fr); }
  .pulse-cell { border-inline-start: 0; }
  .pulse-cell + .pulse-cell { border-top: 1px solid var(--border); } }

/* radyal ölçeğin ortalandığı yuva */
.gauge-host { display: flex; justify-content: center; padding: 4px 0 2px; }

/* --------------------------------------------------------------------------
   7. Butonlar
   -------------------------------------------------------------------------- */

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 13px; font-weight: 650;
  white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t),
              transform 200ms var(--spring), box-shadow var(--t), filter var(--t);
  isolation: isolate;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.97); }

/* üstüne gelince soldan sağa geçen ışık */
.btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--g-sheen);
  transform: translateX(-120%);
  transition: transform 720ms var(--ease-out);
  pointer-events: none;
}
.btn:hover::before { transform: translateX(120%); }

/* tıklama dalgası — motion.js ekler */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
  transform: scale(0);
  animation: ripple 560ms var(--ease-out);
  pointer-events: none;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.btn-primary {
  background: var(--g-accent); color: #fff;
  box-shadow: 0 10px 24px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.20);
}
.btn-primary:hover { filter: brightness(1.10); box-shadow: 0 16px 32px -14px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.24); }

.btn-ghost {
  background: var(--glass-soft); color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-accent); }

.btn-success { background: var(--g-success); color: #04240F; box-shadow: 0 10px 22px -12px rgba(16,185,129,0.7); }
.btn-success:hover { filter: brightness(1.08); }

.btn-info { background: var(--g-info); color: #fff; box-shadow: 0 10px 22px -12px rgba(37,99,235,0.7); }
.btn-info:hover { filter: brightness(1.10); }

.btn-warning { background: var(--g-warning); color: #291701; box-shadow: 0 10px 22px -12px rgba(249,115,22,0.7); }
.btn-warning:hover { filter: brightness(1.08); }

.btn-danger {
  background: var(--danger-soft); color: var(--danger);
  border-color: rgba(244, 63, 94, 0.34);
}
.btn-danger:hover { background: var(--g-danger); color: #fff; border-color: transparent; box-shadow: 0 10px 22px -12px rgba(225,29,72,0.7); }

.btn-sm { height: 33px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }

.btn-icon { width: 33px; padding: 0; }

/* WhatsApp/e-posta gibi kanal butonları */
.btn-whatsapp { background: var(--g-success); color: #04240F; box-shadow: 0 10px 22px -12px rgba(16,185,129,0.7); }
.btn-whatsapp:hover { filter: brightness(1.08); }

/* --------------------------------------------------------------------------
   8. Rozetler / durumlar
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }
.badge .bullet {
  width: 6px; height: 6px; border-radius: 99px;
  background: currentColor; flex: none;
  box-shadow: 0 0 8px 0 currentColor;
}

.badge-success { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,0.28); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(244,63,94,0.28); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(245,158,11,0.28); }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: rgba(59,130,246,0.28); }
.badge-accent  { background: var(--accent-soft);  color: var(--accent-hover); border-color: var(--border-accent); }
.badge-muted   { background: var(--surface-3);    color: var(--text-2);  border-color: var(--border); }

/* gecikmiş kayıt nefes alsın — listede göze çarpsın */
.badge-danger .bullet { animation: pulse-dot 1.9s var(--ease) infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1;   box-shadow: 0 0 8px 0 currentColor; }
  50%      { opacity: 0.45; box-shadow: 0 0 2px 0 currentColor; }
}

.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-muted   { color: var(--text-2); }
.text-dim     { color: var(--text-3); }

/* --------------------------------------------------------------------------
   9. Tablolar
   -------------------------------------------------------------------------- */

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 620px;
}
table.data.wide { min-width: 940px; }
/* Az sütunlu tablolar iki sütunlu ızgarada da tam görünsün: 620px'lik
   varsayılan alt sınır onları gereksiz yere yatay kaydırmaya sokuyordu. */
table.data.narrow { min-width: 380px; }

/* tarih, tutar ve fatura no satır sarmasın */
table.data .num,
table.data .invoice-no,
table.data .badge { white-space: nowrap; }

table.data thead th {
  text-align: start;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data thead th:first-child { padding-inline-start: 20px; }
table.data thead th:last-child  { padding-inline-end: 20px; }

table.data tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
table.data tbody td:first-child { padding-inline-start: 20px; position: relative; }
table.data tbody td:last-child  { padding-inline-end: 20px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background var(--t); }
table.data tbody tr:hover { background: var(--surface-2); }

/* üstüne gelen satırın başında ince vurgu çubuğu */
table.data tbody td:first-child::before {
  content: '';
  position: absolute;
  inset-block: 6px;
  inset-inline-start: 0;
  width: 2px;
  border-radius: 99px;
  background: var(--g-accent-l);
  opacity: 0;
  transform: scaleY(0.3);
  transition: opacity var(--t), transform 260ms var(--ease-out);
}
table.data tbody tr:hover td:first-child::before { opacity: 1; transform: scaleY(1); }

table.data td.strong, table.data td .strong { color: var(--text); font-weight: 650; }
table.data .right, table.data th.right { text-align: end; }
table.data .actions { display: flex; gap: 6px; justify-content: flex-end; }

.cell-main { display: flex; align-items: center; gap: 11px; }
.cell-title { color: var(--text); font-weight: 650; font-size: 13px; }
.cell-sub { display: block; font-size: 11.5px; color: var(--text-3); }

a.cell-main .cell-title { transition: color var(--t); }
a.cell-main:hover .cell-title { color: var(--accent-hover); }
a.cell-main .avatar { transition: transform 300ms var(--spring); }
a.cell-main:hover .avatar { transform: scale(1.08) rotate(-4deg); }

.thumb {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; flex: none;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: transform 300ms var(--spring), color var(--t), border-color var(--t);
}
.thumb svg { width: 16px; height: 16px; }
tr:hover .thumb { transform: scale(1.06); color: var(--accent-hover); border-color: var(--border-accent); }

.invoice-no {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   10. Zaman çizelgesi — tahsilat hareketleri
   -------------------------------------------------------------------------- */

.timeline { position: relative; padding: 4px 0 4px 0; }

.tl-item {
  display: flex; gap: 14px;
  padding: 14px 20px;
  position: relative;
  transition: background var(--t);
}
.tl-item:hover { background: var(--surface-2); }

.tl-rail { position: relative; flex: none; width: 30px; display: flex; justify-content: center; }
.tl-rail::before {
  content: '';
  position: absolute;
  top: 32px; bottom: -14px; left: 50%;
  width: 1px;
  background: linear-gradient(180deg, var(--border-accent), var(--border) 70%);
  transform: translateX(-50%);
}
.tl-item:last-child .tl-rail::before { display: none; }

.tl-dot {
  width: 30px; height: 30px; border-radius: 99px;
  display: grid; place-items: center;
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  z-index: 1;
  transition: transform 320ms var(--spring), box-shadow var(--t);
}
.tl-dot svg { width: 14px; height: 14px; }
.tl-item:hover .tl-dot { transform: scale(1.12); }
.tl-dot.success { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,0.32); box-shadow: 0 0 16px -4px rgba(34,197,94,0.55); }
.tl-dot.danger  { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(244,63,94,0.32); box-shadow: 0 0 16px -4px rgba(244,63,94,0.55); }
.tl-dot.warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(245,158,11,0.32); box-shadow: 0 0 16px -4px rgba(245,158,11,0.55); }
.tl-dot.accent  { background: var(--accent-soft);  color: var(--accent-hover); border-color: var(--border-accent); box-shadow: 0 0 16px -4px var(--accent-glow); }

.tl-body { flex: 1; min-width: 0; }
.tl-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-title { font-size: 13.5px; font-weight: 650; color: var(--text); }
.tl-amount { margin-inline-start: auto; font-size: 14.5px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* --------------------------------------------------------------------------
   11. Müşteri detayı
   -------------------------------------------------------------------------- */

.profile-card { text-align: center; padding: 26px 20px 20px; }

.profile-avatar {
  position: relative;
  width: 76px; height: 76px; border-radius: 24px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  background: var(--g-accent);
  color: #fff;
  font-size: 25px; font-weight: 750;
  box-shadow: 0 16px 34px -16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.24);
}
/* yavaşça dönen ışık halkası */
.profile-avatar::before {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 28px;
  background: conic-gradient(from 0deg, transparent 0deg, var(--accent-hover) 70deg, var(--accent-2) 140deg, transparent 210deg, transparent 360deg);
  opacity: 0.55;
  z-index: -1;
  animation: spin 7s linear infinite;
}
.profile-name { font-size: 18px; font-weight: 750; letter-spacing: -0.024em; }
.profile-tag { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.profile-badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 13px; }

.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  transition: background var(--t);
}
.info-row:hover { background: var(--surface-2); }
.info-row svg { width: 15px; height: 15px; color: var(--accent-hover); margin-top: 2px; flex: none; opacity: 0.8; }
.info-label { font-size: 10.5px; color: var(--text-3); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.info-value { font-size: 13.5px; color: var(--text); font-weight: 500; word-break: break-word; }

/* borç özeti — sadece anlamlı yerde renk */
.balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.balance-cell { background: var(--surface-2); padding: 16px; transition: background var(--t); }
.balance-cell:hover { background: var(--surface-3); }
.balance-label { font-size: 11.5px; color: var(--text-3); font-weight: 650; }
.balance-value {
  font-size: 21px; font-weight: 750; margin-top: 4px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.032em;
}
.balance-note { font-size: 11px; color: var(--text-3); margin-top: 3px; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-row .btn { flex: 1 1 auto; min-width: 132px; }

/* --------------------------------------------------------------------------
   12. Grafikler
   -------------------------------------------------------------------------- */

.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

/* çizgi grafiği açılışta kendini çizer (motion.js sınıfı ekler) */
.chart-wrap.draw .lc-line {
  stroke-dasharray: var(--len, 1200);
  stroke-dashoffset: var(--len, 1200);
  animation: draw-line 1200ms var(--ease-out) forwards;
}
@keyframes draw-line { to { stroke-dashoffset: 0; } }

.chart-wrap.draw .lc-area { animation: fade-up 900ms var(--ease-out) both; }
.chart-wrap.draw .lc-end  { animation: pop-in 460ms var(--spring) 900ms both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in  { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }

/* son noktanın etrafındaki nabız */
.lc-pulse { animation: mark-pulse 2.4s var(--ease-out) infinite; transform-origin: center; transform-box: fill-box; }
@keyframes mark-pulse {
  0%   { r: 4; opacity: 0.55; }
  70%  { r: 13; opacity: 0; }
  100% { r: 13; opacity: 0; }
}

.chart-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-2);
}
.legend-key { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; box-shadow: 0 0 8px -1px currentColor; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--glass-strong);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  min-width: 142px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms var(--ease), transform 140ms var(--ease-out);
  z-index: 5;
}
.chart-tip.on { opacity: 1; transform: none; }
.chart-tip .tip-title { font-weight: 750; color: var(--text); margin-bottom: 7px; font-size: 12px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.chart-tip .tip-row .legend-swatch { width: 8px; height: 8px; }
.chart-tip .tip-name { color: var(--text-2); }
.chart-tip .tip-val { margin-left: auto; font-weight: 750; color: var(--text); font-variant-numeric: tabular-nums; }

/* yaşlandırma açıklaması geniş kartta yatayda dağılır */
.hbar.aging-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.aging-legend .hbar-row { grid-template-columns: auto 1fr; row-gap: 2px; }
.aging-legend .hbar-val { grid-column: 1 / -1; font-size: 15px; font-weight: 750; color: var(--text); }
@media (max-width: 860px) { .hbar.aging-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .hbar.aging-legend { grid-template-columns: minmax(0, 1fr); } }

/* yığılmış çubuk (yaşlandırma) */
.stack-bar {
  display: flex; gap: 2px; height: 14px;
  border-radius: 5px; overflow: hidden;
  background: var(--surface-3);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.stack-seg {
  height: 100%; border-radius: 3px;
  width: 0;
  transition: width 900ms var(--ease-out);
  position: relative;
}
.stack-seg::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), transparent 60%);
}

/* yatay kategori çubukları */
.hbar { display: flex; flex-direction: column; gap: 16px; }
.hbar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.hbar-name { font-size: 13px; color: var(--text); font-weight: 550; }
.hbar-val { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hbar-track {
  grid-column: 1 / -1; height: 8px; border-radius: 99px;
  background: var(--surface-3); overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
}
.hbar-fill {
  /* `display: block` şart: dolgu bir <span> ve kapsayıcısı ızgara/esnek kutu
     değil, dolayısıyla satır içi kalıyordu — satır içi kutular genişlik ve
     yükseklik almadığı için çubuklar hiç çizilmiyordu. */
  display: block;
  height: 100%; border-radius: 99px;
  background: var(--series-1);
  width: 0;
  transition: width 900ms var(--ease-out);
  box-shadow: 0 0 12px -2px currentColor;
  position: relative;
  overflow: hidden;
}
.hbar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.28), transparent 65%);
}

/* radyal ölçek — tahsilat oranı */
.gauge { position: relative; display: grid; place-items: center; }
.gauge svg { display: block; overflow: visible; }
.gauge-arc {
  transition: stroke-dashoffset 1200ms var(--ease-out);
  filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.55));
}
.gauge-center {
  position: absolute;
  text-align: center;
  line-height: 1.1;
}
.gauge-pct {
  font-size: 25px; font-weight: 750; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(170deg, #FFFFFF, #86EFAC);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.gauge-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); margin-top: 2px; }
html[dir='rtl'] .gauge-cap { letter-spacing: normal; }

/* --------------------------------------------------------------------------
   13. Yardımcı bileşenler
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

.seg {
  display: inline-flex;
  background: var(--glass-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.seg button {
  height: 31px; padding: 0 13px;
  border: 0; background: transparent;
  border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 650; color: var(--text-3);
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
.seg button svg { width: 14px; height: 14px; }
.seg button:hover { color: var(--text); background: var(--surface-3); }
.seg button.on {
  background: var(--g-accent); color: #fff;
  box-shadow: 0 6px 16px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}

.page-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h2 {
  font-size: 24px; letter-spacing: -0.032em; font-weight: 750;
  background: linear-gradient(120deg, #FFFFFF 20%, #CBD5E1 70%, #C4B5FD 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.page-head .sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.page-head .head-actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.empty {
  padding: 50px 20px; text-align: center; color: var(--text-3);
}
.empty svg {
  width: 34px; height: 34px; margin-bottom: 12px; opacity: 0.45;
  animation: float 3.6s var(--ease) infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.empty p { font-size: 13px; }
/* çizimli boş sahne (js/art.js) — eski simge kuralını ezer */
.empty svg.empty-art {
  width: 208px; height: 143px; max-width: 100%; margin: 0 auto 8px; opacity: 1;
  display: block; animation: float 4.2s var(--ease) infinite;
}
.spark { transform-box: fill-box; transform-origin: center; animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.55) rotate(0deg); }
  50%      { opacity: 1;    transform: scale(1)    rotate(45deg); }
}

/* kategori küçük resmi: zemin çizimin kendisinde */
.thumb.art { background: none; border: 0; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.5); }
.thumb.art svg { width: 36px; height: 36px; display: block; border-radius: 11px; }
tr:hover .thumb.art, .card-row:hover .thumb.art { transform: translateY(-2px) rotate(-4deg) scale(1.06); }
.trend-cell .spark { display: block; }

/* dashboard karşılama şeridi */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 8px 18px 8px 26px; margin-bottom: 16px;
  border-radius: var(--r-2xl);
  background:
    linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
    var(--g-hairline) border-box;
  border: 1px solid transparent;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: ''; position: absolute; inset: -60% auto auto -8%;
  width: 46%; height: 220%;
  background: radial-gradient(closest-side, var(--accent-glow), transparent 70%);
  opacity: 0.55; pointer-events: none;
}
.hero-text { position: relative; min-width: 0; padding: 10px 0; }
.hero-greet { font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
html[dir='rtl'] .hero-greet { letter-spacing: normal; }
.hero-title { font-size: 23px; font-weight: 800; letter-spacing: -0.015em; margin: 5px 0 6px; color: var(--text); }
html[dir='rtl'] .hero-title { letter-spacing: normal; }
.hero-sub { font-size: 13.5px; color: var(--text-2); margin: 0; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero-art { flex: none; position: relative; }
.hero-art .shop-art { display: block; width: 224px; height: auto; }
@media (max-width: 860px) { .hero-art .shop-art { width: 180px; } }
@media (max-width: 720px) {
  .hero { padding: 14px 18px; }
  .hero-art { display: none; }
  .hero-title { font-size: 19px; }
}

/* giriş ekranındaki vitrin */
.auth-art { display: flex; justify-content: center; margin: -6px 0 6px; }
.auth-art .shop-art { width: 200px; height: auto; }

@media (prefers-reduced-motion: reduce) {
  .empty svg.empty-art, .spark { animation: none !important; }
}

.alert {
  position: relative;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 13px;
  overflow: hidden;
}
/* sol kenarda kalın renk şeridi */
.alert::before {
  content: '';
  position: absolute; inset-block: 0; inset-inline-start: 0;
  width: 3px;
  background: currentColor;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-danger  { background: var(--danger-soft);  border-color: rgba(244,63,94,0.30);  color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: rgba(245,158,11,0.30); color: var(--warning); }
.alert-info    { background: var(--info-soft);    border-color: rgba(59,130,246,0.30); color: var(--info); }
.alert-success { background: var(--success-soft); border-color: rgba(34,197,94,0.30);  color: var(--success); }
.alert strong { color: var(--text); display: block; margin-bottom: 2px; }
.alert .alert-text { color: var(--text-2); }

.stock-bar {
  /* .hbar-fill ile aynı sebep: bu da bir <span> ve kapsayıcısı hücrenin
     kendisi — satır içi kaldığı sürece genişlik/yükseklik almıyor, yani
     çubuk hiç görünmüyordu. */
  display: block;
  width: 84px; height: 6px; border-radius: 99px; background: var(--surface-3);
  overflow: hidden; margin-top: 6px; margin-inline-start: auto;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.35);
}
.stock-bar span { display: block; height: 100%; border-radius: 99px; box-shadow: 0 0 8px -1px currentColor; }

.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }

/* toast */
.toast-host {
  position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; gap: 11px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 550;
  min-width: 244px;
  animation: toast-in 380ms var(--spring);
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast.success svg { color: var(--success); }
.toast.info svg { color: var(--info); }
.toast.warning svg { color: var(--warning); }
/* altta geri sayan şerit */
.toast::after {
  content: '';
  position: absolute; bottom: 0; inset-inline-start: 0;
  height: 2px; width: 100%;
  background: var(--g-accent-l);
  transform-origin: left center;
  animation: toast-bar 2600ms linear forwards;
}
html[dir='rtl'] .toast::after { transform-origin: right center; }
.toast.success::after { background: var(--g-success); }
.toast.warning::after { background: var(--g-warning); }
.toast.info::after    { background: var(--g-info); }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* modal */
.modal-host {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-host.on { display: flex; animation: fade 200ms var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%; max-width: 430px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--g-hairline) border-box;
  border: 1px solid transparent;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), 0 0 60px -30px var(--accent-glow);
  animation: modal-in 380ms var(--spring);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 650; color: var(--text-2); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px;
  padding: 0 13px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px; font-family: inherit;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}
.field textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 78px; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-strong); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--border-accent); background: var(--surface-3);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.14);
}
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

.modal-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 16px 20px; border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   14. Giriş hareketi
   Sayfa çizildikten sonra motion.js her bloğa `.reveal` ve gecikme (`--d`)
   yazar; bloklar sırayla yükselerek belirir. Hareket kapalıysa (bkz. 17)
   animasyon anında biter, içerik yine görünür.
   -------------------------------------------------------------------------- */

.reveal { animation: reveal-up 620ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.reveal-row { animation: reveal-row 420ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes reveal-row {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* sayfa gövdesi rota değişince kısa bir geçiş yapar */
.page.page-swap { animation: page-in 380ms var(--ease-out); }
@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1360px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1180px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-detail { grid-template-columns: minmax(0, 1fr); }
  .search { width: 200px; }
}

/* --- tablet & telefon: kenar çubuğu çekmeceye dönüşür --- */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 240ms var(--ease);
    box-shadow: var(--shadow-lg);
    width: 274px;
  }
  body.nav-open .sidebar { transform: none; }

  .main { margin-inline-start: 0; }   /* margin-left RTL'de sıfırlamıyordu */
  .hamburger { display: grid; }
  .sidebar .nav-close { display: grid; }
  .page { padding: 20px; }
  .topbar { padding: 0 18px; }
}

@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .topbar-title h1 { font-size: 16.5px; }

  /* Arama kutusu yer kaplamasın: düğmeyle açılıp üst barı kaplasın.
     Bu blok dosyada .search-toggle temel kuralından ÖNCE geldiği için
     sıra değil özgüllük kazanmalı — bu yüzden .topbar ön eki var. */
  .topbar .search-toggle { display: grid; }
  .search { display: none; }
  body.search-open .search {
    display: block;
    position: absolute;
    inset-inline: 14px;
    top: 11px;
    width: auto;
    z-index: 46;
  }
  body.search-open .topbar-title,
  body.search-open .topbar .search-toggle,
  body.search-open #langSwitch,
  body.search-open #btnTheme,
  body.search-open #btnNotif,
  body.search-open #btnHelp { visibility: hidden; }
}

/* --- telefon --- */
@media (max-width: 720px) {
  :root { --topbar-h: 62px; }

  /* Telefonda cam katmanları hafiflet: blur her karede yeniden hesaplanır. */
  .sidebar, .topbar { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .aurora-blob { filter: blur(64px); }
  .aurora-grid { background-size: 38px 38px; }

  .page { padding: 16px; }
  .grid { gap: 13px; }
  .grid-stats { grid-template-columns: minmax(0, 1fr); }

  .page-head h2 { font-size: 19px; }
  .page-head .head-actions { width: 100%; }
  .page-head .head-actions .btn { flex: 1; }

  .card-head { padding: 15px 16px; }
  .card-body { padding: 16px; }
  .stat { padding: 17px 16px 15px; }
  .stat-value { font-size: 26px; }
  .stat-icon { width: 38px; height: 38px; border-radius: 12px; }
  .profile-avatar { width: 68px; height: 68px; border-radius: 21px; font-size: 23px; }

  .balance-grid { grid-template-columns: minmax(0, 1fr); }
  .action-row .btn { min-width: 0; flex: 1 1 46%; }

  .toolbar { gap: 8px; }
  /* filtre şeridi tek satırda kalsın, gerekirse yatay kaydırılsın */
  .toolbar .seg {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .toolbar .seg::-webkit-scrollbar { display: none; }
  .toolbar .seg button { flex: 0 0 auto; white-space: nowrap; }

  .toast-host { right: 12px; left: 12px; bottom: 12px; }
  .toast { min-width: 0; }

  /* Tablolar kart görünümüne dönüşür */
  table.data.as-cards { min-width: 0; display: block; }
  table.data.as-cards thead { display: none; }
  table.data.as-cards tbody { display: block; }

  table.data.as-cards tbody tr {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  table.data.as-cards tbody tr:hover { background: var(--surface-3); }
  table.data.as-cards tbody tr:last-child { margin-bottom: 0; }

  table.data.as-cards tbody td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 6px 0;
    border-bottom: 0;
    text-align: end;
  }
  table.data.as-cards tbody td:first-child,
  table.data.as-cards tbody td:last-child { padding-inline: 0; }

  table.data.as-cards tbody td > span[style*="display:block"] { text-align: end; }

  table.data.as-cards tbody td::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase;
    color: var(--text-3);
    text-align: start;
    flex: none;
  }
  /* ilk hücre kartın başlığı olur */
  table.data.as-cards tbody td.card-title-cell {
    display: block; text-align: start;
    padding-bottom: 10px; margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }
  table.data.as-cards tbody td.card-title-cell::before { display: none; }
  table.data.as-cards tbody td.actions-cell { justify-content: flex-end; padding-top: 10px; }
  table.data.as-cards tbody td.actions-cell::before { margin-inline-end: auto; }
  table.data.as-cards .actions { justify-content: flex-end; }

  .tl-item { padding: 12px 16px; }
  .tl-amount { margin-left: 0; }

  .info-row { padding: 11px 16px; }
  .profile-card { padding: 20px 16px 16px; }
}

@media (max-width: 430px) {
  /* Dar ekranda üst bar sırası: dil seçici ve tema düğmesi kalır.
     Zil ve soru işareti yalnızca birer göstergedir, bir şey açmazlar —
     yer darsa ilk onlar çıkar. Tema tercihine Ayarlar'dan da erişilir. */
  #btnHelp, #btnNotif { display: none; }
  .topbar { gap: 10px; padding: 0 14px; }
  .topbar-actions { gap: 7px; }
}

@media (max-width: 400px) {
  .stat-value { font-size: 24px; }
  .action-row .btn { flex: 1 1 100%; }
}

/* --------------------------------------------------------------------------
   15d. Erişilebilirlik — hareketi azalt

   Kullanıcı işletim sisteminde "hareketi azalt" dediyse süsleme niteliğindeki
   her şey durur: aurora sürüklenmesi, nabızlar, parıltılar, giriş animasyonu.
   İçerik yine tam olarak görünür — animasyon yalnızca bitmiş hâline atlar.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Sonsuz döngüler tamamen kapansın — 0.01ms'lik bir döngü de boyama yapar. */
  .aurora-blob,
  .meter-fill::after,
  .icon-btn .dot::after,
  .badge-danger .bullet,
  .profile-avatar::before,
  .lc-pulse,
  .empty svg { animation: none !important; }

  /* Giriş hareketleri sonuç hâliyle başlasın. */
  .reveal, .reveal-row, .page.page-swap { opacity: 1 !important; transform: none !important; }
}



/* --------------------------------------------------------------------------
   15b. Formlar — iki sütunlu alan ızgarası ve kalem listesi
   -------------------------------------------------------------------------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}
.field-grid > .field { grid-column: 1 / -1; }        /* varsayılan: tam genişlik */
.field-grid > .field-half { grid-column: span 1; }
.field-grid > .field-full { grid-column: 1 / -1; }

.modal { max-width: 520px; }

/* --- kalem seçici --- */
.line-picker { display: flex; gap: 8px; }
.line-picker select { flex: 1; min-width: 0; height: 38px; }
.line-picker .btn { flex: none; height: 38px; }

/* Izgara SATIRDA değil listede kurulur: her satır kendi grid'i olsaydı
   sütun genişlikleri satır satır değişir, miktar kutuları hizalanmazdı.
   display: contents ile satırların hücreleri ortak ızgaraya girer. */
.line-host {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 8px 10px;
  max-height: 240px;
  overflow-y: auto;

  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px auto 32px;
  align-items: center;
  column-gap: 0;              /* boşluk hücre dolgusundan gelir, yoksa
                                 satır ayıracı sütun aralarında kesilir */
}
.line-host > .hint { grid-column: 1 / -1; color: var(--text-3); padding: 6px 2px; }

.line-row { display: contents; }
.line-row > * { padding-block: 7px; border-bottom: 1px solid var(--border); }
.line-row > *:not(:last-child) { padding-inline-end: 10px; }
.line-row:last-of-type > * { border-bottom: 0; }

.line-name { font-size: 13px; font-weight: 600; color: var(--text); min-width: 0; }
.line-sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-3); }

.line-qty {
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  width: 100%;
}
.line-qty:focus { outline: none; border-color: var(--border-accent); }

.line-amount { font-size: 13px; font-weight: 650; color: var(--text); white-space: nowrap; }

.line-total {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: 8px; padding-top: 10px;
  border-top: 1px solid var(--border-strong);
  font-size: 13px;
}
.line-total span { color: var(--text-2); font-weight: 600; }
.line-total b { font-size: 15px; font-weight: 700; }

@media (max-width: 560px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .field-grid > .field-half { grid-column: 1 / -1; }
  .line-host { grid-template-columns: minmax(0, 1fr) 60px 30px; }
  .line-amount { grid-column: 1 / -1; text-align: end; padding-block: 0 7px; }
}

/* --------------------------------------------------------------------------
   15c. Global arama paneli
   -------------------------------------------------------------------------- */

.search-toggle { display: none; }        /* yalnızca dar ekranda görünür */

.search-panel {
  position: absolute;
  /* Kutudan geniş: sonuç satırında başlık, rozet ve tutar birlikte sığsın.
     Dar ekranda görünüm alanını taşmaması için kelepçelenir. */
  inset-inline-start: auto;
  inset-inline-end: 0;
  min-width: 100%;
  width: 392px;
  max-width: calc(100vw - 28px);
  top: calc(100% + 10px);
  background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), 0 0 50px -28px var(--accent-glow);
  padding: 6px;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  display: none;
  z-index: 45;
}
.search-panel.on { display: block; animation: panel-in 260ms var(--ease-out); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.search-group + .search-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.search-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
  padding: 8px 10px 5px;
}
html[dir='rtl'] .search-group-label { letter-spacing: normal; }

.search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  transition: background var(--t);
}
.search-item:hover, .search-item.on {
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border-accent);
}
.search-item .search-icon { transition: transform 280ms var(--spring), color var(--t); }
.search-item:hover .search-icon,
.search-item.on .search-icon { transform: scale(1.08); color: var(--accent-hover); }

.search-icon {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.search-icon svg { width: 15px; height: 15px; }

.search-text { min-width: 0; flex: 1; }
.search-title { display: block; font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-3);
  overflow: hidden; white-space: nowrap; margin-top: 1px;
}
.search-sub .badge { flex: none; padding: 1px 7px 1px 5px; font-size: 10.5px; }
.search-sub .badge svg { width: 10px; height: 10px; }
.search-meta { font-size: 12.5px; font-weight: 650; color: var(--text-2); white-space: nowrap; }

.search-empty { padding: 26px 16px; text-align: center; color: var(--text-3); }
.search-empty svg { width: 24px; height: 24px; opacity: 0.5; margin-bottom: 8px; }
.search-empty p { font-size: 12.5px; }

.search-hint {
  font-size: 11px; color: var(--text-3);
  padding: 9px 10px 5px; margin-top: 4px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ==========================================================================
   16. Sağdan sola (فارسی / دری)
   Düzenin çoğu mantıksal özelliklerle çalışır; burada yalnızca yön
   mantıksal karşılığı olmayan birkaç kural düzeltilir.
   ========================================================================== */

html[dir='rtl'] body {
  font-family: 'Vazirmatn', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.72;               /* Fars alfabesi daha yüksek satır ister */
}

/* Sıkı harf aralığı Arap alfabesinde bağlantıları bozar */
html[dir='rtl'] h1, html[dir='rtl'] h2, html[dir='rtl'] h3, html[dir='rtl'] h4,
html[dir='rtl'] .stat-value, html[dir='rtl'] .balance-value,
html[dir='rtl'] .brand-name, html[dir='rtl'] .invoice-no {
  letter-spacing: normal;
}

/* Çekmece ters yönden girer. */
@media (max-width: 1024px) {
  html[dir='rtl'] .sidebar { transform: translateX(100%); }
  html[dir='rtl'] body.nav-open .sidebar { transform: none; }
}

/* Geri oku ve menü karesi yön değiştirir */
html[dir='rtl'] .nav-back svg,
html[dir='rtl'] .chip-caret svg { transform: scaleX(-1); }

/* Zaman serisi grafiği aynalanmaz: zaman daima soldan sağa akar */
.chart-wrap.ltr { direction: ltr; }

/* Para ve tarih gibi karışık yönlü metinler yalıtılır */
.num, .money, .invoice-no, .tl-amount, .balance-value, .stat-value { unicode-bidi: isolate; }

/* ==========================================================================
   17. Belge: fatura ve tahsilat fişi
   Ekranda koyu arayüz üzerinde beyaz kâğıt; yazdırıldığında yalnızca kâğıt.
   ========================================================================== */

.doc-host {
  position: fixed; inset: 0; z-index: 85;
  display: none;
  flex-direction: column;
  background: rgba(2, 6, 16, 0.80);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.doc-host.on { display: flex; animation: fade 220ms var(--ease); }
.doc-host.on .sheet { animation: sheet-in 460ms var(--ease-out); }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(26px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
body.doc-open { overflow: hidden; }

.doc-bar {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.doc-bar .spacer { flex: 1; }

.doc-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 48px;
  display: flex; justify-content: center;
  align-items: flex-start;
}

/* --- kâğıt --- */
.sheet {
  width: 100%;
  max-width: 820px;
  background: #FFFFFF;
  color: #0F172A;
  border-radius: 6px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  padding: 42px 46px 34px;
  font-size: 13px;
  line-height: 1.6;
}
html[dir='rtl'] .sheet { line-height: 1.8; }

.sheet .ink-success { color: #15803D; }
.sheet .ink-danger  { color: #B91C1C; }
.sheet .ink-warning { color: #B45309; }
.sheet .mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.sheet .c { text-align: center; }
.sheet .e { text-align: end; }

/* başlık */
.sheet-head {
  display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 2px solid #0F172A;
}
.sheet-brand { display: flex; gap: 12px; align-items: flex-start; }
.sheet-mark {
  width: 40px; height: 40px; flex: none;
  object-fit: contain;
  display: block;
}
.sheet-biz { font-size: 16px; font-weight: 700; }
.sheet-biz-sub { font-size: 11.5px; color: #64748B; }

.sheet-meta { text-align: end; min-width: 210px; }
.sheet-doctype {
  font-size: 21px; font-weight: 800; letter-spacing: 0.06em;
  color: #7C3AED; margin-bottom: 8px;
}
html[dir='rtl'] .sheet-doctype { letter-spacing: normal; }
.sheet-meta-row {
  display: flex; justify-content: space-between; gap: 14px;
  font-size: 12px; padding: 2px 0;
}
.sheet-meta-row span { color: #64748B; }
.sheet-meta-row b { font-variant-numeric: tabular-nums; }

/* taraflar */
.sheet-parties {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px; padding: 22px 0 24px;
}
.sheet-party-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em;
  color: #7C3AED; margin-bottom: 6px;
}
html[dir='rtl'] .sheet-party-label { letter-spacing: normal; }
.sheet-party-name { font-size: 14px; font-weight: 700; }
.sheet-party-line { font-size: 12px; color: #475569; }

/* kalem tablosu */
.sheet-table { width: 100%; border-collapse: collapse; margin-bottom: 22px; }
.sheet-table thead th {
  text-align: start;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #475569;
  background: #F1F5F9;
  padding: 9px 11px;
  border-bottom: 1px solid #CBD5E1;
}
html[dir='rtl'] .sheet-table thead th { letter-spacing: normal; text-transform: none; }
.sheet-table thead th.e { text-align: end; }
.sheet-table thead th.c { text-align: center; }
.sheet-table tbody td {
  padding: 10px 11px;
  border-bottom: 1px solid #E2E8F0;
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}
.sheet-table tbody tr:last-child td { border-bottom: 0; }
.sheet-table tbody td.e { text-align: end; }
.sheet-table tbody td.c { text-align: center; color: #94A3B8; }
.sheet-sku { display: block; font-size: 11px; color: #94A3B8; font-weight: 400; }

/* özet */
.sheet-summary {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 26px; align-items: start;
}
.sheet-sub-h {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em;
  color: #475569; margin-bottom: 7px; text-transform: uppercase;
}
html[dir='rtl'] .sheet-sub-h { letter-spacing: normal; text-transform: none; }
.sheet-mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.sheet-mini td {
  padding: 6px 0; border-bottom: 1px solid #E2E8F0;
  font-variant-numeric: tabular-nums; color: #475569;
}
.sheet-mini td.e { text-align: end; color: #0F172A; }
.sheet-empty { color: #94A3B8; font-style: italic; }

.sheet-totals { border: 1px solid #E2E8F0; border-radius: 8px; overflow: hidden; }
.stot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 9px 14px; font-size: 12.5px;
  border-bottom: 1px solid #E2E8F0;
}
.stot span { color: #64748B; }
.stot b { font-variant-numeric: tabular-nums; }
.stot.grand { background: #F1F5F9; font-size: 14px; }
.stot.grand span, .stot.grand b { color: #0F172A; font-weight: 800; }
.stot.balance { background: #FEF2F2; font-size: 14px; border-bottom: 0; }
.stot.balance span { color: #7F1D1D; font-weight: 700; }
.stot.balance b { font-weight: 800; }

.sheet-status {
  padding: 8px 14px; font-size: 12px; font-weight: 700; text-align: center;
  border-top: 1px solid #E2E8F0;
}
.sheet-status.success { background: #F0FDF4; color: #15803D; }
.sheet-status.warning { background: #FFFBEB; color: #B45309; }
.sheet-status.danger  { background: #FEF2F2; color: #B91C1C; }

/* garanti belgesi */
.wr-serial { letter-spacing: 0.02em; }
/* durum satırı: solda kalan gün, sağda kaşe — kaşe hiçbir sütunu kapatmaz */
.wr-status {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 2px 0 14px; min-height: 58px;
}
.wr-stamp { flex: none; transform: rotate(-7deg); mix-blend-mode: multiply; opacity: 0.94; }
html[dir='rtl'] .wr-stamp { transform: rotate(7deg); }
.wr-stamp .stamp { display: block; }
.wr-left { font-size: 12.5px; color: #15803D; font-weight: 700; margin: 0; }
.wr-left.ink-danger { color: #B91C1C; }
.wr-terms {
  border: 1px solid #E2E8F0; border-radius: 10px;
  padding: 14px 16px 12px; margin-bottom: 18px;
  background: #F8FAFC;
  break-inside: avoid;
}
.wr-terms-h { margin-bottom: 10px; }
.wr-terms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.wr-term ul { margin: 0; padding-inline-start: 17px; }
.wr-term li { font-size: 11.8px; color: #475569; margin-bottom: 4px; }
.wr-howto { font-size: 11.8px; color: #475569; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #E2E8F0; }
.wr-howto b { color: #0F172A; }
@media (max-width: 720px) {
  .wr-terms-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wr-stamp { top: -24px; }
}

/* fiş tutarı */
.receipt-amount {
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 10px;
  padding: 18px 22px; margin-bottom: 22px;
}
.receipt-amount span { font-size: 12.5px; font-weight: 700; color: #15803D; }
.receipt-amount strong { font-size: 26px; font-weight: 800; color: #15803D; font-variant-numeric: tabular-nums; }

/* --- belge güvenliği: mühür, kaşe, şerit, doğrulama (js/seal.js) --- */
.sheet { position: relative; overflow: hidden; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .band { display: block; width: 100%; height: 16px; margin: 8px 0 -6px; opacity: 0.85; }
.sheet-totals-wrap, .receipt-amount-wrap { position: relative; }
.stamp-wrap {
  position: absolute; top: -44px; inset-inline-end: -10px;
  transform: rotate(-9deg);
  mix-blend-mode: multiply; opacity: 0.94;
  pointer-events: none;
}
html[dir='rtl'] .stamp-wrap { transform: rotate(9deg); }
.receipt-amount-wrap .stamp-wrap { top: -8px; inset-inline-end: 34%; }
.sign { position: relative; }
.seal-wrap {
  position: absolute; top: -64px; inset-inline-start: 110px;
  transform: rotate(-7deg);
  mix-blend-mode: multiply; opacity: 0.92;
  pointer-events: none;
}
html[dir='rtl'] .seal-wrap { transform: rotate(7deg); }
.sheet .seal { display: block; }
.sheet .stamp { display: block; }

.sheet-verify {
  display: flex; align-items: center; gap: 16px;
  border: 1px dashed #CBD5E1; border-radius: 10px;
  padding: 10px 14px; margin: 4px 0 0;
  break-inside: avoid;
}
.sheet-verify .qr { flex: none; display: block; }
.sheet-verify-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: #475569;
}
html[dir='rtl'] .sheet-verify-label { letter-spacing: normal; text-transform: none; }
.sheet-verify-code {
  font-size: 21px; font-weight: 800; letter-spacing: 0.14em; color: #0F172A;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  direction: ltr; unicode-bidi: isolate;
}
.sheet-verify-hint { font-size: 11px; color: #64748B; margin-top: 2px; }
.sheet .micro { display: block; width: 100%; height: 8px; margin: 6px 0 12px; opacity: 0.85; }

.sheet .wm { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.sheet.copy .wm { display: block; }
.doc-bar [data-act='toggle-copy'].on { background: var(--danger-soft); color: var(--danger); }

/* doğrulama aracı (modal) */
.vf-facts { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.vf-facts td { padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; }
.vf-facts td.e { text-align: end; color: var(--text); }
.vf-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

/* alt bilgi */
.sheet-foot { margin-top: 30px; padding-top: 22px; border-top: 1px solid #E2E8F0; }
.sheet-signs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; margin-bottom: 22px; }
.sign { font-size: 11.5px; color: #64748B; }
.sign-line { display: block; height: 34px; border-bottom: 1px solid #94A3B8; margin-bottom: 7px; }
.sign em { display: block; font-style: normal; color: #0F172A; font-weight: 600; font-size: 12px; }
.sheet-thanks { font-size: 12.5px; color: #0F172A; font-weight: 600; }
.sheet-legal { font-size: 11px; color: #94A3B8; margin-top: 4px; }

/* --- dil seçici --- */
#langSwitch .seg { padding: 3px; }
#langSwitch .seg button { padding: 0 10px; font-size: 12px; min-width: 34px; }

/* --- belge: küçük ekran --- */
@media (max-width: 720px) {
  .doc-scroll { padding: 14px 10px 40px; }
  .sheet { padding: 24px 20px 22px; font-size: 12.5px; }
  .sheet-head { gap: 16px; }
  .sheet-meta { text-align: start; min-width: 0; width: 100%; }
  .sheet-parties { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sheet-summary { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sheet-signs { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sheet-table { display: block; overflow-x: auto; }
  .stamp-wrap { top: -26px; inset-inline-end: 0; }
  .stamp-wrap .stamp { width: 150px; height: 56px; }
  .seal-wrap { top: -64px; inset-inline-start: auto; inset-inline-end: 0; }
  .seal-wrap .seal { width: 112px; height: 112px; }
  .sheet-verify { gap: 12px; }
  .sheet-verify .qr { width: 76px; height: 76px; }
  .sheet-verify-code { font-size: 17px; }
  #langSwitch .seg button { padding: 0 8px; min-width: 30px; }
}

/* ==========================================================================
   18. Yazdırma — yalnızca belge basılır
   ========================================================================== */

@media print {
  @page { margin: 12mm; }

  body { background: #fff; }

  /* zemin ışıkları kâğıda basılmaz */
  .aurora { display: none !important; }

  /* belge açıkken arayüz basılmaz */
  body.doc-open .app,
  body.doc-open .scrim,
  body.doc-open .modal-host,
  body.doc-open .toast-host { display: none !important; }

  body.doc-open .doc-host {
    position: static; display: block;
    background: none; backdrop-filter: none;
  }
  body.doc-open .doc-bar { display: none !important; }
  body.doc-open .doc-scroll { padding: 0; overflow: visible; display: block; }
  body.doc-open .sheet {
    max-width: none; box-shadow: none; border-radius: 0; padding: 0;
  }
  body.doc-open .stamp-wrap { inset-inline-end: 6px; }
  body.doc-open .doc-host { overflow: visible; }

  /* belge kapalıyken sayfanın kendisi basılır */
  body:not(.doc-open) .sidebar,
  body:not(.doc-open) .topbar,
  body:not(.doc-open) .scrim,
  body:not(.doc-open) .toast-host,
  body:not(.doc-open) .head-actions { display: none !important; }

  /* Sayfanın kendisi basılırken koyu tema kâğıda taşınmaz: tarayıcı zemini
     basmaz, beyaz yazı da kâğıtta görünmezdi. Baskı için tokenlar koyuya
     çevrilir — böylece ekrandan bağımsız olarak okunur bir çıktı olur. */
  body:not(.doc-open) {
    --text: #0F172A; --text-2: #334155; --text-3: #64748B;
    --surface: #FFFFFF; --surface-2: #F8FAFC; --surface-3: #F1F5F9;
    --border: #E2E8F0; --border-strong: #CBD5E1;
    color: #0F172A;
  }
  body:not(.doc-open) .card,
  body:not(.doc-open) .stat {
    background: #fff !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: none !important;
  }
  body:not(.doc-open) .stat-value,
  body:not(.doc-open) .page-head h2,
  body:not(.doc-open) .brand-name,
  body:not(.doc-open) .gauge-pct {
    background: none !important;
    -webkit-text-fill-color: #0F172A !important;
    color: #0F172A !important;
  }

  /* Zemini gradyan olan rozetler: tarayıcı zemini basmadığı için beyaz yazı
     kâğıtta kayboluyordu (ölçüldü: 9 sayfada 63 görünmez metin düğümü, 59'u
     müşteri baş harfleri). Baskıda koyu mürekkebe ve ince çerçeveye çevrilir. */
  body:not(.doc-open) .avatar,
  body:not(.doc-open) .profile-avatar,
  body:not(.doc-open) .seg button.on,
  body:not(.doc-open) .nav-item.active,
  body:not(.doc-open) .pulse-ico,
  body:not(.doc-open) .stat-icon {
    background: #F1F5F9 !important;
    color: #0F172A !important;
    -webkit-text-fill-color: #0F172A !important;
    border: 1px solid #CBD5E1 !important;
    box-shadow: none !important;
  }
  body:not(.doc-open) .profile-avatar::before { display: none !important; }
  body:not(.doc-open) .main { margin-inline-start: 0; }
  body:not(.doc-open) .card { break-inside: avoid; }
}

/* Latin rakamlı teknik diziler (telefon, vergi no, e-posta) RTL bağlamda
   sırası bozulmadan gösterilsin. */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}
html[dir='rtl'] .sheet .mono,
html[dir='rtl'] .invoice-no { direction: ltr; unicode-bidi: isolate; }

/* ==========================================================================
   Giriş ekranı (ortak defter)
   Uygulamanın üstünde tam sayfa açılır; giriş yapılmadan arkası görünmez.
   ========================================================================== */

.auth-host {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: 24px;
  padding-block-start: calc(24px + env(safe-area-inset-top, 0px));
  padding-block-end: calc(24px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(124, 58, 237, 0.20), transparent 62%),
    var(--bg);
  overflow-y: auto;
}
.auth-host.on { display: grid; }

/* Arkadaki uygulama okunmasın; giriş yapılmadan kaydırma da olmasın. */
body.auth-open { overflow: hidden; }
body.auth-open .app { visibility: hidden; }

.auth-card {
  width: 100%;
  max-width: 392px;
  background:
    linear-gradient(var(--glass-strong), var(--glass-strong)) padding-box,
    var(--g-hairline) border-box;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid transparent;
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg), 0 0 80px -34px var(--accent-glow);
  padding: 28px 26px 24px;
  animation: modal-in 560ms var(--spring);
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand .brand-mark { width: 48px; height: 48px; }
.auth-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.auth-tag {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.05em; text-transform: uppercase;
}

.auth-lead { color: var(--text-2); font-size: 13.5px; margin-bottom: 18px; }
.auth-note { color: var(--text-3); font-size: 12px; margin-top: 14px; text-align: center; }

.auth-btn { width: 100%; justify-content: center; }
.auth-card .alert { margin-bottom: 16px; }

.auth-wait {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-2); font-size: 13.5px;
  padding: 26px 0 18px;
}

.spinner {
  width: 17px; height: 17px; flex: none;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent-hover);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

@media (max-width: 430px) {
  .auth-host { padding-inline: 16px; }
  .auth-card { padding: 22px 18px 18px; }
}

/* ==========================================================================
   Ana ekrandan açıldığında (PWA / tam ekran)
   Tarayıcı çubuğu olmadığı için çentik ve alt gezinme çubuğu payını
   uygulamanın kendisi bırakmalı. Tarayıcıda açıkken hiçbir şey değişmez.
   ========================================================================== */

@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .topbar {
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
  }
  .sidebar { padding-top: env(safe-area-inset-top, 0px); }
  .page { padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
  .modal-host, .doc-host { padding-bottom: env(safe-area-inset-bottom, 0px); }

  /* Ana ekran uygulamasında metin seçme kazayla açılan menüleri tetikliyor;
     yalnızca gerçekten kopyalanacak alanlarda serbest bırakılıyor. */
  .sidebar, .topbar { -webkit-user-select: none; user-select: none; }
}

/* ==========================================================================
   İndir sayfası — kurulum dosyası satırları
   ========================================================================== */

.dl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.dl-row:last-child { border-bottom: none; }

.dl-row { transition: background var(--t); border-radius: var(--r-md); }
.dl-row:hover { background: var(--surface-2); }

.dl-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--g-accent);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 8px 20px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.20);
  flex: none;
  transition: transform 320ms var(--spring);
}
.dl-row:hover .dl-icon { transform: translateY(-2px) rotate(-5deg) scale(1.05); }
.dl-icon svg { width: 18px; height: 18px; }

.dl-text { flex: 1; min-width: 0; }
.dl-name { font-weight: 600; font-size: 14.5px; }
.dl-sub { color: var(--text-2); font-size: 13px; }

.dl-btn { flex: none; text-decoration: none; }

@media (max-width: 560px) {
  /* Dar ekranda düğme alta iner, satır iki katlı olur */
  .dl-row { flex-wrap: wrap; }
  .dl-btn { width: 100%; justify-content: center; }
}

/* ==========================================================================
   19. Aydınlık tema

   Tokenlar tek yerde toplandığı için tema, kök öğedeki `data-theme`
   niteliğiyle değişir; bileşenlerin hiçbiri yeniden yazılmaz. Yalnızca
   gradyanla boyanan yazılar (KPI rakamı, sayfa başlığı, marka adı) ve
   zemin ışıkları aydınlık zemine göre yeniden ayarlanır.

   Seçim js/theme.js içinde saklanır; ilk açılışta işletim sisteminin
   tercihine uyar.
   ========================================================================== */

html[data-theme='light'] {
  color-scheme: light;

  --bg:            #F1F3FB;
  --bg-deep:       #E6E9F6;
  --surface:       #FFFFFF;
  --surface-2:     #F6F7FD;
  --surface-3:     #EBEEF9;
  --surface-hover: #E3E8F7;

  --glass:         rgba(255, 255, 255, 0.78);
  --glass-strong:  rgba(255, 255, 255, 0.96);
  --glass-soft:    rgba(241, 243, 252, 0.80);

  --border:        rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-accent: rgba(124, 58, 237, 0.42);

  --accent:        #7C3AED;
  --accent-2:      #C026D3;
  --accent-hover:  #6D28D9;
  --accent-soft:   rgba(124, 58, 237, 0.11);
  --accent-glow:   rgba(124, 58, 237, 0.34);

  --g-hairline: linear-gradient(135deg,
                  rgba(15, 23, 42, 0.13) 0%,
                  rgba(15, 23, 42, 0.05) 40%,
                  rgba(124, 58, 237, 0.06) 66%,
                  rgba(192, 38, 211, 0.16) 100%);
  --g-sheen:    linear-gradient(100deg,
                  transparent 20%,
                  rgba(255,255,255,0.30) 46%,
                  rgba(255,255,255,0.55) 50%,
                  rgba(255,255,255,0.30) 54%,
                  transparent 80%);

  --success:       #16A34A;
  --success-soft:  rgba(22, 163, 74, 0.12);
  --danger:        #E11D48;
  --danger-soft:   rgba(225, 29, 72, 0.10);
  --warning:       #B45309;
  --warning-soft:  rgba(245, 158, 11, 0.16);
  --info:          #2563EB;
  --info-soft:     rgba(37, 99, 235, 0.11);

  --series-1:      #7C3AED;
  --series-2:      #059669;
  --gauge-to:      #10B981;
  --grid:          rgba(15, 23, 42, 0.09);
  --axis-ink:      #64748B;
  --chart-surface: #FFFFFF;

  --text:          #0B1220;
  --text-2:        #475569;
  --text-3:        #64748B;   /* beyaz üzerinde 4.76:1 — AA (önceki #7C8AA5: 3.48:1) */

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow:    0 10px 28px -12px rgba(15, 23, 42, 0.22);
  --shadow-lg: 0 28px 58px -26px rgba(15, 23, 42, 0.36);
}

/* Zemin ışıkları aydınlıkta yalnızca bir fısıltı olmalı. */
html[data-theme='light'] .aurora {
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(167, 139, 250, 0.32), transparent 62%),
    var(--bg);
}
html[data-theme='light'] .aurora-blob { opacity: 0.30; filter: blur(96px); }
html[data-theme='light'] .aurora-blob.a2 { opacity: 0.22; }
html[data-theme='light'] .aurora-blob.a3 { opacity: 0.20; }
html[data-theme='light'] .aurora-grid {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
}

/* Gradyanla boyanan yazılar aydınlık zeminde okunur kalsın. */
html[data-theme='light'] .brand-name {
  background: linear-gradient(120deg, #1E1B4B 10%, #6D28D9 60%, #A21CAF 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme='light'] .stat-value {
  background: linear-gradient(175deg, #0B1220 35%, #3F4A63 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme='light'] .page-head h2 {
  background: linear-gradient(120deg, #0B1220 25%, #334155 62%, #6D28D9 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme='light'] .gauge-pct {
  background: linear-gradient(170deg, #0B1220, #047857);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Aydınlıkta iç gölgeler siyah değil lacivert; aksi hâlde kirli görünür. */
html[data-theme='light'] .meter-track,
html[data-theme='light'] .hbar-track,
html[data-theme='light'] .stock-bar,
html[data-theme='light'] .stack-bar { box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.10); }

html[data-theme='light'] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124,58,237,0.38), rgba(192,38,211,0.28));
  background-clip: padding-box;
}

html[data-theme='light'] .btn-success,
html[data-theme='light'] .btn-whatsapp { color: #052E16; }
html[data-theme='light'] .toast { color: var(--text); }
html[data-theme='light'] ::selection { background: rgba(124, 58, 237, 0.20); color: #0B1220; }

/* ==========================================================================
   20. Tema düğmesi
   Güneş ile ay tek düğmenin içinde durur; biri girerken diğeri döne döne
   çıkar. Düğme genişliği sabit olduğu için üst bar zıplamaz.
   ========================================================================== */

.theme-btn { overflow: hidden; }
.theme-btn .theme-ico {
  display: grid; place-items: center;
  grid-area: 1 / 1;
  transition: transform 460ms var(--spring), opacity 260ms var(--ease);
}
.theme-btn { display: grid; place-items: center; }
.theme-btn .theme-ico svg { width: 17px; height: 17px; }

.theme-btn .ico-sun  { transform: rotate(0deg) scale(1); opacity: 1; }
.theme-btn .ico-moon { transform: rotate(-90deg) scale(0.4); opacity: 0; }

html[data-theme='light'] .theme-btn .ico-sun  { transform: rotate(90deg) scale(0.4); opacity: 0; }
html[data-theme='light'] .theme-btn .ico-moon { transform: rotate(0deg) scale(1); opacity: 1; }

/* Tema değişirken renkler sıçramasın: kısa bir çapraz geçiş. */
html.theme-shift,
html.theme-shift * ,
html.theme-shift *::before,
html.theme-shift *::after {
  transition: background-color 320ms var(--ease),
              border-color 320ms var(--ease),
              color 320ms var(--ease),
              fill 320ms var(--ease),
              stroke 320ms var(--ease) !important;
}

@media (prefers-reduced-motion: reduce) {
  html.theme-shift, html.theme-shift *,
  html.theme-shift *::before, html.theme-shift *::after { transition: none !important; }
}
