/* BambuMail mobil uyum katmani (v2).
   Masaustunde tamamen etkisizdir (yalnizca dar ekran media query'leri).
   styles.css'ten SONRA yuklenir ve yalnizca duzeni uyarlar. */

.m-topbar { display: none; }

@media (max-width: 880px) {

  /* ================= GENEL: tasma ve kaydirma disiplini ================= */
  /* Masaustu iskeleti ekran yuksekligine sabitli (#app 100vh) - mobilde
     icerik uzayinca sayfa buyuyemiyor ve kaydirilamiyordu. Dogal akisa donulur. */
  /* styles.css'te html/body overflow:hidden (masaustu ic-panel kaydirmasi) -
     mobilde DIKEY kaydirma acikca geri acilir, yatay kilitli kalir */
  html, body { overflow-x: hidden; overflow-y: auto !important; width: 100%; height: auto; min-height: 100%; }
  #app { display: block; height: auto !important; min-height: 100vh; }
  body { -webkit-text-size-adjust: 100%; }
  img, svg, video { max-width: 100%; }

  /* Metinler kutulardan tasmasin, kelime kirilabilsin */
  h1, h2, h3, h4, .btn, .tag, .pill, label, .muted, .empty, td, th,
  .panel-head, .view-head { overflow-wrap: anywhere; }

  /* iOS/Android odaklaninca zoom yapmasin diye form yazilari 16px olur */
  input, select, textarea, button { font-size: 16px !important; }
  .btn.small, .tag, .pill { font-size: 12px !important; }

  /* ================= iskelet: ust cubuk + cekmece kenar ================= */
  .m-topbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 900;
    background: var(--bg-2, #fff); border-bottom: 1px solid var(--line, #e5e1f0);
    padding: 0 14px;
  }
  .m-topbar button {
    background: none; border: 1px solid var(--line, #ddd); border-radius: 9px;
    width: 38px; height: 38px; font-size: 19px; cursor: pointer; color: inherit;
  }
  .m-topbar .m-title { font-weight: 800; font-size: 15px; letter-spacing: -.3px; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 950;
    width: min(280px, 84vw); flex: none;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.35);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .m-scrim { display: none; position: fixed; inset: 0; z-index: 940; background: rgba(15,10,30,.45); }
  .m-scrim.open { display: block; }

  .content { padding: 64px 10px 90px; height: auto; overflow: visible; }

  .view-head { flex-wrap: wrap; row-gap: 8px; }
  .view-head h1 { font-size: 20px; }
  .head-actions { flex-wrap: wrap; gap: 6px; width: 100%; }

  /* ================= tum cok kolonlu duzenler tek kolona ================= */
  .grid-side,
  .inbox-grid,
  .settings-layout,
  .mb-grid,
  .grid2c { display: grid; grid-template-columns: 1fr !important; gap: 12px; }

  .field-row { flex-direction: column; gap: 8px; }
  .settings-grid { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, minmax(150px, 1fr)) !important; overflow-x: auto; }

  /* Sabit yukseklikli paneller mobilde dogal akisa doner (kaydirma kilidi fix) */
  .view .panel { height: auto !important; }
  .mb-grid { height: auto !important; }
  .mb-grid .panel { height: auto !important; }

  /* ================= AYARLAR: kategoriler ustte yatay serit ================= */
  .settings-layout { display: block; }
  .set-nav {
    display: flex !important; flex-direction: row !important;
    overflow-x: auto; gap: 6px; padding: 4px 2px 10px;
    position: static; width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .set-nav .set-cat {
    flex: 0 0 auto; white-space: nowrap;
    border: 1px solid var(--line, #ddd); border-radius: 999px;
    padding: 8px 14px !important; width: auto !important;
  }
  .set-content { width: 100%; }

  /* ================= POSTA KUTUSU: dikey akis ================= */
  .mb-folders-panel .panel-body.list { max-height: 170px; overflow-y: auto; }
  .mb-list-panel .panel-body.list { max-height: 46vh; overflow-y: auto; }
  .mb-read-panel .panel-body.mb-read { max-height: none; overflow: visible; }

  /* ================= SABLONLAR / CEVAPLAR listeleri ================= */
  .grid-side > .panel:first-child .panel-body,
  .inbox-grid > .panel:first-child .panel-body { max-height: 44vh; overflow-y: auto; }

  /* ================= tablolar panel icinde yatay kayar ================= */
  .panel-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel-body table { min-width: 620px; }

  .toolbar, .filters, .panel-head { flex-wrap: wrap; row-gap: 8px; }

  /* ================= GIRIS EKRANI: mobil kart ================= */
  .login-screen {
    flex-direction: column; overflow-y: auto;
    background: linear-gradient(160deg, #2e1065, #6d28d9 70%, #8b5cf6);
    justify-content: center; padding: 24px 0;
  }
  .ls-left { display: none; }
  .ls-right { width: 100%; padding: 12px 18px; background: transparent; display: block; }
  .ls-card {
    width: 100%; max-width: 400px; margin: 0 auto;
    background: var(--panel, #fff); border-radius: 20px;
    padding: 26px 22px; box-shadow: 0 30px 70px rgba(10,5,30,.45);
  }
  .ls-card h2 { font-size: 20px; }
  #ls-back { top: 10px !important; left: 12px !important; }

  /* Mobilde masaustu kurulum dugmeleri anlamsiz - gizlenir */
  #btn-dl-app, #ls-dl { display: none !important; }

  /* ================= KULLANIM TURU: alt bilgi karti ================= */
  #tour-hl { display: none !important; }
  #tour-pop {
    position: fixed !important;
    left: 12px !important; right: 12px !important; bottom: 14px !important;
    top: auto !important; width: auto !important; max-width: none !important;
  }

  /* ================= cekmece ve modallar ================= */
  .drawer { width: 100vw !important; max-width: 100vw !important; }
  .modal-card, .pwiz { width: min(560px, 94vw) !important; max-height: 90vh; overflow-y: auto; }
  .pwiz-body { max-height: 52vh !important; }

  .sp-kpis { flex-wrap: wrap; gap: 8px; }

  /* Firma tablosu ustu sayac kartlari sar */
  .lead-counts, .counts, .stat-row { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 480px) {
  .pipeline { grid-template-columns: 1fr !important; }
  .content { padding: 60px 8px 80px; }
  .view-head h1 { font-size: 18px; }
}
