/* Compact working cabinet: all payment fields stay available on phones. */
@media screen and (max-width: 760px) {
  html { scroll-padding-bottom: 96px; }
  body { background: var(--bg); }
  button, .btn { border-radius: 9px; font-size: 14px; }
  input, select, textarea { border-radius: 9px; }
  .sidebar { min-height: 64px; justify-content: center; padding: 16px; background: var(--surface); }
  .sidebar .brand { padding-right: 78px; }
  .sidebar nav { position: fixed; inset: auto 0 0; z-index: 30; display: flex; flex-wrap: nowrap; gap: 4px; margin: 0; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); box-shadow: 0 -4px 20px #173d2808; }
  .sidebar nav button { flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 4px; min-height: 54px; padding: 5px 2px; font-size: 11px; border-radius: 10px; }
  .sidebar nav .icon { width: 21px; height: 21px; }
  .topbar { position: absolute; top: 10px; right: 12px; height: 44px; padding: 0; border: 0; }
  .topbar > span { display: none; }
  .topbar .right { gap: 4px; }
  .topbar #logout { padding: 8px; font-size: 12px; }
  .topbar:has(.test-badge) { position: static; padding: 0 16px; justify-content: flex-end; background: var(--surface); }
  .main { min-height: calc(100dvh - 64px); }
  .content { padding: 24px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-title { flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 20px; }
  h1 { font-size: 26px; letter-spacing: -.6px; }
  .page-title > button { width: 100%; min-height: 48px; font-size: 15px; }
  .stats { padding: 16px; margin-bottom: 26px; gap: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .stat:first-child { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
  .stat:first-child strong { font-size: 30px; color: var(--primary); }
  .stat strong { font-size: 22px; }
  .stat-label { font-size: 12px; }
  .panel-title { margin-bottom: 14px; }
  .panel-title h2 { font-size: 18px; }
  .payments-panel, #users-list { background: transparent; }
  .toolbar { margin-bottom: 16px; }
  .toolbar input, .toolbar select { min-height: 48px; background: var(--surface); }
  .search svg { top: 16px; }
  #reload { width: 48px; min-height: 48px; background: var(--surface); }
  #payment-list .table-wrap, #users-list .table-wrap { overflow: visible; border: 0; }
  #payment-list table, #users-list table { display: block; width: 100%; white-space: normal; }
  #payment-list thead, #users-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #payment-list tbody, #users-list tbody { display: grid; gap: 12px; }
  #payment-list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  #payment-list td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; }
  #payment-list .payment-order { grid-column: 1 / -1; }
  #payment-list .payment-order .order-link { justify-content: flex-start; min-height: 44px; padding: 0; font-size: 16px; font-weight: 650; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  #payment-list .buyer-email { max-width: none; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
  #payment-list .payment-sum { grid-column: 1; text-align: left; font-size: 21px; font-weight: 650; letter-spacing: -.4px; }
  #payment-list .payment-status { grid-column: 1 / -1; }
  #payment-list .status { font-size: 12px; padding: 3px 8px; }
  #payment-list .payment-refund { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--primary); border-radius: 0 6px 6px 0; background: var(--soft); color: var(--ink); }
  #payment-list .payment-client { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
  #payment-list .payment-client::before { content: 'Клиент: '; }
  #payment-list .row-client { display: inline; max-width: none; white-space: normal; overflow-wrap: anywhere; }
  #payment-list .payment-date { grid-column: 1; align-self: center; font-size: 11px; }
  #payment-list .payment-open { grid-column: 2; grid-row: 2; align-self: center; }
  #payment-list .payment-open button { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); }
  .table-footer { flex-wrap: wrap; justify-content: center; gap: 14px; padding-top: 20px; }
  .table-footer > span { width: 100%; text-align: center; font-size: 12px; }
  .pager { width: 100%; }
  .pager button { flex: 1; background: var(--surface); }
  #users-list tr { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  #users-list td { display: block; padding: 0; border: 0; overflow-wrap: anywhere; }
  #users-list .inline-actions { gap: 8px; }
  #users-list .inline-actions button { flex: 1; min-height: 44px; }
  .settings-form { max-width: none; }
  .settings-form .form-actions button { width: 100%; }
  .reports .report-actions { flex-wrap: wrap; gap: 8px; }
  .reports .report-actions > * { font-size: 13px; }
  .reports .report-presets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .reports .report-presets button { flex: none; }
  .reports form input, .reports form select { font-size: 16px; }
  .report-totals { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .report-rows .table-wrap, .cms-deliveries { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .cms-body { padding: 16px 0; }
  .cms-token { flex-wrap: wrap; }
  .cms-token button { width: 100%; }
  dialog:not(.payment-dialog) { width: calc(100vw - 24px); max-width: none; max-height: calc(100dvh - 24px); border-radius: 16px; }
  .dialog-head, .dialog-body { padding: 16px; }
  .dialog-head h2 { font-size: 19px; }
  .payment-dialog .dialog-head { padding: 12px 16px; }
  .payment-content { padding: 20px 16px; }
  .payment-actions { padding-inline: 16px; }
  .payment-actions button { font-size: 13px; }
  .copy-row { flex-wrap: wrap; }
  .copy-row input { flex-basis: 100%; font-size: 16px; }
  .copy-row button { width: 100%; font-size: 14px; }
  .refund-dialog .dialog-body { padding: 16px; }
  .login-card { border-radius: 16px; }
  #toast { bottom: calc(88px + env(safe-area-inset-bottom)); width: calc(100% - 32px); text-align: center; }
}
