/* ==========================================================================================================================
   Ride desktop layout (>= 1024px) — Ride, Ride Carry, Ride Exchange, Ride admin. Kaveh 2026-11-23.
   Replaces the centred phone column: a persistent side navigation, a top bar, and a content area that uses the whole screen.
   Phones (< 700px) never match: every rule is inside @media (min-width:700px) and needs <body class="desk"> (desktop.js).
   700-1023px = TABLET: same shell (icon-only 76px side navigation, top bar, full-width content, centred dialogs) but the request sheet stays a floating
   card at the bottom of the map and grids use fewer columns. >= 1024px = DESKTOP: 248px labelled navigation, request pane beside the map, 4-column grids.

   DESIGN NOTE
   - Tokens (on body.desk):  --rail 248px side navigation | --top 64px top bar | --maxw 1240px content container | --gut 28px min side space
                             --pane-w 424px request pane beside the map | --side = rail width when a navigation is on screen, else 0
                             --pane = pane width while #sheet is shown, else 0 | --ml/--mr = physical left/right edge of the map box
                             --cl/--cr = physical left/right of the content area (RTL: the rail is on the right, LTR: on the left).
   - Side navigation (#nav Ride, .ex-nav Exchange, .cy-nav Carry — same look): inline-start edge, brand on top (the existing .brand), icon + label rows,
     active row = accent chip, "other sections" (#app-menu) pinned to the bottom.
   - Top bar (#topbar): over the content area only; page title (desktop.js), then language, bell, help, theme. Flat 40px buttons.
   - Content: pages/home fill the area, text column limited to --maxw and centred; forms ~720px; lists/cards in grids.
   - Overlays: bottom sheets and modals become centred dialogs (max 560px, 24px radius, soft shadow); toasts top-centre of the content area;
     fixed action bars (.ex-fix, .cy-fab) float centred in the content area. Everything is position:fixed to the VIEWPORT again (no body transform).
   - Map: #map fills the area right of the side navigation; the request sheet (#sheet) is a full-height pane between rail and map; the centre pin
     follows the map box. Logical properties (inset-inline-*) everywhere, so RTL (fa) and LTR (en, ru) both work; light and dark use the app variables.
   ========================================================================================================================== */

/* the nodes desktop.js adds to the top bar stay hidden below 1024px */
#topbar .dsk-only, #topbar .dsk-title { display: none; }
.hside, .cy-fpane { display: none; }   /* home side column (latest rides + quick chips): wide screens only, see below */

@media (min-width: 700px) {

  /* ---------------------------------------------------------------- tokens */
  body.desk { --rail: 76px; --top: 64px; --maxw: 1240px; --gut: 24px; --pane-w: 424px; --side: 0px; --pane: 0px; }   /* tablet values; desktop below */
  @media (min-width: 1024px) { body.desk { --rail: 248px; --gut: 28px; } body.desk:has(#sheet:not(.hidden)) { --pane: var(--pane-w); } }
  @media (min-width: 1024px) and (max-width: 1179px) { body.desk { --pane-w: 368px; } }   /* small laptops: a slimmer request pane, the map keeps its room */
  body.desk.rail { --side: var(--rail); }   /* .rail = a side navigation is on screen (desktop.js) */
  html[dir=ltr] body.desk { --ml: calc(var(--side) + var(--pane)); --mr: 0px; --cl: var(--side); --cr: 0px; }
  html[dir=rtl] body.desk { --ml: 0px; --mr: calc(var(--side) + var(--pane)); --cl: 0px; --cr: var(--side); }
  /* the content column: side space that centres a --maxw wide container inside the area right of the side navigation */
  body.desk { --pad: max(var(--gut), calc((100% - var(--maxw)) / 2)); }

  /* ---------------------------------------------------------------- side navigation */
  /* tablet: an icon-only rail (labels become the accessible name, see desktop.js); desktop (>= 1024px) widens it and shows the labels */
  body.desk #nav, body.desk .ex-nav, body.desk .cy-nav {
    position: fixed; inset-block: 0; inset-inline: 0 auto; width: var(--rail); z-index: 50;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
    padding: calc(var(--top) + 16px) 8px 84px; margin: 0; overflow-y: auto;
    background: var(--panel); border: 0; border-inline-end: 1px solid var(--line); box-shadow: none; scrollbar-width: none;
  }
  body.desk.rail:not(.ex-on):not(.cy-on) #nav.hidden { display: flex !important; }   /* the ride-request flow and Exchange/Carry admin pages keep the Ride navigation on screen (app.css hides it on phones) */
  body.desk #nav button, body.desk .ex-nav button, body.desk .cy-nav button {
    flex: none; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0; position: relative;
    width: 52px; min-height: 52px; padding: 0; border: 0; border-radius: 16px; background: none; text-align: start;
    font: 600 0/1 Vazirmatn, system-ui, sans-serif; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;   /* font-size 0: icon only */
  }
  body.desk #nav button:hover, body.desk .ex-nav button:hover, body.desk .cy-nav button:hover { background: var(--panel-2); color: var(--text); }
  body.desk #nav button:focus-visible, body.desk .ex-nav button:focus-visible, body.desk .cy-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
  body.desk #nav button .ms, body.desk .ex-nav button .ms, body.desk .cy-nav button .ms {
    flex: none; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border-radius: 13px; font-size: 24px; background: none;
  }
  body.desk #nav button.on, body.desk .ex-nav button.on, body.desk .cy-nav button.on { background: var(--accent-soft); color: var(--text); }
  body.desk #nav button.on .ms, body.desk .ex-nav button.on .ms, body.desk .cy-nav button.on .ms { background: var(--accent); color: var(--accent-ink); padding: 0; }
  body.desk .ex-nav button .l { display: none; }
  /* counters: a dot-badge on the icon (tablet); at the row's far end on desktop */
  body.desk .ex-nb, body.desk .ag-nb { position: absolute; top: 4px; inset-inline-end: 2px; margin: 0; box-shadow: 0 0 0 2px var(--panel); flex: none; font-size: 10.5px; }
  /* brand on top of the rail: the existing .brand of the top bar, taken out of the bar */
  body.desk.rail #topbar .brand {
    position: fixed; inset-block-start: 0; inset-inline-start: 0; width: var(--rail); height: var(--top); z-index: 3; margin: 0; padding: 0;
    background: none; box-shadow: none; border-radius: 0; border-bottom: 1px solid var(--line); gap: 10px; justify-content: center; pointer-events: auto;
  }
  body.desk .brand .logo { width: 36px; height: 36px; border-radius: 12px; }
  body.desk.rail .brand b { display: none; }
  body.desk .brand b { font-size: 17px; letter-spacing: .08em; flex-direction: column; line-height: 1.1; }
  body[data-dsk-app=exchange] .brand b::after, body[data-dsk-app=carry] .brand b::after { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
  body[data-dsk-app=exchange] .brand b::after { content: 'Exchange'; }
  body[data-dsk-app=carry] .brand b::after { content: 'Carry'; }
  /* "other sections" lives at the bottom of the rail (the same button as the phone hamburger) */
  body.desk.rail #topbar #app-menu {
    position: fixed; inset-block-end: 16px; inset-inline-start: calc((var(--rail) - 52px) / 2); width: 52px; height: 52px; z-index: 3; justify-content: center; gap: 12px; padding: 0;
    border-radius: 16px; font-weight: 600; font-size: 14px; color: var(--muted);
  }
  body.desk.rail #topbar #app-menu:hover { color: var(--text); }

  @media (min-width: 1024px) {
    body.desk #nav, body.desk .ex-nav, body.desk .cy-nav { align-items: stretch; gap: 4px; padding: calc(var(--top) + 16px) 12px 84px; scrollbar-width: thin; }
    body.desk #nav button, body.desk .ex-nav button, body.desk .cy-nav button {
      justify-content: flex-start; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px; border-radius: 14px; font: 600 14.5px Vazirmatn, system-ui, sans-serif;
    }
    body.desk #nav button .ms, body.desk .ex-nav button .ms, body.desk .cy-nav button .ms { width: 36px; height: 36px; font-size: 22px; border-radius: 12px; }
    body.desk #nav button.on, body.desk .ex-nav button.on, body.desk .cy-nav button.on { font-weight: 800; }
    body.desk .ex-nav button .l { display: block; max-width: none; overflow: visible; font-size: inherit; letter-spacing: 0; white-space: normal; text-align: start; }
    body.en .ex-nav button .l, body.ru .ex-nav button .l { font-size: inherit; letter-spacing: 0; }
    body.desk .ex-nb, body.desk .ag-nb { position: static; order: 9; margin-inline-start: auto; box-shadow: none; }
    body.desk.rail #topbar .brand { padding: 0 20px; justify-content: flex-start; }
    body.desk.rail .brand b { display: flex; }
    body.desk .brand .logo { width: 34px; height: 34px; border-radius: 11px; }
    body.desk.rail #topbar #app-menu { inset-inline-start: 12px; width: calc(var(--rail) - 24px); height: 46px; justify-content: flex-start; padding: 0 14px; border-radius: 14px; }
    body.desk.rail #topbar #app-menu::after { content: attr(title); }
  }

  /* ---------------------------------------------------------------- top bar */
  body.desk #topbar { inset-block: 0 auto; inset-inline: var(--side) 0; height: var(--top); z-index: 52; padding: 0 var(--gut); gap: 16px; }
  /* the translucent, blurred bar lives on a pseudo-element: backdrop-filter on #topbar itself would turn it into the containing block of the brand and the
     "other sections" button that are pinned (position:fixed) into the side navigation. Translucent also avoids an opaque layer hiding the last 64px of the map canvas in headless Chromium. */
  body.desk #topbar::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--panel) 90%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
  body.desk.flow:not(:has(.page.av:not(.hidden))) #topbar { display: flex !important; }   /* app.css hides the bar during the ride-request flow on phones */
  body.desk #topbar .dsk-title { display: block; flex: 1; min-width: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
  body.desk #topbar .dsk-title:empty { display: none; }
  body.desk #topbar .dsk-only { display: flex; }
  body.desk #topbar .dsk-only b { font: 700 12.5px Inter, system-ui, sans-serif; letter-spacing: .04em; }
  body.desk #topbar .top-actions { gap: 8px; align-items: center; }
  body.desk .pill-btn { height: 40px; border-radius: 12px; box-shadow: none; border: 1px solid var(--line); background: var(--panel); transition: background .15s; }
  body.desk .pill-btn:hover { background: var(--panel-2); }
  body.desk .pill-btn.icon-only { width: 40px; padding: 0; justify-content: center; }
  body.desk #topbar .pill-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

  /* ---------------------------------------------------------------- content area: pages, home */
  body.desk .page, body.desk.has-nav .page { inset-block: var(--top) 0; inset-inline: var(--side) 0; }
  body.desk .page.av { inset: 0; }
  body.desk .page header { padding: 22px var(--pad) 0; background: var(--bg); }
  body.desk .page header b { display: none; }                       /* the title is shown in the top bar */
  body.desk .page > header:not(:has(> :not(b))) { display: none; }  /* no back button -> nothing left in the row */
  body.desk .page header .pill-btn { width: 40px; padding: 0; justify-content: center; }
  body.desk #page .body, body.desk.ex-on #page .body, body.desk.cy-on #page .body { padding: 16px var(--pad) 56px; }
  body.desk .page.av .body { padding: 0 var(--gut); }

  body.desk .home, body.desk.has-nav .home {
    inset-block: var(--top) 0; inset-inline: var(--side) 0; padding: 36px max(var(--gut), calc((100% - var(--side) - var(--maxw)) / 2)) 64px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; align-content: start; grid-auto-flow: dense;
  }
  body.desk.has-ad .home { padding-top: calc(36px + var(--adh, 44px) + 12px); }
  body.desk .home > h1, body.desk .home > .sub, body.desk .home > .nlive, body.desk .home > .qk { grid-column: 1 / -1; }
  body.desk .home h1 { margin: 0; font-size: 34px; }
  body.desk .home .sub { margin: -8px 0 8px; font-size: 16px; }
  body.desk .home .svc { margin-top: 0; }
  body.desk .home .svc.big { grid-column: span 2; min-height: 112px; }
  body.desk .svc { transition: transform .15s, box-shadow .15s, border-color .15s; }
  body.desk .svc:hover { border-color: var(--accent); box-shadow: 0 10px 28px rgba(15, 23, 42, .1); }

  body.desk #adbar { top: calc(var(--top) + 12px); inset-inline: calc(var(--side) + var(--gut)) var(--gut); }

  /* ---------------------------------------------------------------- map and the request pane */
  body.desk #map { inset: 0 var(--mr) 0 var(--ml); }
  body.desk #center-pin { left: calc(var(--ml) + (100% - var(--ml) - var(--mr)) / 2); }
  body.desk .fab { left: calc(var(--ml) + 16px); top: calc(var(--top) + 16px); }
  body.desk .maplibregl-ctrl-bottom-right { top: calc(var(--top) + 8px); }
  /* tablet: the request sheet stays a floating card at the bottom of the (full-width) map */
  body.desk #sheet {
    inset-block: auto 16px; inset-inline: var(--side) 0; margin-inline: auto; width: min(560px, calc(100% - var(--side) - 32px)); max-height: min(62vh, calc(100vh - var(--top) - 32px));
    z-index: 12; border-radius: 22px; border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(15, 23, 42, .18);
  }
  body.desk #ftop .flow-top { top: var(--top); inset-inline: var(--side) 0; margin-inline: auto; width: min(560px, calc(100% - var(--side))); padding: 14px 16px 0; z-index: 14; }
  /* desktop: a full-height pane between the navigation and the map; the map box shrinks (--pane), the pin stays centred in it */
  @media (min-width: 1024px) {
    body.desk #sheet {
      inset-block: var(--top) 0; inset-inline: var(--side) auto; margin-inline: 0; width: var(--pane-w); max-height: none; padding: 22px 22px 32px;
      border-radius: 0; border: 0; border-inline-end: 1px solid var(--line); box-shadow: 0 0 40px rgba(15, 23, 42, .08);
    }
    body.desk #sheet::before, body.desk #sheet .grab { display: none; }
    body.desk #ftop .flow-top { inset-inline-start: calc(var(--side) + var(--pane)); inset-inline-end: auto; margin-inline: 0; width: min(520px, calc(100% - var(--side) - var(--pane))); padding: 16px 16px 0; }
  }
  body.desk #live-pill { top: calc(var(--top) + 14px); left: calc(var(--ml) + (100% - var(--ml) - var(--mr)) / 2); }

  /* ---------------------------------------------------------------- toasts and banners (top centre of the content area) */
  body.desk .toast { top: calc(var(--top) + 14px); left: calc(var(--cl) + (100% - var(--cl) - var(--cr)) / 2); right: auto; width: min(520px, calc(100% - var(--side) - 48px)); transform: translateX(-50%); z-index: 80; }
  body.desk .inapp-banner { top: calc(var(--top) + 12px); inset-inline: auto var(--gut); width: min(440px, calc(100% - var(--side) - 48px)); }

  /* ---------------------------------------------------------------- dialogs: sheets and modals become centred dialogs */
  body.desk .modal-bg, body.desk .ex-sheet-bg, body.desk .cy-pick { align-items: center; justify-content: center; padding: 24px; }
  body.desk .modal { width: min(560px, 100%); border-radius: 24px; padding: 24px; max-height: min(86vh, 800px); box-shadow: 0 24px 80px rgba(7, 10, 30, .35); }
  body.desk .ex-sheet { width: min(600px, 100%); border-radius: 24px; padding: 24px; max-height: min(86vh, 800px); box-shadow: 0 24px 80px rgba(7, 10, 30, .4); }
  body.desk .ex-sheet.tall { height: min(80vh, 720px); }
  body.desk .cy-pick-box { max-width: 560px; border-radius: 24px; padding: 22px; box-shadow: 0 24px 80px rgba(7, 10, 30, .4); }
  body.desk #modal .sheet.mod, body.desk.has-nav #modal .sheet.mod {
    inset: 0; margin: auto; width: min(560px, calc(100% - 48px)); height: fit-content; max-height: min(86vh, 820px); border-radius: 24px; padding: 24px; z-index: 60;
    box-shadow: 0 24px 80px rgba(7, 10, 30, .35);
  }
  body.desk #modal .sheet.mod::before { display: none; }
  body.desk .modal-bg.mfa-auto, body.desk .modal-bg.q-btn { padding: 0; }

  /* the language chooser (i18n.js builds it with inline styles: full-window background + 320px card) becomes a dimmed backdrop with a centred card */
  body.desk [data-lang-picker] { background: rgba(7, 10, 30, .55) !important; }
  body.desk [data-lang-picker] > div { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 28px 24px; box-shadow: 0 24px 80px rgba(7, 10, 30, .35); max-width: 380px !important; }

  /* ---------------------------------------------------------------- fixed action bars: centred in the content area */
  body.desk .ex-fix:not(.wrap), body.desk #page:has(.ex-nav) .ex-fix:not(.wrap) {
    inset: auto 0 20px; inset-inline: var(--side) 0; margin-inline: auto; width: min(640px, calc(100% - var(--side) - 48px)); padding: 12px; border-radius: 18px;
    background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(15, 23, 42, .16); z-index: 31;
  }
  body.desk .cy-fab { inset-inline: auto var(--gut); width: auto; min-width: 220px; bottom: 28px; z-index: 29; }

  /* ---------------------------------------------------------------- Exchange / Carry in-page switchers: the rail and the top bar replace them */
  body.desk .ex-switch, body.desk .cy-top.cy-swm { display: none; }

  /* ---------------------------------------------------------------- sign-in / intro */
  body.desk .av-hd { left: var(--gut); right: var(--gut); top: 24px; }
  body.desk .av-w { left: 0; right: 0; margin-inline: auto; width: min(520px, calc(100% - 48px)); bottom: 8vh; padding: 0; }
  body.desk .page.av .body > * { width: min(480px, 100%); align-self: center; }
  body.desk .ob { inset: 24px 0; margin-inline: auto; width: min(440px, 100%); height: auto; border-radius: 28px; box-shadow: 0 0 0 100vmax #070a24, 0 30px 90px rgba(0, 0, 0, .55); }

  /* ---------------------------------------------------------------- Ride pages: grids instead of one long phone list */
  /* home: service cards as a 4-column dashboard (tall cards, the big ones span two columns) */
  body.desk .home .svc { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 16px; padding: 22px; min-height: 172px; border-radius: 24px; position: relative; }
  body.desk .home .svc .tile { width: 56px; height: 56px; border-radius: 18px; }
  body.desk .home .svc .grow { flex: none; width: 100%; }
  body.desk .home .svc b { font-size: 18px; }
  body.desk .home .svc small { font-size: 13px; }
  body.desk .home .svc .go { position: absolute; top: 22px; }   /* physical: the icon font sets direction:ltr on the glyph, which would flip a logical inset */
  html[dir=rtl] body.desk .home .svc .go { left: 20px; }
  html[dir=ltr] body.desk .home .svc .go { right: 20px; }
  body.desk .home .svc.big { flex-direction: row; align-items: center; gap: 22px; min-height: 172px; }
  body.desk .home .svc.big .tile { width: 76px; height: 76px; border-radius: 24px; }
  body.desk .home .svc.big .tile .ms { font-size: 40px; }
  body.desk .home .svc.big .grow { flex: 1; width: auto; }
  body.desk .home .svc.big b { font-size: 22px; }
  body.desk .home .svc.big .go { position: static; }
  body.desk .home .nlive { border-radius: 20px; }
  body.desk .home .qk .chips { gap: 10px; }

  /* narrow reading width for form-like pages (account) */
  body.desk #page:not(:has(> .body > h3 ~ .card)):has(> .body > :is(.person, .opt-list, form, .field, #tk-new)) { --pad: max(var(--gut), calc((100% - 880px) / 2)); }
  body.desk #page .body .opt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 10px; }
  body.desk #page .body .card:has(> .ring-row) { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }   /* profile completion: two columns of checks */
  body.desk #page .body .card:has(> .ring-row) > .ring-row { grid-column: 1 / -1; }
  body.desk #page .body .empty { max-width: 560px; margin-inline: auto; }

  /* lists of rides: a card grid */
  body.desk #page .body:has(> .ord) { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 14px 16px; align-content: start; }
  body.desk #page .body:has(> .ord) > * { grid-column: 1 / -1; }
  body.desk #page .body:has(> .ord) > .ord { grid-column: auto; margin-top: 0; }

  /* points */
  body.desk .gifts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); overflow: visible; gap: 12px; scroll-snap-type: none; }
  body.desk .gift { flex: none; }
  body.desk .earn { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  body.desk .pacts { gap: 14px; }

  /* admin: wider tile rows */
  body.desk .ag-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

  /* Exchange / Carry (shell phase): forms and detail pages sit in a centred 880px container, card lists use the full width in a grid.
     The page-level designs (board table/grid, deal + chat panes) come in the next phase. */
  body.desk.ex-on #page, body.desk.cy-on #page { --pad: max(var(--gut), calc((100% - 880px) / 2)); }
  body.desk.ex-on #page:has(.ex-list), body.desk.cy-on #page:has(#cy-list) { --pad: max(var(--gut), calc((100% - var(--maxw)) / 2)); }
  body.desk .ex-list { align-content: start; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 14px; align-items: start; }
  body.desk #cy-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 14px; align-items: start; }
  body.desk #cy-list > .cy-card { margin-top: 0; }
  body.desk #cy-list > :not(.cy-card) { grid-column: 1 / -1; }
  body.desk .ex-grab, body.desk .cy-grab { display: none; }   /* sheet drag handles make no sense on a centred dialog */

  /* ---------------------------------------------------------------- Phase 2 */
  /* map attribution: bottom corner on wide screens (app.css moves it to the top on phones so the sheet does not cover it) */
  body.desk .maplibregl-ctrl-bottom-right { top: auto; bottom: 0; }
  /* Exchange reference-rate strip: static and complete on wide screens (the marquee loop leaves a gap when the strip is wider than its content) */
  body.desk .ex-mq2 .in { animation: none; }
  body.desk .ex-mq2 .ex-dup { display: none; }
  body.desk .ex-mq2 .trk { -webkit-mask-image: none; mask-image: none; }
  /* Ride home, >= 1280px: three card columns + a side column with the latest rides and the quick chips */
  @media (min-width: 1280px) {
    body.desk .home:has(> .hside) { grid-template-columns: repeat(3, minmax(0, 1fr)) 340px; }
    body.desk .home:has(> .hside) > :is(h1, .sub, .nlive) { grid-column: 1 / 4; }
    body.desk .home > .hside { display: block; grid-column: 4; grid-row: 1 / span 12; align-self: start; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 8px 18px 18px; }
    body.desk .home:has(> .hside) > .qk { display: none; }
    body.desk .hside h3 { margin: 16px 0 6px; }
    body.desk .hs-r { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: start; font: inherit; color: var(--text); cursor: pointer; }
    body.desk .hs-r:hover b { color: var(--blue); }
    body.desk .hs-r .ms { color: var(--muted); flex: none; }
    body.desk .hs-r .grow { flex: 1; min-width: 0; }
    body.desk .hs-r .grow b { display: block; font-size: 14.5px; }
    body.desk .hs-r small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
    body.desk .hs-p { font-size: 13.5px; white-space: nowrap; }
    body.desk .hside .empty { padding: 20px 6px; }
  }

  /* top bar: app-name subtitle under the page title inside Exchange / Carry (product names are never translated) */
  body[data-dsk-app] #dsk-title { line-height: 1.25; }
  body[data-dsk-app] #dsk-title::after { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
  body[data-dsk-app=exchange] #dsk-title::after { content: 'Ride Exchange'; }
  body[data-dsk-app=carry] #dsk-title::after { content: 'Ride Carry'; }

  /* ---------------------------------------------------------------- Phase 2: Exchange + Carry page designs (>= 1024px) */
  @media (min-width: 1024px) {
    /* Exchange board: filter column (reference rates, buy/sell/convert, filter chips) + the listings */
    body.desk.ex-on #page .body:has(> #ex-tick) { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 24px; align-content: start; }
    body.desk.ex-on #page .body:has(> #ex-tick) > :not(.ex-tabs, #ex-tick, .ex-seg, .ex-chips, .ex-list, .ex-nav, .ex-fix) { grid-column: 1 / -1; }
    body.desk.ex-on #page .body:has(> #ex-tick) > .ex-tabs { grid-column: 2; grid-row: 1; margin: 0 0 14px; align-self: start; }
    body.desk.ex-on #page .body:has(> #ex-tick) > #ex-tick { grid-column: 1; grid-row: 2; margin: 0 0 12px; width: 100%; padding: 12px 14px; }
    body.desk.ex-on #page .body:has(> #ex-tick) > .ex-seg { grid-column: 1; grid-row: 3; margin: 0 0 12px; }
    body.desk.ex-on #page .body:has(> #ex-tick) > .ex-chips { grid-column: 1; grid-row: 4; flex-wrap: wrap; overflow: visible; margin: 0; align-content: flex-start; }
    body.desk.ex-on #page .body:has(> #ex-tick) > .ex-list { grid-column: 2; grid-row: 2 / span 4; align-content: start; }
    body.desk .ex-mq2 .rows { gap: 8px; }
    body.desk .ex-mq2 .trk { overflow: visible; }
    body.desk .ex-mq2 .in { flex-wrap: wrap; white-space: normal; gap: 6px 14px; }
    body.desk .ex-seg button { padding-inline: 6px; font-size: 13px; }

    /* Exchange create form: two columns of fields in a 960px container */
    body.desk.ex-on #page:has(> .body > .ex-seg + .ex-f) { --pad: max(var(--gut), calc((100% - 960px) / 2)); }
    body.desk.ex-on #page .body:has(> .ex-seg + .ex-f) { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; grid-auto-flow: dense; align-content: start; }
    body.desk.ex-on #page .body:has(> .ex-seg + .ex-f) > * { grid-column: 1 / -1; }
    body.desk.ex-on #page .body:has(> .ex-seg + .ex-f) > :is(.ex-f, label.ex-f):not(:has(textarea)) { grid-column: auto; }
    /* the fixed action bar needs room under the form */
    body.desk.ex-on #page .body:has(> .ex-fix:not(.wrap)) { padding-bottom: 150px; }
    /* Exchange account / convert */
    body.desk.ex-on #page .body:has(> #ex-prof) { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; align-content: start; align-items: start; }
    body.desk.ex-on #page .body:has(> #ex-prof) > * { grid-column: 1 / -1; }
    body.desk.ex-on #page .body:has(> #ex-prof) > .ex-card2 { grid-column: auto; }
    body.desk.ex-on #page:has(#ex-cvl) { --pad: max(var(--gut), calc((100% - 1100px) / 2)); }
    body.desk #ex-cvl { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
    /* Exchange deal: details/timeline left, the chat sticky on the right */
    body.desk.ex-on #page:has(> .body > .ex-chat) { --pad: max(var(--gut), calc((100% - 1140px) / 2)); }
    body.desk.ex-on #page .body:has(> .ex-chat) { display: grid; grid-template-columns: minmax(0, 1fr) 440px; column-gap: 24px; align-content: start; align-items: start; }
    body.desk.ex-on #page .body:has(> .ex-chat) > * { grid-column: 1; }
    body.desk.ex-on #page .body:has(> .ex-chat) > .ex-chat { grid-column: 2; grid-row: 1 / span 12; position: sticky; top: 0; margin-top: 10px; }
    body.desk .ex-chat .ex-msgs { max-height: calc(100vh - 380px); }
    @media (max-width: 1179px) { body.desk.ex-on #page .body:has(> .ex-chat) { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 18px; } }

    /* Carry board: filter column (type tabs, direction chips, inline filter form) + the cards */
    body.desk.cy-on #page .body:has(> #cy-list) { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 24px; align-content: start; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-seg { grid-column: 1; grid-row: 1; flex-direction: column; border-radius: 20px; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-seg button { justify-content: flex-start; border-radius: 16px; min-height: 42px; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-row { grid-column: 1; grid-row: 2; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-row .chips { flex-wrap: wrap; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-row #cy-filt { display: none; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-fpane { display: block; grid-column: 1; grid-row: 3; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 6px 16px 16px; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-fpane h3 { margin: 10px 0 0; }
    body.desk.cy-on #page .body:has(> #cy-list) > .cy-fpane .btn { margin-top: 16px; }
    body.desk.cy-on #page .body:has(> #cy-list) > #cy-list { grid-column: 2; grid-row: 1 / span 4; }
    /* Carry post detail: details left, owner + actions in a column on the right */
    body.desk.cy-on #page:has(> .body > #cy-owner) { --pad: max(var(--gut), calc((100% - 1100px) / 2)); }
    body.desk.cy-on #page .body:has(> #cy-owner) { display: grid; grid-template-columns: minmax(0, 1fr) 360px; column-gap: 24px; grid-template-rows: auto auto auto 1fr; align-content: start; }
    body.desk.cy-on #page .body:has(> #cy-owner) > * { grid-column: 2; }
    body.desk.cy-on #page .body:has(> #cy-owner) > #cy-owner { grid-row: 1; margin-top: 0; }
    body.desk.cy-on #page .body:has(> #cy-owner) > .cy-card:not(#cy-owner) { grid-column: 1; grid-row: 1 / span 6; margin-top: 0; align-self: start; }
    body.desk.cy-on #page .body:has(> #cy-owner) > .cy-note { grid-row: 2; }
    body.desk.cy-on #page .body:has(> #cy-owner) > #cy-offer { grid-row: 3; margin-top: 10px; }
    body.desk.cy-on #page .body:has(> #cy-owner) > #cy-rep { grid-row: 4; align-self: start; }
    /* Carry profile: cards in two columns */
    body.desk.cy-on #page .body:has(> .cy-stats) { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; align-content: start; align-items: start; }
    body.desk.cy-on #page .body:has(> .cy-stats) > * { grid-column: 1 / -1; }
    body.desk.cy-on #page .body:has(> .cy-stats) > .card { grid-column: auto; }
  }

  /* ---------------------------------------------------------------- Phase 2: Ride + admin page designs */
  /* tablets and desktops: status tags keep their size inside ride cards */
  body.desk .ord .t .tag { flex: none; }
  @media (min-width: 1024px) {
    /* chat and ticket threads: a centred 820px conversation, the composer lines up with it */
    body.desk #page:has(> .body > #msgs) { --pad: max(var(--gut), calc((100% - 820px) / 2)); }
    body.desk #page > .composer { padding-inline: var(--pad); }
    /* shared-trip board (rider) and the driver's shared trips: day headings full width, trip cards in two columns */
    body.desk #page .body:has(> h3 ~ .card):has(> .chips, > #sh-new) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-content: start; }
    body.desk #page .body:has(> h3 ~ .card):has(> .chips, > #sh-new) > * { grid-column: 1 / -1; }
    body.desk #page .body:has(> h3 ~ .card):has(> .chips, > #sh-new) > .card { grid-column: auto; }
    /* admin: lists of people/rides/tickets in two columns, the settings groups card in two columns */
    body.desk #page .body:has(> .list-item) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; align-content: start; }
    body.desk #page .body:has(> .list-item) > * { grid-column: 1 / -1; }
    body.desk #page .body:has(> .list-item) > .list-item { grid-column: auto; }
    body.desk #page .body > .card:has(> .list-item) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
    /* admin ride / user detail pages: one readable 960px column instead of a 1100px stretch */
    body.desk #page:has(> .body > .status.keep) { --pad: max(var(--gut), calc((100% - 960px) / 2)); }
  }

  /* scrollbars: slim, only where a mouse shows them */
  body.desk .page .body, body.desk .home, body.desk #sheet, body.desk .modal, body.desk .ex-sheet, body.desk .cy-pick-list { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 150, .45) transparent; }
}
