/* Phone admin shell. Every layout change is inside max-width: 768px.
   At 769px and up these rules do not apply, so the desktop header,
   sidebar, and tables stay as they are. New pieces are hidden
   by default. */

.rdp-tabbar,
.rdp-m-filter-open,
.rdp-m-desk-note,
.rdp-filter-scrim {
  display: none;
}

.rdp-a2hs[hidden] { display: none; }
.rdp-a2hs:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f4f5f7;
  color: #1c2323;
  font-size: 13px;
  line-height: 1.4;
}
.rdp-a2hs p { margin: 0; flex: 1 1 auto; }
.rdp-a2hs .rdp-btn-ghost { min-height: 44px; flex: 0 0 auto; }

@media screen and (max-width: 768px) {
  /* Hamburger is replaced by the More tab; keep the top bar compact. */
  body.rdp-desk .rdp-menu { display: none; }

  body.rdp-desk .rdp-main-top {
    min-height: 48px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: 8px;
  }
  body.rdp-desk .rdp-main-title {
    font-size: 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.rdp-desk .rdp-content {
    padding-top: 8px;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  /* Reclaim vertical space: long desktop leads / row-count chrome feel empty on phone. */
  body.rdp-desk .rdp-page-head {
    margin: 0 0 10px;
  }
  body.rdp-desk .rdp-page-head h1 {
    font-size: 18px;
    line-height: 1.25;
  }
  body.rdp-desk .rdp-page-lead,
  body.rdp-desk .rdp-kicker {
    display: none;
  }
  body.rdp-desk .rdp-ledger.rdp-m-cards .rdp-dt-toolbar {
    display: none;
  }

  .rdp-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    gap: 2px;
    margin: 0;
    padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: #1c2323;
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.08);
  }
  a.rdp-tab,
  button.rdp-tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 6px 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
    color: #c5cece;
    font: 700 11px/1.15 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    text-align: center;
    text-decoration: none;
    white-space: normal;
  }
  a.rdp-tab.is-on,
  button.rdp-tab.is-on,
  a.rdp-tab[aria-current="page"] {
    background: #f4f5f7;
    color: #1c2323;
  }
  a.rdp-tab:focus-visible,
  button.rdp-tab:focus-visible {
    outline: 2px solid #c4472a;
    outline-offset: 2px;
  }

  body.rdp-desk .rdp-support {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .rdp-m-filter-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    width: auto;
  }
  .rdp-m-filter-when-open { display: none; }
  form.rdp-m-filter-form.is-sheet .rdp-m-filter-when-closed { display: none; }
  form.rdp-m-filter-form.is-sheet .rdp-m-filter-when-open { display: inline; }

  form.rdp-m-filter-form {
    position: sticky;
    top: 0;
    z-index: 28;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: #f4f5f7;
    border: 0;
    border-radius: 12px;
    box-shadow: none;
  }
  form.rdp-m-filter-form:not(.is-sheet) {
    flex-direction: row;
    flex-wrap: wrap;
  }
  form.rdp-m-filter-form:not(.is-sheet) > :not(.rdp-m-filter-open):not(:has(input[name="q"])):not(.rdp-find[data-name="appId"]):not(button[type="submit"]) {
    display: none;
  }
  form.rdp-m-filter-form:not(.is-sheet) > label:has(input[name="q"]) {
    flex: 1 1 100%;
    min-width: 0;
    margin: 0;
  }
  form.rdp-m-filter-form:not(.is-sheet) > label:has(input[name="q"]) input {
    width: 100%;
  }
  form.rdp-m-filter-form:not(.is-sheet) > .rdp-find[data-name="appId"] {
    flex: 1 1 160px;
    min-width: 0;
  }
  form.rdp-m-filter-form:not(.is-sheet) > button[type="submit"] {
    width: auto;
    min-height: 44px;
    flex: 0 0 auto;
  }

  .rdp-filter-scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(28, 35, 35, 0.45);
  }
  form.rdp-m-filter-form.is-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-height: min(85dvh, 680px);
    overflow: auto;
    margin: 0;
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(28, 35, 35, 0.22);
  }
  form.rdp-m-filter-form.is-sheet > label,
  form.rdp-m-filter-form.is-sheet > .rdp-find,
  form.rdp-m-filter-form.is-sheet > button,
  form.rdp-m-filter-form.is-sheet > .rdp-export,
  form.rdp-m-filter-form.is-sheet > details {
    display: block;
    width: 100%;
    max-width: none;
  }
  form.rdp-m-filter-form.is-sheet > button,
  form.rdp-m-filter-form.is-sheet .rdp-export summary,
  form.rdp-m-filter-form.is-sheet .rdp-export-menu a,
  form.rdp-m-filter-form.is-sheet .rdp-export-menu button {
    min-height: 44px;
  }
  form.rdp-m-filter-form.is-sheet .rdp-export-menu {
    position: static;
    width: 100%;
    box-shadow: none;
  }
  form.rdp-m-filter-form .rdp-find,
  form.rdp-m-filter-form .rdp-find-summary {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 44px;
  }
  form.rdp-m-filter-form:not(.is-sheet) .rdp-find-drop[open] .rdp-find-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: none;
    max-height: min(70dvh, 520px);
    border-radius: 16px 16px 0 0;
    z-index: 80;
  }
  form.rdp-m-filter-form:not(.is-sheet) .rdp-find-list {
    max-height: min(52dvh, 380px);
  }
  form.rdp-m-filter-form.is-sheet .rdp-find-panel {
    position: static;
    width: 100%;
    max-width: none;
    box-shadow: none;
  }
  form.rdp-m-filter-form .rdp-find-opt {
    min-height: 44px;
  }

  .rdp-m-desk-note {
    display: block;
    margin: 8px 0 12px;
    padding: 14px 16px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    color: #5c6767;
    font-size: 14px;
    line-height: 1.4;
  }
  .rdp-ledger.rdp-m-desk-only { display: none; }

  .rdp-ledger.rdp-m-cards .rdp-col-picker { display: none; }
  .rdp-ledger.rdp-m-cards .rdp-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table,
  .rdp-ledger.rdp-m-cards .rdp-grid-table tbody {
    display: block;
    width: 100%;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table tr.rdp-click-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    position: relative;
    width: auto;
    max-width: none;
    margin: 0 0 10px;
    padding: 12px 28px 12px 14px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
    cursor: pointer;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table tr.rdp-click-row::after {
    content: "›";
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    color: #7b8686;
    font-size: 22px;
    line-height: 1;
  }
  html[dir="rtl"] .rdp-ledger.rdp-m-cards .rdp-grid-table tr.rdp-click-row::after {
    content: "‹";
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table tr[data-empty] {
    display: block;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    padding: 8px 12px;
    margin: 0 0 10px;
  }

  /* Beat checkout.min.css sticky-first-col + 720px label stack, and beat
     rdpInitCols inline display:none for the fields a phone card must show. */
  .rdp-ledger.rdp-m-cards .rdp-grid-table td,
  .rdp-ledger.rdp-m-cards .rdp-grid-table th:first-child,
  .rdp-ledger.rdp-m-cards .rdp-grid-table td:first-child {
    position: static !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td {
    display: none;
    width: auto;
    max-width: none !important;
    border: 0;
    padding: 0;
    background: transparent !important;
    overflow: visible !important;
    text-overflow: clip;
    white-space: normal;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td::before { content: none !important; }

  /* Product card: amount (+currency already in money()), status, merchant,
     customer, time, masked card, decline reason. Row tap opens detail. */
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="amount"] {
    display: block !important;
    order: 1;
    flex: 1 1 auto;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="status"] {
    display: block !important;
    order: 2;
    flex: 0 0 auto;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="merchantCell"] {
    display: block !important;
    order: 3;
    flex: 1 0 100%;
    font-weight: 650;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="merchantCell"] small {
    font-weight: 450;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="customer"] {
    display: block !important;
    order: 4;
    flex: 1 0 100%;
    color: #1c2323;
    font-size: 14px;
    font-weight: 550;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="CREATE_DATE"] {
    display: block !important;
    order: 5;
    flex: 1 1 auto;
    color: #5c6767;
    font-size: 13px;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="CARD_MASK"] {
    display: block !important;
    order: 6;
    flex: 0 0 auto;
    color: #1c2323;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="ORDER_ID"] {
    display: block !important;
    order: 7;
    flex: 1 0 100%;
    color: #5c6767;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="ORDER_ID"]::before {
    content: attr(data-label) ": ";
    color: #7b8686;
    font-weight: 650;
  }
  /* Do not reserve rows for blank optional fields. */
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="customer"]:empty,
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="ORDER_ID"]:empty,
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="merchantCell"]:empty,
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="CARD_MASK"]:empty,
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="reason"]:empty {
    display: none !important;
  }
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="reason"] {
    display: block !important;
    order: 8;
    flex: 1 0 100%;
    color: #5c6767;
    font-size: 13px;
  }

  /* Hide everything else on the card, including Details/Refund (row is tappable). */
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="TXN_ID"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="email"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="currency"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="txnType"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="acquirer"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="commission"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="vat"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="totalFee"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="settled"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="mid"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="lane"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="fixed"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="settleDate"],
  .rdp-ledger.rdp-m-cards .rdp-grid-table td[data-col="action"] {
    display: none !important;
  }

  .rdp-ledger.rdp-m-cards .rdp-text-link,
  .rdp-ledger.rdp-m-cards .rdp-link-btn,
  .rdp-ledger.rdp-m-cards .rdp-pager button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .rdp-ledger.rdp-m-cards .rdp-pager button { justify-content: center; }
  .rdp-ledger.rdp-m-cards .rdp-pager {
    margin-top: 4px;
  }
}

@media print {
  .rdp-tabbar,
  .rdp-m-filter-open,
  .rdp-a2hs,
  .rdp-m-desk-note,
  .rdp-filter-scrim { display: none !important; }
  .rdp-ledger.rdp-m-desk-only { display: block !important; }
}
