/* 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. */

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

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


/* App customers list and detail. Fine on desktop and stacks cleanly at 390px. */
.upp-cust-list { display: flex; flex-direction: column; gap: 12px; }
.upp-cust-row {
  margin: 0;
  padding: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 16px;
  background: #fff;
}
.upp-cust-row h2 { margin: 0 0 6px; font-size: 18px; }
.upp-cust-row h2 a { color: #0c0c0c; text-decoration: none; }
.upp-cust-row h2 a:hover { border-bottom: 2px solid #fdcb0b; }
.upp-cust-meta,
.upp-cust-bal,
.upp-cust-cards,
.upp-cust-links { margin: 0 0 6px; font-size: 14px; color: #3a3a3a; }
.upp-cust-bal { font-weight: 650; color: #0c0c0c; }
.upp-cust-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.upp-cust-chips a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d0d5dd;
  color: #0c0c0c;
  text-decoration: none;
  font-size: 13px;
}
.upp-cust-chips a.is-on { background: #0c0c0c; color: #fdcb0b; border-color: #0c0c0c; }
.upp-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fdcb0b;
  color: #0c0c0c;
  font-size: 12px;
  font-weight: 650;
}
.upp-cust-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 14px; }
.upp-cust-filters button {
  background: #0c0c0c;
  color: #fdcb0b;
  border: 0;
}
.upp-cust-filters button:hover { background: #1a1a1a; color: #fdcb0b; }

.upp-cust-card-list { margin: 0; padding-left: 1.2em; }

@media screen and (max-width: 768px) {
  body.upp-desk .upp-menu { display: none; }

  body.upp-desk .upp-main-top {
    min-height: 52px;
  }
  body.upp-desk .upp-main-title {
    font-size: 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.upp-desk .upp-content {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }

  /* page-copy uses flex-basis 300px, which becomes height when the
     header stacks in a column on phones. Don't leave a blank band. */
  body.upp-desk .upp-page-head,
  body.upp-desk .upp-page-copy {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 0;
  }

  .upp-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: #0c0c0c;
    box-shadow: 0 -1px 0 rgba(253, 203, 11, 0.25);
  }
  a.upp-tab,
  button.upp-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: #c5cad3;
    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.upp-tab.is-on,
  button.upp-tab.is-on,
  a.upp-tab[aria-current="page"] {
    background: #fdcb0b;
    color: #0c0c0c;
  }
  a.upp-tab:focus-visible,
  button.upp-tab:focus-visible {
    outline: 2px solid #fdcb0b;
    outline-offset: 2px;
  }

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

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

  form.upp-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.upp-m-filter-form:not(.is-sheet) {
    flex-direction: row;
    flex-wrap: wrap;
  }
  form.upp-m-filter-form:not(.is-sheet) > :not(.upp-m-filter-open):not(:has(input[name="q"])):not(.upp-find[data-name="appId"]):not(button[type="submit"]):not(.upp-filter-actions) {
    display: none;
  }
  form.upp-m-filter-form:not(.is-sheet) .upp-filter-actions > :not(button[type="submit"]) {
    display: none;
  }
  form.upp-m-filter-form:not(.is-sheet) > label:has(input[name="q"]) {
    flex: 1 1 100%;
    min-width: 0;
    margin: 0;
  }
  form.upp-m-filter-form:not(.is-sheet) > label:has(input[name="q"]) input {
    width: 100%;
  }
  form.upp-m-filter-form:not(.is-sheet) > .upp-find[data-name="appId"] {
    flex: 1 1 160px;
    min-width: 0;
  }
  form.upp-m-filter-form:not(.is-sheet) > button[type="submit"],
  form.upp-m-filter-form:not(.is-sheet) .upp-filter-actions > button[type="submit"] {
    width: auto;
    min-height: 44px;
    flex: 0 0 auto;
  }

  .upp-filter-scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(12, 12, 12, 0.45);
  }
  form.upp-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(12, 12, 12, 0.22);
  }
  form.upp-m-filter-form.is-sheet > label,
  form.upp-m-filter-form.is-sheet > .upp-find,
  form.upp-m-filter-form.is-sheet > button,
  form.upp-m-filter-form.is-sheet > .upp-export,
  form.upp-m-filter-form.is-sheet > .upp-filter-actions,
  form.upp-m-filter-form.is-sheet > details {
    display: block;
    width: 100%;
    max-width: none;
  }
  form.upp-m-filter-form.is-sheet > button,
  form.upp-m-filter-form.is-sheet .upp-filter-actions button,
  form.upp-m-filter-form.is-sheet .upp-export summary,
  form.upp-m-filter-form.is-sheet .upp-export-menu a,
  form.upp-m-filter-form.is-sheet .upp-export-menu button {
    min-height: 44px;
  }
  form.upp-m-filter-form.is-sheet .upp-export-menu {
    position: static;
    width: 100%;
    box-shadow: none;
  }
  form.upp-m-filter-form .upp-find,
  form.upp-m-filter-form .upp-find-summary {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 44px;
  }
  form.upp-m-filter-form:not(.is-sheet) .upp-find-drop[open] .upp-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.upp-m-filter-form:not(.is-sheet) .upp-find-list {
    max-height: min(52dvh, 380px);
  }
  form.upp-m-filter-form.is-sheet .upp-find-panel {
    position: static;
    width: 100%;
    max-width: none;
    box-shadow: none;
  }
  form.upp-m-filter-form .upp-find-opt {
    min-height: 44px;
  }

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

  .upp-ledger.upp-m-cards .upp-col-picker { display: none; }
  .upp-ledger.upp-m-cards .upp-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .upp-ledger.upp-m-cards .upp-grid-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .upp-ledger.upp-m-cards .upp-grid-table,
  .upp-ledger.upp-m-cards .upp-grid-table tbody {
    display: block;
    width: 100%;
  }
  .upp-ledger.upp-m-cards .upp-grid-table tr.upp-click-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    position: relative;
    width: auto;
    max-width: none;
    margin: 0 0 10px;
    padding: 14px 28px 12px 14px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
    cursor: pointer;
  }
  .upp-ledger.upp-m-cards .upp-grid-table tr.upp-click-row::after {
    content: "›";
    position: absolute;
    top: 14px;
    inset-inline-end: 12px;
    color: #8b939e;
    font-size: 22px;
    line-height: 1;
  }
  html[dir="rtl"] .upp-ledger.upp-m-cards .upp-grid-table tr.upp-click-row::after {
    content: "‹";
  }
  .upp-ledger.upp-m-cards .upp-grid-table tr[data-empty] {
    display: block;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    padding: 8px 12px;
    margin: 0 0 10px;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td,
  .upp-ledger.upp-m-cards .upp-grid-table td:first-child {
    position: static;
    left: auto;
    right: auto;
    display: block;
    width: auto;
    max-width: none;
    border: 0;
    padding: 0;
    background: transparent !important;
    box-shadow: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    justify-content: flex-start;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td::before { content: none; }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="amount"] {
    order: 1;
    flex: 1 1 auto;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="status"] {
    order: 2;
    flex: 0 0 auto;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="merchant"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="merchantCell"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="name"] {
    order: 3;
    flex: 1 0 100%;
    font-weight: 650;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="CREATE_DATE"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="when"] {
    order: 4;
    flex: 1 1 auto;
    color: #5c6570;
    font-size: 13px;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="CARD_MASK"] {
    order: 5;
    flex: 0 0 auto;
    color: #0c0c0c;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="action"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="pick"] {
    order: 6;
    flex: 1 0 100%;
    margin-top: 4px;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="reason"] {
    order: 7;
    flex: 1 0 100%;
    color: #5c6570;
    font-size: 13px;
  }
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="TXN_ID"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="ORDER_ID"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="customer"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="email"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="currency"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="txnType"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="acquirer"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="commission"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="vat"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="totalFee"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="settled"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="mid"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="lane"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="fixed"],
  .upp-ledger.upp-m-cards .upp-grid-table td[data-col="settleDate"] {
    display: none;
  }
  .upp-ledger.upp-m-cards .upp-text-link,
  .upp-ledger.upp-m-cards .upp-link-btn,
  .upp-ledger.upp-m-cards .upp-pager button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .upp-ledger.upp-m-cards .upp-pager button { justify-content: center; }

  /* Plain admin tables (chat, funding alerts, deposits) become stacked cards. */
  table.upp-table {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
  }
  table.upp-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table.upp-table tbody,
  table.upp-table tr {
    display: block;
    width: 100%;
  }
  table.upp-table tr {
    margin: 0 0 10px;
    padding: 14px 14px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
  }
  table.upp-table td {
    display: block;
    border: 0;
    padding: 3px 0;
    overflow-wrap: anywhere;
  }
  table.upp-table td:first-child {
    font-weight: 650;
    font-size: 16px;
  }
  #customer-chat-thread textarea,
  #customer-chat-thread button[type="submit"] {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
  }
  #customer-chat-thread textarea { min-height: 88px; }
  ul.customer-chat-messages li {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f4f5f7;
  }
  .upp-metrics { grid-template-columns: 1fr 1fr; }
  .upp-dash .upp-btn,
  .upp-dash .upp-btn-ghost,
  .upp-page-actions .upp-btn,
  .upp-page-actions .upp-btn-ghost {
    min-height: 44px;
  }

  .upp-cust-filters { flex-direction: column; align-items: stretch; }
  .upp-cust-filters input,
  .upp-cust-filters button { width: 100%; min-height: 44px; box-sizing: border-box; }
  .upp-cust-chips a { min-height: 44px; }
  .upp-cust-row { padding: 14px; }
  #customer-profile .upp-txn-dl div { display: block; margin: 0 0 10px; }
  #customer-profile dt { font-size: 12px; color: #667085; }
  #customer-profile dd { margin: 0; overflow-wrap: anywhere; }
}

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