/* qwadrat mobile v2 (2026-11-14): the phone presentation of every page, loaded LAST (after the legacy inline sheets).
   Same routes, same data, same tokens (`--qg-*` of qwadrat_grid.css); nothing here changes the desktop or the design DNA
   (square corners, hairlines, tiles, mono labels). Rules: 16px gutters, 44px touch targets, 16px inputs (no iOS zoom),
   10px minimum text, opaque bottom bar with safe-area inset, one scroll axis, nothing wider than the screen. */
@media (max-width:700px){
  :root{--m-gut:14px;--m-tap:44px;--m-nav:58px}
  html,body{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;overscroll-behavior-y:contain}
  html[data-theme] body{overflow-x:hidden}

  /* ---- gutters and bottom clearance ------------------------------------------------------------------------- */
  html[data-theme] #main{padding-left:var(--m-gut)!important;padding-right:var(--m-gut)!important;padding-bottom:calc(var(--m-nav) + 28px + env(safe-area-inset-bottom))!important}
  html[data-theme] #view{min-width:0}

  /* ---- header: wordmark, search, theme -------------------------------------------------------------------- */
  html[data-theme] #hdr{padding-left:12px!important;padding-right:12px!important;gap:8px!important;min-height:56px}
  html[data-theme] #hdr .searchbox{height:44px!important;min-width:0}
  html[data-theme] #hdr .searchbox input{font-size:16px!important}
  html[data-theme] #hdr .searchbox kbd{display:none!important}
  html[data-theme] #hdr .headicon,html[data-theme] #hdr .hright button{width:44px!important;height:44px!important;min-width:44px!important}
  html[data-theme] #hdr .header-position-btn,html[data-theme] #hdr #feedsBtn{display:none!important}

  /* ---- bottom bar: five equal, opaque, labelled tiles ------------------------------------------------------- */
  html[data-theme] .mobile-bottom-nav{height:calc(var(--m-nav) + env(safe-area-inset-bottom))!important;padding:0 0 env(safe-area-inset-bottom)!important;gap:0!important;background:var(--qg-bg)!important;border-top:1px solid var(--qg-line)!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important;box-shadow:0 -10px 24px -14px var(--qg-cardsh)}
  html[data-theme] .mobile-navitem{min-height:var(--m-nav)!important;gap:4px!important;font-size:10px!important;font-weight:600!important;letter-spacing:.02em;text-transform:none;color:var(--qg-dim)!important;border-radius:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
  html[data-theme] .mobile-navitem .navicon{width:24px;height:24px;display:inline-flex}
  html[data-theme] .mobile-navitem .navicon svg{width:24px;height:24px}
  html[data-theme] .mobile-navitem.on{background:var(--qg-tile)!important;color:var(--qg-ink)!important;box-shadow:inset 0 3px 0 var(--qg-ink)!important}
  html[data-theme] .mobile-navitem:active{background:var(--qg-s2)!important}

  /* ---- ящик «Ещё»: full-height sheet, large rows ---------------------------------------------------------- */
  html[data-theme] #navOverlay{width:100%!important;max-width:none!important;padding-bottom:calc(var(--m-nav) + env(safe-area-inset-bottom))}
  html[data-theme] #navOverlayItems a,html[data-theme] #navOverlayItems .navitem{min-height:var(--m-tap);font-size:15px}
  html[data-theme] #navOverlayClose{width:var(--m-tap)!important;height:var(--m-tap)!important}

  /* ---- generic controls: 44px, 16px text ---------------------------------------------------------------------- */
  html[data-theme] #view input:not([type=checkbox]):not([type=radio]),html[data-theme] #view select,html[data-theme] #view textarea{font-size:16px!important;min-height:var(--m-tap)}
  html[data-theme] #view .btn,html[data-theme] #view button.btn,html[data-theme] #view a.btn{min-height:var(--m-tap)}
  html[data-theme] #view input[type=checkbox],html[data-theme] #view input[type=radio]{width:22px;height:22px}

  html[data-theme] #view button:not(.iconbtn):not(.qi):not([data-icon-only]),html[data-theme] #view a.promo-detail,html[data-theme] #view [role=tab]{min-height:var(--m-tap)}
  html[data-theme] #view td button,html[data-theme] #view .tbl button{min-height:36px}
  html[data-theme] #view .promo-detail{display:flex;align-items:center;justify-content:center}
  html[data-theme] #view .iconbtn{min-width:44px;min-height:44px}
  html[data-theme] #view .seg button,html[data-theme] #view .segmented button,html[data-theme] #view .tabs-lite button{min-height:var(--m-tap);padding:0 14px}

  /* ---- legacy routes (/chart, /asset): head and timeframe strip ---------------------------------------------------- */
  html[data-theme] #pageTitle,html[data-theme] #pageHead h1,html[data-theme] .head h1{font-size:26px!important;line-height:1.1!important}
  html[data-theme] #pageHead p,html[data-theme] .head p{font-size:12px!important}
  html[data-theme] .qsp-timeframes,html[data-theme] .timeframes,html[data-theme] [class*=timeframe-row]{display:flex!important;overflow-x:auto;scrollbar-width:none}
  html[data-theme] .qsp-timeframes .ui-segmented-item,html[data-theme] .qsp-timeframes button,html[data-theme] .timeframes button{flex:0 0 auto;min-width:48px;overflow:visible!important;text-overflow:clip!important;padding:0 12px}

  html[data-theme] .position-filter-tabs button{height:var(--m-tap)!important;min-height:var(--m-tap)!important}
  html[data-theme] .position-filter-tabs{height:auto!important}

  html.route-chart-phone #qgNavHost{display:none!important}
  /* ---- /chart (the page every spread alert opens): the chart first, setup compact, details after ---------------------- */
  html[data-theme] #qspRoot{display:flex!important;flex-direction:column!important;gap:10px!important}
  html[data-theme] #qspRoot .qsp-control-top{order:1!important;margin:0!important;padding:0!important;min-height:0!important}
  html[data-theme] #qspRoot .qsp-toolbar-group{order:2!important;display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;margin:0!important;padding:0!important}
  html[data-theme] #qspRoot .qsp-timeframes{grid-column:1/-1!important;display:flex!important;overflow-x:auto!important;scrollbar-width:none;width:100%}
  html[data-theme] #qspRoot .qsp-timeframes::-webkit-scrollbar{display:none}
  html[data-theme] #qspRoot #qspLiveButton{grid-column:1/-1!important;min-height:40px!important}
  html[data-theme] #qspRoot #qspSymbol{grid-column:1/-1!important}
  html[data-theme] #qspRoot .qsp-select{width:100%!important;max-width:none!important;min-width:0!important;height:44px!important;min-height:44px!important;font-size:16px!important}
  html[data-theme] #qspRoot .qsp-main-column>.qsp-card:first-child{order:3!important;display:flex!important;flex-direction:column!important}
  html[data-theme] #qspRoot .qsp-main-column>.qsp-card:first-child>.qsp-card-head{order:1!important}
  html[data-theme] #qspRoot .qsp-main-column>.qsp-card:first-child>.qsp-chart{order:2!important}
  html[data-theme] #qspRoot .qsp-main-column>.qsp-card:first-child>.qsp-attribution{order:3!important}
  html[data-theme] #qspRoot .qsp-main-column>.qsp-card:first-child>.qsp-metrics{order:4!important;margin-top:12px}
  html[data-theme] #qspRoot .qsp-card.qsp-stats{order:4!important}
  html[data-theme] #qspRoot .qsp-card.qsp-history{order:5!important}
  html[data-theme] #qspRoot .qsp-card.qsp-book{order:6!important}
  html[data-theme] #qspRoot #svPairTools{order:7!important}
  html[data-theme] #qspRoot .qsp-chart{height:min(46vh,340px)!important}
  html[data-theme] #qspRoot .qsp-view-switch button{min-height:40px}
  html[data-theme] #qspRoot .qsp-card-head{padding:12px 14px!important}

  /* =====================================================================================================================
     CALM PHONE SURFACE (2026-11-14, owner: "dirty, not beautiful"): the desktop terminal dressing -- tiled grid with crosses,
     inner frame + tick ruler + corner brackets on every card, numbered 01/02 chips, hard offset shadows, wide mono caps --
     is noise at 390 px. On a phone the DNA is kept as: black/white surface, hairline 1px frames, square corners, tiles for the
     ACTIVE state only, mono micro-labels, tabular numbers. (Same call as projects/antidetect.md §9: the canon sets the
     materials, not how many of them fit on one screen.)
     ===================================================================================================================== */
  html[data-theme],html[data-theme] body,html[data-theme] #appShell,html[data-theme] #main,html[data-theme] #view,html[data-theme] .pg{background-image:none!important;background-color:var(--qg-bg)!important}
  html[data-theme] body :is(.card,.coin-ranking,.promo-section,.markets-card,.asset-card,.dashcard,.utility-card,.feature-card,.analytics-card,.market-card,.workspace-panel,.tablecard,.qf4,.qsp-card,.qsp-toolbar,.spread-coin-header,.spread-summary,.pv-form,.sv-login)::before,
  html[data-theme] body :is(.card,.coin-ranking,.promo-section,.markets-card,.asset-card,.dashcard,.utility-card,.feature-card,.analytics-card,.market-card,.workspace-panel,.tablecard,.qf4,.qsp-card,.qsp-toolbar,.spread-coin-header,.spread-summary,.pv-form,.sv-login)::after,
  html[data-theme] body :is(.card>h3,.coin-ranking-head h2,.coin-ranking-head h3,.tablecard>header h2,.tablecard>header h3,.dashcard>header h2,.feature-card__title,.qsp-card h2)::before{content:none!important;display:none!important}
  html[data-theme] body :is(.card,.coin-ranking,.promo-section,.markets-card,.asset-card,.dashcard,.utility-card,.feature-card,.analytics-card,.market-card,.workspace-panel,.tablecard,.qf4,.qsp-card,.pv-form,.sv-login){background:var(--qg-panel)!important;background-image:none!important;border:1px solid var(--qg-line2)!important;box-shadow:none!important;border-radius:0!important}
  html[data-theme] body .qsp-toolbar,html[data-theme] body .spread-coin-header,html[data-theme] body .spread-summary{background:transparent!important;border:0!important;box-shadow:none!important}
  html[data-theme] body :is(.card>h3,.coin-ranking-head h2,.coin-ranking-head h3,.tablecard>header h2,.tablecard>header h3,.dashcard>header h2,.feature-card__title,.qsp-card h2){font:600 11px/1.3 "Helvetica Neue",Helvetica,Arial,sans-serif!important;letter-spacing:.09em!important;text-transform:uppercase;color:var(--qg-dim)!important;gap:0!important}
  html[data-theme] body :is(.qsp-card-head,.card>header,.coin-ranking-head,.tablecard>header){border-bottom:1px solid var(--qg-line2)!important;background:transparent!important}
  html[data-theme] body .qsp-card-head p,html[data-theme] body .qsp-line-legend{font-size:11px!important;color:var(--qg-dim)!important;line-height:1.35}
  /* controls: one hairline language, no hard shadows; the active one is the filled tile */
  html[data-theme] #view :is(.btn,.ui-button,.ui-segmented-item,.qsp-select,select,input:not([type=checkbox]):not([type=radio]),textarea){box-shadow:none!important;border:1px solid var(--qg-line)!important;border-radius:0!important;background:var(--qg-panel)!important;color:var(--qg-fg)!important;font-weight:500}
  html[data-theme] #view :is(.btn.primary,.btn.pri,.ui-button-primary,.ui-segmented-item.is-selected,.ui-segmented-item[aria-pressed=true],.is-active[data-sort-direction]){background:var(--qg-tile)!important;color:var(--qg-ink)!important;border-color:var(--qg-tile)!important}
  html[data-theme] #view .ui-segmented{display:flex;border:1px solid var(--qg-line)!important;background:transparent!important;gap:0!important}
  html[data-theme] #view .ui-segmented .ui-segmented-item{flex:1 1 0;border:0!important;border-right:1px solid var(--qg-line2)!important;letter-spacing:.02em;text-transform:none!important;font-size:13px!important;min-width:0}
  html[data-theme] #view .ui-segmented .ui-segmented-item:last-child{border-right:0!important}
  html[data-theme] #view .qsp-timeframes .ui-segmented-item{flex:1 0 46px;font-family:"SF Mono",Menlo,monospace;font-size:12px!important}
  html[data-theme] #view #qspLiveButton{background:transparent!important;text-transform:none!important;letter-spacing:.02em;font-size:12px!important;color:var(--qg-dim)!important}
  html[data-theme] #view .qsp-select{font-size:15px!important;padding:0 36px 0 12px!important;text-overflow:ellipsis}
  html[data-theme] #view .qsp-back-link{font-size:12px;color:var(--qg-dim)}
  /* data cells: flat tiles separated by hairlines instead of boxes in boxes */
  html[data-theme] #view .qsp-metrics{gap:0!important;border:0!important}
  html[data-theme] #view .qsp-metrics>*{border:0!important;border-bottom:1px solid var(--qg-line2)!important;border-right:1px solid var(--qg-line2)!important;background:transparent!important;box-shadow:none!important;padding:12px 12px!important}
  html[data-theme] #view .qsp-metrics>*:nth-child(2n){border-right:0!important}
  html[data-theme] #view .qsp-metrics strong,html[data-theme] #view .qsp-metrics b{font-size:20px!important;font-weight:650;font-variant-numeric:tabular-nums}
  html[data-theme] #view .qsp-chart{border-top:1px solid var(--qg-line2)}
  html[data-theme] #view .qsp-attribution{font-size:10px!important;opacity:.7}
  /* rows and lists: hairline separated, calm */
  html[data-theme] #view .tbl tr,html[data-theme] #view .sp-t tr{border-bottom:1px solid var(--qg-line2)!important;background:transparent!important}
  html[data-theme] #view .promo-card,html[data-theme] #view .offer-card{box-shadow:none!important;border:1px solid var(--qg-line2)!important}
  html[data-theme] #view :is(h1,h2,h3){letter-spacing:-.01em}
  html[data-theme] body :is(.promo-stat,.promo-source-panel,.promo-card,.promo-section-heading)::before,html[data-theme] body :is(.promo-stat,.promo-source-panel,.promo-card)::after{content:none!important;display:none!important}
  html[data-theme] #view :is(.promo-stat,.promo-source-panel,.promo-card,.offer-card,.pv-kpi,.sp-item,.qs-card,.position-card){background:var(--qg-panel)!important;border:1px solid var(--qg-line2)!important;box-shadow:none!important;border-radius:0!important}
  html[data-theme] #view .promo-source-panel .promo-sources>*{background:transparent!important;border:0!important;box-shadow:none!important;padding:4px 0!important}
  html[data-theme] #view .promo-card{padding:14px!important}
  html[data-theme] #view .promo-card .promo-detail{border:1px solid var(--qg-line)!important;background:transparent!important}

  /* ---- cards: hairline panels, no nested double frames ------------------------------------------------------ */
  html[data-theme] #view .card{padding:16px!important;margin-bottom:12px}
  html[data-theme] #view .coin-ranking,html[data-theme] #view .tablecard{margin-left:0;margin-right:0}

  /* ---- empty / loading / gate states: compact, never a 220px void ------------------------------------------ */
  html[data-theme] #view .empty,html[data-theme] #view .coin-ranking-table .empty,html[data-theme] #view .nodata{min-height:140px!important;padding:20px 12px!important}
  html[data-theme] #view .empty .empty-icon,html[data-theme] #view .empty .ib{transform:scale(.75);transform-origin:center}
  html[data-theme] #view .pv-gate,html[data-theme] #view .gate,html[data-theme] #view [class*=login-card]{padding:18px 16px!important}
  html[data-theme] #view .pv-gate h2,html[data-theme] #view .gate h2{font-size:20px;line-height:1.2;margin:0 0 8px}

  /* ---- sort controls and chip rows ---------------------------------------------------------------------------- */
  html[data-theme] .semantic-sort{display:grid!important;gap:10px!important}
  html[data-theme] .semantic-sort-directions{display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important}
  html[data-theme] .semantic-sort-directions button{min-height:var(--m-tap);white-space:normal!important;line-height:1.2}
  html[data-theme] .offer-filters{display:grid!important;grid-template-columns:1fr 1fr;gap:10px}
  html[data-theme] .offer-filters select{width:100%}

  /* ---- readable minimum text --------------------------------------------------------------------------------- */
  html[data-theme] #view .lbl,html[data-theme] #view small,html[data-theme] #view td[data-l]:before{font-size:10px!important}

  /* ---- promotions: stat tiles in a row, one-column offer cards ------------------------------------------------ */
  html[data-theme] .promo-stats{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important}
  html[data-theme] .promo-stat{padding:12px 10px!important;min-height:0!important}
  html[data-theme] .promo-stat b{font-size:24px!important}
  html[data-theme] .promo-stat small,html[data-theme] .promo-stat span{font-size:10px!important}
  html[data-theme] .promo-stat .promo-stat-ic{display:none!important}
  html[data-theme] .promo-toolbar{display:grid!important;grid-template-columns:1fr!important;gap:10px!important}
  html[data-theme] .promo-kinds{display:flex!important;overflow-x:auto;gap:8px;scrollbar-width:none;padding-bottom:4px}
  html[data-theme] .promo-kinds::-webkit-scrollbar{display:none}
  html[data-theme] .promo-kinds button{flex:0 0 auto;min-height:var(--m-tap)}
  html[data-theme] .promo-grid{grid-template-columns:1fr!important}

  /* ---- settings / forms: one column ----------------------------------------------------------------------------- */
  html[data-theme] .pv-grid,html[data-theme] .alertform,html[data-theme] .settings-fields{grid-template-columns:1fr!important}
  html[data-theme] .settings-layout{grid-template-columns:1fr!important}
}

/* ---- sub-tab strip: edge fade shows that it scrolls (shadow root `.tabs`, see qg.css) --------------------------- */
