/* K10 bolmesi: components.css 3/3 — modal, yardimcilar, async buton geri bildirimi */
@layer components {
  /* ---- modal (Tahsilat gir — Müşteri Detay mockup'ı) ---- */
  .modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(22, 24, 43, .4);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .modal-card {
    width: 440px;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 40px 90px -30px rgba(22, 24, 43, .5);
  }
  .modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 0;
  }
  .modal-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
  .modal-sub { font-size: var(--text-sm); color: var(--muted); margin-top: 2px; }
  .modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 22px 20px;
  }
  .amt-card {
    background: var(--bg);
    border: 1px solid rgba(22, 24, 43, .08);
    border-radius: var(--r-card);
    padding: 16px 18px;
    text-align: center;
  }
  .amt-card .lbl { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
  .amt-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 6px; }
  .amt-in {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 34px;
    letter-spacing: -.02em;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: none;
    text-align: center;
    width: 100%;
    max-width: 220px;
  }
  .amt-cur { font-size: 15px; font-weight: 700; color: var(--muted); flex: none; }
  .amt-chips { display: flex; justify-content: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
  .amt-chip {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid rgba(22, 24, 43, .1);
    border-radius: var(--r-pill);
    padding: 4px 11px;
    cursor: pointer;
  }
  .amt-chip.active { color: var(--primary); background: var(--primary-soft); border-color: transparent; }

  /* bekleyenler AI kart-tablosu (Gelen Faturalar / Teklifler) */
  .ai-panel {
    position: relative;
    overflow: hidden;
    background: var(--banner-grad);
    border: 1px solid var(--banner-border);
    border-radius: var(--r-lg);
    padding: 14px 18px 2px;
    box-shadow: var(--shadow-card);
  }
  .ai-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 10px;
  }
  .ai-panel-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
  }
  .ai-panel-title span {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .ai-panel .tgrid { padding-inline: 2px; border-bottom: 0; border-top: 1px solid var(--banner-line); }
  .ai-panel .tbl-foot { background: transparent; padding: 8px 2px 10px; border-top: 1px solid var(--banner-line); }
  .ai-panel .scroll-x { overflow-x: auto; }

  .btn-row-cta {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--grad-primary);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    cursor: pointer;
    border: 0;
    box-shadow: 0 8px 16px -8px rgba(79, 70, 229, .5);
    flex: none;
  }
  .btn-row-ghost {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    cursor: pointer;
    border: 0;
    flex: none;
  }
  .btn-row-ghost[disabled], .btn-row-cta[disabled] { opacity: .55; cursor: not-allowed; }

  /* ---- yardımcılar ---- */
  .muted { color: var(--muted); }
  .faint { color: var(--faint); }
  .num { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }

  /* ============================================================
     RESPONSIVE KABUK — kaynak: "Fynex Asistan Geliştirmesi" mockup'ı
     Kademeler: mobil ≤640, tablet 641-1024, masaüstü ≥1025.
     Kompakt modda (mobil+tablet) sidebar çekmeceye dönüşür; üstte
     hamburger'lı mobil bar çıkar. Mockup viewport'u JS ile ölçer
     (Design kısıtı); burada aynı davranış CSS media ile — JS yalnız
     çekmece aç/kapa ve AI pili çarpışma koruması.
     ============================================================ */
  .mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 16px 0;
    width: 100%;
  }
  .hamburger {
    width: 34px;
    height: 34px;
    border-radius: var(--r-nav);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    background: var(--surface);
    border: 1px solid rgba(22, 24, 43, .08);
    box-shadow: 0 3px 10px -4px rgba(22, 24, 43, .18);
    cursor: pointer;
    flex: none;
  }
  .hamburger i {
    width: 15px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
  }
  /* ortada şirket değiştirici: ad + dönen ok; sağda yalnız FY logosu */
  .company-switch {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 0;
  }
  .company-switch-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .company-switch-chevron {
    font-size: 9px;
    color: var(--faint);
    flex: none;
    transition: transform .18s ease;
  }
  body.company-menu-open .company-switch-chevron { transform: rotate(180deg); }
  .topbar-logo {
    width: 30px;
    height: 30px;
    border-radius: var(--r-btn);
    font-size: 11px;
    box-shadow: var(--shadow-logo);
  }

  .company-menu-wrap {
    position: fixed;
    inset: 0;
    z-index: 75;
    pointer-events: none;
  }
  body.company-menu-open .company-menu-wrap { pointer-events: auto; }
  .company-menu {
    position: absolute;
    top: 56px;
    left: 50%;
    width: 240px;
    background: var(--surface);
    border-radius: var(--r-card);
    padding: 8px;
    box-shadow: var(--shadow-menu);
    opacity: 0;
    transform: translateX(-50%) translateY(-6px) scale(.97);
    transition: opacity .16s ease, transform .16s ease;
  }
  body.company-menu-open .company-menu { opacity: 1; transform: translateX(-50%); }
  .company-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    border-radius: var(--r-btn);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
  }
  .company-menu-item:hover { background: var(--surface-muted); }
  .company-menu-item .name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .company-menu-item .check { color: var(--primary); font-weight: 700; flex: none; }

  .nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(22, 24, 43, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

  @media (max-width: 1024px) {
    .mobile-topbar { display: flex; }
    /* daralt/genişlet tutamacı masaüstü-özeldir; çekmecede yok (drawer-close var).
       Collapse kuralları min-width:1025'te olduğundan çekmece daima genişletilmiş
       görünür — sidebar-collapsed durumu mobile taşınmaz. */
    .nav-collapse-toggle { display: none; }
    .sidebar {
      position: fixed;
      inset: 0 auto 0 0;
      z-index: 100;
      width: min(270px, 82vw); /* çekmece masaüstü sidebar'dan geniş (mockup) */
      transform: translateX(-105%);
      transition: transform .22s ease;
      box-shadow: 0 24px 60px -20px rgba(22, 24, 43, .45);
      overflow-y: auto;
    }
    body.nav-open .sidebar { transform: none; }
    .shell { flex-direction: column; }
    .shell-main { padding: 22px 24px 90px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    /* 3c mobil (2a): çekmecede sidebar-foot içindeki kompakt şirket satırı
       (org-row: avatar + ad + çıkış ikonu) altta sabit kalır; üst barda ayrıca
       company-switch var. Dokunma hedefleri büyür (11px dolgu = ~44px). */
    .drawer-close { display: flex; }
    .nav-item { padding: 11px 12px; font-size: 14.5px; }
    .nav-item.active { padding-block: 11px; }
  }
  @media (max-width: 640px) {
    .shell-main { padding: 18px 16px 90px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .btn-primary { padding: 9px 15px; font-size: var(--text-sm); }
    .page-title { font-size: 23px; }
    .ai-fab .name { display: none; }
  }

  /* AI pili çarpışma koruması: içerik pilin altına girdiğinde soldur */
  .ai-fab.dodge { opacity: 0; pointer-events: none; transition: opacity .18s ease; }
  .ai-fab { transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease; }
  /* dock açıkken pil gizlenir (mockup: pillVisible = !dockOpen) */
  body.dock-open .ai-fab { opacity: 0; pointer-events: none; }

  /* Kompakt modda FAB KALICI olmalı: çarpışma-koruması (dodge) masaüstü
     içindir; mobilde içerik zaten 90px alt boşluk bırakır (pil içeriği
     örtmez) ve tam-genişlik/uzun KPI grid'i dodge bölgesini sürekli
     tetikleyip FAB'ı gizlerdi. dock açıkken gizleme (üstteki, daha özgül
     kural) korunur. */
  @media (max-width: 1024px) {
    .ai-fab.dodge { opacity: 1; pointer-events: auto; }
  }
}


/* --- Async buton geri bildirimi: donen halka + basma efekti --- */
/* Zemin-BAĞIMSIZ halka (2026-07-29 düzeltmesi): eski sabit-beyaz tanım koyu
   zeminli .btn-primary için doğruydu, açık zeminli link/row-cta butonlarında
   GÖRÜNMEZDİ (pasife-al vakası — spinner DOM'daydı, beyaz-üstü-beyazdı).
   currentColor her butonda metin rengini alır; buton-türü istisnası gerekmez. */
.btn-spin {
  width: 12px; height: 12px; box-sizing: border-box;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; display: inline-block; margin-left: 8px;
  vertical-align: -2px; animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
/* Sonuç geçişi (08 §8.7): hedefli yama ile gelen yeni içerik yumuşak belirir —
   CSS-only, tek seferlik; layout'u oynatmaz (transform+opacity, compositor işi). */
.sonuc-gecis { animation: sonuc-gecis .32s ease; }
@keyframes sonuc-gecis { from { opacity: 0; transform: translateY(-2px); } }
button[data-busy] { opacity: .78; cursor: progress; }
.btn-primary:active:not(:disabled), .btn-ghost:active:not(:disabled),
.btn-row-primary:active:not(:disabled), .btn-row-ghost:active:not(:disabled),
.act-btn:active { transform: translateY(1px) scale(.985); }
