/* Forge cockpit UI — phone composition (approved mobile reference).
   One scrolling column: compact status header, decision counts, map, Jobs queue, the selected job below it, five-item bottom bar.
   The menu button opens the existing More sheet (Operations, System, Rules, Columns, Settings). */
@media(max-width:760px),(pointer:coarse) and (max-width:980px){
  html,body{background:#020303}
  header{display:flex;flex-wrap:nowrap!important;align-items:center;gap:4px;min-height:0;padding:8px 6px 8px 2px!important;border-bottom:1px solid var(--forge-line-strong);overflow:hidden;max-width:100vw}
  header .menu-btn{min-width:34px;min-height:44px}
  header .brand{display:flex;flex-direction:column;padding:0 4px 0 7px;border-left:1px solid var(--forge-line);font:600 12.5px/1 var(--sans);letter-spacing:1px;white-space:nowrap;flex:0 1 auto;min-width:0;overflow:hidden}
  header .brand small{display:block;margin-top:4px;font:6.5px/1 var(--mono);letter-spacing:.9px;color:var(--forge-dim);overflow:hidden;text-overflow:ellipsis}
  header .writer-identity{margin-left:auto}
  header .hcell,header .writer-badge{padding:0 6px;min-height:38px}
  header .hstat{flex:none}
  header .hcell small,header .writer-badge small{font-size:8px;letter-spacing:.6px}
  header .hcell b,header .writer-badge b{font-size:14px}
  header #crumb,header #compare-open,header #density-toggle,header #refresh,header #bell,header #settings,header .build-identity{display:none!important}
  header #layout-toggle{flex:none;min-height:34px;padding:0 5px;font-size:9px;letter-spacing:.4px}
  header .writer-identity,header .hstat{flex:none}
  header #search{display:none}
  body.search-open header #search{display:block;position:fixed;left:8px;right:8px;top:66px;z-index:96;height:46px;font-size:16px;box-shadow:0 18px 40px #000c}

  /* One scrolling column */
  #view-pipeline.on{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;grid-template-rows:none!important;grid-auto-rows:auto;align-content:start;row-gap:8px;column-gap:6px;padding:8px 8px 14px;overflow-x:hidden!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch}
  #dash,#queue-head{display:contents!important}
  #queue-head .decide-strip{grid-column:1/-1;grid-row:1;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:0;border:1px solid var(--forge-line);background:var(--forge-panel)}
  #queue-head .decide{min-width:0;padding:10px 4px}
  #queue-head .decide b{font-size:24px}
  #queue-head .decide small{font-size:9px;letter-spacing:.6px;white-space:normal;text-align:center;line-height:1.15}
  #job-map-card{grid-column:1/-1!important;grid-row:2!important;height:300px!important;min-height:0!important;margin:0}
  .qh-title{grid-column:1;grid-row:3;align-self:center;font-size:0;padding:8px 2px 0;letter-spacing:1.6px}
  .qh-title:before{content:"JOBS ";font-size:17px}
  .qh-title .mono{font-size:15px}
  .qh-tools{grid-column:2;grid-row:3;padding-top:8px}
  .qh-search{display:inline-flex}
  .qh-view{max-width:150px;min-height:40px;font-size:13px}
  #worksplit{grid-column:1/-1;grid-row:4;height:min(46vh,330px)!important;min-height:200px;border:1px solid var(--forge-line)}
  #drawer{grid-column:1/-1!important;grid-row:5!important;position:relative!important;inset:auto!important;width:auto!important;max-width:none!important;max-height:none!important;display:flex!important;border:1px solid var(--forge-line);z-index:1}
  #drawer #d-body{overflow:visible;flex:none}
  #drawer:not(.on){min-height:120px}

  /* Map on the phone: controls stacked right, legend left */
  #job-map-card .map-zoom{display:flex;flex-direction:column-reverse;right:8px;top:8px;bottom:auto;gap:6px;border:0;background:transparent}
  #job-map-card .map-zoom button{min-width:46px;min-height:44px;border:1px solid var(--forge-line-strong);background:#060808}
  #job-map-card .map-zoom #map-zoom-level{min-height:26px;font-size:10px}
  #job-map-card .map-layers{position:absolute;right:8px;top:170px;z-index:5;min-width:46px;min-height:44px;border:1px solid var(--forge-line-strong);background:#060808}
  #job-map-card.layers-open #mapfilters{right:60px;top:8px;left:auto}
  #job-map-card .map-legend{display:flex!important;flex-direction:column;align-items:flex-start;left:10px;bottom:10px;gap:5px;font:13px var(--sans)}
  #job-map-card .map-head h4{font-size:12px;letter-spacing:1.4px}
  #job-map-card .map-actions{right:62px;bottom:8px}

  /* Jobs table: compact, readable, no card rows */
  #grid th{height:30px;min-height:30px;padding:3px 6px;font:9.5px var(--mono);letter-spacing:.8px}
  #grid td,body:not([data-density=comfortable]) #grid td{height:34px;min-height:34px;padding:4px 5px;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #grid th[data-c]:before{font-size:9px;letter-spacing:.6px}

  /* Workspace below the queue */
  #drawer .wh-top{padding:12px 12px 4px}
  #drawer .wh-title h2,#drawer #d-title{font-size:24px!important}
  .ws-meta{font-size:14px}
  .ws-ring{width:80px;height:80px}.ws-ring b{font-size:25px}
  #drawer .wh-nav{display:none}
  #detail-tabs{margin:0 8px;overflow-x:auto;scrollbar-width:none}#detail-tabs::-webkit-scrollbar{display:none}
  #detail-tabs button{flex:none;min-height:44px;padding:0 14px;font-size:12px}
  #drawer #d-body{padding:10px 12px}
  .ck-over{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:4px 12px}
  .ck-kd{padding-right:10px}
  .ck-kd li,.ck-checks li,.ck-sum p,.ck-next p{font-size:14px}
  #drawer .wh-actions{gap:6px;padding:10px;position:sticky;bottom:0;z-index:3;box-shadow:0 -10px 24px #000b}
  #drawer .wh-actions button{min-height:44px;font-size:12.5px}

  /* Five-item bottom bar */
  #bottombar{grid-template-columns:repeat(5,minmax(0,1fr))!important;height:calc(64px + env(safe-area-inset-bottom));background:#030505;border-top-color:var(--forge-line-strong)}
  #bottombar button{color:#a3adaa;font-size:11px}
  #bottombar button.cur{color:var(--forge-amber);border-top-color:var(--forge-amber)}
  #sheet .sheet-in{background:#060808;border-top-color:var(--forge-line-strong);border-radius:12px 12px 0 0;animation:forge-sheet-in 240ms var(--forge-ease) both}
  @keyframes forge-sheet-in{from{opacity:0;transform:translateY(32px)}to{opacity:1;transform:none}}

  /* View & filters as a bottom sheet */
  .qv-panel{left:0!important;right:0;top:auto!important;bottom:0;width:auto;max-height:78vh;border-radius:12px 12px 0 0;padding-bottom:calc(14px + env(safe-area-inset-bottom));transform-origin:bottom center;animation:forge-sheet-in 240ms var(--forge-ease) both}
  .qv-panel .chip{min-height:38px;display:inline-flex;align-items:center}
}
@media(max-width:760px),(pointer:coarse) and (max-width:980px){
  #job-map-card .map-prefs{font-size:14px}
  #job-map-card .map-prefs select{font-size:16px;min-height:40px}
  #job-map-card .map-prefs input{width:20px;height:20px}
}

/* Phase 4 overhaul: mobile sizing/readability corrections.
   Presentation-only pass: no Writer, scoring, master, automation, or data-flow changes. */
@media(max-width:760px),(pointer:coarse) and (max-width:980px){
  header{padding:7px 8px calc(7px + env(safe-area-inset-top)*.2) 6px!important;gap:5px!important}
  header .menu-btn{min-width:42px!important;min-height:42px!important;padding:0!important}
  header .brand{font-size:11.6px!important;letter-spacing:.85px!important;max-width:38vw!important}
  header .brand small{font-size:6.2px!important;letter-spacing:.75px!important}
  header .hcell,header .writer-badge{min-height:36px!important;padding:0 5px!important}
  header .hcell b,header .writer-badge b{font-size:12.5px!important}

  #view-pipeline.on{padding:7px 8px calc(82px + env(safe-area-inset-bottom))!important;row-gap:7px!important}
  #queue-head .decide-strip{grid-template-columns:repeat(4,minmax(0,1fr));border-color:#262626!important}
  #queue-head .decide{padding:7px 3px!important}
  #queue-head .decide b{font-size:19px!important;line-height:1!important}
  #queue-head .decide small{font-size:7.6px!important;letter-spacing:.45px!important;line-height:1.05!important}

  #job-map-card{height:clamp(220px,31vh,290px)!important;border-color:#262626!important}
  #job-map-card .map-legend{font-size:10.6px!important;line-height:1.05!important;gap:3px!important;max-width:42vw!important;bottom:8px!important;left:8px!important}
  #job-map-card .map-head{padding:6px 8px!important;min-height:30px!important}
  #job-map-card .map-head h4{font-size:10px!important;letter-spacing:1.1px!important}
  #job-map-card .map-actions{right:56px!important;bottom:7px!important;gap:4px!important}
  #job-map-card .map-actions button{min-height:32px!important;padding:2px 7px!important;font-size:9px!important}
  #job-map-card .map-zoom{right:7px!important;top:7px!important;gap:4px!important}
  #job-map-card .map-zoom button{min-width:38px!important;min-height:36px!important;font-size:13px!important}
  #job-map-card .map-zoom #map-zoom-level{min-height:22px!important;font-size:8.8px!important}
  #job-map-card .map-layers{right:7px!important;top:132px!important;min-width:38px!important;min-height:36px!important;font-size:12px!important}
  #job-map-card.layers-open #mapfilters{right:50px!important;left:8px!important;top:7px!important;max-height:calc(100% - 14px)!important;overflow:auto!important}
  .map-target-label{max-width:128px!important;max-height:50px!important;padding:3px 5px!important;font-size:8.1px!important;line-height:1.05!important;border-radius:2px!important}
  .map-target-label strong{font-size:8.7px!important;line-height:1.05!important}.map-target-label span,.map-target-label small{font-size:7.4px!important;line-height:1.05!important}

  .qh-title{padding-top:5px!important}.qh-title:before{font-size:14px!important}.qh-title .mono{font-size:12px!important}
  .qh-tools{padding-top:4px!important}.qh-view{min-height:34px!important;max-width:118px!important;font-size:10.5px!important;padding:0 7px!important}
  #worksplit{height:min(40vh,285px)!important;min-height:185px!important}
  #grid th{height:26px!important;min-height:26px!important;padding:2px 5px!important;font-size:8.3px!important;letter-spacing:.55px!important}
  #grid td,body:not([data-density=comfortable]) #grid td{height:30px!important;min-height:30px!important;padding:3px 5px!important;font-size:10.8px!important;line-height:1.08!important}

  #drawer{border-color:#262626!important}
  #drawer .wh-top{padding:9px 10px 3px!important;gap:6px!important}
  #drawer .wh-title h2,#drawer #d-title{font-size:18px!important;line-height:1.08!important;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .ws-meta{font-size:10.8px!important;line-height:1.18!important;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .ws-ring{width:62px!important;height:62px!important}.ws-ring:before{inset:5px!important}.ws-ring b{font-size:18px!important}.ws-ring small{font-size:8px!important}
  #drawer .wh-chips{padding:1px 10px 5px!important;gap:3px!important}.wh-chips .bpill,.wh-chips .chip{font-size:8.6px!important;padding:1px 4px!important;max-width:42vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #detail-tabs{margin:0 6px!important}#detail-tabs button{min-height:38px!important;padding:0 10px!important;font-size:10px!important}
  #drawer #d-body{padding:8px 10px!important}.detail-card{padding:7px!important}.ck-kd li,.ck-checks li,.ck-sum p,.ck-next p{font-size:11.2px!important;line-height:1.28!important}
  #drawer .wh-actions{padding:7px 8px calc(7px + env(safe-area-inset-bottom)*.35)!important;gap:5px!important}#drawer .wh-actions button{min-height:38px!important;font-size:10.6px!important;padding:0 8px!important}

  #bottombar{height:calc(58px + env(safe-area-inset-bottom))!important;padding-bottom:env(safe-area-inset-bottom)!important}
  #bottombar button{font-size:9.4px!important;letter-spacing:.2px!important;gap:2px!important;min-width:0!important;padding:3px 1px!important}
  #bottombar button svg{width:19px!important;height:19px!important}
  #sheet .sheet-in{max-height:82vh!important;overflow:auto!important;padding-bottom:calc(16px + env(safe-area-inset-bottom))!important}
  #sheet .sheet-g button{min-height:38px!important;font-size:11px!important}
}
@media(max-width:980px) and (orientation:landscape){
  header{padding-left:calc(12px + env(safe-area-inset-left))!important;padding-right:calc(12px + env(safe-area-inset-right))!important}
  #view-pipeline.on{padding-left:calc(14px + env(safe-area-inset-left))!important;padding-right:calc(14px + env(safe-area-inset-right))!important;padding-bottom:calc(70px + env(safe-area-inset-bottom))!important;grid-template-columns:minmax(0,1fr)!important}
  #job-map-card{height:clamp(190px,44vh,250px)!important}
  #job-map-card .map-actions{right:calc(58px + env(safe-area-inset-right))!important}
  #job-map-card .map-zoom,#job-map-card .map-layers{right:calc(8px + env(safe-area-inset-right))!important}
  #worksplit{height:clamp(185px,42vh,270px)!important}
  #drawer .wh-actions{padding-left:calc(10px + env(safe-area-inset-left))!important;padding-right:calc(10px + env(safe-area-inset-right))!important}
  #bottombar{padding-left:env(safe-area-inset-left)!important;padding-right:env(safe-area-inset-right)!important}
}
