/* Mobile UX refinements for m-money views (owned by one agent; loaded after admin.css) */
@media (max-width: 900px) {
  /* ---------- card lists (customers / quotes / invoices) ---------- */
  .mm-list { display: grid; gap: 8px; margin-bottom: 8px; }
  .mm-card { display: flex; align-items: stretch; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .mm-card:active { background: var(--hover); }
  .mmc-main { flex: 1; min-width: 0; padding: 12px 12px 12px 14px; cursor: pointer; display: grid; gap: 3px; align-content: center; min-height: 64px; }
  .mmc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .mmc-top b { font-size: 15.5px; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
  .mmc-top .badge { margin-left: auto; }
  .mmc-bal { margin-left: auto; font: 700 11.5px/1 var(--body); color: var(--bad); background: var(--bad-bg); padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
  .mmc-sub { color: var(--muted); font-size: 13px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mmc-sub b { color: var(--ink-2); font-weight: 600; }
  .mmc-sub b.late { color: var(--bad); }
  .mmc-acts { display: flex; flex-direction: column; border-left: 1px solid var(--line-2); }
  .mmc-ico { flex: 1; width: 52px; min-height: 44px; display: grid; place-items: center; color: var(--navy); text-decoration: none; }
  .mmc-ico + .mmc-ico { border-top: 1px solid var(--line-2); }
  .mmc-ico.wa { color: var(--wa); }
  .mmc-ico svg { width: 20px; height: 20px; }
  .mmc-ico:active { background: #f1eee6; }
  .mmc-amt { display: grid; align-content: center; justify-items: end; padding: 12px 14px 12px 4px; text-align: right; flex: none; }
  .mmc-amt b { font: 800 1.05rem/1.2 var(--display); letter-spacing: -.01em; white-space: nowrap; }
  .mmc-amt b.paid { color: var(--good); }
  .mmc-amt .badge { margin-top: 6px; }
  .mmc-amt small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
  .mm-list > .empty { margin: 0; }

  /* segmented filters: full width, thumb-sized, equal buttons */
  .filters .seg { display: flex; width: 100%; }
  .filters .seg button { flex: 1 1 0; min-height: 44px; padding: 0 6px; }
  .filters input[type=search], .filters select { min-height: 44px; }
  .inv-kpis > .kpi { flex-basis: 40%; }

  /* ---------- customer detail ---------- */
  .c-head { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px 12px; align-items: start; }
  .c-head .avatar { width: 48px; height: 48px; font-size: 16px; }
  .c-head .info { min-width: 0; }
  .c-head h1 { font-size: 1.25rem; line-height: 1.2; margin: 0 0 2px; }
  .c-head .c-edit { padding: 8px 12px; min-height: 40px; }
  .c-head .btn-row { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .c-head .btn-row .btn { min-height: 48px; font-size: 14.5px; }
  .c-head .btn svg { width: 18px; height: 18px; }
  .c-contact { margin-top: 6px; font-size: 14px; }
  .c-contact a.mono { font-size: 15px; }
  .c-since { font-size: 12.5px; margin-top: 4px; overflow-wrap: anywhere; }
  .c-kpis { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; margin: 0 0 14px; padding: 0; }
  .c-kpis > .kpi { flex: none; }
  .c-kpis .kpi .l { font-size: 12px; }
  .timeline li { padding-right: 14px; font-size: 14.5px; }
  .timeline li:nth-child(n+7) { display: none; }
  .timeline.open li { display: block; }
  .hist-more { width: calc(100% - 28px); margin: 12px 14px 14px; min-height: 44px; }
  .attn .btn.sm, .panel > header .btn.sm { min-height: 40px; padding: 8px 12px; }

  /* ---------- quote editor / viewer ---------- */
  .doc { padding: 14px; }
  .doc-head { flex-wrap: nowrap; align-items: flex-start; gap: 10px; padding-bottom: 10px; margin-bottom: 12px; }
  .doc-head img { width: 96px; }
  .doc .doc-head > div:last-child { text-align: right !important; font-size: 12.5px; }
  .doc-head h2 { font-size: 1.1rem !important; letter-spacing: .02em; }
  .q-meta { gap: 10px; }
  .q-meta > .f3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .q-method { grid-column: 1 / -1; }
  /* line items: one stacked card per line */
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines thead { display: none; }
  .lines tbody tr { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
  .lines td { padding: 0; width: auto !important; }
  .lines td.d { grid-column: 1 / -1; }
  .lines td.q, .lines td.p { position: relative; }
  .lines td[data-label]:not(.d)::before { content: attr(data-label); display: block; font: 600 10.5px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .lines td.x { grid-column: 3; grid-row: 2; }
  .lines input { padding: 11px 10px; min-height: 44px; }
  .lines .icon-btn { width: 44px; height: 44px; }
  [data-lines-wrap] .btn-row { margin-top: 10px !important; display: grid; gap: 8px; }
  [data-lines-wrap] .btn-row [data-addsvc] { width: 100%; min-height: 46px; flex: none; }
  [data-lines-wrap] .btn-row [data-addline] { min-height: 44px; }
  dialog:has(.modal-card.wide) { width: 100vw; }
  .q-totals { align-items: center; margin-top: 14px; font-size: 15px; gap: 8px 16px; }
  .q-totals input { min-height: 44px; width: 120px !important; }
  .doc textarea.tpl { min-height: 150px; }
  body:has(.page-actbar) main { padding-bottom: 150px; }

  /* ---------- invoice drawer ---------- */
  .d-bal { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--hover); border: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .d-bal span { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .d-bal b { font: 800 1.5rem/1 var(--display); }
  .d-bal.late { background: var(--bad-bg); border-color: transparent; }
  .d-bal.late b { color: var(--bad); }
  .d-sec .totals { font-size: 15px; }

  /* ---------- modal forms ---------- */
  .modal-form .f > input, .modal-form .f > select, .modal-form .f > textarea { min-height: 46px; }
  .modal-form .f > textarea { min-height: 80px; }
  .modal-form .checks label { padding: 10px 14px; min-height: 44px; }
  .modal-form .btn { min-height: 48px; }
  .pay-due { margin-bottom: 10px; font-size: 14px; }
  .pay-due b { color: var(--ink); }
  .pay-amt input { font-size: 22px !important; font-weight: 700; min-height: 54px !important; }
  .modal-form [data-lines-wrap] .lines tbody tr { padding: 10px 0; }
}
