/* App shell (sidebar · top bar · content · phone tab bar) and responsive page grids.
   ≥1440 full sidebar · 1024–1439 icon rail · 768–1023 drawer · <768 drawer + bottom tab bar */

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

/* ---------- sidebar ---------- */
.side { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, #1E48CC 0%, #14308F 100%); color: #fff; display: flex; flex-direction: column; gap: 12px; padding: 20px 14px 16px; overflow-y: auto; z-index: 60; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 6px; }
.mark { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35), 0 8px 18px rgba(9,25,90,.35); overflow: hidden; flex-shrink: 0; }
.mark img { width: 100%; height: 100%; }
.brand b { display: block; font-family: var(--disp); font-size: 20px; font-weight: 700; }
.brand span { font-size: 12px; color: #CBD8FF; font-weight: 600; }
.ws { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); }
.ws-av { width: 32px; height: 32px; border-radius: 9px; background: var(--sun); color: #3D2A00; font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ws b { display: block; font-size: 13.5px; }
.ws small { display: block; font-size: 11.5px; color: #CBD8FF; font-weight: 600; }
.grp { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #A9BCF2; font-weight: 700; padding: 0 12px 4px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: #DCE5FF; font-size: 14.5px; font-weight: 700; margin-bottom: 1px; }
.nav:hover { background: rgba(255,255,255,.1); }
.nav .dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; display: none; }
.nav.on { background: #fff; color: var(--blue); box-shadow: 0 8px 20px rgba(9,25,90,.25); }
.nav .b { margin-left: auto; font-size: 11px; font-weight: 800; background: var(--sun); color: #3D2A00; border-radius: 9px; padding: 1px 8px; }
.engines { margin-top: auto; border-radius: 16px; background: rgba(255,255,255,.12); padding: 14px; border: 1px solid rgba(255,255,255,.16); }
.engines b { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.engines b i { width: 8px; height: 8px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 4px rgba(52,211,153,.22); }
.engines b i.down { background: #F87171; box-shadow: 0 0 0 4px rgba(248,113,113,.25); }
.engines small { display: block; font-size: 11.5px; color: #CBD8FF; margin-top: 5px; line-height: 1.45; }

/* ---------- top bar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.top { position: sticky; top: 0; z-index: 50; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 var(--gutter); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .crumb { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.top .title { font-family: var(--disp); font-size: 26px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .search { width: 300px; }
.icb { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: var(--ink2); position: relative; background: var(--bg); border: 1px solid var(--line); flex-shrink: 0; }
.icb svg { width: 19px; height: 19px; }
.icb .dotn { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #F97316; border: 2px solid #fff; }
.av { width: 42px; height: 42px; border-radius: 50%; background: var(--sun-bg); color: #8A5A00; border: 2px solid var(--sun); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; cursor: pointer; }
.menu-btn { display: none; }
.top .search-ic { display: none; }
.top .rel { position: relative; }
.demo-pill { height: 28px; padding: 0 10px; border-radius: 8px; background: var(--sun-bg); color: #8A5A00; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; border: 1px solid #FFE08A; white-space: nowrap; }
.pop { position: absolute; top: calc(100% + 8px); right: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; min-width: 220px; z-index: 80; }
.pop a, .pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--ink2); text-align: left; }
.pop a:hover, .pop button:hover { background: var(--bg); }

/* ---------- content ---------- */
.content { padding: 22px var(--gutter) 28px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-bar .intro { font-size: 13.5px; font-weight: 700; color: var(--muted); }

/* ---------- phone bottom tab bar ---------- */
.tabbar { display: none; }
.scrim { display: none; }

/* ---------- generic responsive grids ---------- */
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.g5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.g6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.split-l { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 16px; align-items: start; }
.sticky-col { position: sticky; top: calc(var(--top-h) + 16px); }

/* ---------- desktop: the « / » button at the top of the side menu switches it between full and icons (remembered per browser) ---------- */
.side-top { display: flex; align-items: center; gap: 6px; }
.side-top .brand { flex: 1; min-width: 0; }
.side-tog { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: #CBD8FF; background: rgba(255,255,255,.12); border: 0; cursor: pointer; transition: background .15s, color .15s; }
.side-tog:hover, .side-tog:focus-visible { background: rgba(255,255,255,.18); color: #fff; }
@media (min-width: 1024px) {
  body.rail .side-top { flex-direction: column; gap: 8px; }
  body.rail .side-top .brand { flex: none; }
  body.rail .app { grid-template-columns: var(--side-rail) minmax(0, 1fr); }
  body.rail .side { padding: 16px 10px; align-items: center; }
  body.rail .brand { padding: 0 0 6px; }
  body.rail .brand > div:last-child, body.rail .ws > div, body.rail .ws > .chev, body.rail .grp, body.rail .nav .label,
  body.rail .engines small, body.rail .engines .etext { display: none; }
  body.rail .ws { padding: 6px; justify-content: center; }
  body.rail .grp { display: block; height: 1px; padding: 0; margin: 6px 8px; background: rgba(255,255,255,.18); font-size: 0; }
  body.rail .nav { width: 52px; height: 44px; justify-content: center; padding: 0; position: relative; }
  body.rail .nav .dot { display: none; }
  body.rail .nav svg { display: block; }
  body.rail .nav .b { position: absolute; top: 2px; right: 0; margin: 0; padding: 0 5px; font-size: 10px; }
  body.rail .engines { padding: 10px; display: flex; justify-content: center; }
}
/* small / short laptop screens (Windows 125–150 % scaling): the app renders like browser zoom ≈ 85 % */
:root { --z: 1; }
@media (min-width: 1024px) and (max-width: 1535px), (min-width: 1024px) and (max-height: 820px) { :root { --z: .86; } }
@media (min-width: 1024px) and (max-height: 680px) { :root { --z: .8; } }
body.appz { zoom: var(--z); }
body.appz .app { min-height: calc(100vh / var(--z)); }
body.appz .side { height: calc(100vh / var(--z)); }

/* ---------- laptop ---------- */
@media (max-width: 1439px) {
  .top .search { width: 220px; }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr) 340px; }
  .split-l { grid-template-columns: 380px minmax(0, 1fr); }
}

/* ---------- narrow laptop: side panels move below ---------- */
@media (max-width: 1279px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .sticky-col { position: static; }
}
@media (min-width: 768px) { .tbl.wide { min-width: 860px; } }

/* ---------- tablet: drawer ---------- */
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .22s ease; align-items: stretch; padding: 20px 14px 16px; }
  .side .brand > div:last-child, .side .ws > div, .side .ws > .chev, .side .nav .label, .side .engines small, .side .engines .etext { display: block; }
  .side .grp { display: block; height: auto; margin: 0; background: none; font-size: 11px; padding: 0 12px 4px; }
  .side .ws { padding: 9px 10px; justify-content: flex-start; }
  .side .nav { width: auto; height: auto; padding: 10px 12px; justify-content: flex-start; }
  .side .nav .b { position: static; margin-left: auto; font-size: 11px; padding: 1px 8px; }
  .side .engines { display: block; padding: 14px; }
  .side-tog { display: none; }
  body.drawer-open .side { transform: none; box-shadow: 0 0 60px rgba(9,25,90,.4); }
  body.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(14,26,58,.4); z-index: 55; }
  .menu-btn { display: flex; }
  .top .title { font-size: 22px; }
  .top .search { display: none; }
  .top .search-ic { display: flex; }
  .g2, .g3, .split, .split-l { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky-col { position: static; }
}

/* ---------- phone: bottom tab bar, cards instead of tables ---------- */
@media (max-width: 767px) {
  body { font-size: 14px; }
  .content { padding: 16px var(--gutter) 96px; gap: 14px; }
  .top { gap: 8px; }
  .top .crumb, .top .newrun-label, .top .demo-pill { display: none; }
  .top .title { font-size: 19px; }
  .top .icb, .top .av { width: 38px; height: 38px; }
  .top .newrun { width: 38px; height: 38px; padding: 0; }
  .g4, .g5, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: #fff; border-top: 1px solid var(--line); z-index: 70; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 800; color: var(--muted); position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--blue); }
  .tabbar a .b { position: absolute; top: 6px; left: calc(50% + 6px); font-size: 10px; font-weight: 800; background: var(--sun); color: #3D2A00; border-radius: 8px; padding: 0 5px; }
  .card-pad { padding: 14px; }
  .btn { height: 44px; }
  .btn-sm { height: 36px; }
  /* tables become stacked cards */
  .tbl.resp thead { display: none; }
  .tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td { display: block; width: 100%; }
  .tbl.resp tr { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  .tbl.resp td { border: 0; padding: 5px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: right; }
  .tbl.resp td[data-label]::before { content: attr(data-label); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 800; text-align: left; }
  .tbl.resp td > div { flex: 0 1 62%; min-width: 0; }
  .tbl.resp td > div.row { justify-content: flex-end; }
  .tbl.resp td.cell-main { display: block; text-align: left; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--soft); }
  .tbl.resp td.cell-main::before { display: none; }
  .tbl.resp td.hide-m { display: none; }
  .tbl.resp tr.sel { box-shadow: 0 0 0 2px var(--blue); }
  .tbl.resp tr.sel td { background: none; }
  .table-wrap { overflow: visible; }
  /* sticky action bar for run buttons */
  .m-sticky { position: sticky; bottom: 72px; z-index: 40; }
}
@media (max-width: 420px) {
  .g4, .g5, .g6 { grid-template-columns: minmax(0, 1fr); }
}
