/* ============================================================
   Page: cari detay (müşteri / tedarikçi)
   ============================================================ */
.cari-back { display: inline-block; font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--space-3); }
.cari-back:hover { color: var(--brand); }

/* Liste bakiye kolonu — müşteri alacak (turuncu) / tedarikçi borç (kırmızı) / avans (yeşil) */
.bal-credit { color: var(--brand); font-weight: 600; }
.bal-debt   { color: var(--red);   font-weight: 600; }
.bal-advance { color: var(--green); font-weight: 600; }
/* Cari ekstresi hareket tutarı (işaretli+renkli): alacaklanma +yeşil / borçlanma −kırmızı */
.ekstre-amt-up   { color: var(--green); font-weight: 600; }
.ekstre-amt-down { color: var(--red);   font-weight: 600; }

/* Cari Bakiye kartında yön etiketi (Alacak / Borç / Avans) */
.cari-bal-dir { display: inline-block; margin-left: 8px; font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); vertical-align: middle; }

/* Çek/Senet sekmesi açık-özet barı */
.cari-cek-ozet { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); font-size: var(--fs-sm); }
.cari-cek-ozet .stb-count { font-weight: 700; color: var(--text-muted); }
.cari-cek-ozet .stb-net { font-weight: 700; color: var(--text); }

.cari-head {
  display: flex; align-items: center; gap: var(--space-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: var(--space-5); margin-bottom: var(--space-4);
}
.cari-avatar { display: grid; place-items: center; width: 50px; height: 60px; border-radius: 14px; background: var(--navy); color: #fff; font-size: 20px; font-weight: 800; flex-shrink: 0; }
.cari-head-info { flex: 1; min-width: 0; }
.cari-head-info h2 { font-size: var(--fs-xl); }
.cari-head-meta { font-size: var(--fs-sm); color: var(--text-muted); }

/* Başlık eylem kümesi (Tahsilat/Ödeme · Düzenle · Diğer) */
.cari-head-actions { display: flex; align-items: stretch; gap: var(--space-2); flex-shrink: 0; }
.cari-head-actions .btn { height: 40px; }
.cari-head-actions .btn svg { margin: 0; }
.cari-bal { text-align: right; }
.cari-bal-label { display: block; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.cari-bal-val { font-size: var(--fs-xl); font-weight: 800; color: var(--brand); }

.cari-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--space-4); flex-wrap: wrap; }
.cari-tab { padding: 10px var(--space-4); font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cari-tab:hover { color: var(--text); }
.cari-tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }

.cari-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); border-radius: var(--radius-sm); }

.cari-tab-body { min-height: 200px; }

/* Özet kartlar: masaüstünde 4'lü tek satır (mobilde global 2×2 kalır) */
@media (min-width: 760px) { #cariCards { grid-template-columns: repeat(4, 1fr); } }

/* Diğer İşlemler dropdown (başlık eylem kümesinde) */
.cari-diger { position: relative; }
.cari-diger-trigger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.cari-diger-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); }
.cari-diger-trigger:hover { color: var(--brand); border-color: var(--brand); }
.cari-diger-lead { color: var(--text-muted); transition: color .15s; }
.cari-diger-trigger:hover .cari-diger-lead { color: var(--brand); }
.cari-diger-caret { transition: transform .15s; }
.cari-diger.is-open .cari-diger-trigger { color: var(--brand); border-color: var(--brand); }
.cari-diger.is-open .cari-diger-lead { color: var(--brand); }
.cari-diger.is-open .cari-diger-caret { transform: rotate(180deg); }
.cari-diger-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 240px;
  display: none; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.cari-diger.is-open .cari-diger-menu { display: flex; }
.cari-diger-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 600; color: var(--text); text-align: left;
  transition: background .12s;
}
.cari-diger-item svg { flex: 0 0 auto; color: var(--text-muted); }
.cari-diger-item:hover { background: var(--surface-alt); }
.cari-diger-item--danger { color: var(--red); }
.cari-diger-item--danger svg { color: var(--red); }
.cari-diger-item:disabled { opacity: .5; cursor: default; }
.cari-diger-item:disabled:hover { background: transparent; }

/* Ekstre araç çubuğu (Yazdır · PDF · Mutabakat) */
.ekstre-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: var(--space-3); }
.ekstre-tool {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-muted);
  cursor: pointer; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em;
  transition: border-color .15s, color .15s;
}
.ekstre-tool:hover { border-color: var(--brand); color: var(--brand); }
.ekstre-tool:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); border-color: var(--brand); }
.ekstre-tool--ghost:hover { border-color: var(--text-muted); color: var(--text); }
.ekstre-tool:disabled { opacity: .55; cursor: default; }
.ekstre-tool:disabled:hover { border-color: var(--border); color: var(--text-muted); }

/* Ekstre ekran-içi tarih aralığı filtresi */
.ekstre-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-3); }
.ekstre-filter-lbl { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.ekstre-filter-date { height: 34px; max-width: 160px; padding: 0 8px; }
.ekstre-filter-sep { color: var(--text-muted); }

/* Ekstre satırı: Geri Al butonu + ters/iptal kayıt görünümü */
.ekstre-act { text-align: right; }
.ekstre-undo {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.ekstre-undo:hover { border-color: var(--red); color: var(--red); }
.ekstre-undo:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-glow); border-color: var(--red); }

/* Ekstre bakiye kolonu: mutlak değer + yön etiketi (Alacak/Borç/Avans) */
.ekstre-bal-dir { display: inline-block; margin-left: 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); }
.ekstre-reversed-tag { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); font-style: italic; }
.ekstre-reversed td { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-muted); }
.ekstre-reversed td.ekstre-act { text-decoration: none; }
.ekstre-reversal td { color: var(--text-muted); font-style: italic; }
.ekstre-devir td { background: var(--surface-alt); font-style: italic; color: var(--text-muted); }

@media (max-width: 560px) {
  .cari-head { flex-wrap: wrap; }
  .cari-bal { text-align: left; }
  .cari-head-actions { width: 100%; }
  .cari-head-actions .btn { flex: 1; }
}

/* — Kargo Etiketi modalı (cari-detay; müşteri+tedarikçi ortak) — */
.ke-wrap { display: flex; flex-direction: column; gap: var(--space-3); }
.ke-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.ke-field { display: flex; flex-direction: column; gap: 4px; }
.ke-tpl-lbl { font-size: var(--text-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.ke-tpl-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ke-tpl-chip { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 6px 12px; font-size: var(--text-sm); cursor: pointer; transition: border-color .15s, color .15s; }
.ke-tpl-chip:hover { border-color: var(--brand); color: var(--brand); }
.ke-tpl-chip.is-active { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); font-weight: 600; box-shadow: 0 0 0 1px var(--brand) inset; }
.ke-tpl-hint { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.ke-tpl-hint a { color: var(--brand); font-weight: 600; }
.ke-preview { border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-alt); padding: var(--space-3); overflow: auto; min-height: 80px; display: flex; justify-content: center; }
.ke-tpl-scale { display: inline-block; }
/* Küçük (yalnız-yazdır) kargo önizlemesi: ölçekli etiket görünür boyutuna sığar. */
.ke-preview--sm { min-height: 0; padding: var(--space-4); align-items: center; }
.ke-prev-box { position: relative; flex: 0 0 auto; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.14); }
.ke-prev-scale { position: absolute; top: 0; left: 0; }
.ke-tpl-name { font-size: var(--text-sm); font-weight: 700; color: var(--text); }
.ke-empty { text-align: center; color: var(--text-muted); font-size: var(--text-sm); padding: var(--space-5) var(--space-3); line-height: 1.6; }
.ke-empty a { color: var(--brand); font-weight: 600; }
@media (max-width: 560px) { .ke-grid { grid-template-columns: 1fr; } }

/* CRM aktivite sekmesi (cari-detay) */
.cari-akt-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; flex-wrap: wrap; }
.cari-akt-count { font-size: var(--text-sm); color: var(--text-muted); font-weight: 600; }
.cari-akt-list { display: flex; flex-direction: column; gap: var(--space-2); }
.cari-akt-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3); }
.cari-akt-top { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.cari-akt-date { font-size: var(--text-sm); color: var(--text-muted); }
.cari-akt-by { font-size: var(--text-xs); color: var(--text-muted); background: var(--surface-alt); border-radius: var(--radius-full); padding: 1px var(--space-2); }
.cari-akt-del { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-muted); display: inline-flex; padding: 2px; border-radius: var(--radius-sm); }
.cari-akt-del:hover { color: var(--red); background: var(--row-hover); }
.cari-akt-del svg { width: 16px; height: 16px; }
.cari-akt-note { margin-top: var(--space-2); font-size: var(--text-sm); white-space: pre-wrap; line-height: 1.5; }
.cari-akt-fu { display: inline-block; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--blue); font-weight: 600; }
.cari-akt-fu.overdue { color: var(--red); }
.cari-akt-fu.done { color: var(--green); }
.cari-akt-fudone { margin-left: 4px; background: none; border: 1px solid currentColor; color: inherit; border-radius: var(--radius-full); font-size: var(--text-xs); padding: 0 var(--space-2); cursor: pointer; }
