/* mvr.rip mobile overlay — last stylesheet. Desktop unchanged.
   Phone: bottom tabs, sticky header, 44px taps, no zoom, no squashed tables. */

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

.mbar { display: none; }

@media (max-width: 860px) {
  html, body {
    overflow-x: hidden;
    overscroll-behavior-y: none;
  }

  body .app {
    grid-template-columns: 1fr !important;
    min-height: 100dvh;
    width: 100% !important;
    max-width: none !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  body .main { min-width: 0; }

  /* Sticky header + notch */
  body .header {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    height: calc(56px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(56px + env(safe-area-inset-top, 0px)) !important;
    padding: env(safe-area-inset-top, 0px) 10px 0 10px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: var(--bg, #0d0f11) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  body .header .nav-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px !important;
  }

  body .menu-toggle {
    display: inline-flex !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 10px !important;
    align-items: center;
    justify-content: center;
    background: var(--bg3) !important;
    border: 1px solid var(--border) !important;
  }
  body .menu-toggle svg {
    width: 18px !important;
    height: 18px !important;
  }

  body .crumb-kicker { display: none !important; }
  body .breadcrumb a,
  body .breadcrumb .sep { display: none !important; }
  body .breadcrumb .current {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
    color: var(--t1) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body .header .right {
    flex: 0 0 auto;
    gap: 8px !important;
    align-items: center !important;
    height: 36px !important;
  }

  body .hdr-chip,
  body .rate-chip,
  body a.rate-chip,
  body .balance-wrap {
    display: inline-flex !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    border-radius: 10px !important;
    align-items: center !important;
    box-sizing: border-box !important;
  }
  body .rate-chip,
  body a.rate-chip {
    max-width: 140px;
    padding: 0 10px 0 8px !important;
  }
  body .hdr-chip-text,
  body .rate-chip-text,
  body .balance,
  body .balance-wrap #headerBalance {
    font-size: 13px !important;
    font-weight: 650 !important;
    line-height: 1 !important;
    height: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
  }
  body .rate-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 84px;
  }

  body .balance-wrap {
    padding: 0 4px 0 8px !important;
  }
  body .add-funds-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    border-radius: 7px !important;
    padding: 0 !important;
    flex: 0 0 28px !important;
  }
  body .add-funds-btn svg {
    width: 14px !important;
    height: 14px !important;
  }

  body .collapse-toggle { display: none !important; }

  /* Drawer */
  body .sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 70 !important;
    width: min(300px, 86vw) !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    transform: translateX(-108%) !important;
    transition: transform 220ms ease !important;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: none !important;
  }
  body .sidebar.open,
  body .app.sidebar-open .sidebar {
    transform: translateX(0) !important;
  }
  body .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 60 !important;
    background: rgba(0, 0, 0, 0.55) !important;
  }
  body .sidebar-overlay[hidden] { display: none !important; }
  body .sidebar-overlay.show,
  body .app.sidebar-open .sidebar-overlay {
    display: block !important;
  }
  html:has(.app.sidebar-open) { overflow: hidden; }

  body .sidebar-nav a,
  body .sidebar-nav .nav-item {
    min-height: 44px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
  }

  /* Page body */
  body .content {
    padding: 12px 12px calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body .page-head,
  body .db-top {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }
  body .page-title,
  body .db-top h1,
  body h1.page-title {
    font-size: 22px !important;
    letter-spacing: -0.03em;
  }
  body .page-desc,
  body .db-top .sub { font-size: 13px !important; }
  body .page-head .actions {
    display: flex !important;
    width: 100% !important;
    gap: 8px !important;
  }
  body .page-head .actions .btn { flex: 1 1 0; }

  /* Taps + no iOS zoom */
  body .btn,
  body .sip-btn,
  body .dep-btn,
  body .rt-btn,
  body .btn-primary,
  body .btn-secondary,
  body .btn-danger {
    min-height: 44px !important;
    height: auto !important;
    padding: 10px 14px !important;
    font-size: 15px !important;
    border-radius: 10px !important;
    touch-action: manipulation;
  }
  body .running-pill {
    min-height: 44px !important;
    height: auto !important;
    padding: 0 14px !important;
  }

  body input.input,
  body select.input,
  body textarea.input,
  body .wrap input,
  body .field input,
  body .field select,
  body .field textarea,
  body input[type="text"],
  body input[type="password"],
  body input[type="number"],
  body input[type="search"],
  body input[type="date"],
  body input[type="tel"],
  body textarea,
  body select {
    font-size: 16px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
  }
  body textarea { min-height: 96px !important; }
  body .dep-amount input,
  body .dep-amount input[type="number"],
  body .dep-amt-display input,
  body .dep-page #amount {
    font-size: 40px !important;
    min-height: 0 !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  body .sd-search,
  body .rt-search-wrap,
  body label.sd-search,
  body label.rt-search-wrap {
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
  }
  body .sd-search input,
  body .sd-search input[type="text"],
  body .sd-search .input,
  body .rt-search-wrap input,
  body .rt-search-wrap input[type="text"],
  body input.rt-search,
  body .rt-search {
    font-size: 16px !important;
    min-height: 0 !important;
    height: 22px !important;
    max-height: 28px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  body .row,
  body .field-row,
  body .xfer-grid,
  body .split-2,
  body .grid3,
  body .filter-row,
  body .server-row,
  body .sip-reg,
  body .sip-tools,
  body .profile-grid {
    grid-template-columns: 1fr !important;
  }

  /* Dense 2-up, not a lonely single column */
  body .db-kpis,
  body .db-route,
  body .db-quick,
  body .stats-grid,
  body .p1d-tiles,
  body .kpi-strip,
  body .cur-grid,
  body .meta-row {
    grid-template-columns: 1fr 1fr !important;
    display: grid !important;
    gap: 8px !important;
  }
  body .kpi-strip {
    display: grid !important;
  }
  body .kpi-item { min-width: 0 !important; }
  body .db-kpi .val { font-size: 18px !important; }
  body .p1d-hero-counts .big { font-size: 22px !important; }

  body .layout,
  body .pay-grid,
  body .dep-stage,
  body .dep-pay-body {
    grid-template-columns: 1fr !important;
  }
  body .monitor,
  body .layout .monitor.p1-ops {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Tables: swipe, don't crush — CDR uses stacked cards instead */
  body .panel:has(table),
  body .table-wrap,
  body .table-scroll,
  body .sip-table,
  body .content:has(table) .panel {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body table {
    min-width: 560px;
  }
  body .cdr-page .table-wrap,
  body .cdr-page .table-scroll {
    overflow: visible !important;
  }
  body .cdr-page table {
    min-width: 0 !important;
  }

  /* DTMF stays chip row — just fatter taps */
  body .dtmf-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    grid-template-columns: none !important;
  }
  body .dtmf-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
    font-size: 15px !important;
  }
  body .dtmf-btn::after { display: none !important; content: none !important; }

  body .running-pill { display: inline-flex !important; }

  body .dep-assets { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body .dep-qr { justify-self: center !important; margin: 0 auto; }
  body .dep-qr svg,
  body .dep-qr img {
    width: 180px !important;
    height: 180px !important;
  }
  body .dep-stage.has-pay {
    display: flex !important;
    flex-direction: column !important;
  }
  body .dep-stage.has-pay > .dep-pay {
    order: -1;
  }
  body .dep-page .dep-chips button,
  body .dep-page .dep-asset {
    min-height: 44px !important;
  }
  body .dep-page .dep-btn.primary,
  body .dep-page .dep-cta {
    width: 100%;
    min-height: 48px !important;
  }
  body .dep-page .dep-amount,
  body .dep-page .dep-amt-display {
    height: auto;
    min-height: 0;
  }
  body .dep-page .dep-amount input,
  body .dep-page .dep-amount input[type="number"],
  body .dep-page .dep-amt-display input,
  body .dep-page #amount {
    font-size: 40px !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
  }
  body .dep-page .dep-chip {
    min-height: 52px !important;
  }
  body .dep-page table,
  body .dep-page .dep-table {
    min-width: 0 !important;
  }
  body .dep-page .dep-table-wrap {
    overflow: visible !important;
    border: 0 !important;
  }
  body .dep-page .dep-copy .dep-btn.ghost,
  body .dep-page .dep-copy-btn {
    min-height: 44px !important;
    height: 44px !important;
  }
  body .dep-top {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  body .dep-bal {
    width: 100%;
    justify-content: center;
  }
  body .dep-page .dep-table thead {
    display: none !important;
  }
  body .dep-page .dep-table,
  body .dep-page .dep-table tbody {
    display: block !important;
    width: 100% !important;
  }
  body .dep-page .dep-table tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px 12px !important;
    padding: 12px !important;
    margin-bottom: 8px !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    background: var(--bg2) !important;
  }
  body .dep-page .dep-table td {
    display: block !important;
    width: auto !important;
    padding: 0 !important;
    border: 0 !important;
    min-width: 0 !important;
  }
  body .dep-page .dep-table td:last-child {
    grid-column: 1 / -1 !important;
  }
  body .dep-page .dep-table td::before {
    display: block;
    margin-bottom: 4px;
    font-family: var(--fm);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--t4);
  }
  body .dep-page .dep-table td:nth-child(1)::before { content: "When"; }
  body .dep-page .dep-table td:nth-child(2)::before { content: "Amount"; }
  body .dep-page .dep-table td:nth-child(3)::before { content: "Asset"; }
  body .dep-page .dep-table td:nth-child(4)::before { content: "Status"; }
  body .dep-page .dep-table td:nth-child(5)::before { content: "Credited"; }
  body .dep-page .dep-table td[data-label]::before { content: attr(data-label); }
  body .dep-page .dep-table td[data-label=""]::before,
  body .dep-page .dep-table td:nth-child(6)::before {
    display: none !important;
    content: none;
  }

  body .sip-page .sip-table-wrap {
    overflow: visible !important;
    border: 0 !important;
  }
  body .sip-page .sip-table,
  body .sip-page .sip-table thead,
  body .sip-page .sip-table tbody {
    display: block !important;
    width: 100% !important;
  }
  body .sip-page .sip-table thead { display: none !important; }
  body .sip-page .sip-table tbody tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px 12px !important;
    margin: 0 0 10px !important;
    padding: 14px !important;
    border: 1px solid var(--border) !important;
    border-radius: 14px !important;
    background: var(--bg2) !important;
  }
  body .sip-page .sip-table tbody td {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    padding: 0 !important;
    border: 0 !important;
    min-width: 0 !important;
  }
  body .sip-page .sip-table tbody td::before {
    font-family: var(--fm);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--t4);
  }
  body .sip-page .sip-table tbody td:nth-child(1)::before { content: "User"; }
  body .sip-page .sip-table tbody td:nth-child(2)::before { content: "Mode"; }
  body .sip-page .sip-table tbody td:nth-child(3)::before { content: "Password"; }
  body .sip-page .sip-table tbody td:nth-child(4)::before { content: "Caller ID"; }
  body .sip-page .sip-table tbody td:nth-child(5)::before { content: "Peer / Host"; }
  body .sip-page .sip-table tbody td:nth-child(6)::before { content: "Actions"; }
  body .sip-page .sip-table tbody td:nth-child(1),
  body .sip-page .sip-table tbody td:nth-child(5),
  body .sip-page .sip-table tbody td:nth-child(6) {
    grid-column: 1 / -1 !important;
  }
  body .sip-page .sip-table .actions {
    min-width: 0 !important;
    justify-content: flex-start !important;
    width: 100%;
  }

  body .campaign-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  body .campaign-row .actions { display: flex; gap: 8px; }
  body .campaign-row .actions .btn { flex: 1; }

  body .audio-item audio { display: none !important; }

  /* Bottom sheets */
  body .modal-backdrop.open .modal,
  body .modal-backdrop.show .modal,
  body .confirm-modal {
    width: calc(100% - 16px) !important;
    max-width: none !important;
    margin: 0 8px 8px !important;
    border-radius: 16px 16px 12px 12px !important;
    align-self: flex-end;
  }

  body .toast,
  body #toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
    left: 12px !important;
    max-width: none !important;
  }

  /* Bottom tab bar */
  .mbar {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding: 6px 8px env(safe-area-inset-bottom, 0px);
    background: rgba(15, 18, 25, 0.94);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  }
  .mbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    color: var(--t4, #6f6c65);
    text-decoration: none;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .mbar a.on {
    color: var(--accent-hot, var(--accent));
    background: var(--accent-s, rgba(167, 139, 250, 0.12));
  }
  .mbar-ico {
    display: flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    background: none !important;
    border-radius: 0 !important;
  }
  .mbar-ico svg {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    stroke: currentColor;
    fill: none;
  }
  .mbar-lab {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  html.light .mbar {
    background: rgba(245, 245, 247, 0.94);
    border-top-color: #c8c5bc;
  }
  html.light body .header {
    background: rgba(245, 245, 247, 0.92) !important;
  }

  body .copy-btn,
  body .sd-copy.copy-btn,
  body .icon-btn,
  body .db-icon-btn,
  body .logout-btn,
  body .captcha-reload,
  body .sip-reg-item .sip-btn.ghost,
  body .sip-table .sip-btn.ghost,
  body .sip-kv .sip-btn.ghost {
    min-width: 44px !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 10px !important;
  }
  body .sd-copy:not(.copy-btn) {
    min-height: 44px !important;
  }
  body .sip-tab {
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 12px !important;
  }
}

@media (max-width: 380px) {
  body .rate-chip-text { display: none !important; }
  body .rate-chip { max-width: 36px; padding: 0 !important; justify-content: center; }
  body .page-title, body .db-top h1 { font-size: 20px !important; }
  body .dep-page .dep-top h1 { font-size: 20px !important; }
  body .dep-page .dep-crypto { font-size: 18px !important; }
  body .dep-page .dep-qr svg,
  body .dep-page .dep-qr img {
    width: 160px !important;
    height: 160px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body .sidebar {
    transition: none !important;
  }
}

@media (max-width: 860px) {
  body .sd-search,
  body .rt-search-wrap,
  body label.sd-search {
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
  }
  body .sd-search input,
  body .sd-search input[type="text"],
  body .rt-search-wrap input,
  body input.rt-search,
  body .rt-search {
    min-height: 0 !important;
    height: 22px !important;
    max-height: 28px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 16px !important;
  }
}

/* No Plans item in the left rail */
body .sidebar-nav a[href*="plans"],
body .sidebar-nav a[href*="Plans"],
body .nav-tile[href*="plans"],
body .mbar a[href*="plans"] {
  display: none !important;
}
