/* SaQa · the mobile version (BACKLOG+mobile-pages.md). Loaded after kit.css only on pages rendered for phones
   (html[data-device="m"], src/edge/layout.ts). kit.css stays the desktop sheet; this one reshapes the chrome, the
   shared components and the pages that have no layout of their own for phones. Every rule is scoped to the device
   attribute, so a desktop page never picks anything up even if the file were loaded there. No gradients. */

/* ---------- Tokens and base ---------- */
html[data-device="m"] {
  --header-h: 56px; --tabs-h: 60px; --gut: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--header-h) + 8px);
}
[data-device="m"] body { min-width: 0; padding-bottom: calc(var(--tabs-h) + var(--safe-b)); overflow-x: hidden; }
[data-device="m"] .wrap { padding: 0 var(--gut); }
[data-device="m"] main { min-width: 0; }
[data-device="m"] h1 { font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
[data-device="m"] h2 { font-size: 21px; }
[data-device="m"] h3 { font-size: 17px; }
/* 16px in fields: smaller text makes iOS zoom the page on focus. */
[data-device="m"] :is(.inp, .sel, textarea, input:not([type="checkbox"]):not([type="radio"]), select) { font-size: 16px; }
[data-device="m"] .inp, [data-device="m"] .sel { height: 44px; }
[data-device="m"] .btn { min-height: 40px; }
[data-device="m"] .btn.sm { min-height: 34px; height: 34px; }
[data-device="m"] .chip { height: 34px; }
[data-device="m"] .sticky, [data-device="m"] .side-sticky { position: static; max-height: none; }
[data-device="m"] img, [data-device="m"] video, [data-device="m"] iframe:not([data-doodle-parts]) { max-width: 100%; }
[data-device="m"] .d-only { display: none !important; }
[data-device="m"] :focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- Top bar ---------- */
[data-device="m"] .m-top {
  height: auto; position: sticky; top: 0; z-index: 50;
  transition: transform .22s ease; will-change: transform;
}
[data-device="m"] .m-top-in { display: flex; align-items: center; gap: 6px; height: var(--header-h); padding: 0 12px 0 var(--gut); }
[data-device="m"] .m-top .logo { min-width: 0; }
[data-device="m"] .m-top .logo .sub, [data-device="m"] .m-top .logo .city { display: none; }
[data-device="m"] .m-top .logo .word { font-size: 22px; }
[data-device="m"] .m-top .logo-doodle { width: 150px; height: 46px; flex: 0 1 auto; min-width: 96px; }
[data-device="m"] .m-top .icon-btn, [data-device="m"] .m-top .lang-btn { height: 40px; border-color: transparent; }
[data-device="m"] .m-top .icon-btn { width: 40px; color: var(--text); font-size: 20px; }
[data-device="m"] .m-top .lang-btn { padding: 0 8px; }
[data-device="m"] .m-top .btn.sm { height: 36px; min-height: 36px; border-radius: var(--rp); }
[data-device="m"] .m-top .pop { position: fixed; top: calc(var(--header-h) + 4px); left: var(--gut); right: var(--gut); width: auto; max-height: calc(100dvh - var(--header-h) - var(--tabs-h) - 24px); overflow: auto; }
[data-device="m"] .m-top .pop-row { flex-wrap: wrap; }
[data-device="m"] .m-top .hdr-msg { width: 40px; height: 40px; background: transparent; font-size: 19px; }
[data-device="m"] .m-top .user-menu > summary.ava { width: 34px; height: 34px; }
[data-device="m"] .m-top .user-menu .pop { width: auto; }
/* Hidden while scrolling down (public/m.js), back on the way up. */
html.m-hide[data-device="m"] .m-top { transform: translateY(-100%); }

/* Search: an icon that opens a field across the bar. */
[data-device="m"] .m-find > summary { list-style: none; }
[data-device="m"] .m-find > summary::-webkit-details-marker { display: none; }
[data-device="m"] .m-find[open] > summary { color: var(--acc); }
[data-device="m"] .m-find-form {
  position: absolute; left: 0; right: 0; top: var(--header-h); display: flex; gap: 8px; padding: 10px var(--gut);
  background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 10px 24px #0000001f; z-index: 2;
}
[data-device="m"] .m-find-form .btn { flex: none; }

/* Chips of the current section under the bar. */
[data-device="m"] .m-chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 0 var(--gut) 10px; scrollbar-width: none;
  scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
[data-device="m"] .m-chips::-webkit-scrollbar { display: none; }
[data-device="m"] .m-chips .chip { flex: none; scroll-snap-align: start; }

/* ---------- Tab bar and the menu sheet ---------- */
[data-device="m"] .m-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  border-top: 1px solid var(--line); transition: transform .22s ease;
}
/* The blur lives on a layer of its own: backdrop-filter on the bar would make it the box of the fixed sheet. */
[data-device="m"] .m-tabs::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
html.m-hide[data-device="m"] .m-tabs { transform: translateY(100%); }
[data-device="m"] .m-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; height: var(--tabs-h); color: var(--muted); font: 600 11px/1.1 var(--font-ui); text-decoration: none; cursor: pointer;
  list-style: none;
}
[data-device="m"] .m-tab::-webkit-details-marker { display: none; }
[data-device="m"] .m-tab > span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-device="m"] .m-tab .sico, [data-device="m"] .m-tab .m-emo { font-size: 23px; line-height: 1; }
[data-device="m"] .m-tab.on { color: var(--acc); }
[data-device="m"] .m-tab.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--acc); }
[data-device="m"] .m-tab:active { background: var(--surface-2); }
[data-device="m"] .m-tab .nav-b, [data-device="m"] .m-tab .m-dot {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--red); color: #fff; font: 700 10px/17px var(--font-ui); text-align: center;
}
[data-device="m"] .m-more[open] > summary { color: var(--acc); }
/* The backdrop is the summary's own layer: a tap on it is a tap on the summary, so it closes the sheet without JS. */
[data-device="m"] .m-more[open] > summary::after {
  content: ""; position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); z-index: -1;
  background: #0008; cursor: default;
}
[data-device="m"] .m-sheet {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); z-index: 1;
  max-height: min(78dvh, 640px); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; padding: 8px var(--gut) 20px;
  background: var(--surface); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line-2);
  box-shadow: 0 -16px 40px #00000040; animation: m-up .22s ease;
}
@keyframes m-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
[data-device="m"] .m-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 2px auto 6px; flex: none; }
[data-device="m"] .m-sheet .eyebrow { margin-top: 6px; }
[data-device="m"] .m-sheet-find .inp { border-radius: var(--rp); padding-left: 16px; background: var(--surface-2); }
/* The site menu, one item a row; sub-items follow their item, indented. */
[data-device="m"] .m-nav { display: flex; flex-direction: column; gap: 2px; }
[data-device="m"] .m-nav a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 12px; color: var(--strong); font: 600 16px/1.2 var(--font-ui); background: none; }
[data-device="m"] .m-nav a.on { background: var(--acc-soft); color: var(--acc-strong); }
[data-device="m"] .m-nav a:active { background: var(--surface-2); }
[data-device="m"] .m-nav .nav-item { display: flex; flex-direction: column; position: static; }
[data-device="m"] .m-nav .nav-caret { display: none; }
[data-device="m"] .m-nav .nav-sub { display: flex; flex-direction: column; position: static; box-shadow: none; border: 0; padding: 0 0 4px 22px; background: none; min-width: 0; }
[data-device="m"] .m-nav .nav-sub a { min-height: 40px; font-size: 15px; font-weight: 400; color: var(--muted); }
[data-device="m"] .m-nav .nav-b { margin-left: auto; position: static; }
[data-device="m"] .m-nav .nav-pop { display: none; }
[data-device="m"] .m-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
[data-device="m"] .m-links a { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 600; }
[data-device="m"] .m-set { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; border-radius: 14px; background: var(--surface-2); }
[data-device="m"] .m-set .pop-row { flex-wrap: wrap; padding: 8px 0; }
[data-device="m"] .m-set .pop-row + .pop-row { border-top: 1px solid var(--line); }
[data-device="m"] .m-set .seg a, [data-device="m"] .m-set .seg button { padding: 9px 11px; }
[data-device="m"] .m-look { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
[data-device="m"] .m-look .look-theme { width: 40px; height: 36px; padding: 0; font-size: 17px; }
[data-device="m"] .m-ver { text-align: center; padding-top: 6px; font-size: 14px; }
html.m-locked, html.m-locked body { overflow: hidden; }

/* ---------- Footer ---------- */
[data-device="m"] .m-foot { margin-top: 36px; }
[data-device="m"] .m-foot-head { display: flex; flex-direction: column; gap: 8px; padding: 24px 0 12px; }
[data-device="m"] .m-foot .foot-logo { width: 180px; height: 48px; }
[data-device="m"] .m-foot-links { list-style: none; margin: 0; padding: 4px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
[data-device="m"] .m-foot-links a { display: block; padding: 9px 0; color: var(--muted); font-size: 15px; }
[data-device="m"] .foot-team { flex-wrap: wrap; gap: 10px 14px; }
[data-device="m"] .foot-bottom { flex-wrap: wrap; }

/* ---------- Shared components ---------- */
[data-device="m"] .g2, [data-device="m"] .g3 { grid-template-columns: minmax(0, 1fr); }
[data-device="m"] .g4, [data-device="m"] .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-device="m"] .grid { gap: 12px; }
[data-device="m"] .layout-side { grid-template-columns: minmax(0, 1fr); gap: 20px; }
[data-device="m"] .row:not(.nowrap) { flex-wrap: wrap; }
[data-device="m"] .card.pad { padding: 16px; }
[data-device="m"] .sec-h { flex-wrap: wrap; }
[data-device="m"] .crumbs { padding-top: 12px; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
[data-device="m"] .crumbs::-webkit-scrollbar { display: none; }
[data-device="m"] .toolbar { gap: 8px; }
[data-device="m"] .toolbar .sel { height: 40px; }
[data-device="m"] .pager { flex-wrap: wrap; gap: 6px; }
[data-device="m"] .pager a, [data-device="m"] .pager span { min-width: 40px; height: 40px; }
/* Wide tables scroll inside their box, never the page. */
[data-device="m"] main table:not(.keep) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
[data-device="m"] pre { max-width: 100%; overflow-x: auto; }
/* Grids set inline by page templates: many columns become one or two. Fine grids (calendars, cells) keep theirs. */
[data-device="m"] main [style*="grid-template-columns:repeat(3"], [data-device="m"] main [style*="grid-template-columns: repeat(3"],
[data-device="m"] main [style*="grid-template-columns:3fr"], [data-device="m"] main [style*="grid-template-columns:minmax(0,1.6fr)"],
[data-device="m"] main [style*="grid-template-columns:minmax(0,1fr) minmax(0,1.15fr)"], [data-device="m"] main [style*="grid-template-columns:minmax(200px"],
[data-device="m"] main [style*="grid-template-columns:minmax(0,1fr) minmax(0,1fr)"], [data-device="m"] main [style*="grid-template-columns:1fr 1fr"],
[data-device="m"] main [style*="grid-template-columns:repeat(2,minmax(0,1fr))"], [data-device="m"] main [style*="grid-template-columns: 1fr 1fr"] {
  grid-template-columns: minmax(0, 1fr) !important;
}
[data-device="m"] main [style*="grid-template-columns:repeat(4"], [data-device="m"] main [style*="grid-template-columns:repeat(5"],
[data-device="m"] main [style*="grid-template-columns:repeat(6"], [data-device="m"] main [style*="grid-template-columns:repeat(12"] {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
[data-device="m"] main [style*="minmax(340px"], [data-device="m"] main [style*="minmax(260px"], [data-device="m"] main [style*="minmax(250px"] {
  grid-template-columns: minmax(0, 1fr) !important;
}
/* Fixed widths set inline (side columns, wide boxes) give way to the screen. */
[data-device="m"] main [style*="width:320px"], [data-device="m"] main [style*="width:360px"], [data-device="m"] main [style*="width:420px"],
[data-device="m"] main [style*="width:480px"], [data-device="m"] main [style*="width:520px"], [data-device="m"] main [style*="width:560px"] { width: auto !important; max-width: 100%; }
[data-device="m"] main [style*="max-width:900px"], [data-device="m"] main [style*="max-width:820px"] { max-width: 100% !important; }
[data-device="m"] .pop { max-width: calc(100vw - 2 * var(--gut)); }
/* Listing cards: two columns of compact cards read better than one huge column. */
[data-device="m"] .grid.g3 > .lcard .body, [data-device="m"] .grid.g4 > .lcard .body { padding: 10px 12px; }
[data-device="m"] .lcard:hover { transform: none; }
/* Section management (/<section>/panel): the side menu becomes a strip of chips. */
[data-device="m"] .panel { grid-template-columns: minmax(0, 1fr); min-height: 0; }
[data-device="m"] .panel-nav { position: sticky; top: 0; z-index: 5; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line);
  padding: 8px var(--gut); gap: 6px; background: var(--surface); scrollbar-width: none; }
[data-device="m"] .panel-nav::-webkit-scrollbar { display: none; }
[data-device="m"] .panel-nav .eyebrow, [data-device="m"] .panel-nav .pn-head { display: none; }
[data-device="m"] .panel-nav a { flex: none; padding: 8px 12px; border-radius: var(--rp); border: 1px solid var(--line); font-size: 14px; }
[data-device="m"] .panel-main { padding: 16px var(--gut) 24px; }
[data-device="m"] .blk { grid-template-columns: 22px 36px minmax(0, 1fr); }
[data-device="m"] .blk > :last-child { grid-column: 1 / -1; }
/* Markdown editors: one pane with the switch. */
[data-device="m"] .md-split { grid-template-columns: 1fr; }
[data-device="m"] .md-modes { display: inline-flex; }
/* The messenger: a list, then a conversation full screen. */
[data-device="m"] .msg-app { min-height: calc(100dvh - var(--header-h) - var(--tabs-h)); }
/* Ads in side rails are for wide screens. */
[data-device="m"] .ad-side, [data-device="m"] .ad-rail { display: none !important; }

/* ---------- Home: the hero as a split card (mobile design) ---------- */
[data-device="m"] .home-top { padding: 0 !important; margin-top: 16px; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 10px 30px #0000001a; }
[data-device="m"] .home-top .hero { display: contents; }
[data-device="m"] .home-top .hero-inner { order: 1; padding: 24px 20px 4px; max-width: none; }
[data-device="m"] .home-top .hero-title { color: var(--strong); text-shadow: none; font-size: 30px; line-height: 1.15; letter-spacing: -.02em; }
[data-device="m"] .home-top .hero-acc { color: var(--acc); }
[data-device="m"] .home-top .hero-lead { color: var(--muted); text-shadow: none; font-size: 15px; line-height: 1.6; margin-top: 12px; }
[data-device="m"] .hero-pill { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 6px 12px; border-radius: var(--rp);
  background: var(--acc-soft); color: var(--acc); border: 1px solid color-mix(in srgb, var(--acc) 25%, transparent); font: 600 12px/1.2 var(--font-ui); }
[data-device="m"] .hero-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--acc); animation: hero-pulse 2s ease-in-out infinite; }

[data-device="m"] .hq { order: 2; margin: 16px 20px 20px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 4px 14px #00000012; }
[data-device="m"] .hq-r { position: absolute; opacity: 0; pointer-events: none; }
[data-device="m"] .hq-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
[data-device="m"] .hq-tab { text-align: center; overflow: hidden; text-overflow: ellipsis; padding: 9px 2px; border-radius: 12px; font: 600 12px/1.2 var(--font-ui); color: var(--muted); white-space: nowrap; cursor: pointer; }
[data-device="m"] .hq-p { display: none; }
[data-device="m"] .hq-form { display: flex; flex-direction: column; gap: 8px; }
[data-device="m"] .hq-form .btn { justify-content: center; height: 44px; }
#hq-rent:checked ~ .hq-p-rent, #hq-sale:checked ~ .hq-p-sale, #hq-market:checked ~ .hq-p-market, #hq-forum:checked ~ .hq-p-forum { display: block; }
#hq-rent:checked ~ .hq-tabs [for="hq-rent"], #hq-sale:checked ~ .hq-tabs [for="hq-sale"],
#hq-market:checked ~ .hq-tabs [for="hq-market"], #hq-forum:checked ~ .hq-tabs [for="hq-forum"] { background: var(--acc); color: var(--acc-ink); }
#hq-rent:focus-visible ~ .hq-tabs [for="hq-rent"], #hq-sale:focus-visible ~ .hq-tabs [for="hq-sale"],
#hq-market:focus-visible ~ .hq-tabs [for="hq-market"], #hq-forum:focus-visible ~ .hq-tabs [for="hq-forum"] { outline: 2px solid var(--acc); outline-offset: 2px; }

/* The photo with the conversation: its own card below the estate block (server/edge/pages.ts). */
[data-device="m"] .home-chat .hero-bg { position: relative; inset: auto; min-height: 340px; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 10px 30px #0000001a; }
[data-device="m"] .home-chat .hero-bg picture { position: absolute; inset: 0; }
[data-device="m"] .home-chat .hero-bg::after { background: #00000059; }

/* The conversation over the photo (src/shared/home-chat.ts, played by public/m.js). */
[data-device="m"] .hchat { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 18px; }
[data-device="m"] .hc-head { display: flex; align-items: center; gap: 10px; align-self: flex-start; padding: 6px 14px 6px 6px; border-radius: var(--rp);
  background: #1c1917b3; backdrop-filter: blur(8px); color: #fff; border: 1px solid #ffffff26; }
[data-device="m"] .hc-ava { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); font: 700 15px/1 var(--font-head); }
[data-device="m"] .hc-head b { display: block; font-size: 13px; }
[data-device="m"] .hc-head small { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #ffffffc7; }
[data-device="m"] .hc-head small i { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; animation: hero-pulse 2s ease-in-out infinite; }
[data-device="m"] .hc-log { display: flex; flex-direction: column; gap: 10px; }
[data-device="m"] .hc-pair { display: flex; flex-direction: column; gap: 6px; }
[data-device="m"] .hc-msg { position: relative; max-width: 86%; margin: 0; padding: 9px 12px; font-size: 14px; line-height: 1.4; border-radius: 18px;
  box-shadow: 0 8px 20px #00000040; transition: opacity .3s ease, transform .3s ease; }
[data-device="m"] .hc-msg.out { align-self: flex-end; background: var(--acc); color: var(--acc-ink); border-bottom-right-radius: 6px; }
[data-device="m"] .hc-msg.in { align-self: flex-start; background: #1c1917d9; backdrop-filter: blur(8px); color: #fff; border: 1px solid #ffffff1f; border-bottom-left-radius: 6px; }
[data-device="m"] .hc-cta { display: inline-flex; margin-top: 8px; padding: 6px 12px; border-radius: var(--rp); background: #ffffff1f; color: #fff; font: 700 13px/1.2 var(--font-ui); border: 1px solid #ffffff38; }
[data-device="m"] .hc-cta:active { background: #ffffff38; }
/* Played by m.js: a line waits hidden (its place kept, so nothing jumps), then pops in. */
[data-device="m"] .hc-msg.wait { opacity: 0; transform: translateY(8px) scale(.98); }
[data-device="m"] .hc-msg.typing > * { visibility: hidden; }
[data-device="m"] .hc-msg.typing { min-width: 64px; }
[data-device="m"] .hc-msg.typing::after { content: ""; position: absolute; left: 14px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: #fff; box-shadow: 12px 0 #fff, 24px 0 #fff; clip-path: inset(-2px 100% -2px -2px); animation: hc-dots 1.2s steps(4) infinite; opacity: .85; }
@keyframes hc-dots { to { clip-path: inset(-2px -2px -2px -2px); } }
[data-device="m"] .hchat.fade .hc-log { opacity: 0; transition: opacity .35s ease; }
[data-device="m"] .hc-log { transition: opacity .35s ease; }
@keyframes hero-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  [data-device="m"] .hero-pill i, [data-device="m"] .hc-head small i { animation: none; }
  [data-device="m"] .hc-msg { transition: none; }
}

[data-device="m"] .home-sections { padding-top: 28px; }
[data-device="m"] .home-sections .sec-h h2, [data-device="m"] .home-estate .sec-h h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
[data-device="m"] .home-sections .sec-h h2::before, [data-device="m"] .home-estate .sec-h h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--acc); }
[data-device="m"] .home-sections .grid.g5 { grid-template-columns: 1fr 1fr; gap: 12px; }
[data-device="m"] .home-sections .g5 > :last-child:nth-child(odd) { grid-column: span 2; }
[data-device="m"] .home-sections .lcard { padding: 16px; border-radius: 16px; }
[data-device="m"] .home-car .car { grid-auto-columns: 82%; }
[data-device="m"] .home-car .car-nav { display: none; }

/* ---------- Estate: list, filters as a sheet, the rail folded ---------- */
[data-device="m"] .es-head { align-items: flex-start; }
[data-device="m"] .es-head .row { width: 100%; }
[data-device="m"] .es-head .row .btn { flex: 1 1 auto; }
[data-device="m"] .es-search { grid-template-columns: 1fr 1fr; border-radius: 14px; }
[data-device="m"] .es-search.sale { grid-template-columns: 1fr 1fr; }
[data-device="m"] .es-search > label { border-bottom: 1px solid var(--line); padding: 8px 14px; }
[data-device="m"] .es-search > label:nth-of-type(2n) { border-right: 0; }
[data-device="m"] .es-search .go { grid-column: 1 / -1; min-height: 44px; }
[data-device="m"] .es3 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
[data-device="m"] .es3 .filters { position: static; max-height: none; order: 0; padding: 0 14px; border-radius: 14px; }
[data-device="m"] .es3 .filters > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; font-weight: 700; color: var(--strong); cursor: pointer; list-style: none; }
[data-device="m"] .es3 .filters > summary::-webkit-details-marker { display: none; }
[data-device="m"] .es3 .filters > summary::after { content: "▾"; margin-left: auto; color: var(--faint); transition: transform .2s; }
[data-device="m"] .es3 .filters[open] > summary::after { transform: rotate(180deg); }
[data-device="m"] .es-list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
[data-device="m"] .m-rail { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
[data-device="m"] .m-rail > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; font-weight: 700; color: var(--strong); cursor: pointer; list-style: none; }
[data-device="m"] .m-rail > summary::-webkit-details-marker { display: none; }
[data-device="m"] .m-rail > summary::after { content: "▾"; margin-left: auto; color: var(--faint); }
[data-device="m"] .m-rail[open] > summary::after { transform: rotate(180deg); }
[data-device="m"] .m-rail .rail { position: static; max-height: none; padding: 0 12px 12px; }
[data-device="m"] .es-trust { flex-direction: column; align-items: stretch; }
[data-device="m"] .gallery { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto !important; }
[data-device="m"] .gallery > :not(:first-child) { display: none; }
[data-device="m"] .gallery > :first-child { grid-row: auto !important; grid-column: auto !important; aspect-ratio: 4 / 3; }

/* ---------- Forum, boards, bazaar ---------- */
[data-device="m"] .lot { scroll-margin-top: 70px; }
[data-device="m"] .lot-main, [data-device="m"] .lot-side { padding: 12px; }
[data-device="m"] .post, [data-device="m"] .fpost { overflow-wrap: anywhere; }

/* ---------- The /panel frame (src/edge/panel-shell.ts renders its own switcher for phones) ---------- */
[data-device="m"] .pm-bar { position: sticky; top: 0; z-index: 6; display: flex; gap: 8px; padding: 10px var(--gut); background: var(--surface); border-bottom: 1px solid var(--line); }
[data-device="m"] .pm-pick { position: relative; flex: 1 1 0; min-width: 0; }
[data-device="m"] .pm-pick > summary { list-style: none; display: flex; flex-direction: column; gap: 1px; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; min-width: 0; }
[data-device="m"] .pm-pick > summary::-webkit-details-marker { display: none; }
[data-device="m"] .pm-pick > summary small { font: 700 10px/1.2 var(--font-ui); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
[data-device="m"] .pm-pick > summary b { font-size: 14px; color: var(--strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-device="m"] .pm-pick > summary .cnt { margin-left: 4px; font-size: 11px; background: var(--red); color: #fff; border-radius: var(--rp); padding: 0 6px; }
[data-device="m"] .pm-pick[open] > summary { border-color: var(--acc); }
[data-device="m"] .pm-list { position: fixed; left: var(--gut); right: var(--gut); top: calc(var(--header-h) + 64px); z-index: 70; max-height: calc(100dvh - var(--header-h) - var(--tabs-h) - 90px); overflow: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-pop); }
[data-device="m"] .pm-list a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--text); font-weight: 600; }
[data-device="m"] .pm-list a.on { background: var(--acc-soft); color: var(--acc-strong); }
[data-device="m"] .pm-list a .cnt { margin-left: auto; font-size: 11px; background: var(--red); color: #fff; border-radius: var(--rp); padding: 1px 7px; }
[data-device="m"] .pm-list .grp { padding: 10px 12px 4px; font: 700 11px/1 var(--font-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
[data-device="m"] .pshell { display: block; min-height: 0; }
[data-device="m"] .pshell-main { padding: 14px var(--gut) 24px; }
[data-device="m"] .ptabs { margin: 0 calc(-1 * var(--gut)) 14px; padding: 0 var(--gut); scrollbar-width: none; }
[data-device="m"] .ptabs::-webkit-scrollbar { display: none; }

/* ---------- Reading mode (articles, topics, threads: [data-reader], public/m.js) ---------- */
[data-device="m"] { --rd-size: 18px; --rd-lh: 1.7; }
[data-device="m"] [data-reader] .prose { font-size: var(--rd-size); line-height: var(--rd-lh); max-width: none; }
[data-device="m"] [data-reader] .prose h2 { font-size: calc(var(--rd-size) * 1.3); }
[data-device="m"] [data-reader] .prose h3 { font-size: calc(var(--rd-size) * 1.1); }
[data-device="m"] [data-reader] .prose img { border-radius: 10px; }
html[data-rd-font="serif"][data-device="m"] [data-reader] :is(.prose, .post-body, .fpost-body) { font-family: Georgia, "Noto Serif", "Noto Serif Georgian", "Times New Roman", serif; }
[data-device="m"] .m-toc { margin: 4px 0 18px; border: 1px solid var(--line-2); border-radius: 14px; }
[data-device="m"] .m-toc > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; font-weight: 700; color: var(--strong); cursor: pointer; }
[data-device="m"] .m-toc > summary::-webkit-details-marker { display: none; }
[data-device="m"] .m-toc > summary::after { content: "▾"; margin-left: auto; color: var(--faint); }
[data-device="m"] .m-toc ol { margin: 0; padding: 0 14px 12px 34px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
[data-device="m"] .m-toc .l3 { margin-left: 14px; list-style: circle; }
/* The progress line on top and the reader bar at the bottom (in place of the tab bar while reading). */
[data-device="m"] .rd-progress { position: fixed; left: 0; top: 0; z-index: 70; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--rd-p, 0)); background: var(--acc); pointer-events: none; }
[data-device="m"] .rd-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 10px); z-index: 61;
  display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: var(--rp);
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  transition: transform .22s ease, bottom .22s ease, opacity .2s;
}
html.m-hide[data-device="m"] .rd-bar { bottom: calc(var(--safe-b) + 10px); }
[data-device="m"] .rd-bar button, [data-device="m"] .rd-bar a { all: unset; box-sizing: border-box; display: inline-grid; place-items: center; min-width: 42px; height: 40px; padding: 0 10px; border-radius: var(--rp);
  color: var(--text); font: 700 14px/1 var(--font-ui); cursor: pointer; }
[data-device="m"] .rd-bar button:active, [data-device="m"] .rd-bar a:active { background: var(--surface-2); }
[data-device="m"] .rd-bar .rd-on { background: var(--acc); color: var(--acc-ink); }
[data-device="m"] .rd-left { flex: 1; text-align: center; font: 600 12px/1.2 var(--font-ui); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-device="m"] .rd-pop { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 66px); z-index: 62; padding: 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 12px; }
html.m-hide[data-device="m"] .rd-pop { bottom: calc(var(--safe-b) + 66px); }
[data-device="m"] .rd-pop .pop-row { padding: 0; }
[data-device="m"] .rd-pop .seg button { padding: 9px 13px; font-size: 13px; }
[data-device="m"] .rd-pop ol { margin: 0; padding-left: 20px; max-height: 50dvh; overflow: auto; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
[data-device="m"] .rd-toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 70px); transform: translateX(-50%); z-index: 63; padding: 10px 16px; border-radius: var(--rp);
  background: var(--strong); color: var(--bg); font: 600 13px/1.2 var(--font-ui); box-shadow: var(--shadow-pop); display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); }
[data-device="m"] .rd-toast button { all: unset; cursor: pointer; font-weight: 700; color: var(--acc); }
/* Focus: reading mode hides everything but the text. */
html.rd-focus[data-device="m"] :is(.m-top, .m-tabs, .site-footer, .crumbs, .ads, aside, .comments, .m-chips, .ad-card) { display: none !important; }
html.rd-focus[data-device="m"] body { padding-bottom: 80px; }
html.rd-focus[data-device="m"] .rd-bar { bottom: calc(var(--safe-b) + 10px); }
html.rd-focus[data-device="m"] .rd-pop { bottom: calc(var(--safe-b) + 66px); }
html.rd-focus[data-device="m"] [data-reader] { padding-top: 18px; }
html.rd-focus[data-device="m"] [data-reader] .prose { max-width: 36em; margin: 0 auto; }

/* ---------- Sticky strips under the top bar follow it (it steps aside while scrolling down) ---------- */
[data-device="m"] .pm-bar, [data-device="m"] .panel-nav { top: var(--header-h); transition: top .22s ease; }
html.m-hide[data-device="m"] .pm-bar, html.m-hide[data-device="m"] .panel-nav { top: 0; }

/* ---------- Page headings set inline by templates ---------- */
[data-device="m"] main h1[style*="font-size"] { font-size: 25px !important; }
[data-device="m"] article > p.muted[style*="font-size:19px"] { font-size: 17px !important; }
[data-device="m"] .article-cover { margin-left: calc(-1 * var(--gut)); margin-right: calc(-1 * var(--gut)); }
[data-device="m"] .article-cover img { border-radius: 0 !important; }

/* ---------- Forum posts: the author on a line above the text ---------- */
[data-device="m"] .post { grid-template-columns: minmax(0, 1fr); }
[data-device="m"] .post .who { flex-direction: row; flex-wrap: wrap; align-items: center; text-align: left; gap: 4px 10px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
[data-device="m"] .post .who .ava.lg { width: 36px; height: 36px; font-size: 13px; }
[data-device="m"] .post .msg { padding: 12px 14px; }
[data-device="m"] [data-reader] .post .msg-body { font-size: calc(var(--rd-size) - 2px); line-height: var(--rd-lh); }
html[data-rd-font="serif"][data-device="m"] [data-reader] .msg-body { font-family: Georgia, "Noto Serif", "Noto Serif Georgian", "Times New Roman", serif; }
[data-device="m"] .m-top-in > :not(.logo):not(.grow) { flex: none; }
[data-device="m"] .m-top .lang-btn { white-space: nowrap; }
/* Closed details: their content is laid out by newer engines (content-visibility) and can widen the page; it must
   not exist at all until opened. */
[data-device="m"] details:not([open]) > :not(summary) { display: none !important; }

/* ---------- Component grids of kit.css that are too wide for a phone ---------- */
[data-device="m"] :is(.layout-filters, .lot-full.two.feed, .lot-steps, .lot-grid, .cv-doc .cv-skg, .cv-doc .cv-cols, .cv-doc .cv-act, .skc, .hire, .hire.three,
  .job-cols, .lot-editor, .lot-row2, .mcat-cols, .mcat-two, .notes-grid, .near-row, .bk-months, .bk-extra, .md-split, .kv) { grid-template-columns: minmax(0, 1fr); }
[data-device="m"] :is(.g6, .alb-strip, .lot-kpicks, .lot-meters, .size-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-device="m"] .hire.three > .hire-thread { grid-column: auto; position: static; max-height: none; }
[data-device="m"] .cv-doc .cv-gantt-row { grid-template-columns: 96px minmax(0, 1fr) 52px; }
[data-device="m"] .mcat-side, [data-device="m"] .skc-list { position: static; max-height: none; }
[data-device="m"] .notes-grid > :first-child { border-right: 0; border-bottom: 1px solid var(--line); }
/* Boards: two rows of tiles that swipe sideways, as a strip of stories. */
[data-device="m"] .boards-strip { grid-template-columns: none; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: 44%;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 4px; scroll-padding: 0 14px; }
[data-device="m"] .boards-strip::-webkit-scrollbar { display: none; }
[data-device="m"] .boards-strip > * { scroll-snap-align: start; min-width: 0; }
/* Facts of an object are short: they stay in a row of three (more wrap to the next row). */
[data-device="m"] main .facts[style] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
[data-device="m"] .facts > div { padding: 10px 6px; }
/* The menu sheet is the only thing over the page while open. */
html.m-locked[data-device="m"] :is(.rd-bar, .rd-pop, .rd-toast) { display: none; }
/* Underlined tabs of a page scroll sideways instead of widening it. */
[data-device="m"] .tabs { overflow-x: auto; scrollbar-width: none; margin-left: calc(-1 * var(--gut)); margin-right: calc(-1 * var(--gut)); padding: 0 var(--gut); }
[data-device="m"] .tabs::-webkit-scrollbar { display: none; }
[data-device="m"] .tabs a { flex: none; white-space: nowrap; }

/* ---------- Staff: acting as a persona, the "on behalf of" field, the switcher in the sheet ---------- */
[data-device="m"] .m-act { position: static; display: flex; align-items: center; gap: 10px; justify-content: flex-start; flex-wrap: nowrap;
  padding: 8px var(--gut); background: var(--warn-soft); color: var(--warn); border-top: 1px solid var(--warn); border-bottom: 0; font-size: 13px; font-weight: 600; }
[data-device="m"] .m-act .m-act-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-device="m"] .m-act .btn { flex: none; }
[data-device="m"] .m-sheet .m-act { border: 1px solid var(--warn); border-radius: 12px; }
[data-device="m"] .m-acc { display: flex; flex-direction: column; gap: 8px; }
[data-device="m"] .m-acc-me { display: flex; align-items: center; gap: 12px; padding: 6px 4px; color: var(--text); }
[data-device="m"] .m-acc-me .ava { width: 44px; height: 44px; font-size: 17px; }
[data-device="m"] .m-acc-me small { display: block; }
[data-device="m"] .m-acc > form .btn { width: 100%; }
[data-device="m"] .m-personas { border: 1px solid var(--line-2); border-radius: 12px; padding: 0 12px; }
[data-device="m"] .m-personas > summary { list-style: none; min-height: 46px; display: flex; align-items: center; font-weight: 700; color: var(--strong); cursor: pointer; }
[data-device="m"] .m-personas > summary::-webkit-details-marker { display: none; }
[data-device="m"] .m-personas[open] { padding-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
[data-device="m"] .m-persona-list { display: flex; flex-direction: column; gap: 4px; max-height: 42dvh; overflow: auto; }
[data-device="m"] .m-persona-b { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 10px;
  border-radius: 10px; cursor: pointer; }
[data-device="m"] .m-persona-b:active { background: var(--surface-2); }
[data-device="m"] .m-persona-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
[data-device="m"] .m-persona-r { color: var(--faint); }
[data-device="m"] .as-pick { flex-wrap: wrap; width: 100%; font-size: 13px; }
[data-device="m"] .as-pick .inp { max-width: none !important; flex: 1 1 200px; }
[data-device="m"] .as-pick-list { left: 0; right: 0; min-width: 0; max-height: 46dvh; }
[data-device="m"] .as-pick-item { padding: 10px 12px; }
[data-device="m"] .m-as-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
[data-device="m"] .m-as-chips::-webkit-scrollbar { display: none; }
[data-device="m"] .m-as-chips .chip { flex: none; }
[data-device="m"] .vp-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
[data-device="m"] .vp-card { display: flex; flex-direction: column; gap: 8px; }
[data-device="m"] .vp-card .ava { width: 40px; height: 40px; }

/* ---------- Tables of rows (.tbl): a card per row, cells flow and wrap, each with its column's name (m.js) ---------- */
[data-device="m"] main table.tbl { display: block; overflow: visible; font-size: 14px; }
[data-device="m"] .tbl thead { display: none; }
[data-device="m"] .tbl tbody, [data-device="m"] .tbl tfoot { display: block; }
[data-device="m"] .tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
[data-device="m"] .tbl tr:last-child { border-bottom: 0; }
[data-device="m"] .tbl tr:hover td { background: none; }
[data-device="m"] .tbl td, [data-device="m"] .tbl th { display: block; padding: 0; border: 0; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
[data-device="m"] .tbl td:empty { display: none; }
[data-device="m"] .tbl td.wide, [data-device="m"] .tbl td:has(> b, > a.strong, > .strong, > form.stack-sm, > details) { flex: 1 1 100%; }
[data-device="m"] .tbl td[data-label]::before { content: attr(data-label); display: block; font: 700 10px/1.3 var(--font-ui); letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
[data-device="m"] .tbl .num { text-align: left; }
[data-device="m"] .tbl tr:has(> th):not(:has(> td)) { display: none; }
/* The title of a row needs no column name. */
[data-device="m"] .tbl td:is(.wide, :has(> b, > a.strong, > .strong))::before { display: none; }

/* ---------- Messenger: the list, then one conversation on the whole screen ---------- */
[data-device="m"] .msg-page { padding: 8px 0 0; }
[data-device="m"] .msg-app { border-radius: 14px; }
[data-device="m"] .msg-app.open { margin: 0 calc(-1 * var(--gut)); border-radius: 0; border-left: 0; border-right: 0; }
[data-device="m"] .msg-app.open .msg-thread { height: calc(100dvh - var(--header-h) - var(--tabs-h) - var(--safe-b) - 8px); display: flex; flex-direction: column; }
html.m-hide[data-device="m"] .msg-app.open .msg-thread { height: calc(100dvh - var(--safe-b) - 8px); }
[data-device="m"] .msg-app.open .msg-msgs { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
[data-device="m"] .msg-head { gap: 8px; padding: 8px 10px; }
[data-device="m"] .m-msg-back { flex: none; width: 36px; height: 36px; font-size: 18px; color: var(--text); }
[data-device="m"] .msg-ctx { margin: 8px 10px 0; }
[data-device="m"] .m-msg-info { margin: 6px 10px 0; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 13px; }
[data-device="m"] .m-msg-info > summary { list-style: none; min-height: 38px; display: flex; align-items: center; font-weight: 600; cursor: pointer; color: var(--muted); }
[data-device="m"] .m-msg-info > summary::-webkit-details-marker { display: none; }
[data-device="m"] .m-msg-info .msg-side { display: block !important; border: 0; padding: 0 0 10px; max-height: 40dvh; overflow: auto; }
[data-device="m"] .msg-comp { padding: 8px 10px calc(8px + var(--safe-b)); }
[data-device="m"] .msg-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
[data-device="m"] .msg-toolbar .msg-tf { position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabs-h) + var(--safe-b) + 10px); z-index: 62; max-height: 60dvh; overflow: auto; flex-direction: column; align-items: stretch; }
[data-device="m"] .msg-qr { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
[data-device="m"] .lot-pop { right: 0; max-width: calc(100vw - 32px); }
/* The conversation is an app screen: no footer under it. */
[data-device="m"] body:has(.msg-app.open) .site-footer { display: none; }
[data-device="m"] .msg-toolbar .msg-tf { width: auto; max-width: none; }

/* ---------- Typing: the on-screen keyboard needs the room; floating bars step aside ---------- */
html[data-device="m"]:has(main :is(textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, [contenteditable="true"]):focus) :is(.m-tabs, .rd-bar, .rd-pop) { display: none; }
html[data-device="m"]:has(main :is(textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), [contenteditable="true"]):focus) body { padding-bottom: 0; }
/* Inline fixed widths of form fields give way to the screen. */
[data-device="m"] main :is(.inp, .sel, textarea)[style*="width:"] { width: 100% !important; max-width: 100% !important; }
[data-device="m"] main .field { min-width: 0; flex: 1 1 100%; }

/* ---------- Long forms: the save / publish row stays at hand at the bottom of the screen ---------- */
[data-device="m"] .form-actions { position: sticky; bottom: calc(var(--tabs-h) + var(--safe-b)); z-index: 7; margin: 0 calc(-1 * var(--gut));
  padding: 10px var(--gut); background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--line); }
html.m-hide[data-device="m"] .form-actions { bottom: var(--safe-b); }
[data-device="m"] .form-actions .btn { flex: 1 1 auto; }
[data-device="m"] .form-actions .ml-auto { flex: 0 0 auto; }
/* The resume editor (.re): its toolbar sticks under the top bar; source and preview one under the other. */
[data-device="m"] .re-tools { top: var(--header-h); }
html.m-hide[data-device="m"] .re-tools { top: 0; }
[data-device="m"] .re-work { height: auto; min-height: 0; }
[data-device="m"] .re-b { min-width: 36px; height: 36px; }
[data-device="m"] .md-ed textarea { min-height: 50dvh; }
/* The visual article editor (rich.js): one row of tools under the top bar while writing. */
[data-device="m"] .rich-bar { top: var(--header-h); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; transition: top .22s ease; }
[data-device="m"] .rich-bar::-webkit-scrollbar { display: none; }
[data-device="m"] .rich-bar > * { flex: none; min-width: 38px; min-height: 38px; }
html.m-hide[data-device="m"] .rich-bar { top: 0; }
[data-device="m"] .rich-area { min-height: 50dvh; padding: 12px 14px; font-size: 17px; }
html[data-device="m"]:has(main :is(textarea, [contenteditable="true"]):focus) .form-actions { position: static; }
/* The edit bar of an object (src/edge/lot-edit.ts): one row that swipes sideways, glued under the top bar. */
[data-device="m"] .lot-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; padding: 6px 10px; margin: 0 calc(-1 * var(--gut)) 14px;
  border-radius: 0; border-left: 0; border-right: 0; transition: top .22s ease; }
[data-device="m"] .lot-bar::-webkit-scrollbar { display: none; }
[data-device="m"] .lot-bar > * { flex: none; }
[data-device="m"] .lot-bar .seg a, [data-device="m"] .lot-bar .seg button { padding: 8px 10px; }
html.m-hide[data-device="m"] .lot-bar { top: 0; }
/* Unsaved changes of the object: "undo / save all" float at the bottom, never scrolled away in the bar. */
[data-device="m"] .lot-bar [data-dirty-show]:not([hidden]) { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 10px); z-index: 62;
  display: flex; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--warn); box-shadow: var(--shadow-pop); }
[data-device="m"] .lot-bar [data-dirty-show] .dirty-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }
html.m-hide[data-device="m"] .lot-bar [data-dirty-show]:not([hidden]), html[data-device="m"]:has(main :is(textarea, input, [contenteditable="true"]):focus) .lot-bar [data-dirty-show]:not([hidden]) { bottom: calc(var(--safe-b) + 10px); }
/* Object tabs of the estate cabinet (/estate/panel/<id>/…) swipe sideways. */
[data-device="m"] .etabs { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
[data-device="m"] .etabs::-webkit-scrollbar { display: none; }
[data-device="m"] .etabs a { flex: none; white-space: nowrap; }
/* Chips with long texts wrap inside themselves instead of widening the page. */
[data-device="m"] main .chip { max-width: 100%; height: auto; min-height: 34px; white-space: normal; padding-top: 4px; padding-bottom: 4px; }
[data-device="m"] main :is(.m-chips, .m-as-chips, .row.nowrap) .chip { white-space: nowrap; }
[data-device="m"] .saved-toast { bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); max-width: calc(100vw - 32px); }
/* Management screens over a page (#edit~5, app.js ui-sheet): a full screen of their own, over the bars. */
[data-device="m"] .ui-sheet { z-index: 75; }
[data-device="m"] .ui-sheet-box { width: 100%; padding-bottom: var(--safe-b); }
[data-device="m"] .ui-sheet-bar { padding: 8px var(--gut); min-height: var(--header-h); }
[data-device="m"] .ui-sheet-body { padding: 14px var(--gut) 32px; }
/* The leading cells are the row's name: no column caption over them; they take the whole line. */
[data-device="m"] .tbl td:nth-child(-n+2)::before { display: none; }
[data-device="m"] .tbl td:nth-child(2):not(:last-child) { flex: 1 1 60%; }
[data-device="m"] .m-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-device="m"] .m-links a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-device="m"] .m-act .m-act-t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }

/* Place cards over the map (src/edge/estate-rail.ts) */
html[data-device="m"] .pcard-ph img{height:120px}
html[data-device="m"] .pcard-box{left:4px;right:4px;bottom:30px}
