/* ═══════════════════════════════════════════════════════════════════════
   BAYI SATISLARI — rapor sayfasi + bayinin cari kartindaki sekme (04.10.2026)
   Köşeler her yerde düz (border-radius: 0) — proje kuralı.
   ═══════════════════════════════════════════════════════════════════════ */

.by-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 14px 16px;
    gap: 12px;
    background: var(--yl-bg, #f5f7fa);
    overflow-y: auto;
}
/* Sayfa KAYAR, ogeler EZILMEZ: secili bayinin teklifleri acilinca ozet tablosu sikismasin. */
.by-shell > * { flex-shrink: 0; }
/* Ozet tablosu dogal yuksekliginde (grid normalde kalan alani doldurur, icini kaydirir):
   cok teklifli bayi secilince tablo ezilmesin, SAYFA kaysin. */
.by-shell > .ylg-root { flex: 0 0 auto; }

/* ── Başlık ── */
.by-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--yl-border, #dfe4ec);
}
.by-header-sol { display: flex; align-items: center; gap: 12px; min-width: 0; }
.by-header-ikon { width: 30px; height: 30px; color: #B4690E; flex-shrink: 0; }
.by-header h3 { margin: 0; font-size: 1.12rem; font-weight: 700; color: #0f172a; }
.by-alt { margin: 2px 0 0; font-size: 0.78rem; color: var(--yl-text-light, #64748b); }
.by-header-sag { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.by-tarih { display: inline-flex; align-items: center; gap: 6px; }
.by-tarih-ayrac { opacity: .55; }

.by-btn {
    height: 30px;
    padding: 0 12px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--yl-border, #dfe4ec);
    border-radius: 0;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
    white-space: nowrap;
}
.by-btn:hover:not(:disabled) { background: #f3f6fa; }
.by-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.by-btn-ghost { background: transparent; }

.by-bilgi {
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #7c4a03;
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

/* ── Özet tablosu ── */
.by-ozet-grid tbody tr { cursor: pointer; }
.by-ozet-grid tbody tr.by-secili > td { background: #fff7ed; }
.by-bayi-ad { font-weight: 700; font-size: 0.82rem; color: #111827; }
.by-bayi-kod { font-size: 0.72rem; color: var(--yl-text-light, #6b7280); }
.by-sayi-onay { color: #166534; font-weight: 600; }
.by-sayi-siparis { color: #1d4ed8; font-weight: 600; }
.by-sayi-kayip { color: #991b1b; font-weight: 600; }
.by-sayi-sifir { color: #94a3b8; }
.by-tutar { white-space: normal; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.by-tutar-satis { font-weight: 700; color: #166534; }
.by-dip { margin-left: 12px; font-size: 0.75rem; color: var(--yl-text-light, #6b7280); }

/* ── Seçili bayinin teklifleri ── */
.by-detay {
    background: #fff;
    border: 1px solid var(--yl-border, #dfe4ec);
    border-top: 3px solid #B4690E;
    padding: 10px 12px 12px;
}
.by-detay-baslik {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}
.by-detay-kapat { border: none; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: #64748b; }

/* ── Bayi satışları (bileşen: cari kart sekmesi + rapor detayı) ── */
.by-satis { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.by-bos {
    padding: 14px 12px;
    font-size: 0.82rem;
    color: var(--yl-text-light, #64748b);
    background: #fafbfd;
    border: 1px dashed var(--yl-border, #dfe4ec);
}
.by-ozet {
    display: grid;
    grid-template-columns: repeat(5, minmax(84px, 1fr)) repeat(2, minmax(180px, 2fr));
    gap: 6px;
}
.by-kutu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 9px;
    background: #fff;
    border: 1px solid var(--yl-border, #dfe4ec);
    min-width: 0;
}
.by-kutu span { font-size: 0.68rem; font-weight: 600; letter-spacing: .02em; color: var(--yl-text-light, #64748b); }
.by-kutu strong { font-size: 0.95rem; color: #0f172a; overflow-wrap: anywhere; }
.by-kutu-genis strong { font-size: 0.84rem; }
.by-kutu-satis strong { color: #166534; }

.by-grid tbody tr { cursor: pointer; }
.by-musteri { font-weight: 600; color: #111827; }
.by-teklif-no { color: var(--yl-primary, #1a3a6b); font-weight: 600; }
.by-durum { font-size: 0.74rem; font-weight: 600; padding: 1px 6px; border: 1px solid transparent; white-space: nowrap; }
.by-durum.acik    { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.by-durum.onay    { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }
.by-durum.siparis { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.by-durum.kayip   { color: #991b1b; background: #fef2f2; border-color: #fecaca; }

/* ── Koyu tema (.app-root.dark — prefers-color-scheme DEĞİL) ── */
.app-root.dark .by-header,
.app-root.dark .by-detay,
.app-root.dark .by-kutu { background: #161b22; border-color: #30363d; }
.app-root.dark .by-header h3,
.app-root.dark .by-detay-baslik,
.app-root.dark .by-bayi-ad,
.app-root.dark .by-musteri,
.app-root.dark .by-kutu strong { color: #e6edf3; }
.app-root.dark .by-bos { background: #0d1117; border-color: #30363d; }
.app-root.dark .by-ozet-grid tbody tr.by-secili > td { background: #2d2112; }

/* ── Telefon / dar ekran ── */
@media (max-width: 900px) {
    .by-ozet { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .by-kutu-genis { grid-column: span 5; }
}
@media (max-width: 768px) {
    .by-shell { padding: 10px; }
    .by-ozet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .by-kutu-genis { grid-column: span 2; }
    .by-header-sag { width: 100%; }
}
