body.gantry-page { grid-template-columns: 330px 1fr; }
#g-main { overflow-y: auto; display: block; min-width: 0; }
#g-main #viewport { height: 58vh; min-height: 360px; }
#g-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px; }
#g-bar button { padding: 5px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
#g-bar .primary-btn { border-color: var(--accent); color: var(--accent); background: #0c2a3a; font-weight: 600; }
#g-bar select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
#g-bar label { display: inline-flex; align-items: center; gap: 4px; }
#g-bar .jog { display: inline-flex; gap: 10px; }
#g-bar [hidden] { display: none !important; }
#g-bar .jog input { width: 110px; }
#g-bar .read { color: var(--muted); font-variant-numeric: tabular-nums; flex: 1 1 260px; min-width: 0; }
#out { padding: 16px 20px 40px; }
.use-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 6px; }
.use-grid button { margin: 0 !important; padding: 8px 6px !important; text-align: center; }
.use-grid button.on { border-color: var(--accent) !important; background: #0c2a3a !important; color: var(--accent); }

.g-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.g-card h2 { margin: 0 0 4px; font-size: 17px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.g-card h2 small { font-size: 12px; color: var(--muted); font-weight: 400; }
.g-card h4 { margin: 14px 0 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.g-pick { font-size: 15px; font-weight: 600; margin: 6px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.g-pick .auto { font-size: 11px; color: var(--muted); font-weight: 400; }
.g-pick button { font-size: 11px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.badge-g { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #0c2a3a; color: var(--accent); font-weight: 500; white-space: nowrap; }
.g-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; }
.g-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin: 8px 0; }
.g-num { background: var(--bg); border-radius: 8px; padding: 6px 9px; }
.g-num span { display: block; font-size: 11px; color: var(--muted); }
.g-num b { font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 600; }
.checks { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.5px; line-height: 1.6; }
.checks li::before { display: inline-block; width: 18px; }
.checks li.ok::before { content: '✓'; color: #4ade80; }
.checks li.warn::before { content: '⚠'; color: #facc15; }
.checks li.bad::before { content: '✗'; color: #f87171; }
.checks li.info::before { content: 'ⓘ'; color: var(--muted); }
.checks li.bad { color: #fca5a5; }
.chart { width: 100%; height: auto; background: var(--bg); border-radius: 8px; }
.chart text { fill: var(--muted); font-size: 10px; }
.chart .curve { fill: #38bdf833; stroke: var(--accent); stroke-width: 1.5; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tgt { stroke: #e5e7eb88; stroke-dasharray: 3 3; }
.chart-cap { font-size: 11px; color: var(--muted); margin-top: 4px; }

.g-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.g-table th { color: var(--muted); font-weight: 400; text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.g-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.g-table td.n { text-align: right; white-space: nowrap; }
.g-table tr.row { cursor: pointer; }
.g-table tr.row:hover { background: #1c2129; }
.g-table tr.cur { background: #0c2a3a; }
.g-table tr.no td { color: var(--muted); }
.g-table .why { color: #fca5a5; font-size: 11px; }
.g-more { margin-top: 10px; font-size: 12px; }
.g-more summary { cursor: pointer; color: var(--accent); }
.g-scroll { max-height: 420px; overflow: auto; margin-top: 6px; }
.fails { font-size: 12px; margin: 6px 0; color: var(--muted); }
.fails b { color: #fca5a5; font-weight: 500; }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.lead-note { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; line-height: 1.6; }

@media (max-width: 900px) {
  /* phone: 3D view and its buttons first, then the settings, then the results */
  body.gantry-page { display: flex; flex-direction: column; height: auto; overflow: auto; }
  body.gantry-page #g-main { display: contents; }
  body.gantry-page #viewport { order: 0; flex: none; }
  body.gantry-page #g-bar { order: 1; }
  body.gantry-page #panel { order: 2; overflow: visible; }
  body.gantry-page #out { order: 3; }
  body.gantry-page #panel { border-right: 0; border-bottom: 1px solid var(--line); }
  #out { padding: 12px; }
  #g-main #viewport { height: 60vh; min-height: 300px; }
  #g-bar .jog input { width: 80px; }
  .g-cols { grid-template-columns: 1fr; }
}

.gantry-page #panel label:has(select) { align-items: center; gap: 8px; white-space: nowrap; }
.gantry-page #panel label select { width: auto; flex: 1; min-width: 0; margin-top: 0; }
.to-out { display: none; font-size: 12px; margin-top: 6px; }
@media (max-width: 900px) { .to-out { display: block; } }
