/* ═══════════════════════════════════════════════════
   Bottom nav bar — hidden on desktop
══════════════════════════════════════════════════ */
.mobile-nav { display: none; }

/* ═══════════════════════════════════════════════════
   TABLET  769 – 1100 px  (compress 3 columns)
══════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1100px) {
  .app-main {
    grid-template-columns: 220px 1fr 250px;
  }
  .composer-body { padding: 12px 14px; }
  .composer-header { padding: 12px 14px 0; }
  .type-tabs { padding: 0 14px 10px; }
}

/* ═══════════════════════════════════════════════════
   MOBILE  ≤ 768 px
══════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Base ── */
  html, body { overflow: hidden; }

  /* ── Header ── */
  .app-header {
    height: 52px;
    padding: 0 12px;
  }
  .header-info { display: none !important; }
  .brand-name { font-size: 14px; }
  .btn-logout { padding: 5px 10px; font-size: 11px; }

  /* ── Main layout: fixed block between header and bottom nav ── */
  .app-main {
    display: block;
    position: fixed;
    top: 52px;
    bottom: 56px;
    left: 0;
    right: 0;
    height: auto;
    margin-top: 0;
    overflow: hidden;
  }

  /* ── Panels: all hidden until .mobile-active ── */
  .panel-sidebar,
  .panel-composer,
  .panel-right {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border: none !important;
  }
  .panel-sidebar.mobile-active,
  .panel-composer.mobile-active,
  .panel-right.mobile-active {
    display: flex;
  }

  /* ── Bottom navigation ── */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-btn {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-family: var(--font);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
  }
  .mobile-nav-btn.active {
    color: var(--green);
  }
  .mobile-nav-icon {
    font-size: 19px;
    line-height: 1;
    display: block;
    transition: transform 0.15s;
  }
  .mobile-nav-btn.active .mobile-nav-icon {
    transform: scale(1.12);
  }
  .mobile-nav-badge {
    position: absolute;
    top: 5px;
    right: calc(50% - 24px);
    background: var(--green);
    color: #fff;
    border-radius: 8px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 700;
    min-width: 15px;
    text-align: center;
    line-height: 1.5;
    pointer-events: none;
  }

  /* ── Sidebar ── */
  .sidebar-header { padding: 10px 10px; }
  .contact-sections { flex: 1; overflow-y: auto; min-height: 0; }

  /* ── Composer ── */
  .composer-header { padding: 12px 14px 0; }
  .composer-header h2 { font-size: 14px; margin-bottom: 8px; }
  .type-tabs {
    padding: 0 14px 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .type-tabs::-webkit-scrollbar { display: none; }
  .type-tab {
    flex-shrink: 0;
    padding: 7px 13px;
    font-size: 12px;
  }
  .composer-body { padding: 12px 14px; gap: 12px; }

  /* WA preview smaller on mobile */
  .wa-preview-outer { padding: 14px 12px 12px; }
  .wa-preview-bubble { max-width: 96%; }

  /* ── Right panel ── */
  .panel-right { overflow-y: auto; }
  .schedule-card,
  .queue-card,
  .history-card,
  .signature-card,
  .greetings-card,
  .storage-card { padding: 14px; }
  .schedule-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .schedule-actions .btn-secondary,
  .schedule-actions .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }

  /* ── Touch-friendly inputs ── */
  input[type="text"],
  input[type="url"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 10px 12px;
  }
  .btn-primary  { padding: 11px 18px; font-size: 14px; }
  .btn-secondary { padding: 11px 18px; font-size: 14px; }
  .contact-item { min-height: 46px; }

  /* Link input row stacks on narrow screens */
  .link-input-row { flex-direction: column; }
  .btn-fetch { width: 100%; text-align: center; }

  /* Tags wrap nicely */
  .tags-container { min-height: 44px; }

  /* Toasts above mobile nav */
  #toast-container {
    bottom: 66px;
    right: 10px;
    left: 10px;
  }
  .toast { max-width: 100%; }

  /* QR modal padding */
  .modal-box { padding: 28px 20px; }

  /* OG preview image smaller */
  .og-img { max-height: 120px; }
}
