/* mobile.css — the phone layout (reference: docs/mockups/mobile.html).
 *
 * Desktop is not affected: every rule that changes how a page looks sits inside the phone media query below
 * (narrow, or a touch screen held sideways — the same test as nbIsPhone() in nestbook.js). Outside it there are
 * only (a) phone-only elements kept hidden and (b) the bell's "Needs attention" list and the More page, which
 * are the same on every screen.
 */

/* ── Phone-only elements: hidden on desktop ─────────────────────────────── */
.m-titlebar, .m-fab, .m-only, .m-call-td, .m-lab, .m-back { display: none; }

/* ── Bell: "Needs attention" (phone and desktop) ────────────────────────── */
.nb-attn { width: 340px; max-width: calc(100vw - 24px); border-radius: 14px; border: 1px solid var(--border);
           box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: 6px 6px 8px; }
.nb-attn-h { font-size: .95rem; font-weight: 700; color: var(--text); padding: 8px 10px 6px; }
.nb-attn-g { font-size: .78rem; font-weight: 600; color: var(--text-muted); padding: 10px 10px 4px; }
.nb-attn-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; white-space: normal; }
.nb-attn-ic { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.nb-attn-ic.approval { background: var(--amber-light); color: var(--amber); }
.nb-attn-ic.overdue  { background: var(--red-light); color: var(--red); }
.nb-attn-tx { min-width: 0; display: flex; flex-direction: column; }
.nb-attn-tx b { font-size: .86rem; font-weight: 600; color: var(--text); }
.nb-attn-tx span { font-size: .78rem; color: var(--text-muted); }
.nb-attn-empty { font-size: .86rem; color: var(--text-2); padding: 10px 10px 8px; display: flex; align-items: center; gap: 8px; }
.nb-attn-empty i { color: var(--teal); font-size: 1.05rem; }

/* ── More page (a phone page, but it works on any screen) ───────────────── */
/* Phone: the content is hidden while the page is laid out (header.jsp sets m-pending, mobile.js clears it), then fades in.
   If mobile.js never runs, it shows anyway after 1.5s. */
html.m-pending .nb-content, html.m-pending .m-title-slot { opacity: 0; animation: mReveal 0s 1.5s forwards; }
@keyframes mReveal { to { opacity: 1; } }
.nb-content, .m-title-slot { transition: opacity .12s ease-out; }

/* "More" sheet from the bottom bar (mobile-more.jsp) */
.m-more-sheet .m-sheet-body { padding-top: 0; }
.more-h { font-size: .95rem; font-weight: 600; color: var(--text); margin: 16px 6px 8px; }
.more-h:first-child { margin-top: 4px; }
.more-grp { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 8px 6px; }
.more-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.more-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 2px; border-radius: 12px;
             font-size: .8rem; color: var(--text); text-align: center; text-decoration: none; line-height: 1.25; }
.more-tile:hover, .more-tile:focus-visible { background: var(--surface-2); color: var(--text); }
.more-ic { position: relative; width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
           background: var(--accent-light); color: var(--accent); font-size: 1.2rem; }
.more-n { position: absolute; top: -5px; right: -7px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
          background: var(--red); color: #fff; font-size: .66rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
          border: 2px solid var(--surface); }

/* ═══════════════════════════════════════════════════════════════════════════
   PHONE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px), (hover: none) and (pointer: coarse) and (max-height: 500px) {

  /* ── Top bar: building on the left, bell + avatar on the right; the title has its own line ── */
  .nb-topbar { height: 52px; --topbar-h: 52px; padding: 0 12px; gap: 6px; border-bottom: 0; }
  .nb-topbar .btn-hamburger, .nb-topbar .topbar-left, .nb-topbar .nb-quick { display: none !important; }
  .topbar-actions { flex: 1; min-width: 0; gap: 4px; }
  .nb-prop-dd { margin-right: auto; min-width: 0; }
  /* the switcher is on the left on a phone: open its menu from the left edge, not off-screen to the left */
  .nb-prop-dd .dropdown-menu { inset: calc(100% + 4px) auto auto 0 !important; transform: none !important; }
  .nb-prop-switcher { max-width: 62vw; border: 0; background: var(--surface-2); border-radius: 999px; padding: 6px 12px 6px 10px; }
  .nb-prop-name { max-width: none; font-size: .84rem; font-weight: 500; }
  .nb-bell { display: block; }
  .nb-bell .topbar-icon-btn { display: flex !important; width: 40px; height: 40px; background: none; border: 0; color: var(--text-2); }
  .nb-bell .nb-bell-n { font-size: .66rem !important; padding: 2px 5px !important; transform: translate(-70%, -10%) !important; }
  .topbar-user-btn { border: 0 !important; padding: 0 !important; background: none !important; }
  .topbar-user-btn.dropdown-toggle::after { display: none; }
  .nb-attn { width: calc(100vw - 24px); }

  .m-titlebar { display: flex; align-items: center; gap: 10px; padding: 2px 12px 12px 13px; background: var(--surface);
                border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .m-title { margin: 0; flex: 1; min-width: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; color: var(--text); }
  .m-title-slot:empty { display: none; }

  /* ── Content: room at the bottom for the bottom bar and "+ New" ── */
  .nb-content { padding: 12px 12px calc(150px + env(safe-area-inset-bottom, 0px)); }

  /* ── Bottom bar: five items with full labels ── */
  .nb-bnav-item { min-width: 0; padding: 6px 2px; }
  .nb-bnav-label { font-size: .7rem; }

  /* ── "+ New" ── */
  .m-fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 950;
           right: 16px; bottom: calc(64px + 16px + env(safe-area-inset-bottom, 0px));
           background: var(--accent); color: #fff; border: 0; border-radius: 16px; padding: 14px 18px;
           font: 600 .92rem var(--font); box-shadow: 0 6px 16px rgba(2,89,200,.35); transition: padding .2s; }
  .m-fab i { font-size: 1.1rem; }
  .m-fab.m-shrink { padding: 15px; }
  .m-fab.m-shrink .m-fab-l { display: none; }
  /* while typing, the keyboard needs the room: the bar and the button step aside */
  body.m-typing .m-fab, body.m-typing .nb-bottom-nav { display: none; }

  /* ── Bottom sheets ── */
  .m-sheet { height: auto !important; max-height: 88vh; border: 0 !important; border-radius: 22px 22px 0 0; }
  .m-sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 8px auto 2px; }
  .m-sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 6px 18px 6px 20px; }
  .m-sheet-h h2 { margin: 0; font-size: 1.1rem; font-weight: 700; }
  .m-sheet-body { padding: 4px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .m-grp { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
  .m-grp-h { font-size: .92rem; font-weight: 600; color: var(--text); padding: 14px 4px 8px; }
  .m-li { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left;
          padding: 12px 14px; font: inherit; color: var(--text); min-height: 56px; }
  .m-li + .m-li { border-top: 1px solid var(--surface-3); }
  .m-li:active { background: var(--surface-2); }
  .m-li-ic { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
  .m-li-ic.blue  { background: var(--accent-light); color: var(--accent); }
  .m-li-ic.in    { background: var(--teal-light); color: var(--teal); }
  .m-li-ic.out   { background: var(--red-light); color: var(--red); }
  .m-li-ic.amber { background: var(--amber-light); color: #A14F00; }
  .m-li-ic.gray  { background: var(--surface-2); color: var(--text-2); }
  .m-li-tx { min-width: 0; }
  .m-li-tx b { display: block; font-weight: 500; font-size: .95rem; }
  .m-li-tx span { display: block; font-size: .78rem; color: var(--text-muted); margin-top: 1px; }

  /* ── Page tabs: one segmented bar, equal parts, never scrolling sideways ──
     Two markups: div.gm-tabs-bar > ul.gm-tabs-list > li (People, Vendors) and ul.gm-tabs-bar > li (Units, Staff). */
  .gm-tabs-bar { border: 0; background: transparent; border-radius: 0; flex-wrap: nowrap; overflow: visible; margin-bottom: 12px; padding: 0; }
  .gm-tabs-list, ul.gm-tabs-bar { flex: 1 1 100%; background: #E4E7EB; border-radius: 12px; padding: 3px; }
  /* (the tab items share the .nav-item class with the sidebar links — undo the sidebar's padding and hover) */
  .gm-tabs-list > .nav-item, ul.gm-tabs-bar > .nav-item { flex: 1 1 0; min-width: 0; padding: 0; margin: 0; background: none !important; display: block; }
  .gm-tabs-bar .nav-item > .gm-tab { width: 100%; }
  .gm-tab { justify-content: center; padding: 8px 4px; border: 0 !important; border-radius: 9px; margin: 0; font-size: .85rem; height: 100%; }
  .gm-tab i { display: none; }
  .gm-tab.active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.04); }
  .gm-tab-count { background: #D5D9DE; color: #3C4043; font-weight: 600; }
  .gm-tab.active .gm-tab-count { background: var(--accent-light); color: var(--accent); }
  .gm-tabs-spacer { display: none !important; }
  /* the page's own Add button moves into "+ New" */
  .gm-tabs-actions { display: none !important; }
  /* one tab only (nothing to switch): no bar */
  .gm-tabs-bar:not(:has(.nav-item + .nav-item)) { display: none; }
  .gm-tabs-content { border: 0; border-radius: 0; overflow: visible; }

  /* ── Lists: one toolbar row — search across the width, download as an icon; no "Show 25 entries" ── */
  div.dt-length { display: none !important; }
  .dt-top { padding: 0 0 12px !important; margin-bottom: 16px; border: 0 !important; background: transparent; }   /* the phone keeps its gap above the cards */
  .dt-top-right { flex: 1 1 auto; min-width: 0; width: 100%; gap: 8px !important; }
  div.dt-search { flex: 1 1 auto; min-width: 0; }
  div.dt-search input { min-width: 0 !important; width: 100% !important; height: 44px; border-radius: 12px; font-size: .9rem; padding-left: 36px; margin: 0 !important; }
  .dt-buttons { flex: 0 0 auto !important; width: auto !important; }
  .btn-dt-download { font-size: 0 !important; width: 44px; height: 44px; padding: 0 !important; border-radius: 50% !important;
                     display: inline-flex !important; align-items: center; justify-content: center; flex-shrink: 0; }
  .btn-dt-download i { font-size: 1.05rem; margin: 0 !important; }

  /* ── Phone-only bits inside pages; desktop-only bits hidden ── */
  .m-only { display: inline; }
  .m-no { display: none !important; }
  table.m-cards td.m-desk-hide { display: block; }

  /* ═══ List cards ═══════════════════════════════════════════════════════════
     A table marked .m-cards shows each row as a card (one DOM, so search, sort and download keep working).
     Cells say what they are: .m-c-main (name + avatar), .m-c-line (a line under the name), .m-c-chips (unit chips,
     labels), .m-c-hide (desktop only). The row's actions column is hidden: tapping the card opens it (mobile.js),
     and a phone number in data-m-tel gets a round Call button. */
  .nb-card:has(table.m-cards), .gm-tabs-content .nb-card:has(table.m-cards) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-wrap:has(table.m-cards) { overflow: visible; }
  .dt-container:has(table.m-cards) .dt-foot { display: none; }
  table.m-cards { display: block; width: 100% !important; border: 0; }
  table.m-cards thead { display: none; }
  table.m-cards tbody { display: flex; flex-direction: column; gap: 12px; }
  table.m-cards tbody tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; row-gap: 4px; position: relative;
                           background: var(--surface) !important; border: 1px solid var(--border); border-radius: 14px; padding: 16px 14px 16px 16px; cursor: pointer; }
  table.m-cards tbody tr:active { background: #F6F8FB !important; }
  table.m-cards tbody tr > td { display: block; border: 0 !important; padding: 0 !important; background: none !important; min-width: 0; box-shadow: none !important; }
  table.m-cards tbody tr > td:last-child, table.m-cards .m-c-hide { display: none !important; }
  table.m-cards tbody tr > td.m-call-td { display: block !important; position: absolute; right: 14px; top: 16px; }
  table.m-cards tbody tr:has(> td.m-call-td) > td.m-c-main { padding-right: 52px !important; }
  table.m-cards .m-c-main { order: 1; flex: 1 1 0; }
  table.m-cards .m-c-line { order: 3; flex: 0 0 100%; padding-left: 54px !important; font-size: .84rem; color: var(--text-2); line-height: 1.45; }
  table.m-cards .m-c-chips { order: 4; flex: 0 0 auto; display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: .8rem; color: var(--text-muted); }
  table.m-cards .m-c-chips:first-of-type, table.m-cards .m-c-line + .m-c-chips { padding-left: 54px !important; }
  table.m-cards .m-c-chips:empty { display: none !important; }
  table.m-cards .person-avatar { width: 40px; height: 40px; font-size: .95rem; flex-shrink: 0; position: absolute; left: 16px; top: 16px; }
  table.m-cards tbody tr:has(.person-avatar) { min-height: 72px; }
  table.m-cards .m-c-main:has(.person-avatar) { padding-left: 54px !important; align-self: center; }
  table.m-cards .m-c-line { margin-top: -2px; }
  table.m-cards .m-c-main > .d-flex { gap: 14px !important; }
  table.m-cards .person-name { font-size: .95rem; font-weight: 600; line-height: 1.35; }
  table.m-cards td.dt-empty, table.m-cards td.dataTables_empty { display: block !important; flex: 1 1 100%; text-align: center; color: var(--text-muted); }
  .m-call { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
            background: var(--accent-light); color: var(--accent); font-size: 1.05rem; text-decoration: none; position: relative; }
  .m-call::after { content: ''; position: absolute; inset: -2px; }   /* 44px to tap */
  .m-lab { display: inline-block; width: 66px; flex-shrink: 0; font-size: .66rem; font-weight: 500; letter-spacing: .5px; text-transform: uppercase; color: #5F6368; }

  /* Owners & Tenants: "· On portal" / "· Invited" after the unit chips (words drawn here, so desktop search and downloads don't see them) */
  table.m-cards td.m-portal > * { display: none !important; }
  table.m-cards td.m-portal:not(.m-portal-on):not(.m-portal-inv) { display: none !important; }
  table.m-cards td.m-portal-on::after  { content: '· On portal'; }
  table.m-cards td.m-portal-inv::after { content: '· Invited'; }

  /* Units: [A2]  RESIDENT name / OWNER name, and "৳… due" top right */
  #tblUnits tbody tr { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "tile res due" "tile own due";
                       column-gap: 14px; row-gap: 4px; align-items: center; }
  #tblUnits td.m-u-tile { grid-area: tile; }
  #tblUnits td.m-u-tile .nb-badge { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
                                     font-size: 1rem; font-weight: 700; padding: 0; }
  #tblUnits td.m-u-res { grid-area: res; }
  #tblUnits td.m-u-own { grid-area: own; }
  #tblUnits td.m-u-res, #tblUnits td.m-u-own { display: flex !important; align-items: baseline; min-width: 0; white-space: nowrap; overflow: hidden; }
  #tblUnits td.m-u-res::before, #tblUnits td.m-u-own::before { display: inline-block; width: 66px; flex-shrink: 0; font-size: .66rem; font-weight: 500;
                                     letter-spacing: .5px; text-transform: uppercase; color: #5F6368; }
  #tblUnits td.m-u-res::before { content: 'Resident'; }
  #tblUnits td.m-u-own::before { content: 'Owner'; }
  #tblUnits td.m-u-res strong { font-size: .95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
  #tblUnits td.m-u-own strong { font-weight: 400; font-size: .88rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
  #tblUnits td.m-u-res > div, #tblUnits td.m-u-own > div { display: none; }        /* the date ranges */
  #tblUnits td.m-u-vacant > * { display: none !important; }
  #tblUnits td.m-u-vacant::after { content: 'Vacant'; color: var(--text-muted); font-size: .95rem; }
  #tblUnits td.m-u-due { grid-area: due; align-self: start; }
  #tblUnits td.m-u-due > * { display: none !important; }
  #tblUnits td.m-u-due[data-m-due]::after { content: attr(data-m-due); font-size: .8rem; font-weight: 600; color: var(--red); white-space: nowrap; }
  #tblUnits tbody tr > td:nth-child(5) { display: none !important; }              /* meters: in the unit's Meters tab */
  /* the building's own meters: a slim row above the units */
  #tblUnits tr.m-bld-row { display: flex; padding: 10px 14px; background: transparent !important; border-style: dashed; }
  #tblUnits tr.m-bld-row > td { display: none !important; }
  #tblUnits tr.m-bld-row > td.m-bld { display: block !important; }
  #tblUnits tr.m-bld-row > td.m-bld > * { display: none; }
  #tblUnits tr.m-bld-row > td.m-bld::after { content: 'Building · common area meters  ›'; font-size: .86rem; color: var(--text-2); }

  /* Staff / Vendors: the job role or service as plain words under the name */
  table.m-cards td.m-st-role .nb-badge { background: none !important; padding: 0; font-size: .84rem; font-weight: 400; color: var(--text-2) !important; }
  /* Staff / Vendors: two lines — name, then "job role · number" (the start date, contact person etc. are inside the card) */
  #tblStaff .m-c-main .person-name ~ *, #tblVendors .m-c-main .person-name ~ * { display: none !important; }
  table.m-cards td.m-st-role { margin-top: -2px; }
  table.m-cards td.m-st-role[data-m-tel]:not([data-m-tel=""])::after { content: ' · ' attr(data-m-tel); color: var(--text-2); }

  /* Utility Bills: [☐] Water ……… ৳1,200 / Unpaid · due 25 Jul ……… [Pay]  (the checkbox stays: pay several at once) */
  #tblUtility tbody tr { padding-left: 50px; align-items: center; }
  #tblUtility tbody tr > td:nth-child(1) { position: absolute; left: 14px; top: 16px; }
  #tblUtility tbody tr > td:nth-child(1) input { width: 20px; height: 20px; }
  #tblUtility tbody tr > td:nth-child(2) { order: 1; flex: 1 0 calc(100% - 6.5rem - 14px); font-size: .95rem; padding-right: 10px !important; }
  #tblUtility tbody tr > td:nth-child(2) .fw-600 { font-size: .95rem !important; }
  #tblUtility tbody tr > td:nth-child(4) { order: 2; flex: 0 0 6.5rem; text-align: right; font-size: .95rem; }
  #tblUtility tbody tr > td:nth-child(3) { display: none !important; }                  /* the month: it's beside the title */
  #tblUtility tbody tr > td:nth-child(6) { order: 3; }
  #tblUtility tbody tr > td:nth-child(5) { order: 4; font-size: .8rem; color: var(--text-muted); }
  #tblUtility tbody tr > td:nth-child(5)::before { content: 'due '; }
  #tblUtility tbody tr > td:nth-child(7) { order: 5; font-size: .8rem; color: var(--text-muted); }
  #tblUtility tbody tr > td:nth-child(7):has(.text-muted) { display: none !important; }
  #tblUtility tbody tr > td:nth-child(7)::before { content: '· paid '; }
  #tblUtility tbody tr.m-bill-paid > td:nth-child(5) { display: none !important; }   /* paid: the due date no longer matters */
  /* only "Record payment" stays on the card, as a "Record" button; edit and delete are inside the bill */
  #tblUtility.m-cards tbody tr > td:last-child { display: flex !important; order: 6; margin-left: auto; }
  #tblUtility tbody tr > td:last-child > * { display: none !important; }
  #tblUtility tbody tr > td:last-child > [title="Record payment"] { display: inline-flex !important; width: auto; height: 40px; padding: 0 16px;
      border-radius: 999px; border: 1.5px solid var(--accent); background: var(--accent-light); color: var(--accent-dark); font-size: 0; position: relative; }
  #tblUtility tbody tr > td:last-child > [title="Record payment"] i { display: none; }
  #tblUtility tbody tr > td:last-child > [title="Record payment"]::before { content: 'Record'; font-size: .82rem; font-weight: 600; }
  #tblUtility tbody tr > td:last-child > [title="Record payment"]::after { content: ''; position: absolute; inset: -4px -2px; }      /* 48px to tap */

  /* ═══ Money pages: month beside the title, totals in one strip, filters behind an icon ═══ */
  .m-title-slot .m-month { display: flex; align-items: center; background: var(--surface-2); border-radius: 999px; height: 36px; flex-shrink: 0; position: relative; }
  .m-title-slot .m-month .tx-nav-arrow { width: 36px; height: 36px; border: 0 !important; background: none !important; border-radius: 50%; padding: 0;
                                          display: flex; align-items: center; justify-content: center; color: var(--text-2); position: relative; }
  .m-title-slot .m-month .tx-nav-arrow::after { content: ''; position: absolute; inset: -4px 0; }       /* 44px to tap */
  .m-title-slot .m-month .tx-nav-label { border: 0 !important; background: none !important; height: 36px; padding: 0 2px; font-size: .88rem;
                                          font-weight: 600; color: var(--text); white-space: nowrap; box-shadow: none !important; }
  .m-titlebar:has(.m-month) .m-title { font-size: 1.3rem; }
  /* the date picker opens under the title, inside the screen */
  .m-title-slot .m-month .tx-date-picker { position: fixed !important; left: 8px !important; right: 8px !important; top: 104px !important; width: auto !important;
                                            max-width: none !important; z-index: 1060; }
  .m-title-slot .m-month .txdp-body { flex-direction: column; }

  /* the filter box: only its folded filters, shown when "Filters" is tapped */
  .m-money form[data-mobile-filters] { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
  .m-money form[data-mobile-filters] > .ms-auto { display: none !important; }        /* Add / Generate / Export: in "+ New" and the download icon */
  .m-money form.nb-mf:not(.nb-mf-open) { display: none !important; }
  .m-money form.nb-mf.nb-mf-open { display: flex !important; background: var(--surface) !important; border: 1px solid var(--border) !important;
                                   border-radius: 14px; padding: 12px !important; margin-bottom: 12px !important; }
  .dt-top-right .m-filter-btn { width: 44px; height: 44px; flex-shrink: 0; padding: 0 !important; border-radius: 50% !important; font-size: 0 !important;
                                display: inline-flex !important; align-items: center; justify-content: center; position: relative; background: var(--surface);
                                border: 1.5px solid var(--border) !important; color: var(--text-2); }
  .dt-top-right .m-filter-btn i { font-size: 1.05rem; }
  .dt-top-right .m-filter-btn .nb-mf-count { position: absolute; top: -6px; right: -6px; font-size: .66rem; min-width: 18px; height: 18px; border-radius: 9px;
                                             background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
  .dt-top-right .m-filter-btn[aria-expanded="true"] { border-color: var(--accent) !important; color: var(--accent); background: var(--accent-light); }

  /* totals: one card, three columns (Income · Expense · Net; Expected · Collected · Outstanding; Billed · Unpaid · Overdue) */
  .tx-kpi-strip { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0 !important; border-radius: 14px;
                           background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
  .tx-kpi-strip > .tx-kpi-divider, .tx-kpi-icon { display: none !important; }
  .tx-kpi-strip > .tx-kpi-item { padding: 12px 10px 12px 14px; min-width: 0; flex: none !important; }
  .tx-kpi-strip > .tx-kpi-item + .tx-kpi-item { border-left: 1px solid var(--surface-3); }
  .tx-kpi-strip > .tx-kpi-item ~ .tx-kpi-item ~ .tx-kpi-item ~ .tx-kpi-item { display: none !important; }   /* a 4th box (rate, count) */
  .tx-kpi-label { font-size: .72rem; text-transform: none; letter-spacing: 0; white-space: nowrap; }
  .tx-kpi-amount { font-size: 1rem; white-space: nowrap; }

  /* Dashboard: the month beside the title; no greeting line or "This month" button */
  .dsh-head { display: none !important; }
  .m-title-slot .m-month .bi-calendar3 { display: none; }
  .m-title-slot .m-month .tx-nav-arrow:disabled { opacity: .35; }
  .m-title-slot #kpiBmPanel { right: 0 !important; }

  /* the search row: everything on one line, centred */
  .dt-top, .dt-top-right { align-items: center !important; }
  .dt-top-right > * { margin: 0 !important; }

  /* Transactions / Collections cards: tap to open (mobile.js); no ✎ / bin on the card */
  #tblTx tbody tr, #tblSc tbody tr { cursor: pointer; }
  #tblTx .tx-c-action [title="Edit"], #tblTx .tx-c-action [title="Delete"] { display: none !important; }
  #tblSc .sc-c-month { display: none !important; }                                   /* the month is beside the title */
  #tblSc .sc-c-action > * { display: none !important; }
  /* an unpaid charge keeps one button: "Record" (records its payment) */
  #tblSc .sc-c-action > [title="Record payment"] { display: inline-flex !important; align-items: center; width: auto !important; height: 40px !important; padding: 0 14px;
      border-radius: 999px; border: 1.5px solid var(--accent); background: var(--accent-light); color: var(--accent-dark); font-size: 0 !important; position: relative; }
  #tblSc .sc-c-action > [title="Record payment"] i { display: none; }
  #tblSc .sc-c-action > [title="Record payment"]::before { content: 'Record'; font-size: .82rem; font-weight: 600; }
  #tblSc .sc-c-action > [title="Record payment"]::after { content: ''; position: absolute; inset: -4px -2px; }      /* 48px to tap */
  #tblSc .sc-c-action { margin: 0 !important; flex: 0 0 auto !important; order: 8; margin-left: auto !important; }

  /* ═══ Sub-screens: a round ‹ in front of the title; the building switcher stays in the top row ═══ */
  .m-back { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; margin: 0 0 0 -6px;
            border-radius: 50%; color: var(--text); text-decoration: none; position: relative; }
  .m-back:hover, .m-back:active { background: var(--surface-2); color: var(--text); }
  .m-back::after { content: ''; position: absolute; inset: -4px; }                  /* 44px to tap */
  .m-back .bi { font-size: 1.2rem; }
  .m-titlebar:has(.m-back) { gap: 4px; }
  body:not(.m-rpt-open) .m-rpt-back { display: none !important; }

  /* Settings: the menu first (two groups: Your account · the building), each section on its own screen */
  .pf-wrap { flex-direction: column; gap: 0 !important; min-height: 0 !important; }
  .pf-wrap.pf-menu-mode .profile-content { display: none !important; }
  .pf-wrap.pf-section-mode .profile-vnav { display: none !important; }
  .pf-wrap.pf-menu-mode .profile-vnav { display: block; width: 100% !important; background: none; border: 0; border-radius: 0; overflow: visible; }
  .pf-wrap .pnav-h { display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
                     color: var(--text-muted); margin: 18px 6px 8px; }
  .pf-wrap .pnav-h:first-child { margin-top: 4px; }
  .pf-wrap .pnav-h .bi { color: var(--accent); }
  .pf-wrap .pnav-list { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
  .pf-wrap.pf-menu-mode .profile-vnav-item { padding: 14px 16px; min-height: 52px; border-left: 0 !important; background: none !important; }
  .pf-wrap.pf-menu-mode .profile-vnav-item .pnav-name { color: var(--text) !important; font-size: .95rem; font-weight: 500; }
  .pf-wrap.pf-menu-mode .profile-vnav-item .pnav-icon { color: var(--accent) !important; }
  .pf-wrap.pf-menu-mode .profile-vnav-item::after { content: '\203A'; margin-left: auto; color: #BDC1C6; font-size: 1.3rem; line-height: 1; }

  /* Settings sections: the title bar names the section (no in-page title); cards stack, one column, big fields */
  .pf-wrap .profile-content { width: 100%; min-width: 0; padding: 0 !important; gap: 12px; }
  .pf-wrap .st-ph-row { justify-content: stretch; }
  .pf-wrap .st-ph-row .btn { flex: 1; min-height: 46px; border-radius: 999px; }
  .pf-wrap .st-hero { padding: 14px 16px; }
  .pf-wrap .st-card { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .pf-wrap .st-fields, .pf-wrap .st-fields.st-one { grid-template-columns: 1fr; gap: 14px; }
  .pf-wrap .st-lbl { font-size: .84rem; }
  .pf-wrap .st-card .form-control, .pf-wrap .st-card .form-select { min-height: 48px; font-size: 16px !important; border-radius: 12px; padding-left: 14px; padding-right: 14px; }
  .pf-wrap .st-card .form-select { padding-right: 38px; }
  .pf-wrap .st-card .input-group > .form-control, .pf-wrap .st-card .input-group > .input-group-text { min-height: 48px; font-size: 16px; }
  .pf-wrap .st-card .input-group > .input-group-text { border-radius: 12px 0 0 12px; }
  .pf-wrap .st-card .input-group > .form-control { border-radius: 0 12px 12px 0; }
  .pf-wrap .st-ut { grid-template-columns: 1fr; gap: 10px; }
  .pf-wrap .st-unit { flex-wrap: wrap; }
  .pf-wrap .m-save { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 48px; border-radius: 999px; font-size: .95rem; }
  /* sticky bottom is measured inside .nb-content's bottom padding (150px + safe area): 64px bar − 150px */
  .pf-wrap .st-savebar { bottom: -86px; border-radius: 0; margin: 0 -12px; border-left: 0; border-right: 0; padding: 10px 16px 12px; flex-wrap: wrap; }
  body.m-typing .pf-wrap .st-savebar { bottom: calc(-150px - env(safe-area-inset-bottom, 0px)); }
  .pf-wrap .st-savebar .st-sv-msg { flex: 1 1 100%; font-size: .8rem; }
  .pf-wrap .st-savebar .btn { flex: 1; min-height: 46px; border-radius: 999px; }
  /* users: each person a card — name and e-mail, role and status below, ··· in the corner */
  .pf-wrap .st-lh { display: none; }
  .pf-wrap .st-lr { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "who more" "role status"; row-gap: 6px; padding: 14px 12px 14px 16px; }
  .pf-wrap .st-lr .st-who { grid-area: who; }
  .pf-wrap .st-lr .st-role { grid-area: role; padding-left: 46px; font-size: .84rem; }
  .pf-wrap .st-lr > div:nth-child(3) { grid-area: status; justify-self: end; }
  .pf-wrap .st-lr .st-more { grid-area: more; }
  .pf-wrap .st-inv { grid-template-areas: "who who" "role acts"; }
  .pf-wrap .st-inv .st-inv-acts { grid-area: acts; }
  .pf-wrap .st-tlink { min-height: 40px; }
  .pf-wrap .dc-more { width: 44px; height: 44px; }
  .modal .st-opts2 { grid-template-columns: 1fr; }

  /* Settings › Categories: the phone's own block (.m-cat; the computer keeps .d-cat) — a list with Income / Expense tabs;
     a category opens as a screen of its own (‹ back to the list); Add is in "+ New" */
  .pf-wrap .d-cat { display: none; }
  .pf-wrap .m-cat { display: block; }
  .m-cat .cat-tabs { display: flex; background: #E4E7EB; border-radius: 12px; padding: 3px; margin-bottom: 12px; }
  .m-cat .cat-tabs button { flex: 1 1 0; border: 0; background: none; border-radius: 9px; padding: 8px 4px; font-size: .86rem; color: var(--text-2); }
  .m-cat .cat-tabs button.on { background: var(--surface); color: var(--accent-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
  .m-cat .cat-tabs .n { color: var(--text-muted); font-weight: 500; margin-left: 4px; }
  .m-cat .cat-tbl { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
  .m-cat .cat-tbl[hidden], .m-cat .cat-panel[hidden] { display: none; }
  .m-cat .cat-r { display: flex; align-items: center; gap: 14px; padding: 0 14px 0 16px; min-height: 54px; font-size: .95rem;
                  border-top: 1px solid var(--border); cursor: pointer; }
  .m-cat .cat-r:first-child { border-top: 0; }
  .m-cat .cat-r:active, .m-cat .cp-sub:active { background: #F6F8FB; }
  .m-cat .cat-nm { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; font-weight: 500; color: var(--text); }
  .m-cat .cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-cat .cat-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
  .m-cat .cat-m { font-size: .8rem; color: var(--text-muted); white-space: nowrap; }
  .m-cat .cat-off .cat-name { color: #9AA0A6; }
  .m-cat .cat-off .cat-dot { opacity: .45; }
  .m-cat .cat-off .cat-m, .m-cat .cp-off { background: var(--surface-2); padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: .75rem; color: var(--text-muted); }
  .m-cat .cat-r::after, .m-cat .cp-sub::after { content: '\203A'; color: #BDC1C6; font-size: 1.25rem; line-height: 1; }
  .m-cat .cat-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: .85rem; }
  .m-cat .cat-builtin-note { padding: 12px 4px; line-height: 1.5; }
  body.cat-panel-open .m-cat .cat-tabs, body.cat-panel-open .m-cat .cat-tbl, body.cat-panel-open .m-cat .cat-builtin-note,
  body.cat-panel-open .m-fab { display: none !important; }
  .m-cat .cp-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
  .m-cat .cp-card .nb-label { display: block; margin: 14px 0 6px; font-size: .84rem; font-weight: 600; color: var(--text-2); }
  .m-cat .cp-card .nb-label:first-child { margin-top: 0; }
  .m-cat .cp-card .form-control { min-height: 48px; font-size: 16px !important; border-radius: 12px; padding: 0 14px; }
  .m-cat .cp-type { display: flex; background: #E4E7EB; border-radius: 12px; padding: 3px; }
  .m-cat .cp-type label { flex: 1 1 0; position: relative; display: flex; justify-content: center; margin: 0; padding: 9px 4px; border-radius: 9px;
                          font-size: .9rem; color: var(--text-2); cursor: pointer; }
  .m-cat .cp-type label:has(input:checked) { background: var(--surface); color: var(--accent-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
  .m-cat .cp-type input { position: absolute; opacity: 0; pointer-events: none; }
  .m-cat .cp-coll { margin-top: 12px; }
  .m-cat .cp-coll .form-check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding-left: 0; }
  .m-cat .cp-coll .form-check-input { width: 22px; height: 22px; margin: 0; float: none; flex-shrink: 0; }
  .m-cat .cp-coll small { display: block; color: var(--text-muted); font-size: .76rem; }
  .m-cat .cp-on { display: flex; align-items: center; gap: 12px; margin: 16px -16px -16px; padding: 4px 16px; min-height: 56px; border-top: 1px solid var(--border); }
  .m-cat .cp-on label { flex: 1; font-size: .95rem; font-weight: 500; }
  .m-cat .cp-on small { display: block; font-size: .76rem; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
  .m-cat .cp-on .form-check-input { width: 2.6em; height: 1.4em; }
  .m-cat .cp-sub-h { margin: 20px 4px 8px; font-size: .74rem; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); }
  .m-cat .cp-sub-list { background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 0 0; overflow: hidden; }
  .m-cat .cp-sub-list:empty { display: none; }
  .m-cat .cp-sub { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 14px 0 16px; font-size: .95rem; border-top: 1px solid var(--border); cursor: pointer; }
  .m-cat .cp-sub:first-child { border-top: 0; }
  .m-cat .cp-sub-nm { flex: 1; min-width: 0; }
  .m-cat .cp-sub-off .cp-sub-nm { color: #9AA0A6; }
  .m-cat .cp-sub .btn-tbl-action { display: none; }
  .m-cat .cp-add-sub { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 16px; background: var(--surface);
                       border: 1px solid var(--border); border-top: 0; border-radius: 0 0 14px 14px; color: var(--accent); font-weight: 600; font-size: .95rem; }
  .m-cat .cp-sub-list:empty + .cp-add-sub { border-top: 1px solid var(--border); border-radius: 14px; }
  .m-cat .cp-del { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; border: 0; background: none; color: #C5221F;
                   font-weight: 600; font-size: .92rem; padding: 20px 0 6px; }
  .m-cat .cat-panel.cp-new .cp-del, .m-cat .cat-panel.cp-new #mCatSubs, .m-cat .cat-panel.cp-new #mCatOnRow { display: none !important; }
  /* sticky bottom is measured inside .nb-content's bottom padding (150px + safe area): 64px bar − 150px */
  .m-cat .cp-f { position: sticky; bottom: -86px; z-index: 3; display: flex; margin: 16px -12px 0; padding: 10px 16px 12px; background: var(--surface); border-top: 1px solid var(--surface-3); }
  body.m-typing .m-cat .cp-f { bottom: calc(-150px - env(safe-area-inset-bottom, 0px)); }
  .m-cat .cp-f .btn-primary { flex: 1; min-height: 48px; border-radius: 999px; font-weight: 600; font-size: .95rem; }
  /* a subcategory: a small sheet (name only — the category is the screen it was opened from) */
  body.cat-panel-open #subParentRow { display: none; }
  #subcategoryModal .modal-footer [data-bs-dismiss] { display: none !important; }
  #subcategoryModal .modal-footer .btn-primary { flex: 1 1 auto; }

  /* Reports: the list first, a report full width */
  .rpt-layout.m-rpt-menu .rpt-main { display: none !important; }
  .rpt-layout:not(.m-rpt-menu) .rpt-sidebar { display: none !important; }
  .rpt-layout .rpt-sidebar { border-radius: 14px; }
  .rpt-layout.m-rpt-menu .rpt-nav-item { min-height: 56px; }
  .rpt-layout.m-rpt-menu .rpt-nav-item.active { background: none; border-left-color: transparent; }
  .rpt-layout.m-rpt-menu .rpt-nav-item.active .rpt-nav-name { color: var(--text); }

  .tx-kpi-strip .tx-kpi-body > div:not(.tx-kpi-label):not(.tx-kpi-amount) { display: none; }   /* "All accounts combined" */

  /* Accounts: one line per account — name, "Bank · ****4321", balance; the page's Add is in "+ New" */
  .acc-row { padding: 14px 14px !important; gap: 12px !important; }
  .acc-row .nb-badge, .acc-row a[href*="/transactions?account="], .acc-row a[href*="/transactions?account="] ~ *, .acc-row span[style*="color:var(--border)"] { display: none !important; }
  .acc-row .text-end > div:nth-child(2) { display: none; }                          /* "Current balance" */
  .pf-wrap [data-bs-target="#addAccountModal"] { display: none !important; }

  /* Approvals: segmented tabs; Reject and Approve as two wide buttons */
  .drawer-tabs { background: #E4E7EB; border-radius: 12px; padding: 3px; display: flex; flex-wrap: nowrap; }
  .drawer-tabs .nav-item { flex: 1 1 0; padding: 0 !important; margin: 0; background: none !important; }
  .drawer-tabs .drawer-tab-link { display: block; width: 100%; text-align: center; border: 0 !important; border-radius: 9px; padding: 8px 4px; font-size: .85rem; color: var(--text-2); }
  .drawer-tabs .drawer-tab-link.active { background: var(--surface); color: var(--accent-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
  div:has(> .drawer-tabs) { border-bottom: 0 !important; }
  .approval-item { flex-wrap: wrap; }
  .approval-item > .d-flex.flex-column { flex: 1 1 100%; flex-direction: row-reverse !important; gap: 8px !important; margin-top: 10px; }
  .approval-item > .d-flex.flex-column > .btn { flex: 1 1 0; height: 44px; border-radius: 999px; font-weight: 600; }

  /* ═══ Forms full screen (small confirmations stay small); Save stays above the keyboard ═══ */
  .modal-dialog:not(.modal-sm) { margin: 0 !important; max-width: none !important; width: 100% !important; min-height: 100%; height: 100%; }
  .modal-dialog:not(.modal-sm) > .modal-content { min-height: 100%; height: 100%; border: 0; border-radius: 0; }
  .modal-dialog:not(.modal-sm) .modal-body { flex: 1 1 auto; overflow-y: auto; }
  .modal-dialog:not(.modal-sm) .modal-footer { position: sticky; bottom: 0; background: var(--surface); padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .modal-footer .m-del-btn { margin-right: auto; color: var(--red); border: 1.5px solid #F2B8B5; background: var(--surface); border-radius: 999px; font-weight: 600; }

  /* ═══ The unit popup: full screen, segmented tabs ═══ */
  .up-wrap { padding: 0 !important; }
  .up-dlg { width: 100% !important; max-width: none !important; height: 100%; max-height: none !important; border-radius: 0 !important; }
  .up-head { padding: 10px 12px 0 16px !important; }
  .up-tabs { margin: 10px 12px 0; padding: 3px !important; border: 0 !important; background: #E4E7EB; border-radius: 12px; overflow: visible; }
  .up-tab { flex: 1 1 0; text-align: center; justify-content: center; border: 0 !important; border-radius: 9px; padding: 8px 4px !important; margin: 0 !important; }
  .up-tab.on { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

  /* a segmented bar made by mobile.js (Collections: To collect · Paid · All) */
  .m-seg { display: flex; background: #E4E7EB; border-radius: 12px; padding: 3px; margin-bottom: 12px; }
  .m-seg button { flex: 1 1 0; min-width: 0; border: 0; background: none; border-radius: 9px; padding: 8px 4px; font-size: .85rem; font-weight: 500;
                  color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
  .m-seg button.on { background: var(--surface); color: var(--accent-dark); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
  .m-seg-n { font-size: .72rem; font-weight: 600; background: #D5D9DE; color: #3C4043; border-radius: 999px; padding: 1px 7px; }
  .m-seg button.on .m-seg-n { background: var(--accent-light); color: var(--accent); }

  /* Transactions grouped by day: the date once above the day's cards, not on every card */
  #tblTx tbody tr.m-day { display: block; padding: 14px 4px 6px !important; border: 0 !important; background: none !important; cursor: default; }
  #tblTx tbody tr.m-day > td { display: block !important; font-size: .8rem; font-weight: 700; color: var(--text-2); }
  #tblTx.m-days .tx-c-date { display: none !important; }

  /* the search row stays at the top while the list scrolls (the totals scroll away) */
  .dt-container > .dt-top { position: sticky; top: -12px; z-index: 6; background: var(--bg) !important; padding-top: 12px !important; margin: -12px 0 0 !important; }
  /* …inside a white card (Transactions, Collections, Utility): the card's own white, and room on both sides — the search
     box and the filter button touched the card's edges over a grey band */
  /* the totals strip's "this month / overall" tag sits under its label on a phone (it ran past the edge on Utility) */
  .tx-kpi-label .kpi-scope:not([hidden]) { display: table; margin: 3px 0 0; }
  .nb-card:not(:has(table.m-cards)) .dt-container > .dt-top { background: var(--surface) !important; top: 0; margin: 0 !important;
    padding: 12px 12px 12px !important; border-radius: inherit; }

  /* unit popup header on a phone: "‹ Units" · "‹ A2 ›" · ⋯ */
  .up-head { display: grid !important; grid-template-columns: 1fr auto auto auto 1fr; align-items: center; gap: 2px; padding: 8px 8px 0 !important; }
  .up-head .up-tools { display: contents; }
  .up-head #up-chip, .up-head #up-sub, .up-head #up-viewonly { display: none; }
  .up-head #up-close { grid-column: 1; grid-row: 1; justify-self: start; width: auto; border-radius: 8px; padding: 0 8px; color: var(--accent); font-size: .92rem;
                       font-weight: 500; display: flex; align-items: center; gap: 4px; }
  .up-head #up-close i { display: none; }
  .up-head #up-close::before { font-family: bootstrap-icons; content: "\f284"; font-size: .9rem; }
  .up-head #up-close::after { content: 'Units'; }
  .up-head #up-prev { grid-column: 2; grid-row: 1; }
  .up-head h2 { grid-column: 3; grid-row: 1; font-size: 1.15rem !important; font-weight: 700; padding: 0 6px; }
  .up-head #up-next { grid-column: 4; grid-row: 1; }
  .up-head #up-more { grid-column: 5; grid-row: 1; justify-self: end; }
  .up-head #up-prev i, .up-head #up-next i { display: none; }
  .up-head #up-prev::before { font-family: bootstrap-icons; content: "\f284"; }
  .up-head #up-next::before { font-family: bootstrap-icons; content: "\f285"; }
  .up-head #up-prev, .up-head #up-next { background: var(--surface-2); }
  /* money owed: a red dot on the Collections tab instead of the long label */
  .up-tab .up-badge:not([hidden]) { font-size: 0 !important; width: 7px; height: 7px; padding: 0 !important; border-radius: 50%; background: var(--red) !important;
                                     display: inline-block; vertical-align: top; margin-left: -2px; }
  .up-tab i { display: none; }
  .up-people { grid-template-columns: 1fr !important; }

  /* Vendors: Current · Past only (search finds anyone; "All" is not needed on a phone) */
  .gm-tabs-list > li:has(> a.gm-tab[href*="show=all"]) { display: none !important; }

  /* the bell: a light outline like the bottom bar's icons, not a heavy solid one */
  .nb-bell .bi-bell-fill::before { content: "\f18a"; }
  .nb-bell .topbar-icon-btn { color: var(--text-2); }

  /* a report on a phone: titled with its name; filters in one compact row (month · account · PDF); full width */
  .rpt-main { width: 100%; min-width: 0; }
  .rpt-view-header { display: none !important; }
  #rptFilterBar form { flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important; gap: 8px !important; margin-bottom: 12px !important; }
  #rptFilterBar .tx-nav-label { padding: 0 !important; min-width: 0; }
  #rptFilterBar .nb-label { display: none !important; }
  #rptFilterBar form > div { min-width: 0; flex: 0 0 auto !important; width: auto !important; margin: 0 !important; }
  #rptFilterBar form > div:has(#rptAccountSelect) { flex: 1 1 0 !important; }
  #rptFilterBar #rptAccountSelect { width: 100% !important; }
  #rptFilterBar #rptAccountSelect { height: 40px; border-radius: 12px; font-size: .84rem; padding-left: 10px; padding-right: 26px; background-position: right 8px center; }
  #rptFilterBar form > a.btn { display: none !important; }                          /* Reset */
  #rptFilterBar form > button.btn { width: 44px; height: 44px; min-height: 44px; padding: 0 !important; font-size: 0 !important; border-radius: 50%; margin: 0 !important; flex-shrink: 0; }
  #rptFilterBar form > button.btn i { font-size: 1.1rem; }
  /* the report's Download menu in the filter row: a round icon, as the PDF button was */
  .rpt-dl-moved { margin-left: auto !important; flex-shrink: 0; }
  .rpt-dl-moved .rpt-dl { width: 44px; height: 44px; min-height: 44px; padding: 0 !important; font-size: 0 !important; border-radius: 50% !important; }
  .rpt-dl-moved .rpt-dl i { font-size: 1.1rem; margin: 0 !important; }
  .rpt-dl-moved .rpt-dl.dropdown-toggle::after { display: none; }
  #rptFilterBar .tx-date-nav { display: flex; align-items: center; background: var(--surface-2); border-radius: 999px; height: 40px; }
  #rptFilterBar .tx-nav-arrow { width: 34px; height: 40px; border: 0 !important; background: none !important; padding: 0; }
  #rptFilterBar .tx-nav-label { border: 0 !important; background: none !important; font-size: .86rem; font-weight: 600; white-space: nowrap; padding: 0 2px; }
  #rptFilterBar .tx-date-picker { position: fixed !important; left: 8px !important; right: 8px !important; top: 150px !important; width: auto !important; z-index: 1060; }

  /* ═══ Forms on a phone (every dialog): one column, big fields, Save at the bottom ═══════════════════
     Header: title + ✕, fixed at the top. Body: one column. Fields: 48px tall, 16px text (smaller text makes an
     iPhone zoom in when you tap the field). Footer: fixed at the bottom; the main button wide; Cancel goes (✕ does it). */
  .modal-dialog:not(.modal-sm) .modal-header { position: sticky; top: 0; z-index: 4; background: var(--surface); min-height: 56px;
                                               padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--surface-3); }
  .modal-dialog:not(.modal-sm) .modal-title { font-size: 1.05rem !important; font-weight: 700 !important; color: var(--text); }
  .modal-dialog:not(.modal-sm) .modal-title > i.bi:first-child { display: none; }       /* decorative icon */
  .modal-dialog:not(.modal-sm) .modal-header .btn-close { width: 44px; height: 44px; padding: 0; margin: 0 0 0 auto; border-radius: 50%; background-size: 14px; }
  .modal-dialog:not(.modal-sm) .modal-body { padding-bottom: 24px; }

  /* one column: Bootstrap grid columns and side-by-side field rows stack */
  .modal .row > [class*="col"] { flex: 0 0 100%; max-width: 100%; }
  .modal .row { --bs-gutter-x: 0; row-gap: 14px; }
  .modal .pf-form-row { grid-template-columns: 1fr !important; }

  /* fields */
  .modal .form-control, .modal .form-select, .modal textarea,
  .modal input[type="text"], .modal input[type="number"], .modal input[type="email"], .modal input[type="tel"],
  .modal input[type="password"], .modal input[type="date"], .modal input[type="search"], .modal select {
      min-height: 48px; font-size: 16px !important; border-radius: 12px; padding-left: 14px; padding-right: 14px; }
  .modal textarea { min-height: 88px; padding-top: 12px; }
  .modal .form-select, .modal select.form-select { padding-right: 38px; background-position: right 14px center; }
  .modal .input-group > .form-control, .modal .input-group > .input-group-text { min-height: 48px; }
  .modal .input-group-text { font-size: 16px; border-radius: 12px; }
  .modal .form-label, .modal .nb-label, .modal label.small, .modal .x-small.form-label { font-size: .84rem !important; font-weight: 600; color: var(--text-2) !important; margin-bottom: 6px; }
  .modal .form-check-input { width: 22px; height: 22px; margin-top: 0; }
  .modal .form-check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-left: 0; }
  .modal .form-check .form-check-input { margin-left: 0; float: none; flex-shrink: 0; }
  .modal .modal-body .btn-sm { min-height: 44px; padding-left: 16px; padding-right: 16px; font-size: .9rem; }

  /* footer: the main button wide; Cancel hidden when there's a main button (✕ closes) */
  .modal-dialog:not(.modal-sm) .modal-footer { display: flex; flex-wrap: nowrap; gap: 10px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
                                               border-top: 1px solid var(--surface-3); box-shadow: 0 -4px 12px rgba(0,0,0,.04); }
  .modal-dialog:not(.modal-sm) .modal-footer > * { margin: 0 !important; }
  .modal-dialog:not(.modal-sm) .modal-footer:has(.btn-primary, .btn-success, .btn-danger:not(.m-del-btn)) > [data-bs-dismiss="modal"]:not(.btn-primary) { display: none !important; }
  .modal-dialog:not(.modal-sm) .modal-footer .btn { min-height: 48px; border-radius: 999px; font-size: .95rem; font-weight: 600; padding: 0 20px; }
  .modal-dialog:not(.modal-sm) .modal-footer .btn-primary, .modal-dialog:not(.modal-sm) .modal-footer .btn-success,
  .modal-dialog:not(.modal-sm) .modal-footer .btn-danger:not(.m-del-btn) { flex: 1 1 auto; }

  /* forms are full screens, not the old bottom sheet (no grab handle, no height cap) */
  .modal-dialog:not(.modal-sm) { position: fixed !important; inset: 0 !important; height: 100% !important; }
  .modal-dialog:not(.modal-sm) > .modal-content { border-radius: 0 !important; box-shadow: none !important; padding-bottom: 0; }
  .modal-dialog:not(.modal-sm) .modal-header::before { display: none !important; }
  .modal-dialog:not(.modal-sm) .modal-header { flex-direction: row !important; }
  .modal-dialog:not(.modal-sm) .modal-header .btn-close { position: static !important; }
  .modal-dialog:not(.modal-sm) .modal-body { max-height: none !important; }
  .modal-footer .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; }
  .modal-footer .btn > i { margin: 0 !important; }
  .modal-dialog:not(.modal-sm) .modal-footer:has(.btn-primary, .btn-success) .btn-outline-secondary[data-bs-dismiss="modal"] { display: none !important; }
  /* a footer that wraps its buttons in a group (Add New Units): the group takes the width */
  .modal-dialog:not(.modal-sm) .modal-footer > .d-flex { flex: 1 1 auto; }
  .modal-dialog:not(.modal-sm) .modal-footer > .d-flex > .btn-primary { flex: 1 1 auto; }
  .modal-dialog:not(.modal-sm) .modal-footer > div:empty { display: none; }

  /* small confirmations stay a bottom sheet, with thumb-size buttons */
  .modal-dialog.modal-sm .modal-footer .btn { min-height: 44px; border-radius: 999px; flex: 1 1 0; font-weight: 600; }

  /* Pay salaries: one card per person — [☐] name / role, then Salary and Bonus side by side, then status */
  #psTable { display: block; width: 100% !important; }
  #psTable thead { display: none; }
  #psTable tbody { display: flex; flex-direction: column; gap: 10px; }
  #psTable tbody tr { display: grid; grid-template-columns: 28px 1fr 1fr; column-gap: 10px; row-gap: 8px; align-items: center;
                      background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
  #psTable tbody td { display: block; border: 0 !important; padding: 0 !important; min-width: 0; }
  #psTable tbody td[colspan] { grid-column: 1 / -1; }
  #psTable tbody td:nth-child(1) { grid-column: 1; grid-row: 1; }
  #psTable tbody td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; font-weight: 600; }
  #psTable tbody td:nth-child(3) { grid-column: 2; grid-row: 2; }
  #psTable tbody td:nth-child(4) { grid-column: 3; grid-row: 2; }
  #psTable tbody td:nth-child(5) { grid-column: 2 / 4; grid-row: 3; }
  #psTable tbody td:nth-child(3)::before { content: 'Salary'; display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
  #psTable tbody td:nth-child(4)::before { content: 'Bonus'; display: block; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
  #psTable .ps-pick { width: 22px; height: 22px; }
  #psTable .form-control { text-align: left !important; }
  #psTable tbody td.num { text-align: left !important; }

  /* Add New Units: per unit — name across the width, then size and charge side by side; ✕ top right */
  #addUnitModal .unit-row-header, #addUnitModal .unit-entry-row { display: grid !important; grid-template-columns: 1fr 1fr 44px; gap: 8px; }
  #addUnitModal .ucol-name { grid-column: 1 / 3; grid-row: 1; }
  #addUnitModal .ucol-del  { grid-column: 3; grid-row: 1; }
  #addUnitModal .ucol-num  { grid-row: 2; }
  #addUnitModal .ucol-num ~ .ucol-num ~ .ucol-num { grid-row: 3; }
  #addUnitModal .unit-entry-row { padding: 12px 0; }
  #addUnitModal .btn-del-row { width: 44px; height: 48px; }   /* 44px to tap, the button standard */

  /* the unit popup's own dialogs (change owner / resident, record payment, meters, rename): full screen like every form */
  .up-swrap { padding: 0 !important; background: var(--surface); }
  .up-sdlg, .up-sdlg.narrow { width: 100% !important; max-width: none; height: 100%; max-height: none !important; border-radius: 0 !important; box-shadow: none;
                              display: flex; flex-direction: column; overflow: hidden; }
  .up-s-head { position: sticky; top: 0; min-height: 56px; padding: 8px 8px 8px 16px !important; border-bottom: 1px solid var(--surface-3); background: var(--surface); flex-shrink: 0; }
  .up-s-head h3 { font-size: 1.05rem !important; font-weight: 700 !important; }
  .up-s-head .up-ib { width: 40px; height: 40px; }
  .up-s-body { flex: 1 1 auto; overflow-y: auto; padding: 16px !important; }
  .up-s-body input:not([type=checkbox]):not([type=radio]), .up-s-body select, .up-s-body textarea {
      min-height: 48px; font-size: 16px !important; border-radius: 12px; width: 100%; }
  .up-s-body label, .up-s-body .lbl { font-size: .84rem; font-weight: 600; color: var(--text-2); }
  .up-s-foot { flex-shrink: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important; border-top: 1px solid var(--surface-3);
               box-shadow: 0 -4px 12px rgba(0,0,0,.04); background: var(--surface); }
  .up-s-foot .up-btn { min-height: 48px; border-radius: 999px; font-size: .95rem; font-weight: 600; padding: 0 20px; }
  .up-s-foot .up-btn-primary, .up-s-foot .up-btn-danger { flex: 1 1 auto; justify-content: center; }
  .up-s-foot:has(.up-btn-primary, .up-btn-danger) [data-close] { display: none; }        /* ✕ closes */

  .up-input { height: 48px !important; font-size: 16px !important; border-radius: 12px; }
  .up-date { max-width: none !important; }
  .up-date .up-input { border-radius: 12px 0 0 12px; }
  .up-date button { border-radius: 0 12px 12px 0; min-width: 48px; }
  .up-money .up-input { border-radius: 0 12px 12px 0; }
}

/* ═══ Buttons on a phone (the button standard, docs/audits/buttons.html): nothing smaller than 44px to tap ═══ */
@media (max-width: 768px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
  .btn, .btn-sm, .btn-dt-download, .nb-btn-outline, .nb-btn-ghost, .btn-add-row, .txdp-btn-apply, .txdp-btn-cancel { min-height: 44px; }
  .btn-sm { --bs-btn-padding-x: 16px; --bs-btn-font-size: 14px; }
  .input-group > .btn { min-height: 0; }
  .up-btn, .up-btn-sm { height: 44px; padding: 0 18px; font-size: 14px; }
  .up-ib { width: 44px; height: 44px; }
  .up-mrow .up-ib, .up-picked .up-ib { width: 44px; height: 44px; }
  .btn-tbl-action, .dc-more, .btn-del-row { width: 44px; height: 44px; font-size: 17px; }
  .btn-tbl-slot { width: 44px; height: 44px; }
  .btn-close { width: 44px; height: 44px; background-size: 14px; }
  .m-sheet-h .btn-close { margin-right: -10px; }
  .nb-pw-btn { width: 40px !important; height: 40px !important; }
  .btn-kpi-nav { width: 44px; height: 44px; }
}

/* Small phones (320–340px): the title beside a month picker was cut ("Dashboar", "Collection") — release audit UI-03 */
@media (max-width: 340px) {
  .m-titlebar:has(.m-month) { gap: 6px; }
  .m-titlebar:has(.m-month) .m-title { font-size: 1.08rem; letter-spacing: -.2px; }
  .m-title-slot .m-month .tx-nav-arrow { width: 30px; }
  .m-title-slot .m-month .tx-nav-label { font-size: .82rem; }
}
