/* Tedarikçiler modül stilleri — sahibi: public/js/suppliers.js
   Ortak sınıflar (.card, .kpi-grid, .data-table, .pill, .toolbar, .form-grid, .modal…) styles.css'tedir; tedarikçi kartının
   üst bölümü (.cari-hesap, .cari-toplamlar), geri bağlantısı (.cari-geri) ve telefondaki fatura kartları (.cari-tel-*)
   Cari Hesaplar ile ortaktır (cari.css). Burada yalnızca ted- önekli, bu sayfaya özgü kurallar var. */

/* hidden özniteliği .notice gibi display veren sınıflarda da çalışsın */
.ted-page [hidden], .ted-form [hidden] { display: none !important; }

/* ------------------------------------------------------------------ LİSTE */
.ted-kpi .kpi-card.clickable { cursor: pointer; transition: border-color 0.15s; }
.ted-kpi .kpi-card.clickable:hover { border-color: var(--line-strong); }
.ted-liste-kart .card-head h3 { flex-wrap: wrap; }
.ted-toolbar .input { min-width: 190px; }

.ted-tablo { min-width: 860px; }
.ted-tablo td { vertical-align: top; }
.ted-tablo td.ted-col-ad { min-width: 220px; }
.ted-ad { font-weight: 700; color: var(--heading); text-decoration: none; overflow-wrap: anywhere; }
.ted-ad:hover { color: var(--primary-d); text-decoration: underline; }
.ted-link { color: var(--blue); text-decoration: none; overflow-wrap: anywhere; }
.ted-link:hover { text-decoration: underline; }
.ted-telefonlar { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.ted-cep { display: inline-flex; align-items: center; gap: 4px; }
.ted-cep-ikon { display: inline-flex; color: var(--muted); }
.ted-borc { color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tr.ted-pasif td { background: var(--surface-2); color: var(--muted); }
.data-table tr.ted-pasif .ted-ad { color: var(--muted); }

/* Telefon kart listesi: ekranda gizli, ≤640 px'te tablonun yerine geçer */
.ted-tel-liste { display: none; }

/* ------------------------------------------------------------------ TEDARİKÇİ KARTI
   Sıra: üst kart (ad, telefonlar, toplamlar) → Faturalar (yalnızca yönetici, tam genişlik) → bilgi kartları yan yana */
.ted-ust h2 .pill { margin-left: 10px; vertical-align: middle; font-size: 12px; }
.ted-fatura-kart { margin-bottom: 20px; }
.ted-bilgiler { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.ted-bilgiler .card { margin-bottom: 0; min-width: 0; }
.ted-bos { margin: 0; font-size: 13.5px; }

/* İletişim bilgileri: etiket / değer satırları */
.ted-bilgi { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 14px; margin: 0; font-size: 14px; }
.ted-bilgi dt { color: var(--muted); font-size: 13px; font-weight: 500; padding-top: 1px; }
.ted-bilgi dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.ted-adres { white-space: pre-line; }
.ted-iban { display: flex; align-items: flex-start; gap: 6px; }
.ted-iban-no { flex: 1 1 auto; min-width: 0; font-variant-numeric: tabular-nums; }
.ted-iban .mini-btn { flex: 0 0 auto; margin-top: -3px; }
.ted-not { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ted-not-baslik { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.ted-not p { margin: 0; white-space: pre-line; font-size: 14px; overflow-wrap: anywhere; }

/* Kişiler ve stok kalemleri: sade liste */
.ted-kisi-liste, .ted-stok-liste { list-style: none; margin: 0; padding: 0; }
.ted-kisi-liste li { padding: 10px 0; display: flex; flex-direction: column; gap: 3px; }
.ted-kisi-liste li + li, .ted-stok-liste li + li { border-top: 1px solid var(--line); }
.ted-kisi-liste li:first-child, .ted-stok-liste li:first-child { padding-top: 0; }
.ted-kisi-ad { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ted-kisi-ad b { color: var(--heading); }
.ted-kisi-iletisim { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13.5px; }
.ted-stok-liste li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13.5px; }
.ted-stok-liste li.pasif { color: var(--muted); }
.ted-stok-ad { display: flex; gap: 8px; min-width: 0; }
.ted-stok-ad b { color: var(--heading); white-space: nowrap; }
.ted-stok-ad span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Faturalar */
.ted-fatura-kart .card-head h3 { flex-wrap: wrap; }
.ted-fatura-toolbar .secenek-anahtari { flex: 0 0 auto; }
.ted-fatura-tablo { min-width: 760px; }
.ted-fatura-tablo td { vertical-align: top; }
.ted-fatura-tablo td.ted-col-aciklama { min-width: 160px; }
.ted-fatura-tablo td.ted-col-aciklama .clamp { max-width: 280px; }

/* ------------------------------------------------------------------ FORM */
.modal.ted-modal { max-width: 760px; }
.ted-form .field-label { white-space: nowrap; }
.ted-form-bolum { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.ted-form-bolum h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--heading); }
.ted-ipucu { display: block; margin-top: 5px; font-size: 12.5px; line-height: 1.4; color: var(--muted); font-weight: 400; }
.ted-kullanim { margin-top: 14px; }
.ted-form-hata { margin: 14px 0 0; }
.ted-aktif-sec { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; align-self: end; }
.ted-aktif-sec input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.ted-aktif-sec b { display: block; font-size: 14px; color: var(--heading); }
.ted-aktif-sec small { display: block; font-size: 12px; color: var(--muted); }

/* Ek kişi satırları: ad · görev · telefon · e-posta · sil */
.ted-kisi-form { display: flex; flex-direction: column; gap: 8px; }
.ted-kisi-satir { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.3fr auto; gap: 8px; align-items: center; }
.ted-kisi-satir .input { min-width: 0; }
.ted-kisi-bos { margin: 0; }

/* ------------------------------------------------------------------ TEKLİF TALEPLERİ (supplierQuotes.js) */
.ted-sekmeler { padding: 4px 20px 0; }
.ted-sekmeler .tabbar { margin-bottom: 0; }
.ted-liste-kart > .card-body { padding-top: 16px; }
.tt-tablo { min-width: 820px; }
.tt-tablo td { vertical-align: top; }
.tt-tablo td.tt-col-konu { min-width: 200px; }
.tt-tablo td.tt-col-ted .clamp { max-width: 240px; }

.tt-sayfa .card { margin-bottom: 20px; }
.tt-ust h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.tt-durum .pill { font-size: 12px; }
.tt-not { padding: 0 20px 16px; }
.tt-not p { margin: 0; white-space: pre-line; font-size: 14px; overflow-wrap: anywhere; }
.tt-sonuc { display: flex; align-items: center; gap: 8px; margin: 0 20px 18px; }
.tt-sil:hover { color: var(--danger); border-color: var(--danger); }

/* Tedarikçi satırları: ad · durum · işlemler */
.tt-ted-liste { display: flex; flex-direction: column; }
/* Durum ve işlem sütunları sabit genişlikte: satırlar arasında hizalı kalsın (işlem düğmesi sayısı satıra göre değişir) */
.tt-ted-satir { display: grid; grid-template-columns: minmax(180px, 1fr) 190px 270px; gap: 10px 16px; align-items: center; padding: 12px 0; }
.tt-ted-satir + .tt-ted-satir { border-top: 1px solid var(--line); }
.tt-ted-ad { min-width: 0; }
.tt-ted-durum { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.tt-ted-tutar { color: var(--heading); font-variant-numeric: tabular-nums; }
.tt-ted-islem { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.tt-ted-islem a.mini-btn { text-decoration: none; }
/* Seçim kutulu satır (açık talep): kutu · ad · durum · işlemler */
.tt-ted-satir.secimli { grid-template-columns: auto minmax(180px, 1fr) 190px 270px; }
.tt-ted-kutu-hucre input, .tt-toplu-sec input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }

/* Toplu gönderim çubuğu: aynı talep seçilen tedarikçilere */
.tt-toplu { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px; margin-bottom: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tt-toplu-sec { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--heading); }
.tt-toplu-dugmeler { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.tt-toplu-eposta { text-decoration: none; }
.tt-toplu-eposta.disabled { opacity: 0.5; pointer-events: none; }
.tt-toplu-not { flex-basis: 100%; }

/* Karşılaştırma tablosu: en iyi toplam sütunu açık yeşil, kalemde en ucuz fiyat yeşil */
.tt-karsilastirma { min-width: 560px; }
.tt-karsilastirma th { vertical-align: bottom; }
.tt-sutun-ad { font-weight: 700; color: var(--heading); white-space: normal; }
.tt-sutun-alt { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.tt-karsilastirma .tt-en-iyi { background: #F0FAF4; }
.tt-karsilastirma th.tt-en-iyi .tt-sutun-alt { color: var(--primary-d); font-weight: 700; }
.tt-karsilastirma .tt-secilen { background: #E3F5EA; box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
.tt-karsilastirma td.tt-ucuz > div:first-child { color: var(--primary-d); font-weight: 700; }
.tt-karsilastirma tfoot td { font-size: 13px; }
.tt-karsilastirma tfoot tr.tt-toplam td { border-top: 2px solid var(--line-strong); font-size: 14px; }
.tt-karsilastirma tfoot td:first-child { color: var(--muted); font-weight: 600; text-align: left; }
.tt-not-hucre { display: inline-block; max-width: 220px; white-space: normal; text-align: right; }
.tt-sec-satir td { border-bottom: 0; }

/* Formlar */
.tt-kalem-form { display: flex; flex-direction: column; gap: 8px; }
.tt-kalem-satir { display: grid; grid-template-columns: 2.2fr 0.8fr 0.8fr 1.6fr auto; gap: 8px; align-items: center; }
.tt-kalem-satir .input { min-width: 0; }
.tt-ted-sec { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 2px; }
.tt-ted-kutu { display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.tt-ted-kutu:has(input:checked) { border-color: var(--primary); background: #F0FAF4; }
.tt-ted-kutu input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--primary); flex: 0 0 auto; }
.tt-ted-kutu b { display: block; font-size: 13.5px; color: var(--heading); }
.tt-ted-kutu small { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tt-ted-kutu.pasif { opacity: 0.7; }
.tt-fiyat-tablo td { vertical-align: middle; }
.tt-fiyat-hucre { width: 170px; }
.tt-fiyat-hucre .input { width: 100%; }
.tt-teklif-form .table-wrap { margin: 14px 0 6px; }
.tt-ted-liste.ted-kisi-liste li .clamp { max-width: 200px; }

/* ------------------------------------------------------------------ DAR EKRAN */
@media (max-width: 640px) {
  .ted-toolbar > * { flex: 1 1 100%; max-width: none; }
  .ted-toolbar .input { width: 100%; }
  .ted-tablo-wrap { display: none; }
  .ted-tel-liste { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
  .ted-tel-satir { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; cursor: pointer; }
  .ted-tel-satir + .ted-tel-satir { border-top: 1px solid var(--line); }
  .ted-tel-satir.pasif { background: var(--surface-2); }
  .ted-tel-ust { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .ted-tel-iletisim { display: flex; flex-wrap: wrap; gap: 8px; }
  .ted-tel-dugme {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); background: var(--panel); color: var(--blue); font-weight: 600; font-size: 14px; text-decoration: none;
  }
  .ted-tel-borc b { color: var(--heading); font-variant-numeric: tabular-nums; }

  .ted-bilgiler { gap: 16px; }
  .ted-fatura-kart { margin-bottom: 16px; }
  .ted-bilgi { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ted-bilgi dd + dt { margin-top: 8px; }
  .ted-fatura-icerik .table-wrap { display: none; }
  .ted-tel-durum { margin-left: auto; }
  .ted-fatura-toolbar .secenek-anahtari { display: flex; flex: 1 1 100%; }
  .ted-fatura-toolbar .secenek-anahtari button { flex: 1 1 0; min-height: 44px; }
  .ted-fatura-toolbar .input { flex: 1 1 100%; width: 100%; }

  .ted-form .field-label { white-space: normal; }
  .ted-sekmeler { padding: 0 6px; }
  .tt-ted-satir, .tt-ted-satir.secimli { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .tt-ted-satir.secimli { grid-template-columns: auto minmax(0, 1fr); }
  .tt-ted-satir.secimli > .tt-ted-kutu-hucre { grid-row: 1 / span 3; padding-top: 2px; }
  .tt-toplu-dugmeler { margin-left: 0; width: 100%; }
  .tt-toplu-dugmeler > * { flex: 1 1 auto; justify-content: center; min-height: 44px; }
  .tt-ted-islem { justify-content: flex-start; }
  .tt-kalem-satir { grid-template-columns: minmax(0, 1fr) 90px auto; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .tt-kalem-satir > .input:nth-child(1) { grid-column: 1 / span 2; }
  .tt-kalem-satir > .input:nth-child(2) { grid-column: 1; grid-row: 2; }
  .tt-kalem-satir > .input:nth-child(3) { grid-column: 2; grid-row: 2; }
  .tt-kalem-satir > .input:nth-child(4) { grid-column: 1 / span 2; grid-row: 3; }
  .tt-kalem-satir > button { grid-column: 3; grid-row: 1 / span 3; }
  .tt-sonuc { margin: 0 16px 16px; }
  .tt-not { padding: 0 16px 14px; }
  .ted-kisi-satir { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .ted-kisi-satir > .input:nth-child(3), .ted-kisi-satir > .input:nth-child(4) { grid-row: 2; }
  .ted-kisi-satir > .input:nth-child(3) { grid-column: 1; }
  .ted-kisi-satir > .input:nth-child(4) { grid-column: 2; }
  .ted-kisi-satir > button { grid-column: 3; grid-row: 1 / span 2; }
}
