/* ============================================================
   PWP Intelligence — Shared Mobile Styles
   Applies to: hcm.html, finance.html, electricity.html, pwp.html
   Desktop styles remain in each HTML file's <style> block
   ============================================================ */

@media (max-width: 768px) {

  /* Hide desktop-only elements */
  .sidebar          { display: none !important; }
  .dashboard-panel  { display: none !important; }
  .chat-header #expand-btn { display: none !important; }

  /* Root — full screen, reserve space for fixed bottom nav */
  body {
    overflow: hidden;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .main {
    margin-left: 0 !important;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(56px + env(safe-area-inset-bottom) + 50px);
    box-sizing: border-box;
  }

  .header {
    padding: 8px 14px !important;
    padding-top: max(8px, env(safe-area-inset-top)) !important;
    flex-shrink: 0;
  }
  .header h1    { font-size: 16px !important; }
  .header p     { font-size: 11px; }
  .header-badge { display: none !important; }

  .split-content {
    flex: 1;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
    grid-template-columns: none !important;
  }

  .chat-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-header { flex-shrink: 0; padding: 10px 14px; }

  .messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 8px !important;
  }

  .bubble                          { max-width: 95% !important; font-size: 14px !important; }
  .bubble p, .bubble li            { font-size: 14px !important; }
  .bubble table                    { font-size: 12px !important; }
  .bubble h1, .bubble h2, .bubble h3 { font-size: 14px !important; }

  .chat-suggestions { flex-shrink: 0; padding: 6px 10px; }

  .mobile-lever-btn {
    display: flex !important;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    color: white;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin: 6px auto;
    width: calc(100% - 24px);
  }

  .input-area {
    flex-shrink: 0;
    padding: 8px 10px !important;
    gap: 6px !important;
  }
  .input-area input {
    font-size: 16px !important;
    padding: 10px 14px !important;
    border-radius: 22px !important;
  }
  .input-area button {
    padding: 10px 18px !important;
    font-size: 14px !important;
    border-radius: 22px !important;
  }

  /* ── BOTTOM NAV ─────────────────────────────────────────── */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
  }
  .mobile-nav a, .mobile-nav span {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    text-decoration: none;
    color: rgba(255,255,255,0.6);
    font-size: 9px;
    font-weight: 600;
    gap: 2px;
    transition: color 0.2s;
  }
  .mobile-nav .nav-icon { font-size: 18px; }
  .mobile-nav a:hover   { color: white; }

  /* ── LEVER SHEET ─────────────────────────────────────────── */
  .mobile-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
  }
  .mobile-sheet-overlay.open { display: block; }

  .mobile-sheet {
    position: fixed;
    bottom: 56px;
    left: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    padding: 16px 12px;
    max-height: 72vh;
    overflow-y: auto;
    z-index: 201;
    transform: translateY(200vh);
    transition: transform 0.3s ease;
  }
  .mobile-sheet.open { transform: translateY(0); }

  .mobile-sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    margin: 0 auto 14px;
  }
  .mobile-sheet h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
  }
  .mobile-sheet .section-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    margin: 10px 0 4px;
  }
  .mobile-sheet .quick-btn {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    color: white;
    padding: 8px 10px;
    border-radius: 5px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.4;
  }
}

/* ── DESKTOP — hide all mobile elements ─────────────────────── */
@media (min-width: 769px) {
  .mobile-nav           { display: none !important; }
  .mobile-lever-btn     { display: none !important; }
  .mobile-sheet-overlay { display: none !important; }
  .mobile-sheet         { display: none !important; }
}
