/* ================= Telefon görünümü =================
   760 pikselden dar ekranlarda: sol menü kenardan açılır, tablolar karta dönüşür, sütunlar yana kaydırılır. */

.mobile-bar, .side-back { display: none; }

@media (max-width: 760px) {
  html, body { font-size: 15px; }
  .app { height: 100dvh; }
  input, select, textarea { font-size: 16px; } /* iPhone'un yazarken sayfayı büyütmesini engeller */

  /* Sol menü: menü düğmesiyle kenardan açılır */
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 84vw; max-width: 310px; z-index: 40; transform: translateX(-102%); transition: transform .22s ease; }
  .app.nav-open .sidebar { transform: none; box-shadow: 0 0 40px #000b; }
  .app.kp-collapsed .sidebar { display: flex; }
  .side-back { display: block; position: fixed; inset: 0; background: #0009; z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.nav-open .side-back { opacity: 1; pointer-events: auto; }
  .mobile-bar { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 8px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex: none; }
  .mobile-bar .icon-btn { width: 40px; height: 40px; }
  .mobile-bar .icon-btn svg { width: 22px; height: 22px; }
  .mobile-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kp-handle { display: none; }
  .nav-item { padding: 10px 10px; }

  /* Sayfa başlıkları */
  .main-head { height: auto; min-height: 46px; flex-wrap: wrap; padding: 6px 10px; gap: 6px 8px; }
  .main-head h2 { display: none; } /* sayfa adı üst çubukta yazıyor */
  .main-head .head-ico, .main-head .topic { display: none; }
  .btn { padding: 9px 14px; }
  .btn.small { padding: 7px 11px; }

  /* Sohbet */
  .msg { padding: 4px 10px; gap: 8px; }
  .msg .avatar { width: 32px; height: 32px; }
  .msg .gutter { width: 32px; }
  .msg-actions { display: flex; position: static; margin-left: auto; align-self: flex-start; background: transparent; border: 0; opacity: .55; }
  .composer { margin: 0 8px 8px; }
  .attachment img, .attachment video { max-width: 100%; }
  .pdf-att { width: 100%; }
  .typing { padding: 0 12px; }

  /* Filtreler */
  .toolbar { padding: 8px 10px; gap: 6px; }
  .toolbar .search, #board-search { min-width: 0; flex: 1 1 45%; }
  #board-search { flex-basis: 100%; }

  /* İş panosu tablosu → kartlar */
  .task-table:not(.compact) thead { display: none; }
  .task-table:not(.compact), .task-table:not(.compact) tbody { display: block; width: 100%; }
  .task-table:not(.compact) tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 8px 10px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
  .task-table:not(.compact) td { display: block; border: 0; padding: 0; min-width: 0; }
  .task-table:not(.compact) td.t-title { grid-column: 1 / -1; min-width: 0; font-size: 15px; }
  .task-table:not(.compact) td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--text-3); margin-bottom: 2px; }
  .cell-select { max-width: 100%; width: 100%; }

  /* Kart görünümü: sütunlar yana kaydırılır */
  .board { grid-template-columns: repeat(4, 86vw); padding: 10px; scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }

  /* Takvim: işler renkli çizgi olarak görünür, güne dokununca açılır */
  .calendar-wrap { padding: 8px; }
  .cal-head .muted { display: none; }
  .cal-head h3 { min-width: 0; font-size: 16px; }
  .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(58px, auto); gap: 2px; }
  .cal-day { padding: 3px; border-radius: 6px; }
  .cal-chip { height: 6px; padding: 0; border: 0; border-radius: 3px; background: var(--c); box-shadow: none; }
  .cal-chip span, .cal-chip .avatar, .cal-chip .cal-high { display: none; }
  .cal-list .cal-chip { height: auto; padding: 8px 10px; background: color-mix(in srgb, var(--c) 18%, var(--bg-3)); border-left: 3px solid var(--c); }
  .cal-list .cal-chip span { display: block; }
  .cal-more { font-size: 10px; padding: 0; }

  /* Pencereler alttan açılır */
  .modal-back { padding: 0; align-items: end; }
  .modal, .modal.wide { max-width: 100% !important; max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-body { padding: 12px 14px; }
  .modal-foot { padding: 10px 14px; flex-wrap: wrap; }
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 140px; }
  .comments { max-height: 40vh; }

  /* Firmalar, rapor, yönetim */
  .admin-body { padding: 10px; }
  .admin-list { max-height: 34vh; overflow-y: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-n { font-size: 20px; }
  .panel { padding: 12px; }
  .user-table td { padding: 6px 4px; }
  .user-table .actions { flex-wrap: wrap; justify-content: flex-start; }
  .client-title h3 { font-size: 17px; }
  #admin-tabs, #inv-mode, #board-mode { max-width: 100%; overflow-x: auto; }

  /* Faturalar: liste üstte, ayrıntı altta */
  .inv-layout { display: block; overflow-y: auto; }
  .inv-list-panel { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .inv-detail { overflow: visible; padding: 10px; }
  .inv-preview { height: 55vh; min-height: 260px; }
  .inv-summary .report-tools .search { flex: 1 1 45%; min-width: 0; }

  /* Sesli oda */
  .voice-stage { padding: 12px; gap: 10px; }
  .voice-tile { width: 42vw; height: 120px; }
  .voice-tile .avatar { width: 52px; height: 52px; }
  .voice-actions { flex-wrap: wrap; padding: 12px; gap: 8px; }
  .voice-actions .btn { flex: 1 1 40%; justify-content: center; }
  .voice-screens[data-count] { grid-template-columns: 1fr; padding: 8px 8px 0; }

  /* Bildirimler ve küçük pencereler */
  #toasts { left: 10px; right: 10px; bottom: 10px; }
  .toast { max-width: none; }
  .user-pop { width: calc(100vw - 20px); left: 10px !important; }
  .announce-card { padding: 18px; }
  .announce-body { font-size: 17px; }
  .dlg { max-width: 100%; }
  .auth-card { padding: 22px; }

  /* ---------- Kontrol Paneli ---------- */
  .kp-top, .kp-fields, .kp-actions, .kp-filters, .kp-radios { flex-wrap: wrap; overflow-x: visible; white-space: normal; }
  .kp-fields #kp-job, .kp-fields #kp-firm, .kp-fields #kp-contact, .kp-fields #kp-staff, .kp-fields #kp-loc { width: 100%; }
  .kp-row { height: auto; min-height: 32px; }
  .kp-top { padding: 10px; gap: 8px; }
  .kp-fields { width: 100%; }
  .kp-fields label { flex: 1 1 45%; min-width: 0; }
  .kp-fields input, .kp-fields select { width: 100%; max-width: none; min-width: 0; }
  .kp-fields #kp-add { flex: 1 1 100%; padding: 11px; }
  .kp-actions { margin-left: 0; width: 100%; }
  .kp-actions .kbtn { flex: 1 1 auto; }
  .kp-actions .kbtn.icon { flex: none; }
  .kp-menu { flex: 1 1 auto; }
  .kp-menu .kbtn { width: 100%; }
  .kp-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 8px 8px 0; }
  .kp-tabs button { flex: none; }
  .kp-body { margin: 0 8px 8px; }
  .kp-board { overflow-x: auto; scroll-snap-type: x mandatory; }
  .kp-col { min-width: 84vw; scroll-snap-align: start; }
  .kp-row { font-size: 13px; cursor: default; }
  .kp-row .kp-status { max-width: 150px; font-size: 13px; }
  .kp-del { width: 28px; height: 28px; }
  .kp-filters { padding: 8px; }
  .kp-filters .kp-in { flex: 1 1 45%; min-width: 0; }
  .kp-inline { flex: 1 1 100%; flex-wrap: wrap; }
  .kp-radios { border-left: 0; padding-left: 0; width: 100%; }
  .kp-table-wrap { overflow-x: auto; }
  .kp-table { min-width: 920px; }
  .kp-stats { grid-template-columns: 1fr; }
  .kp-stats > div { border-right: 0; border-bottom: 1px solid var(--kp-line); }
  .kp-arch { grid-template-columns: 1fr 1fr; }
  .kp-arch-btns { grid-column: 1 / -1; }
}
