/* Mobile-first hardening layer loaded after all page styles. */
.mobile-nav-only { display: none; }
html, body { width: 100%; max-width: 100%; }
body { overflow-x: clip; }
input, select, textarea, button { max-width: 100%; font: inherit; }
button, .btn, a { -webkit-tap-highlight-color: transparent; }

@media (max-width: 768px) {
    :root { --container-padding: 16px; }
    html { font-size: 15px; }
    .container { padding-inline: 16px; }
    .section { padding-block: 40px; }
    .header-inner { height: 64px; padding-inline: 14px; gap: 8px; }
    .logo { min-width: 0; gap: 7px; }
    .logo-image { width: 34px; height: 34px; flex: 0 0 34px; }
    .logo-text { font-size: 1.4rem; white-space: nowrap; }
    .header-actions { gap: 4px; margin-inline-start: auto; flex-shrink: 0; }
    .lang-toggle, .mobile-toggle { width: 44px; height: 44px; min-width: 44px; }
    .desktop-action { display: none !important; }
    .mobile-nav-only { display: contents; }
    .nav { top: 64px; max-height: calc(100dvh - 64px); overflow-y: auto; padding: 16px; gap: 0; }
    .nav-link { min-height: 44px; display: flex; align-items: center; padding: 10px 4px; }
    .hero { padding: 100px 0 44px; min-height: auto; }
    .hero h1 { font-size: clamp(2rem, 10vw, 2.75rem); overflow-wrap: anywhere; }
    .hero p { font-size: 1rem; margin-bottom: 24px; }
    .hero-stats-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
    .stat-indicator { width: 100%; min-width: 0; justify-content: center; padding: 9px 6px; font-size: .78rem; text-align: center; }
    .hero-buttons { gap: 10px; }
    .hero-buttons .btn { flex: 1 1 100%; width: 100%; min-height: 48px; padding: 12px 16px; }
    .categories-grid, .how-grid { gap: 12px; }
    .category-card, .how-step { padding: 16px; min-width: 0; }
    .sdg-grid { gap: 12px; }
    .sdg-card { width: 100%; min-width: 0; padding: 16px; gap: 12px; }
    .sdg-icon-wrapper { width: 48px; height: 48px; font-size: 1.5rem; }
    .sdg-content { min-width: 0; }
    .sdg-content h4, .sdg-content p { overflow-wrap: anywhere; }
    .browse-header { align-items: stretch; margin-bottom: 18px; padding-bottom: 16px; }
    .browse-header h2, .search-box { width: 100%; max-width: none !important; }
    .search-box input { min-width: 0; }
    .browse-layout { display: block; }
    .browse-sidebar { position: static; display: flex; width: 100%; max-width: 100%; overflow-x: auto; gap: 12px; padding: 2px 2px 10px; margin-bottom: 20px; scrollbar-width: thin; scroll-snap-type: inline proximity; }
    .filter-group { flex: 0 0 150px; min-width: 150px; margin: 0; padding: 12px; border: 1px solid var(--border-color) !important; border-radius: 12px; scroll-snap-align: start; }
    .filter-group h4 { margin-bottom: 8px; }
    .filter-option { min-height: 40px; padding: 8px 4px; white-space: normal; }
    .items-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .card { min-width: 0; }
    .card-body { padding: 12px; }
    .card-title, .card-meta, .card-footer { min-width: 0; overflow-wrap: anywhere; }
    .green-impact-popup { width: min(280px, calc(100vw - 32px)) !important; left: 50% !important; }
    .item-detail { gap: 20px; }
    .gallery-main { height: min(72vw, 340px); }
    .gallery-thumbs { max-width: 100%; overflow-x: auto; }
    .item-info, .contact-card { padding: 18px !important; }
    .contact-buttons .btn, .btn-whatsapp-primary { width: 100%; min-height: 46px; }
    .form-row { grid-template-columns: 1fr !important; }
    .form-control { width: 100%; min-height: 46px; font-size: 16px; }
    textarea.form-control { min-height: 110px; }
    .upload-zone { padding: 22px 12px; }
    button[type="submit"], form .btn-lg { min-width: 0 !important; max-width: 100%; }
    .dashboard-page { padding-top: 88px; }
    .dashboard-header { align-items: stretch; margin-bottom: 22px; }
    .dashboard-header > *, .dashboard-header .btn { width: 100%; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }
    .dashboard-item .card-actions { opacity: 1; }
    .avatar-upload { align-items: flex-start; gap: 14px; }
    .offer-card { flex-direction: column !important; }
    .offer-card > div[style*="width: 150px"] { width: 100% !important; height: 180px; }
    .messages-page { padding-top: 80px !important; min-height: calc(100dvh - 80px) !important; }
    .inbox-container { border-radius: 12px !important; }
    .inbox-header { padding: 14px !important; }
    .co-item { padding: 12px !important; gap: 10px !important; }
    .co-avatar { width: 46px !important; height: 46px !important; }
    .co-name { font-size: 1rem !important; }
    .chat-page { padding: 64px 0 0 !important; height: 100dvh !important; }
    .chat-page.container { padding-inline: 0; }
    .chat-container { border-radius: 0 !important; border-inline: 0 !important; }
    .chat-header { padding: 10px 8px !important; gap: 8px !important; }
    .chat-partner-avatar { width: 38px !important; height: 38px !important; }
    .chat-partner-info { min-width: 0; flex: 1; }
    .chat-partner-info h2 { font-size: 1rem !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .chat-header form { margin-inline-start: 0 !important; }
    .chat-header form .btn { min-height: 40px; padding: 6px 8px; }
    .chat-box { padding: 12px !important; gap: 10px !important; }
    .msg { max-width: 88% !important; overflow-wrap: anywhere; }
    .chat-input-area { padding: 8px !important; gap: 8px !important; padding-bottom: max(8px, env(safe-area-inset-bottom)) !important; }
    .chat-input-area textarea { min-width: 0; font-size: 16px !important; }
    .btn-send { width: 44px !important; height: 44px !important; }
    .auth-page, .auth-container { min-height: 100dvh; }
    .auth-form-section { max-width: none; width: 100%; padding: 28px 18px !important; justify-content: flex-start; }
    .auth-form-section h2 { font-size: 1.75rem; }
    .credits-flex-container { flex-direction: column; align-items: stretch; width: 100%; }
    .credit-pill { width: 100%; padding: 12px; gap: 12px; }
    .credit-photo { width: 52px; height: 52px; flex-basis: 52px; }
    .credit-info { min-width: 0 !important; width: auto !important; }
    .credit-info h3, .credit-info p, .name-nowrap { white-space: normal !important; overflow-wrap: anywhere; }
    .footer-bottom-mini { margin-top: 28px; }
    .whatsapp-fab { width: 52px; height: 52px; inset-inline-end: 14px; bottom: 14px; }
    .pagination { max-width: 100%; flex-wrap: wrap; }
    .empty-state { padding: 36px 16px; }
    .flash-container { top: 72px !important; width: calc(100% - 24px) !important; }
}

@media (max-width: 480px) {
    :root { --container-padding: 12px; }
    .container { padding-inline: 12px; }
    .items-grid, .categories-grid, .how-grid { grid-template-columns: 1fr; }
    .section-header { margin-bottom: 24px; }
    .gallery-main { height: 280px; }
}

@media (max-width: 360px) {
    html { font-size: 14px; }
    .header-inner { padding-inline: 10px; }
    .logo-text { font-size: 1.2rem; }
    .logo-image { width: 30px; height: 30px; flex-basis: 30px; }
    .lang-toggle, .mobile-toggle { width: 42px; min-width: 42px; }
    .hero-stats-mini { grid-template-columns: 1fr; }
    .sdg-card { flex-direction: column; }
    .gallery-main { height: 250px; }
    .avatar-upload { flex-direction: column; }
}

@media (orientation: landscape) and (max-height: 500px) {
    .nav { max-height: calc(100dvh - 64px); }
    .hero { padding-top: 84px; }
    .chat-page { height: 100dvh !important; }
}
