/* =========================================================
   نقاء المتحدة — نسخة الجوال (نفس الهوية)
   تُحمَّل بعد naqaa-theme.css وتعمل فقط على الشاشات حتى 760px.
   ========================================================= */

.mobile-tabbar,
.mobile-drawer-backdrop {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --tabbar-h: 64px;
  }

  body {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }

  body.auth-mode {
    padding-bottom: 0;
  }

  /* ---------- الهيكل ---------- */
  .app-shell {
    display: block !important;
    min-height: 100vh;
  }

  .main {
    max-width: 100vw !important;
    padding: 12px 12px 20px !important;
  }

  /* ---------- الشريط العلوي للتطبيق ---------- */
  .sidebar {
    align-items: center;
    border-radius: 0 !important;
    box-shadow: 0 2px 12px rgba(11, 31, 58, 0.18);
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    height: auto !important;
    min-height: 58px;
    padding: 10px 14px calc(10px) !important;
    position: sticky !important;
    top: 0;
    z-index: 40;
  }

  .sidebar .brand {
    flex: 1;
    gap: 10px;
    min-height: 0;
  }

  .sidebar .brand-logo {
    height: 36px !important;
    width: 36px !important;
  }

  .sidebar .brand strong {
    font-size: 15px;
  }

  .sidebar .brand span {
    font-size: 11px;
  }

  #mobileMenuToggle,
  .sidebar .nav-list,
  .sidebar .sidebar-user,
  .sidebar .sidebar-footer {
    display: none !important;
  }

  /* ---------- القائمة المنسدلة (المزيد) ---------- */
  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-drawer-backdrop {
    background: rgba(6, 20, 45, 0.45);
    display: block;
    inset: 0;
    position: fixed;
    z-index: 55;
  }

  body.mobile-nav-open .sidebar {
    align-items: stretch;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    flex-direction: column !important;
    gap: 14px !important;
    left: auto;
    overflow-y: auto;
    padding: 18px 14px !important;
    position: fixed !important;
    right: 0;
    top: 0;
    width: min(84vw, 320px);
    z-index: 60;
  }

  body.mobile-nav-open .sidebar > * {
    flex-shrink: 0 !important;
  }

  body.mobile-nav-open .sidebar .brand {
    flex: none;
  }

  body.mobile-nav-open .sidebar .sidebar-user {
    margin-top: 8px !important;
    position: static !important;
  }

  body.mobile-nav-open .sidebar .nav-list {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    display: grid !important;
    gap: 2px !important;
    grid-template-columns: 1fr !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  body.mobile-nav-open .sidebar .nav-group {
    grid-column: 1 / -1;
    margin: 10px 0 2px !important;
    padding: 0 8px !important;
  }

  body.mobile-nav-open .sidebar .nav-button {
    display: grid !important;
    font-size: 14px !important;
    grid-template-columns: 26px minmax(0, 1fr) auto !important;
    justify-items: start;
    min-height: 44px !important;
    padding: 8px 12px !important;
    text-align: right !important;
    white-space: nowrap;
  }

  body.mobile-nav-open .sidebar .nav-button .nav-count {
    justify-self: end;
    position: static !important;
  }

  body.mobile-nav-open .sidebar .sidebar-user {
    display: grid !important;
    margin-top: 6px;
  }

  body.mobile-nav-open .sidebar .sidebar-footer {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  /* ---------- شريط التبويبات السفلي ---------- */
  .mobile-tabbar {
    background: #fff;
    border-top: 1px solid var(--nq-line);
    bottom: 0;
    box-shadow: 0 -6px 20px rgba(11, 31, 58, 0.08);
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    left: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    position: fixed;
    right: 0;
    z-index: 70;
  }

  .mobile-tabbar[hidden] {
    display: none;
  }

  .mobile-tab {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--nq-muted);
    display: flex;
    flex-direction: column;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    gap: 3px;
    justify-content: center;
    padding: 6px 2px;
    position: relative;
  }

  .mobile-tab-icon {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    position: relative;
    transition: background 150ms ease;
    width: 52px;
  }

  .mobile-tab.is-active {
    color: var(--nq-blue);
  }

  .mobile-tab.is-active .mobile-tab-icon {
    background: var(--nq-tint);
  }

  .mobile-tab-icon b {
    background: var(--nq-danger);
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    font-size: 9.5px;
    left: 6px;
    line-height: 1;
    min-width: 18px;
    padding: 2px 4px;
    position: absolute;
    top: -3px;
  }

  /* ---------- عنوان الصفحة والبحث ---------- */
  .topbar {
    align-items: stretch !important;
    display: grid !important;
    gap: 10px !important;
    grid-template-columns: 1fr !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
  }

  .topbar h1 {
    font-size: 19px !important;
  }

  .topbar-actions {
    display: flex !important;
    gap: 8px !important;
    width: 100%;
  }

  .topbar-actions .sync-status {
    display: none !important;
  }

  .topbar-actions .search-box {
    flex: 1;
    min-width: 0;
  }

  .topbar-actions .search-box input {
    min-width: 0 !important;
    width: 100%;
  }

  /* ---------- المؤشرات والشبكات ---------- */
  .metric-grid,
  .customers-kpis,
  .portal-kpis,
  .schedule-kpis,
  .carts-kpis,
  .customer-page-kpis,
  .nq-kpis {
    gap: 8px !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .metric-grid > :first-child,
  .customers-kpis > :first-child,
  .portal-kpis > :first-child,
  .schedule-kpis > :first-child,
  .carts-kpis > :first-child,
  .nq-kpis > :first-child {
    grid-column: 1 / -1;
  }

  .metric-card,
  .nq-kpi {
    min-height: 0 !important;
    padding: 12px 13px !important;
  }

  .metric-card strong,
  .nq-kpi b {
    font-size: 22px !important;
  }

  .panel-grid,
  .order-grid,
  .campaign-grid,
  .readiness {
    grid-template-columns: 1fr !important;
  }

  .view {
    gap: 12px !important;
  }

  .panel {
    border-radius: 14px !important;
    padding: 13px !important;
  }

  .panel-header {
    align-items: flex-start !important;
    flex-wrap: wrap;
    gap: 10px !important;
  }

  .panel-header > .row-actions,
  .panel-header > .primary-button,
  .panel-header > .secondary-button {
    width: 100%;
  }

  .panel-header > .row-actions > * {
    flex: 1 1 auto;
  }

  .panel-header > .primary-button {
    justify-content: center;
  }

  /* ---------- الفلاتر ---------- */
  .nq-chips {
    flex-wrap: nowrap !important;
    margin-inline: -13px;
    overflow-x: auto;
    padding: 2px 13px 6px;
    scrollbar-width: none;
  }

  .nq-chips::-webkit-scrollbar {
    display: none;
  }

  .nq-chips .spacer {
    display: none;
  }

  .nq-chips .nq-search,
  .nq-chips .zid-select {
    flex: none;
  }

  .schedule-filters {
    display: grid !important;
    gap: 8px !important;
    grid-template-columns: 1fr 1fr;
  }

  .schedule-filters .spacer {
    display: none;
  }

  .schedule-filters .nq-search,
  .schedule-filters > .nq-chips {
    grid-column: 1 / -1;
  }

  .schedule-filters .zid-select,
  .schedule-filters .nq-search,
  .schedule-date input {
    min-width: 0 !important;
    width: 100%;
  }

  .schedule-date {
    display: grid;
  }

  .bulk-bar {
    position: sticky;
    top: 64px;
    z-index: 5;
  }

  /* ---------- الجداول تتحول إلى بطاقات ---------- */
  .table-wrap {
    overflow: visible !important;
  }

  #appView .zid-orders-table,
  #appView .table-wrap {
    background: transparent !important;
    border: 0 !important;
  }

  table.mobile-cards,
  table.mobile-cards tbody,
  table.mobile-cards tr,
  table.mobile-cards td {
    display: block;
    min-width: 0 !important;
    width: 100% !important;
  }

  table.mobile-cards thead {
    display: none;
  }

  table.mobile-cards tbody {
    display: grid;
    gap: 10px;
  }

  table.mobile-cards tr {
    background: #fff;
    border: 1px solid var(--nq-line);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(11, 31, 58, 0.04);
    padding: 10px 12px;
    position: relative;
  }

  table.mobile-cards tr.is-unassigned {
    border-right: 3px solid var(--nq-blue);
  }

  table.mobile-cards tr.is-overdue {
    border-right: 3px solid var(--nq-danger);
  }

  table.mobile-cards tbody tr td,
  table.mobile-cards tbody tr:hover td {
    align-items: center;
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px dashed #eef2f8 !important;
    box-shadow: none !important;
    display: flex;
    font-size: 13px;
    gap: 10px;
    justify-content: space-between;
    padding: 7px 0 !important;
    text-align: left;
  }

  table.mobile-cards tbody tr td > * {
    text-align: left;
  }

  table.mobile-cards tbody tr td:last-child {
    border-bottom: 0 !important;
  }

  table.mobile-cards td::before {
    color: var(--nq-muted);
    content: attr(data-label);
    flex: none;
    font-size: 11.5px;
    font-weight: 700;
    text-align: right;
  }

  /* الخلية الأولى (رقم الطلب/العميل) عنوان البطاقة */
  table.mobile-cards td.zid-col-order,
  table.mobile-cards td.zid-col-customer {
    align-items: flex-start;
  }

  table.mobile-cards td.zid-col-order strong,
  table.mobile-cards td.zid-col-customer strong {
    font-size: 14.5px;
  }

  /* خانة التحديد في زاوية البطاقة */
  table.mobile-cards td.carts-check {
    border: 0 !important;
    display: block;
    left: 10px;
    padding: 0 !important;
    position: absolute;
    top: 12px;
    width: auto !important;
    z-index: 1;
  }

  table.mobile-cards td.carts-check::before {
    display: none;
  }

  /* الإجراءات بعرض البطاقة */
  table.mobile-cards td.zid-col-actions,
  table.mobile-cards td.zid-col-owner,
  table.mobile-cards td.sched-reschedule {
    align-items: stretch;
    flex-direction: column;
  }

  table.mobile-cards td.zid-col-actions::before,
  table.mobile-cards td.zid-col-owner::before,
  table.mobile-cards td.sched-reschedule::before {
    margin-bottom: 4px;
  }

  table.mobile-cards .zid-actions {
    display: grid !important;
    gap: 6px;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  }

  table.mobile-cards .zid-actions .mini-button {
    justify-content: center;
    min-height: 38px;
  }

  table.mobile-cards .zid-assign {
    display: grid !important;
    gap: 6px;
    grid-template-columns: 1fr auto;
  }

  table.mobile-cards .zid-select {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  table.mobile-cards td .zid-select {
    max-width: 60%;
  }

  table.mobile-cards td.zid-col-owner .zid-select,
  table.mobile-cards td.sched-reschedule input {
    max-width: 100%;
    width: 100%;
  }

  table.mobile-cards td .muted.small,
  table.mobile-cards td .zid-phone {
    display: block;
  }

  table.mobile-cards td[data-label=""]::before {
    display: none;
  }

  /* ---------- WATI ---------- */
  .wa-inbox {
    border-radius: 14px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .wa-list {
    border-bottom: 1px solid var(--nq-line);
    border-left: 0 !important;
  }

  .wa-list-items {
    max-height: 250px;
  }

  .wa-inbox > *,
  .wa-list,
  .wa-item,
  .wa-item-main {
    min-width: 0;
    max-width: 100%;
  }

  .wa-item-main {
    overflow: hidden;
  }

  .wa-chat-inline {
    height: 72vh !important;
  }

  .wa-head {
    padding: 10px 12px 10px 52px !important;
  }

  .wa-chat-inline .wa-head {
    padding: 10px 12px !important;
  }

  .wa-window {
    display: inline-flex !important;
    font-size: 10.5px !important;
    padding: 4px 8px !important;
  }

  .wa-msg {
    max-width: 88% !important;
  }

  /* ---------- لوحة المهام والتقويم ---------- */
  .task-board {
    grid-auto-columns: 82vw;
    grid-auto-flow: column;
    grid-template-columns: none !important;
    margin-inline: -13px;
    padding: 0 13px 6px;
    scroll-snap-type: x mandatory;
  }

  .task-column {
    scroll-snap-align: start;
  }

  .task-form-grid,
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  .cal-grid,
  .cal-weekdays {
    gap: 3px !important;
  }

  .cal-cell {
    min-height: 46px !important;
    padding: 4px !important;
  }

  .cal-weekdays span {
    font-size: 9.5px !important;
  }

  .cal-names {
    display: none !important;
  }

  .cal-count {
    left: 3px !important;
    top: 3px !important;
  }

  .cal-head .mini-button {
    font-size: 11px;
    padding: 4px 8px;
  }

  /* ---------- البطاقات والصفحات الفرعية ---------- */
  .ops-hero,
  .order-hero,
  .portal-hero,
  .readiness {
    flex-direction: column;
    padding: 16px !important;
  }

  .ops-hero h2,
  .order-hero h2,
  .portal-hero h2 {
    font-size: 19px !important;
  }

  .hero-actions,
  .order-hero-actions,
  .portal-hero-side {
    display: grid !important;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .hero-actions > *,
  .order-hero-actions > * {
    justify-content: center;
    width: 100%;
  }

  .order-facts {
    grid-template-columns: 1fr 1fr !important;
  }

  .staff-grid,
  .job-grid {
    grid-template-columns: 1fr !important;
  }

  .readiness-list {
    grid-template-columns: 1fr !important;
  }

  .readiness-ring svg {
    height: 110px;
    width: 110px;
  }

  .campaign-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .campaign-footer .primary-button {
    justify-content: center;
    width: 100%;
  }

  .notif-row {
    grid-template-columns: 34px minmax(0, 1fr) auto !important;
    padding: 10px 12px !important;
  }

  .notif-icon {
    height: 34px !important;
    width: 34px !important;
  }

  /* ---------- النوافذ المنبثقة كورقة سفلية ---------- */
  .dialog {
    border-radius: 18px 18px 0 0 !important;
    margin: auto 0 0 !important;
    max-height: 92vh;
    max-width: 100vw !important;
    width: 100vw !important;
  }

  .dialog-body {
    border-radius: 18px 18px 0 0 !important;
    max-height: 92vh;
    overflow-y: auto;
    padding: 18px 14px 22px !important;
  }

  .dialog-body:has(.wa-chat) {
    padding: 0 !important;
  }

  .wa-chat {
    height: 86vh !important;
  }

  /* ---------- التنبيهات فوق شريط التبويبات ---------- */
  .toast-stack {
    bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
    right: 12px !important;
  }

  .toast {
    width: 100% !important;
  }

  /* أهداف لمس مريحة */
  .mini-button,
  .zid-select,
  .nq-chip {
    min-height: 36px;
  }

  /* المؤشرات دائماً عمودان حتى داخل panel-grid */
  .panel-grid.customers-kpis,
  .panel-grid.portal-kpis,
  .panel-grid.schedule-kpis,
  .panel-grid.carts-kpis,
  .panel-grid.customer-page-kpis,
  section.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ======================================================================
   App-like mobile: WhatsApp full screen, installable app polish
   ====================================================================== */
.wa-appbar { display: none; }

@media (max-width: 760px) {
  html, body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px !important; } /* stops iOS zooming into fields */
  button, a { touch-action: manipulation; }
  .mobile-tabbar { padding-bottom: max(6px, env(safe-area-inset-bottom)) !important; }

  /* ---------- WhatsApp app mode ---------- */
  body.wa-app-mode { overflow: hidden; background: #f0f2f5; }
  body.wa-app-mode .sidebar,
  body.wa-app-mode .topbar,
  body.wa-app-mode .mobile-tabbar,
  body.wa-app-mode .mobile-menu-toggle,
  body.wa-app-mode .mobile-drawer-backdrop,
  body.wa-app-mode .install-card { display: none !important; }
  body.wa-app-mode .main { padding: 0 !important; margin: 0 !important; min-height: 0 !important; }
  body.wa-app-mode #appView { margin: 0 !important; padding: 0 !important; }

  body.wa-app-mode .wa-appbar {
    position: fixed; top: 0; inset-inline: 0; z-index: 60;
    display: flex; align-items: center; gap: 6px;
    height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0;
    background: #0b2b5e; color: #fff; box-shadow: 0 2px 10px rgba(11, 43, 94, 0.25);
  }
  body.wa-app-mode .wa-appbar[hidden] { display: none; }
  .wa-appbar-back, .wa-appbar-action, .wa-chat-back {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px;
    border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
  }
  .wa-appbar-back:active, .wa-appbar-action:active, .wa-chat-back:active { background: rgba(255, 255, 255, 0.16); }
  .wa-appbar-title { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
  .wa-appbar-title b { font-size: 18px; font-weight: 700; }
  .wa-appbar-title small { font-size: 12px; opacity: 0.8; }

  body.wa-app-mode .wa-inbox {
    position: fixed !important; top: calc(58px + env(safe-area-inset-top)); bottom: 0; inset-inline: 0;
    display: block !important; margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    background: #fff; height: auto !important; min-height: 0 !important; max-height: none !important;
  }
  body.wa-app-mode .wa-list {
    display: flex !important; flex-direction: column; height: 100% !important; max-height: none !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: #fff;
  }
  body.wa-app-mode .wa-list-head { flex: none; padding: 10px 12px 8px !important; border-bottom: 1px solid #edf0f5; }
  body.wa-app-mode .wa-list-title { display: none !important; }
  body.wa-app-mode .wa-list-head .nq-search { margin: 0 0 8px !important; border-radius: 22px !important; background: #f0f2f5 !important; border-color: transparent !important; }
  body.wa-app-mode .wa-list-items {
    flex: 1; min-height: 0; overflow-y: auto !important; max-height: none !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch;
  }
  body.wa-app-mode .wa-item { border-radius: 0 !important; padding: 12px 14px !important; }
  body.wa-app-mode .wa-item:active { background: #eef2f9; }
  body.wa-app-mode .wa-thread { display: none !important; }

  /* ---------- Chat screen ---------- */
  body.wa-app-mode.wa-chat-open .wa-appbar { display: none; }
  body.wa-app-mode.wa-chat-open .wa-list { display: none !important; }
  body.wa-app-mode.wa-chat-open .wa-inbox { top: 0; }
  body.wa-app-mode.wa-chat-open .wa-thread {
    display: flex !important; position: absolute; inset: 0; height: 100% !important; margin: 0 !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    animation: wa-screen-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  body.wa-app-mode.wa-chat-open .wa-chat-inline {
    display: flex !important; flex-direction: column; flex: 1; width: 100%; height: 100% !important;
    max-height: none !important; min-height: 0 !important; margin: 0 !important; border-radius: 0 !important; border: 0 !important;
  }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head {
    position: relative !important; flex: none; display: flex !important; align-items: center; gap: 8px;
    min-height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 4px 0 10px !important;
    border-radius: 0 !important; background: #0b2b5e !important; color: #fff;
  }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title { flex: 1; min-width: 0; }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title strong,
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-avatar { width: 38px !important; height: 38px !important; flex: none; }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-window { flex: none; font-size: 11px !important; padding: 4px 8px !important; max-width: 118px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.wa-app-mode.wa-chat-open #inboxMessages {
    flex: 1 !important; min-height: 0 !important; height: auto !important; max-height: none !important;
    padding: 12px 10px !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch;
  }
  body.wa-app-mode.wa-chat-open .wa-body .wa-msg { max-width: 86% !important; }
  body.wa-app-mode.wa-chat-open .wa-compose {
    flex: none; margin: 0 !important; border-radius: 0 !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important; background: #f0f2f5 !important;
  }
  body.wa-app-mode.wa-chat-open .wa-reply-btn { display: none !important; }
}

@keyframes wa-screen-in { from { transform: translateX(-24px); opacity: 0.4; } to { transform: none; opacity: 1; } }

/* ---------- Install card ---------- */
.install-card {
  position: fixed; inset-inline: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 80;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid #dbe6f7; border-radius: 16px; background: #fff; color: #0f1f3d;
  box-shadow: 0 16px 40px rgba(11, 43, 94, 0.22); animation: wa-toast-in 0.35s ease;
}
.install-card img { flex: none; border-radius: 12px; }
.install-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-card b { font-size: 14px; }
.install-card small { color: #56627a; font-size: 12px; line-height: 1.5; }
.install-card [data-install] { flex: none; padding: 8px 16px; border: 0; border-radius: 999px; background: #1b5fd6; color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.install-card .install-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: #8a96ab; cursor: pointer; }
@media (min-width: 761px) { .install-card { inset-inline: auto 24px; bottom: 24px; width: 380px; } }

/* ---------- Installed app (standalone) ---------- */
@media (display-mode: standalone) {
  body { -webkit-user-select: none; user-select: none; }
  input, textarea, [contenteditable], .wa-msg p, .wa-bot-footer { -webkit-user-select: text; user-select: text; }
}

/* ---------- Compact page headers and chat title on phones ---------- */
@media (max-width: 760px) {
  body:not(.wa-app-mode) .topbar { padding: 12px 14px !important; gap: 10px !important; border-radius: 16px !important; }
  body:not(.wa-app-mode) .topbar #viewEyebrow { font-size: 11px !important; margin-bottom: 0 !important; }
  body:not(.wa-app-mode) .topbar h1 { font-size: 19px !important; line-height: 1.35 !important; }
  body:not(.wa-app-mode) .topbar .topbar-actions { gap: 8px !important; }
  body:not(.wa-app-mode) .topbar .search-box input { height: 42px !important; }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title > * { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title small,
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title span { font-size: 12px; opacity: 0.85; }
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title a,
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title .order-chip,
  body.wa-app-mode.wa-chat-open .wa-chat-inline .wa-head .wa-title [data-open-order] { display: none !important; }
}

/* ======================================================================
   Login: the app shell never shows behind it, and phones get an app-style
   screen (brand header on top, form sheet below).
   ====================================================================== */
body.auth-mode .app-shell,
body.auth-mode .mobile-tabbar,
body.auth-mode .mobile-drawer-backdrop,
body.auth-mode .wa-appbar,
body.auth-mode .install-card,
body.auth-mode .wa-toast-stack { display: none !important; }

.login-form .password-wrap { position: relative; }
.login-form .password-wrap input { width: 100%; padding-inline-end: 48px !important; }
.login-form .password-toggle {
  position: absolute; top: 50%; left: 6px; transform: translateY(-50%);
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 10px; background: transparent; color: #7a879c; cursor: pointer;
}
.login-form .password-toggle:hover { background: #eef2f9; color: #0f2a5c; }
.login-form .password-toggle[aria-pressed="true"] { color: #1b5fd6; }
.login-form input[dir="ltr"] { text-align: left; }
.login-form input[dir="ltr"]::placeholder { text-align: right; }
.login-form .form-error {
  margin: 0; padding: 10px 12px; border: 1px solid #f5c2c7; border-radius: 10px;
  background: #fff4f5; color: #b42335; font-size: 13px; font-weight: 600;
}
.login-submit.is-loading { opacity: 0.8; pointer-events: none; }
.login-submit.is-loading span::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-inline-end: 8px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%;
  animation: login-spin 0.7s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  body.auth-mode { display: block !important; min-height: 100dvh; background: #0b2b5e !important; padding: 0 !important; }
  .login-screen {
    display: flex !important; flex-direction: column; min-height: 100dvh !important;
    background: linear-gradient(165deg, #0a2350 0%, #0b2b5e 45%, #123f86 100%) !important;
  }
  .login-screen .login-hero {
    order: -1; flex: none; min-height: 0 !important; gap: 14px !important; justify-content: flex-start !important;
    padding: calc(28px + env(safe-area-inset-top)) 24px 34px !important; background: transparent !important;
  }
  .login-hero-brand .brand-logo { width: 56px !important; height: 56px !important; border-radius: 16px !important; }
  .login-hero-brand strong { font-size: 17px !important; }
  .login-hero-copy h2 { font-size: 20px !important; line-height: 1.6 !important; margin: 0 !important; }
  .login-hero-chips, .login-hero-footer { display: none !important; }
  .login-screen .login-side {
    flex: 1; display: block !important; padding: 26px 22px calc(28px + env(safe-area-inset-bottom)) !important;
    background: #fff; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 30px rgba(3, 14, 36, 0.25);
  }
  .login-screen .login-panel { max-width: none !important; margin: 0 auto; }
  .login-panel h1 { font-size: 22px !important; }
  .login-subtitle { margin-bottom: 14px !important; }
  .login-form { gap: 16px !important; }
  .login-form .field label { font-size: 13px !important; font-weight: 700; }
  .login-form .field input { min-height: 52px !important; border-radius: 14px !important; font-size: 16px !important; }
  .login-form .primary-button { min-height: 54px !important; border-radius: 14px !important; font-size: 16px !important; font-weight: 700; margin-top: 6px !important; }
}
@media (max-width: 760px) {
  body.mobile-nav-open .sidebar .sidebar-user { display: flex !important; align-items: center; margin-top: 10px !important; }
}
