/* ===== NEYTOM MOBILE — ALL DEVICES ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden !important; width: 100% !important; }

@media (max-width: 1024px) {
  .sidebar, .sidenav, nav.sidenav, aside.sidebar { display: none !important; }

  body:not(.demo-app-body) .main,
  body:not(.demo-app-body).neytom-app-body main.main,
  body:not(.demo-app-body) main,
  body:not(.demo-app-body) .content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 900px) {
  body { overflow-x: hidden !important; }

  body:not(.demo-app-body) .main,
  body:not(.demo-app-body) main,
  body:not(.demo-app-body) .content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 12px 10px !important;
    padding-bottom: var(--app-bottom-clearance, calc(68px + env(safe-area-inset-bottom, 0px))) !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .g2, .g3, .g4, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }

  input, select, textarea { font-size: 16px !important; }

  /* ===== MOBILE NAV BAR — always visible (base in app_shell.css) ===== */
  .mobile-bottom-nav {
    display: flex !important;
    visibility: visible !important;
  }


  /* ===== CHAT AREA - Android standard ===== */
  .ticket-panel { display: none !important; }

  .chat-area {
    transition: transform 0.1s ease, height 0.1s ease !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: var(--app-bottom-chrome, 56px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* Când tastatura e deschisă - JS ascunde nav, CSS adaptează */

  .chat-header {
    flex-shrink: 0 !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 12px !important;
    overflow: hidden !important;
  }

  .ch-sub { display: none !important; }

  .chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    padding: 10px 10px 4px !important;
  }

  .chat-messages .msg-wrap:last-child { margin-bottom: 2px !important; }

  /* INPUT - lipit de keyboard */
  .chat-input-wrap {
    flex-shrink: 0 !important;
    background: #fff !important;
    border-top: 1px solid #e5e5ea !important;
    padding: 6px 10px !important;
    margin: 0 !important;
  }

  .chat-input-inner textarea {
    font-size: 16px !important;
    max-height: 80px !important;
  }

  .send-btn { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; flex-shrink: 0 !important; }
  .input-hint { display: none !important; }
  .closed-bar { flex-shrink: 0 !important; padding: 10px !important; }

  /* ===== INBOX ===== */
  .inbox-msg { padding: 14px !important; }
  .btn-delete { font-size: 12px !important; }

  /* ===== PROFILE ===== */
  .profile-card { padding: 16px !important; margin-bottom: 10px !important; }
  .btn-primary, .btn-secondary { width: 100% !important; display: block !important; margin-bottom: 8px !important; }
}

@media (max-width: 400px) {
  body:not(.demo-app-body) .main,
  body:not(.demo-app-body) main {
    padding: 8px 7px !important;
    padding-bottom: var(--app-bottom-clearance, calc(68px + env(safe-area-inset-bottom, 0px))) !important;
  }
  .mobile-bottom-nav a .mbn-icon,
  .mobile-bottom-nav button.mbn-link .mbn-icon { font-size: 18px !important; }
  .mobile-bottom-nav a .mbn-label,
  .mobile-bottom-nav button.mbn-link .mbn-label { font-size: 10px !important; max-width: 100% !important; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 1024px) {
    .mobile-bottom-nav {
      box-sizing: border-box !important;
      height: var(--app-bottom-chrome, calc(56px + env(safe-area-inset-bottom))) !important;
      max-height: var(--app-bottom-chrome, calc(56px + env(safe-area-inset-bottom))) !important;
      padding-bottom: env(safe-area-inset-bottom) !important;
    }
    .chat-area {
      transition: transform 0.1s ease, height 0.1s ease !important;
      bottom: var(--app-bottom-chrome, calc(56px + env(safe-area-inset-bottom))) !important;
    }
  }
}

@media (min-width: 1400px) {
  .sidebar,
  aside.sidebar.neytom-app-sidebar { width: 260px !important; }
  body:not(.demo-app-body) .main,
  body:not(.demo-app-body).neytom-app-body main.main { margin-left: 260px !important; }
}

/* Dashboard domain fix */
@media (max-width: 900px) {
  .domain-input-wrap, .domain-search-wrap {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .domain-input-wrap input, .domain-search-wrap input {
    width: 100% !important;
    font-size: 16px !important;
  }
  .domain-input-wrap .btn-check, .btn-check {
    width: 100% !important;
  }
  .section-card { padding: 14px !important; }
}

/* Device-specific refinements (via data attributes) */
html[data-device="mobile"] body:not(.demo-app-body) .main,
html[data-device="mobile"] body:not(.demo-app-body) main {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding-bottom: var(--app-bottom-clearance, calc(68px + env(safe-area-inset-bottom, 0px))) !important;
}

html[data-device="tablet"] body:not(.demo-app-body) .main,
html[data-device="tablet"] body:not(.demo-app-body) main {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 20px 16px var(--app-bottom-clearance, calc(68px + env(safe-area-inset-bottom, 0px))) !important;
}

html[data-display-fit="mobile"] body:not(.demo-app-body) .main,
html[data-display-fit="mobile"] body:not(.demo-app-body) main,
html[data-display-fit="mobile"] body:not(.demo-app-body) .content,
html[data-display-fit="tablet"] body:not(.demo-app-body) .main,
html[data-display-fit="tablet"] body:not(.demo-app-body) main,
html[data-display-fit="tablet"] body:not(.demo-app-body) .content {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

html[data-display-fit="mobile"] .sidebar,
html[data-display-fit="mobile"] aside.sidebar,
html[data-display-fit="tablet"] .sidebar,
html[data-display-fit="tablet"] aside.sidebar {
  display: none !important;
}

html[data-display-fit="mobile"] .mobile-bottom-nav,
html[data-display-fit="tablet"] .mobile-bottom-nav {
  display: flex !important;
}

@media (min-width: 1025px) {
html[data-device="desktop"] body:not(.demo-app-body) .main,
html[data-device="desktop"] body:not(.demo-app-body) main {
  margin-left: 260px !important;
  width: calc(100% - 260px) !important;
}
}
@media (max-width: 1024px) {
html[data-device="desktop"] body:not(.demo-app-body) .main,
html[data-device="desktop"] body:not(.demo-app-body) main,
html[data-device="tv"] body:not(.demo-app-body) .main,
html[data-device="tv"] body:not(.demo-app-body) main {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}
}

@media (min-width: 1025px) {
html[data-device="tv"] body:not(.demo-app-body) .main,
html[data-device="tv"] body:not(.demo-app-body) main {
  margin-left: 260px !important;
  width: calc(100% - 260px) !important;
  max-width: none !important;
  padding: 44px 56px 36px !important;
}
}

html[data-os="ios"] {
  /* iOS-specific fixes */
  input, textarea, select {
    font-size: 16px !important; /* Prevents auto-zoom on focus */
  }
}

html[data-os="android"] .mobile-bottom-nav {
  box-sizing: border-box;
}

/* Landscape — keep bottom chrome clearance so Deploy/CTA never sits under nav */
html[data-orientation="landscape"] body:not(.demo-app-body) .main,
html[data-orientation="landscape"] body:not(.demo-app-body) main {
  padding-top: 12px !important;
  padding-bottom: var(--app-bottom-clearance, calc(68px + env(safe-area-inset-bottom, 0px))) !important;
}

@media (max-width: 1024px) and (orientation: landscape) {
  body:not(.demo-app-body) .main,
  body:not(.demo-app-body) main {
    padding: 12px 16px var(--app-bottom-clearance, calc(68px + env(safe-area-inset-bottom, 0px))) !important;
  }
}

/* ===== Dashboard deploy — mobile ===== */
@media (max-width: 768px) {
  body.neytom-app-body .plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.neytom-app-body .plan-card {
    padding: 12px 10px 12px !important;
    padding-right: 30px !important;
    text-align: left !important;
    min-height: 0;
  }

  body.neytom-app-body .dash-product-line {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.neytom-app-body .dash-product-switch {
    gap: 8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
  }

  body.neytom-app-body .dash-product-gaming {
    width: 100% !important;
    justify-content: center !important;
  }

  body.neytom-app-body .dash-product-card {
    min-height: 56px;
    padding: 12px 12px !important;
  }

  body.neytom-app-body .dash-product-card strong {
    font-size: 13px !important;
  }

  body.neytom-app-body .dash-product-card small {
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  body.neytom-app-body .section-card {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  body.neytom-app-body .deploy-btn {
    min-height: 52px !important;
    padding: 16px !important;
    font-size: 16px !important;
    border-radius: 14px !important;
  }

  body.neytom-app-body .deploy-terms label {
    font-size: 13px !important;
  }

  body.neytom-app-body .preset-btn {
    min-height: 40px;
    padding: 8px 14px !important;
  }
}

@media (max-width: 480px) {
  body.neytom-app-body .plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  body.neytom-app-body .dash-product-switch {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  body.neytom-app-body .dash-drawer__panel {
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
  }

  body.neytom-app-body.dash-drawer-open {
    overflow: visible !important; /* keep page width stable */
  }

  body.neytom-app-body .domain-input-wrap {
    flex-direction: column !important;
  }

  body.neytom-app-body .domain-input-wrap input,
  body.neytom-app-body .domain-input-wrap .btn-check {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
  }

  body.neytom-app-body .pay-checkout-layout,
  body.neytom-app-body .dash-pm-grid {
    grid-template-columns: 1fr !important;
  }

  body.neytom-app-body .dash-product-card {
    padding: 12px 12px !important;
    min-height: 56px !important;
  }

  body.neytom-app-body .dash-product-card strong {
    font-size: 13px !important;
  }

  body.neytom-app-body .dash-product-card small {
    font-size: 11px !important;
    line-height: 1.35 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.neytom-app-body .section-card {
    padding: 14px 12px !important;
  }

  body.neytom-app-body .deploy-split {
    border-radius: 14px !important;
  }

  body.neytom-app-body .circuit-panel {
    min-height: 170px !important;
    border-right: none !important;
    border-bottom: 1.5px solid var(--border, #e5e5ea) !important;
  }

  body.neytom-app-body .steps-panel {
    padding: 14px 12px !important;
  }

  body.neytom-app-body #crLogBox.cr-log-mobile.is-on {
    display: block !important;
    max-height: 72px !important;
    font-size: 10px !important;
    padding: 8px 10px !important;
  }

  body.neytom-app-body .btn-check {
    min-height: 48px !important;
  }

  body.neytom-app-body .dash-launch > summary {
    min-height: 48px !important;
  }
}



/* ===== FOLDABLE / ULTRA-NARROW (nt-foldable) ===== */
@media (max-width: 360px) {
  body:not(.demo-app-body) .main,
  body:not(.demo-app-body) main {
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-bottom: var(--app-bottom-clearance, calc(72px + env(safe-area-inset-bottom, 0px))) !important;
  }
  .g2, .g3, .g4, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .mobile-bottom-nav a .mbn-label,
  .mobile-bottom-nav button.mbn-link .mbn-label { font-size: 9px !important; }
  body.neytom-app-body .plans-grid { grid-template-columns: 1fr !important; }
  .dash-launch-intents { grid-template-columns: 1fr !important; }
}
@media (max-width: 320px) {
  :root { --mbn-h: 62px; }
  .mobile-bottom-nav { overflow: visible !important; }
  .mobile-bottom-nav a,
  .mobile-bottom-nav button.mbn-link { overflow: visible; }
  .mobile-bottom-nav a .mbn-label,
  .mobile-bottom-nav button.mbn-link .mbn-label {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 7px !important;
    letter-spacing: -.08em !important;
    transform: scale(.92);
    transform-origin: top center;
  }
}
@media (max-height: 480px) and (orientation: landscape) {
  :root { --mbn-h: 48px; }
  .mobile-bottom-nav { height: var(--app-bottom-chrome); }
  body:not(.demo-app-body) .main {
    padding-bottom: var(--app-bottom-clearance) !important;
  }
}
