/* Partner portal, phone layer (2 Nov 2026, M-1415). Loaded only at 900px and under (index.html: media="(max-width: 900px)"), after portal.css.
   The desktop look is untouched. To go back to the old phone look, remove the <link> to this file from index.html.
   Rules: one column, 16-17px text, 48-54px touch targets, lists as cards, forms and panels as sheets from the bottom,
   the agreement full width with its Sign bar fixed at the bottom. */
@media (max-width: 900px) {
  body { font-size: 15.5px; }
  .top { height: 60px; padding: 0 14px; gap: 10px; }
  .top .refer { height: 42px; padding: 0 16px; font-size: 15px; }
  .view { padding: 14px 16px 120px; }
  .ph h1, .ph > div > h1 { font-size: 26px; }
  .ph p { font-size: 15px; }

  /* home */
  .hero { grid-template-columns: 1fr; gap: 18px; margin: 4px 0 18px; }
  .hero h1 { font-size: 26px; max-width: none; }
  .hero .lede { font-size: 16px; margin-top: 8px; }
  .hero .acts { display: grid; gap: 10px; margin-top: 16px; }
  .hero .acts .btn { width: 100%; height: 54px; font-size: 17px; }
  .hero .acts .tlink { justify-content: center; min-height: 44px; }
  .darkcard { border-radius: 22px; padding: 20px; }
  .darkcard .big { font-size: 40px; }
  .darkcard li, .darkcard .when { font-size: 15px; }
  .panel { border-radius: 18px; }
  .panel-h { padding: 14px 16px; }
  .panel-h h2 { font-size: 17px; }

  /* lists as cards: every table in the portal */
  .tbl, .tbl tbody { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tbody tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative; }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td, .tbl td:first-child { display: block; padding: 0; border: 0; min-width: 0; background: transparent !important; }
  .tbl td.nm b { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
  .tbl td.nm small { font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
  .tbl td.hide-m, .tbl td.hide-s, .tbl td.chev { display: none; }
  .tbl .stage b { font-size: 15px; font-weight: 600; } .tbl .stage small { font-size: 13.5px; }
  .tbl .prog { height: 5px; margin-top: 8px; }
  .tbl tbody tr.click:active { background: var(--hover); }
  .tbl .r { text-align: left; }

  /* filters and search */
  .toolbar { display: grid; gap: 10px; padding: 12px 14px; }
  .toolbar .seg { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; }
  .toolbar .seg::-webkit-scrollbar { display: none; }
  .toolbar .seg button { flex: none; height: 40px; padding: 0 14px; font-size: 15px; }
  .toolbar .sp { display: none; }
  .mini-search { width: 100%; height: 48px; font-size: 16px; }
  .mini-search input { font-size: 16px; }

  /* fields and buttons: 16px text stops phones zooming in, 52px is easy to hit */
  .inp, input.inp, textarea.inp, select.inp { font-size: 16px; height: 52px; border-radius: 14px; }
  textarea.inp { height: auto; min-height: 96px; }
  .btn { height: 48px; font-size: 16px; }
  .btn.sm { height: 40px; font-size: 15px; }
  .btn.primary { font-weight: 600; }
  .fld label, .fld .lab { font-size: 14.5px; }
  .opt, .choice .opt { min-height: 52px; font-size: 15.5px; }
  .two { grid-template-columns: 1fr; }
  .choice.need { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .choice.need .opt { min-height: 48px; padding: 0 10px; font-size: 15px; }
  .dock-b .fld { margin-bottom: 14px; }
  .dock-b .two { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dock-b .two .fld { margin-bottom: 14px; min-width: 0; }
  .dock-b .two .fld:only-child { grid-column: 1 / -1; }
  .ok-ban { align-items: flex-start; gap: 12px; padding: 14px; }
  .ok-ban > div { flex: 1; min-width: 0; }
  .ok-ban .done-mark { flex: none; }

  /* panels (refer a client, one referral): a sheet from the bottom, with the page dimmed behind it */
  .shell.dock-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 34, 51, .4); z-index: 74; }
  .dock, .shell.dock-open .dock, .dock-over .dock { position: fixed !important; inset: auto 0 0 0 !important; top: auto !important; right: 0 !important; width: auto !important; max-width: none !important; height: auto !important; max-height: 92vh !important; max-height: 92dvh !important; border-radius: 24px 24px 0 0 !important; z-index: 75; box-shadow: 0 -24px 50px -20px rgba(10, 34, 51, .4); display: flex; flex-direction: column; animation: psSheet .28s cubic-bezier(.16, 1, .3, 1) both; }
  .dock-h { flex: none; padding: 24px 18px 12px; position: relative; }
  .dock-h::before { content: ""; position: absolute; top: 9px; left: 50%; width: 42px; height: 5px; margin-left: -21px; border-radius: 5px; background: #d6dee1; }
  .dock-h h2 { font-size: 21px; }
  .dock-b { flex: 1; overflow: auto; padding: 8px 18px 28px; -webkit-overflow-scrolling: touch; }
  .dock-rz { display: none !important; }
  @keyframes psSheet { from { transform: translateY(100%); } to { transform: none; } }

  /* the agreement: full width, one column; the document first, the details after, Sign fixed at the bottom */
  .ap-page { display: block !important; overflow: auto !important; padding: 0 0 130px !important; }
  .ap-top { max-width: none; margin: 0; padding: 10px 14px; gap: 10px; flex-wrap: wrap; position: sticky; top: 0; z-index: 3; background: var(--canvas, #f6f8f9); }
  .ap-title h1 { font-size: 20px; } .ap-title small { font-size: 13.5px; }
  .ap-top .chip { margin-left: auto; }
  .ap-grid { display: block !important; max-width: none; padding: 0 12px; }
  .ap-doc { height: auto !important; min-height: 0; border-radius: 16px; overflow: visible; }
  .ap-scroll { overflow: visible; padding: 10px 0; background: transparent; }
  .ap-paper { padding: 22px 18px; font-size: 15.5px; line-height: 1.65; border-radius: 12px; box-shadow: none; border: 1px solid var(--line); }
  .ap-paper h2 { font-size: 21px; } .ap-paper h3 { font-size: 16px; }
  .ap-sigs { grid-template-columns: 1fr; gap: 18px; }
  .ap-side { display: grid !important; margin-top: 12px; overflow: visible; }
  .ap-sign, .ap-done { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); font-size: 15px; box-shadow: 0 -12px 28px -16px rgba(10, 34, 51, .35); }
  .ap-sign .inp { height: 52px; font-size: 16px; }
  .ap-act { flex-direction: column-reverse; align-items: stretch; }
  .ap-act .btn { width: 100%; height: 54px; font-size: 17px; }
  .agr-ban { flex-direction: column; align-items: flex-start; gap: 12px; border-radius: 18px; }
  .agr-ban .btn { width: 100%; height: 50px; }

  /* the share kit, learn, details and commission already stack; give their rows room to be tapped */
  .row { padding-top: 14px; padding-bottom: 14px; }
  .opts, .opts:has(> :nth-child(3)) { grid-template-columns: 1fr; }
  .toast { left: 16px; right: 16px; bottom: 18px; width: auto; }
}
@media (prefers-reduced-motion: reduce) { .dock { animation: none !important; } }
