/* Ana Sayfa (dashboard) modül stilleri — sahibi: public/js/dashboard.js
   Ortak bileşenler (.card, .kpi-card, .quick-action, .alert-list, .activity-list, .chart, .data-table…) styles.css'tedir;
   burada yalnızca panoya özgü yerleşim ve ince ayarlar var. Değişkenler: styles.css :root.

   Yerleşim, panonun KENDİ genişliğine göre seçilir (container query; yan menü açık / çekmece fark etmez):
     > 1010 px   tasarım referansı: 6 KPI · sol 2×2 [Ciro | Durum] / [Aktiviteler | Teklifler]
                 + sağ sütun [Hızlı İşlemler · Uyarılar] (bağımsız yığılır; iki sütunun alt kenarı hizalanır,
                 fazla yükseklik grafik satırına ya da uyarı kartına gider)
     661–1010    3 KPI sütunu · 2 sütun: [Ciro | Durum] / [Hızlı İşlemler | Uyarılar] / [Aktiviteler | Teklifler]
     ≤ 660       2 KPI sütunu · tek sütun, referanstaki satır sırasıyla (Ciro, Durum, Hızlı, Aktiviteler, Teklifler, Uyarılar)
     ≤ 330       KPI tek sütun */

.dashboard-page { display: flex; flex-direction: column; min-width: 0; }
.dash-body { container: dash-govde / inline-size; min-width: 0; }

/* Ekran okuyucuya özel metin (KPI değişiminin açıklaması) */
.dash-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- Sayfa başlığı */
/* Referanstaki gibi zeminsiz, büyük yeşil çubuk grafik */
.dashboard-page > .page-head .ph-icon { background: none; }
.dashboard-page > .page-head .ph-icon svg { width: 44px; height: 44px; }
.dash-guncel { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-refresh { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.dash-refresh-icon { display: inline-flex; }
.dash-refresh-icon svg { width: 18px; height: 18px; }
.dash-refresh.is-loading .dash-refresh-icon svg { animation: dash-don 0.9s linear infinite; }
@keyframes dash-don { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- KPI kartları */
/* Kartlar eşit genişlikte: etiket ve değer yazı boyları kart genişliğinden (cqi) hesaplanır, altı kartta aynı kalır */
.kpi-grid.dash-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-kpis .kpi-card { container: dash-kpi / inline-size; padding: 18px 18px 16px; gap: 4px; }
.dash-kpis .kpi-icon { width: 40px; height: 40px; margin-bottom: 10px; }
/* Etiket tek satır: en uzun etiket ("Onaylanan Teklifler", Inter 500) ≈ 9,2 em → boy = iç genişlik / 9,4 */
.dash-kpis .kpi-label {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(12px, calc(100cqi / 9.4), 14.5px); font-weight: 500; color: var(--ink); line-height: 1.3;
}
/* Değer: --dash-em = satırdaki en geniş değerin em genişliği (dashboard.js yazar) → hepsi aynı boyda, taşmaz */
.dash-kpis .kpi-value { font-size: clamp(15px, calc(100cqi / var(--dash-em, 5.6)), 28px); letter-spacing: -0.5px; margin-top: 2px; }
.dash-kpis .dash-unit { font-size: 0.74em; letter-spacing: 0; }
.dash-kpis .kpi-card.dash-negatif .kpi-value { color: var(--danger); }
.dash-kpis .kpi-delta { margin-top: 2px; }
.dash-kpi-disk .kpi-icon svg { width: 28px; height: 28px; }      /* beyaz disk içinde ikon (onay, ₺) */
.dash-kpi-daire .kpi-icon { border-radius: 50%; }                /* Bu Ay Ciro: yuvarlak ikon */

.dash-kpis a.kpi-card { color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.dash-kpis a.kpi-card:hover { border-color: var(--line-hover); box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 8px 18px rgba(15, 23, 42, 0.07); text-decoration: none; }
.dash-kpis a.kpi-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Değişim satırı: ↑ %20 yeşil · ↓ %12 kırmızı · – %0 gri */
.dash-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; line-height: 1.2; }
.dash-delta.up { color: var(--success); }
.dash-delta.down { color: var(--danger); }
.dash-delta.flat { color: var(--muted); }
.dash-delta-ok { display: inline-flex; }
.dash-delta-ok svg { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- Ana ızgara (referans yerleşimi) */
.dash-main { display: grid; grid-template-columns: minmax(0, 2.86fr) minmax(272px, 1fr); gap: 16px; align-items: stretch; min-width: 0; }
.dash-sol { display: grid; grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr); grid-template-rows: 1fr auto; gap: 16px; min-width: 0; }
.dash-sag { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-sag > .dash-uyari { flex: 1 1 auto; }

.dash-card { min-width: 0; }
.dash-card .card-head { padding: 16px 20px 10px; min-height: 54px; }
.dash-card .card-head h3 { font-size: 16.5px; }
.dash-card-icon { display: inline-flex; }
.dash-card .card-head h3 .dash-card-icon svg { width: 18px; height: 18px; color: var(--heading); }
.dash-card .card-body { flex: 1 1 auto; }

/* "Tümünü Gör": küçük görünür, dokunma hedefi 44 px (negatif kenar boşluğu başlık yüksekliğini bozmaz) */
.dash-card .card-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; margin: -12px -8px;
  background: none; border: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--blue);
  cursor: pointer; border-radius: var(--radius-sm); text-decoration: none; white-space: nowrap;
}
.dash-card .card-link:hover { color: #17559A; background: var(--hover-bg); text-decoration: none; }
.dash-card .card-link:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Boş liste ("Henüz kayıt yok.") */
.dash-empty { padding: 26px 0 16px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------------------------------------------------------------- Son 6 aylık ciro */
/* Grafik kutusu içerikten bağımsız boyutlanır (SVG mutlak konumlu): ResizeObserver döngüye girmez */
.dash-chart-govde { display: flex; flex-direction: column; padding-bottom: 12px; }
.dash-chart-host { position: relative; flex: 1 1 auto; min-height: 200px; }
.dash-chart { position: absolute; inset: 0; }
.dash-chart-bos {
  position: absolute; inset: 0 0 34px 0; display: flex; align-items: center; justify-content: center;
  padding: 0 16px; text-align: center; color: var(--muted); font-size: 14px; pointer-events: none;
}
.dash-chart-bos > span { padding: 4px 12px; border-radius: 999px; background: var(--panel); }   /* ızgara çizgisi metnin üstünü çizmesin */

/* ---------------------------------------------------------------- İş emirlerinin durumu */
.dash-durum { container: dash-durum / inline-size; }
.dash-donut-govde { display: flex; align-items: center; justify-content: center; }
.dash-donut { display: flex; align-items: center; justify-content: center; gap: 24px; width: 100%; }
.dash-donut .chart-donut { flex: 0 0 auto; width: auto; }
.dash-donut .chart-donut svg { width: 156px; height: 156px; }
.dash-donut .legend-list { flex: 1 1 0; min-width: 0; max-width: 230px; }
.dash-donut .legend-row { padding: 8px 0; font-size: 14px; }
.dash-donut .legend-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container dash-durum (max-width: 339px) {
  .dash-donut { gap: 16px; }
  .dash-donut .chart-donut svg { width: 128px; height: 128px; }
  .dash-donut .legend-row { font-size: 13.5px; }
}
@container dash-durum (max-width: 290px) {
  .dash-donut { flex-direction: column; gap: 10px; }
  .dash-donut .legend-list { flex: none; width: 100%; max-width: none; }
}

/* ---------------------------------------------------------------- Hızlı işlemler */
.dash-hizli .card-body { padding-top: 4px; }
.dash-hizli .quick-actions { gap: 10px; }
.dash-hizli .quick-action { min-height: 46px; }

/* ---------------------------------------------------------------- Son aktiviteler (+ "Tümünü Gör" penceresi) */
.dash-aktivite .activity-list { margin: 0 -10px; }
.dash-aktivite .activity-row, .dash-feed-list .activity-row { padding: 9px 10px; gap: 12px; }
.dash-aktivite .activity-icon, .dash-feed-list .activity-icon { width: 38px; height: 38px; border-radius: var(--radius); }
/* Kartta referanstaki gibi tek satır (tam metin: satırın title'ı ve "Tümünü Gör" penceresi); telefonda iki satır */
.dash-aktivite .activity-text { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-feed-list .activity-text { font-size: 14px; }
.dash-aktivite .activity-row > .pill, .dash-feed-list .activity-row > .pill { min-width: 58px; justify-content: center; }
a.dash-link-row { color: inherit; text-decoration: none; cursor: pointer; transition: background-color 0.15s; }
a.dash-link-row:hover { background: var(--hover-bg); color: inherit; text-decoration: none; }
a.dash-link-row:hover .activity-text { color: var(--primary-d); }
a.dash-link-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius-sm); }
.dash-feed-modal { min-height: 140px; }
/* .modal-backdrop bir "auto" ızgara sütunu: sekme çubuğunun tek satırlık genişliği pencereyi telefonda ekrandan
   taşırırdı. inline-size kapsaması çubuğun içsel genişliğini sıfırlar; çubuk pencere genişliğinde kalıp kayar. */
.dash-feed-modal .tabbar { margin-bottom: 6px; contain: inline-size; }
.dash-feed-not { margin: 6px 0 4px; }

/* ---------------------------------------------------------------- Son teklifler */
/* Kart dar olunca (bkz. @container) Müşteri sütunu gizlenir, müşteri adı teklif numarasının altına iner */
.dash-teklif { container: dash-teklif / inline-size; }
.dash-teklif-govde { display: flex; flex-direction: column; }
.dash-teklif .table-wrap { flex: 1 1 auto; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
.dash-teklif .data-table { font-size: 13px; }
.dash-teklif .data-table th { background: var(--surface-2); font-size: 12px; padding: 10px 12px; white-space: nowrap; }
.dash-teklif .data-table td { padding: 8px 12px; height: 50px; vertical-align: middle; }
.dash-teklif .data-table th:first-child, .dash-teklif .data-table td:first-child { padding-left: 20px; }
.dash-teklif .data-table th:last-child, .dash-teklif .data-table td:last-child { padding-right: 20px; }
.dash-teklif .data-table .empty-cell { height: auto; padding: 28px 16px; text-align: center; color: var(--muted); }
.dash-teklif-no { font-weight: 600; color: var(--heading); white-space: nowrap; text-decoration: none; }
.dash-teklif-no:hover { color: var(--primary-d); text-decoration: underline; }
.dash-teklif-no:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
.dash-teklif td.dash-col-musteri > span { display: block; max-width: 15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-teklif td.dash-col-tutar { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-teklif .dash-col-durum { white-space: nowrap; }
.dash-alt-musteri { display: none; }
@container dash-teklif (max-width: 459px) {
  .dash-teklif .dash-col-musteri { display: none; }
  .dash-alt-musteri {
    display: block; max-width: 14em; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 12px; font-weight: 400; color: var(--muted);
  }
}
@container dash-teklif (max-width: 340px) {
  .dash-teklif .data-table { font-size: 12px; }
  .dash-teklif .data-table th, .dash-teklif .data-table td { padding-left: 6px; padding-right: 6px; }
  /* table. öneki: dosya sonundaki telefon kuralını (aynı özgüllük, sonra gelir) ezer */
  .dash-teklif table.data-table th:first-child, .dash-teklif table.data-table td:first-child { padding-left: 10px; }
  .dash-teklif table.data-table th:last-child, .dash-teklif table.data-table td:last-child { padding-right: 10px; }
  .dash-teklif .dash-col-durum .pill { padding-left: 8px; padding-right: 8px; }
}

/* ---------------------------------------------------------------- Bekleyen işler / uyarılar */
.dash-uyari .alert-row { padding: 8px 0; gap: 10px; }
.dash-uyari a.alert-row { color: var(--ink); text-decoration: none; }
.dash-uyari a.alert-row:hover .alert-text { color: var(--primary-d); }
.dash-uyari a.alert-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: var(--radius-sm); }
.dash-uyari .alert-text { font-size: 13.5px; }
.dash-uyari .dash-amber .alert-dot, .dash-uyari .dash-amber .alert-count { --tone: var(--warning); }
.dash-uyari .alert-row.is-zero .alert-text { color: var(--muted); }
.dash-uyari .alert-row.is-zero .alert-dot { opacity: 0.35; }
.dash-uyari .alert-row.is-zero .alert-count { background: var(--tone-gray-soft); color: var(--muted); }

/* ---------------------------------------------------------------- Yükleme iskeleti */
.dash-isk {
  display: block; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--tone-gray-soft) 0%, var(--surface-2) 50%, var(--tone-gray-soft) 100%);
  background-size: 200% 100%; animation: dash-isk 1.3s ease-in-out infinite;
}
@keyframes dash-isk { from { background-position: 100% 0; } to { background-position: 0 0; } }
.dash-kpis .dash-isk-ikon { width: 40px; height: 40px; border-radius: var(--radius-lg); margin-bottom: 10px; }
.dash-isk-satir { width: 72%; height: 14px; }
.dash-isk-deger { width: 52%; height: 26px; margin-top: 6px; }
.dash-isk-blok { padding: 18px 20px; gap: 16px; }
.dash-isk-baslik { width: 42%; height: 18px; }
.dash-isk-govde { flex: 1 1 auto; min-height: 190px; }
.dash-isk-blok.dash-ciro .dash-isk-govde { min-height: 210px; }
.dash-isk-blok.dash-hizli .dash-isk-govde { min-height: 270px; }
.dash-isk-blok.dash-aktivite .dash-isk-govde, .dash-isk-blok.dash-teklif .dash-isk-govde { min-height: 280px; }
@media (prefers-reduced-motion: reduce) {
  .dash-isk, .dash-refresh.is-loading .dash-refresh-icon svg { animation: none; }
}

/* ---------------------------------------------------------------- Duyarlı düzen (panonun genişliğine göre) */
@container dash-govde (max-width: 1010px) {
  .kpi-grid.dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-sol, .dash-sag { display: contents; }
  .dash-ciro { order: 1; }
  .dash-durum { order: 2; }
  .dash-hizli { order: 3; }
  .dash-uyari { order: 4; }
  .dash-aktivite { order: 5; }
  .dash-teklif { order: 6; }
  /* Dar kartta tek satır çok kısalır (tablette title ipucu da yok): iki satır */
  .dash-aktivite .activity-text {
    white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  }
}
@container dash-govde (max-width: 660px) {
  .kpi-grid.dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
  .dash-kpis .kpi-card { padding: 14px 14px 12px; }
  .dash-kpis .kpi-icon, .dash-kpis .dash-isk-ikon { width: 36px; height: 36px; margin-bottom: 6px; }
  .dash-main { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dash-aktivite { order: 4; }
  .dash-teklif { order: 5; }
  .dash-uyari { order: 6; }
  .dash-card .card-head { padding: 14px 16px 8px; min-height: 50px; }
  .dash-card .card-body:not(.flush) { padding: 0 16px 14px; }
  .dash-aktivite .activity-list { margin: 0 -8px; }
  .dash-aktivite .activity-row { padding: 9px 8px; }
  .dash-teklif .data-table th:first-child, .dash-teklif .data-table td:first-child { padding-left: 16px; }
  .dash-teklif .data-table th:last-child, .dash-teklif .data-table td:last-child { padding-right: 16px; }
  .dash-chart-host { min-height: 190px; }
}
@container dash-govde (max-width: 330px) {
  .kpi-grid.dash-kpis { grid-template-columns: minmax(0, 1fr); }
}
