/* Safehoodsa — mobile & tablet app shell (iPhone, Android, iPad, Samsung tablets) */

:root {
  --app-brand: #157a4f;
  --app-brand-light: #1b8a59;
  --app-bg: #eef5f0;
  --app-surface: #ffffff;
  --app-text: #12241c;
  --app-muted: #5f7268;
  --app-border: rgba(18, 36, 28, 0.08);
  --app-radius: 14px;
  --app-radius-lg: 18px;
  --app-touch: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --app-header-h: 56px;
  /* Fallback before JS measures the real fixed dock (includes home-indicator inset) */
  --app-emergency-dock-h: calc(72px + var(--safe-bottom));
  --app-bottom-nav-h: var(--app-emergency-dock-h);
  --app-shell-h: 100dvh;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

.app-shell input,
.app-shell select,
.app-shell textarea {
  font-size: 16px;
}

.app-shell button,
.app-shell .btn,
.app-shell a.btn {
  min-height: var(--app-touch);
  touch-action: manipulation;
}

/* ── Homepage header / mobile menu ── */

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--app-touch);
  height: var(--app-touch);
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: var(--app-surface);
  color: var(--app-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  transition:
    background 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-btn:active {
  transform: scale(0.94);
}

.mobile-menu-btn[aria-expanded="true"] {
  background: var(--app-brand);
  border-color: var(--app-brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(21, 122, 79, 0.22);
}

.mobile-menu-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(18, 36, 28, 0.42);
  /* Must stay BELOW the sticky header stacking context or menu taps never reach the links. */
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Sticky header creates a stacking context — keep it above the dimmed backdrop. */
.page-home .header {
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: 12px;
  z-index: 1100;
}

.page-home .footer {
  padding-bottom: calc(40px + var(--safe-bottom));
}

.page-home .header-content {
  gap: 12px;
}

/* ── Auth pages (sign in / register) ── */

.page-auth {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-auth .site-header {
  padding-top: calc(12px + var(--safe-top));
  padding-bottom: 12px;
}

.page-auth .container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  width: 100%;
}

.page-auth .auth-card {
  margin: 24px auto;
  width: 100%;
  max-width: 480px;
  border-radius: var(--app-radius-lg);
}

.page-auth .footer {
  padding-bottom: calc(20px + var(--safe-bottom));
}

/* ── Dashboard app chrome ── */

.page-dashboard {
  padding-bottom: var(--app-bottom-nav-h);
}

@media (min-width: 768px) {
  /* PC / laptop: no fixed bottom dock — use the in-page emergency card instead */
  .page-dashboard {
    padding-bottom: 24px;
  }

  .page-dashboard .dashboard-main {
    padding-bottom: 24px;
  }

  .page-dashboard .app-emergency-dock {
    display: none !important;
  }

  .page-dashboard .emergency-btn-inline {
    display: block !important;
  }

  .page-dashboard .emergency-card {
    padding: 20px 22px !important;
    margin: 0 0 4px !important;
    border: 1px solid rgba(200, 30, 30, 0.18) !important;
    background: linear-gradient(145deg, rgba(255, 236, 236, 0.95) 0%, rgba(255, 220, 220, 0.88) 100%) !important;
    box-shadow: 0 10px 28px rgba(200, 30, 30, 0.08) !important;
    border-radius: 18px !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .page-dashboard .emergency-card h2,
  .page-dashboard .emergency-card > p {
    display: block !important;
  }
}

.page-dashboard .site-header {
  padding-top: calc(8px + var(--safe-top));
  padding-bottom: 8px;
}

.page-dashboard .header-container {
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
}

.page-dashboard .dashboard-main {
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
  padding-bottom: calc(16px + var(--app-emergency-dock-h));
}

@media (max-width: 767px) {
  .page-dashboard {
    /* Content-only fallback; JS overwrites with measured header + dock heights */
    --app-header-h: calc(56px + var(--safe-top));
    --app-emergency-dock-h: calc(72px + var(--safe-bottom));
    --app-shell-h: 100dvh;
  }

  .page-dashboard .dashboard-main {
    padding-left: 0;
    padding-right: 0;
  }
}

.page-dashboard #chat,
.page-dashboard #live-map {
  scroll-margin-top: 88px;
}

.app-bottom-nav {
  display: none;
}

/* Fixed full-width "I need help" bar — smartphones only */
.app-emergency-dock {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding: 0;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: #9f1515;
  box-shadow: 0 -10px 28px rgba(159, 21, 21, 0.28);
}

.app-emergency-dock .btn-emergency {
  width: 100%;
  min-height: 56px;
  height: auto;
  margin: 0;
  border-radius: 0;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: none;
  animation: none;
  background: linear-gradient(180deg, #e54848 0%, #c81e1e 100%);
  box-sizing: border-box;
}

.app-emergency-dock .btn-emergency:active {
  filter: brightness(0.95);
}

.app-bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.app-bottom-nav button,
.app-bottom-nav a.app-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--app-muted);
  font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-bottom-nav button .nav-icon,
.app-bottom-nav a.app-bottom-nav-item .nav-icon {
  font-size: 20px;
  line-height: 1;
}

.app-bottom-nav button.is-active,
.app-bottom-nav button:active,
.app-bottom-nav a.app-bottom-nav-item.is-active,
.app-bottom-nav a.app-bottom-nav-item:active {
  background: rgba(21, 122, 79, 0.12);
  color: var(--app-brand);
}

.app-bottom-nav button.nav-signout,
.app-bottom-nav a.nav-signout {
  color: #dc2626;
}

.app-bottom-nav button.nav-signout:active,
.app-bottom-nav a.nav-signout:active {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
}

/* Sign-out overlay */
.signout-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(245, 241, 232, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px;
}

.signout-overlay.show {
  display: flex;
}

.signout-card {
  text-align: center;
  max-width: 320px;
  width: 100%;
}

.signout-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(26, 92, 62, 0.2);
  border-top-color: var(--app-brand);
  border-radius: 50%;
  animation: app-spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes app-spin {
  to { transform: rotate(360deg); }
}

/* ── Phones (portrait & small) ── */

@media (max-width: 767px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .page-home .nav {
    display: flex;
    position: fixed;
    top: calc(var(--safe-top) + 64px);
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 16px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    z-index: 1110;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, -18px, 0) scale(0.965);
    transform-origin: top center;
    will-change: transform, opacity;
    transition:
      opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0.55s cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .page-home .nav.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.16);
  }

  .page-home .nav a {
    display: block;
    padding: 14px 16px;
    border-radius: 12px;
    text-align: center;
    pointer-events: auto;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translate3d(0, 12px, 0);
    transition:
      opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
      background 0.25s ease;
  }

  .page-home .nav.is-open a {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .page-home .nav.is-open a:nth-child(1) { transition-delay: 0.06s; }
  .page-home .nav.is-open a:nth-child(2) { transition-delay: 0.12s; }
  .page-home .nav.is-open a:nth-child(3) { transition-delay: 0.18s; }
  .page-home .nav.is-open a:nth-child(4) { transition-delay: 0.24s; }

  .page-home .nav:not(.is-open) a {
    transition-delay: 0s;
    transition-duration: 0.28s;
  }

  .page-home .nav .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .page-home .header-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .page-home .hero {
    padding: 0 0 40px;
  }

  .page-home .hero-brand {
    display: flex;
    margin: 0;
    padding: 0;
  }

  .page-home .hero-brand img {
    width: min(260px, 70vw);
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
  }

  .page-home .hero-title {
    font-size: clamp(28px, 8vw, 36px);
    text-align: center;
  }

  .page-home .hero-subtitle {
    font-size: 16px;
    text-align: center;
  }

  .page-home .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .page-home .iphone-mock {
    max-width: min(280px, 78vw);
  }

  .page-home .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .page-auth .header-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
  }

  .page-auth .site-nav .nav-text {
    display: none;
  }

  .page-auth .auth-card {
    padding: 28px 20px;
    margin: 16px auto;
    border-radius: var(--app-radius-lg);
  }

  .page-auth .auth-card h1 {
    font-size: 26px;
  }

  .page-dashboard .logo-img {
    display: block;
    height: clamp(28px, 9vw, 40px);
    max-width: min(112px, 30vw);
    width: auto;
    object-fit: contain;
  }

  .page-dashboard .header-suburb {
    display: inline-flex;
    font-size: 15px;
    max-width: min(52vw, 240px);
    padding: 6px 10px 6px 8px;
  }

  .page-dashboard .header-suburb-hint {
    display: inline;
  }

  .page-dashboard .header-brand {
    max-width: min(62vw, 280px);
  }

  .page-dashboard .logo {
    max-width: none;
  }

  .page-dashboard .site-nav {
    gap: 6px;
    flex-shrink: 0;
  }

  .page-dashboard .site-nav .nav-text {
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    font-size: 13px;
  }

  .page-dashboard .site-nav .btn-outline {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .page-dashboard .app-bottom-nav {
    display: none !important;
  }

  .page-dashboard .app-emergency-dock {
    display: block;
  }

  .page-dashboard .emergency-btn-inline {
    display: none !important;
  }

  .page-dashboard .emergency-card {
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .page-dashboard .emergency-card h2,
  .page-dashboard .emergency-card > p {
    display: none !important;
  }

  .page-dashboard .emergency-card:has(.emergency-status[style*="display: block"]) {
    padding: 12px 14px;
    background: rgba(255, 236, 236, 0.95);
    border: 1px solid rgba(200, 30, 30, 0.18);
    border-radius: 16px;
  }

  .page-dashboard .emergency-status {
    margin: 0;
  }

  .page-dashboard .emergency-card:not(:has(.emergency-status[style*="display: block"])) {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .page-dashboard .dashboard-main {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: var(--app-emergency-dock-h);
    gap: 0;
    /* Match chat panel so no light strip shows at the sides */
    background: #0f1c17;
  }

  .page-dashboard {
    background: #0f1c17 !important;
  }

  .page-dashboard .map-wrap {
    height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h) - 88px) !important;
    min-height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h) - 88px) !important;
    max-height: none !important;
    border-width: 1px;
    border-radius: 14px;
  }

  .page-dashboard #chat.card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    margin: 0;
    margin-bottom: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    padding: 8px 10px !important;
    /* Fill exactly between sticky header and help dock — tabs + composer always on-screen */
    height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h)) !important;
    min-height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h)) !important;
    max-height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h)) !important;
    overflow: hidden;
    background: #0f1c17;
  }

  .page-dashboard #chat {
    scroll-margin-top: var(--app-header-h);
  }

  .page-dashboard #live-map.card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    border-radius: 0;
    margin: 0;
    height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h)) !important;
    min-height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h)) !important;
    max-height: calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h)) !important;
    padding: 8px 10px !important;
    padding-bottom: 10px !important;
    overflow: hidden;
    background: #0f1c17;
  }

  .page-dashboard #live-map .map-wrap {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
  }

  .page-dashboard #live-map .location-status {
    flex-shrink: 0;
    margin-top: 8px;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
  }

  .page-dashboard .chat-selector,
  .page-dashboard .chat-toolbar {
    flex-shrink: 0;
  }

  .page-dashboard .chat-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
    border-radius: 0;
    border: none;
  }

  .page-dashboard .chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }

  .page-dashboard .wa-composer {
    /* Always pinned at the bottom of the chat card (above I need help) */
    position: relative;
    bottom: auto;
    flex-shrink: 0;
    z-index: 5;
    padding: 8px 2px 8px;
    border-radius: 0;
    background: #0f1c17;
  }

  .page-dashboard .card {
    padding: 10px;
    margin-bottom: 0;
    border-radius: 0;
  }

  .page-dashboard .dashboard-main {
    gap: 0;
    padding-top: 0;
  }

  .page-dashboard .chat-selector {
    gap: 3px;
    margin-bottom: 4px;
    padding: 3px;
    border-radius: 10px;
  }

  .page-dashboard .chat-type-btn {
    min-width: 0;
    text-align: center;
    padding: 6px 8px;
    font-size: 11px;
    border-radius: 8px;
    line-height: 1.2;
  }

  .page-dashboard #street-search-container,
  .page-dashboard #chat-badge,
  .page-dashboard .city-badge {
    display: none !important;
  }

  .page-dashboard .chat-toolbar {
    margin-bottom: 4px;
    gap: 6px;
  }

  .page-dashboard .chat-info {
    margin-bottom: 0;
  }

  .page-dashboard .chat-messages {
    padding: 12px 10px;
    gap: 12px;
  }

  .page-dashboard .chat-input-tools {
    flex-direction: row;
  }

  .page-dashboard .btn-emergency {
    font-size: 16px;
    padding: 17px 16px;
    border-radius: 14px;
  }

  .page-dashboard .notification-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .page-dashboard .notification-banner button {
    width: 100%;
    min-height: var(--app-touch);
  }

  .page-dashboard .emergency-modal-overlay {
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
  }

  .page-dashboard .button-group {
    flex-direction: column;
  }

  .page-dashboard .message {
    max-width: 92%;
  }

  .page-dashboard .chat-input-row {
    flex-wrap: nowrap;
    gap: 6px;
    align-items: flex-end;
  }

  .page-dashboard .chat-call-actions {
    display: inline-flex !important;
    position: relative;
    z-index: 70;
    pointer-events: auto !important;
    gap: 8px;
    padding: 2px;
  }

  .page-dashboard .chat-call-btn {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    pointer-events: auto !important;
    touch-action: manipulation;
  }

  .page-dashboard .chat-toolbar,
  .page-dashboard .chat-info {
    position: relative;
    z-index: 65;
    overflow: visible;
  }

  /* Sign-out edge is visual only — swipe is handled in document capture (all phones) */
  .page-dashboard #signout-swipe-edge {
    width: 14px;
    z-index: 1;
    pointer-events: none !important;
  }

  /* Same call picker as PC — sit above the help dock and accept taps */
  .page-dashboard .call-picker-overlay.show,
  .page-dashboard .call-picker-overlay.show[hidden] {
    display: flex !important;
    z-index: 13050;
    padding-bottom: calc(12px + var(--app-emergency-dock-h));
    align-items: flex-end;
  }

  .page-dashboard .call-picker-card {
    width: 100%;
    max-width: none;
    border-radius: 18px 18px 0 0;
    max-height: min(70vh, calc(var(--app-shell-h) - var(--app-header-h) - var(--app-emergency-dock-h) - 24px));
  }

  .page-dashboard .call-picker-list button {
    min-height: 52px;
    font-size: 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(21, 122, 79, 0.25);
  }

  .page-dashboard .resident-call-overlay.show,
  .page-dashboard .resident-call-overlay.show[hidden] {
    display: flex !important;
    z-index: 13100;
  }

  .page-dashboard .resident-call-actions button {
    min-height: 48px;
    touch-action: manipulation;
  }

  .page-dashboard .chat-clear-btn {
    display: none;
  }

  .page-dashboard .wa-input-pill {
    border-radius: 22px;
  }

  .page-dashboard .chat-tool-btn,
  .page-dashboard .wa-attach-btn,
  .page-dashboard .wa-mic-btn,
  .page-dashboard .wa-send-btn,
  .page-dashboard .send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
  }

  .page-dashboard .message-input {
    font-size: 16px;
    min-height: 40px;
    padding: 10px 12px;
  }

  .page-dashboard .chat-input-tools {
    display: none;
  }

  .page-dashboard .chat-delete-menu {
    padding-bottom: calc(16px + var(--safe-bottom));
  }

  /* Keyboard open: pin chat as a stable layer above the keyboard (no map jump/glitch) */
  .page-dashboard.is-chat-composing {
    overflow: hidden;
  }

  .page-dashboard.is-chat-composing #live-map,
  .page-dashboard.is-chat-composing #emergency-card,
  .page-dashboard.is-chat-composing .app-emergency-dock {
    /* Cover without collapsing layout mid-frame (avoids glitch) */
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .page-dashboard.is-chat-composing .dashboard-main {
    padding-bottom: 0 !important;
  }

  .page-dashboard.is-chat-composing #chat.card {
    position: fixed;
    top: var(--app-header-h);
    left: 0;
    right: 0;
    bottom: var(--keyboard-inset, 0px);
    z-index: 1150;
    margin: 0 !important;
    padding: 8px !important;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    max-width: none;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden;
    background: #0f1c17;
  }

  .page-dashboard.is-chat-composing #chat.card .chat-selector,
  .page-dashboard.is-chat-composing #chat.card .chat-toolbar {
    flex-shrink: 0;
    display: grid;
  }

  .page-dashboard.is-chat-composing #chat.card .chat-toolbar {
    display: flex;
  }

  .page-dashboard.is-chat-composing .chat-container {
    flex: 1 1 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 0;
  }

  .page-dashboard.is-chat-composing .wa-composer {
    position: relative;
    bottom: auto;
    flex-shrink: 0;
  }
}

/* ── Tablets (iPad, Samsung Tab) ── */

@media (min-width: 768px) and (max-width: 1024px) {
  .page-home .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .page-home .hero-title {
    font-size: 42px;
  }

  .page-auth .auth-card {
    padding: 40px 36px;
  }

  .page-dashboard .dashboard-main {
    max-width: 900px;
    padding: 20px 24px;
  }

  .page-dashboard .map-wrap,
  .page-dashboard .chat-container {
    height: 560px !important;
    min-height: 560px !important;
  }
}

/* ── Large phones landscape ── */

@media (max-width: 926px) and (orientation: landscape) {
  .page-auth .container {
    align-items: flex-start;
    padding-top: 12px;
  }

  .page-auth .auth-card {
    margin: 12px auto;
  }

  .page-dashboard .map-wrap,
  .page-dashboard .chat-container {
    height: 70dvh !important;
    min-height: 220px !important;
  }
}

/* ── Reduce motion ── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
