/* The contour workspace keeps its existing overall inspector width. A compact
   left rail exposes every section and a one-click jump to mold subpanels. */
@media (min-width: 761px) {
 body[data-mode="shell"] .workspace { grid-template-columns: 320px minmax(0, 1fr); }
 body[data-mode="shell"] .workspace aside {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 5px;
  row-gap: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
 }
 body.graphite-app[data-mode="shell"] .workspace aside:has(> .panel-switcher[hidden]) {
  grid-template-rows: 0 minmax(0, 1fr);
 }
 body[data-mode="shell"] .tool-rail {
  grid-column: 1;
  grid-row: 1 / 3;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
 }
 body[data-mode="shell"] .tool-rail > .editor-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  align-content: start;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #202426;
 }
 body[data-mode="shell"] .editor-sections button {
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  min-height: 25px;
  padding: 4px 5px;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
 }
 body[data-mode="shell"] .editor-sections button.ui-icon::before {
  font-size: 10px;
 }
 body[data-mode="shell"] aside > .panel-switcher {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border-radius: 5px;
 }
 body[data-mode="shell"] aside > .panel-switcher[hidden] { display: none; }
 body[data-mode="shell"] aside > .panel-switcher button {
  min-width: 0;
  min-height: 25px;
  padding: 3px 4px;
  font-size: 9px;
  line-height: 1.15;
  white-space: normal;
 }
 body[data-mode="shell"] aside > .panel {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 7px;
  border-radius: 6px;
 }
 body[data-mode="shell"] aside .step { gap: 4px; margin-bottom: 5px; }
 body[data-mode="shell"] aside h2 { font-size: 11px; line-height: 1.2; margin: 0; }
 body[data-mode="shell"] aside .field { gap: 4px; margin: 5px 0; min-height: 25px; }
 body[data-mode="shell"] aside .field > label { font-size: 9px; line-height: 1.2; }
 body[data-mode="shell"] aside .field input,
 body[data-mode="shell"] aside .field select { min-height: 25px; padding: 3px 4px; font-size: 9px; }
 body[data-mode="shell"] aside .field:has(> input[type="number"]) { grid-template-columns: minmax(0, 1fr) 58px; gap: 4px; margin: 4px 0; min-height: 25px; }
 body[data-mode="shell"] aside .field:has(> input[type="number"]) > input { min-height: 25px; padding: 3px 4px; }
 body[data-mode="shell"] aside :is(.hint, .tool-help, .inspector-extra) { font-size: 9px; line-height: 1.3; }
 body[data-mode="shell"] aside .inspector-group { margin-top: 6px; }
 body[data-mode="shell"] aside .inspector-group > legend { font-size: 9px; margin-bottom: 2px; }
}
@media (max-width: 760px) {
 body[data-mode="shell"] .tool-rail { display: contents; }
}
@media (min-width: 1800px) {
 body[data-mode="shell"] .workspace { grid-template-columns: 360px minmax(0, 1fr); }
}

/* Keep every rail destination on the same compact rhythm, including the
   analysis, manufacturing and information tabs. */
@media (min-width: 761px) {
 body.graphite-app[data-mode="shell"] aside .tool-rail > .editor-sections button {
  box-sizing: border-box;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 25px;
  height: 25px;
  margin: 0;
  padding: 3px 5px;
  justify-content: flex-start;
  gap: 4px;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
 }
 body.graphite-app[data-mode="shell"] aside .tool-rail > .editor-sections button[data-section="info"] {
  grid-column: auto;
  padding-left: 5px;
  padding-right: 5px;
 }
 body.graphite-app[data-mode="shell"] aside .tool-rail > .editor-sections button::before {
  flex: 0 0 12px;
  width: 12px;
  font-size: 10px;
 }
}

body.graphite-app[data-mode="shell"] #export-pane .export-settings-group {
 display: grid;
 gap: 7px;
 padding: 8px;
 border: 1px solid var(--line);
 border-radius: 5px;
 background: var(--surface-raised);
}
body.graphite-app[data-mode="shell"] #export-pane .density-panel {
 min-width: 0;
 margin: 0;
 padding: 0;
 border: 0;
 border-radius: 0;
 background: transparent;
 box-shadow: none;
}
body.graphite-app[data-mode="shell"] #export-pane .density-panel .step { display: none; }
body.graphite-app[data-mode="shell"] #export-pane .density-panel .field {
 margin: 0;
 min-height: 27px;
}
body.graphite-app[data-mode="shell"] #export-pane .download-settings {
 display: grid;
 gap: 7px;
 margin: 0;
 padding: 0;
 border: 0;
 border-radius: 0;
 background: transparent;
}
body.graphite-app[data-mode="shell"] #export-pane .download-settings .field {
 display: grid;
 grid-template-columns: minmax(0, 1fr);
 gap: 3px;
 margin: 0;
}
body.graphite-app[data-mode="shell"] #export-pane .download-settings .field label {
 display: block;
 margin: 0;
 color: var(--muted);
 font-size: 9px;
 line-height: 1.2;
}
body.graphite-app[data-mode="shell"] #export-pane .download-settings .field select {
 box-sizing: border-box;
 width: 100%;
 max-width: none;
 min-height: 28px;
 padding: 4px 7px;
 border: 1px solid var(--inspector-line);
 border-radius: 4px;
 background: #191d20;
 color: var(--ink);
 font-size: 9px;
}
body.graphite-app[data-mode="shell"] #export-pane .export-readiness {
 margin-top: 8px;
 padding: 8px;
 border: 1px solid var(--line);
 border-radius: 5px;
 background: #202326;
}
body.graphite-app[data-mode="shell"] #export-pane .export-readiness strong {
 color: var(--ink);
 font-size: 10px;
}
body.graphite-app[data-mode="shell"] #export-pane .export-readiness p {
 margin: 4px 0 0;
 color: var(--muted);
 font-size: 9px;
 line-height: 1.35;
}

/* Compact, grouped controls for the two contour-only diagnostic editors. */
body.graphite-app[data-mode="shell"] #manufacturing-panel,
body.graphite-app[data-mode="shell"] #inspection-panel {
 min-width: 0;
 overflow-x: hidden;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel > h2,
body.graphite-app[data-mode="shell"] #inspection-panel > h2 {
 margin: 0 0 6px;
 font-size: 11px;
 line-height: 1.2;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel details,
body.graphite-app[data-mode="shell"] #inspection-panel .inspection-group {
 min-width: 0;
 margin: 5px 0;
 padding: 6px;
 border: 1px solid var(--line);
 border-radius: 5px;
 background: #202427;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel details > summary {
 min-height: 20px;
 padding: 1px 0 4px;
 font-size: 10px;
 line-height: 1.2;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel label,
body.graphite-app[data-mode="shell"] #inspection-panel label {
 min-width: 0;
 margin: 4px 0;
 font-size: 9px;
 line-height: 1.2;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel label:has(> input[type="number"]),
body.graphite-app[data-mode="shell"] #inspection-panel label:has(> input[type="number"]) {
 grid-template-columns: minmax(0, 1fr) 52px;
 gap: 4px;
 margin: 4px 0;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel input:not([type="checkbox"]):not([type="range"]),
body.graphite-app[data-mode="shell"] #manufacturing-panel select,
body.graphite-app[data-mode="shell"] #inspection-panel input:not([type="checkbox"]):not([type="range"]),
body.graphite-app[data-mode="shell"] #inspection-panel select {
 box-sizing: border-box;
 min-width: 0;
 min-height: 25px;
 padding: 3px 5px;
 font-size: 9px;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel .mf-grid,
body.graphite-app[data-mode="shell"] #manufacturing-panel .mf-triple {
 min-width: 0;
 gap: 2px 4px;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel .mf-actions,
body.graphite-app[data-mode="shell"] #inspection-panel .thickness-actions {
 gap: 4px;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel button,
body.graphite-app[data-mode="shell"] #inspection-panel button {
 min-height: 24px;
 margin: 3px 0;
 padding: 4px 6px;
 font-size: 9px;
 line-height: 1.2;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel .mf-note,
body.graphite-app[data-mode="shell"] #inspection-panel .inspection-note {
 margin: 5px 0 1px;
 color: var(--muted);
 font-size: 8px;
 line-height: 1.35;
}
body.graphite-app[data-mode="shell"] #manufacturing-panel .mf-status,
body.graphite-app[data-mode="shell"] #inspection-panel .inspection-report {
 margin: 5px 0;
 padding: 6px;
 font-size: 9px;
 line-height: 1.3;
}
body.graphite-app[data-mode="shell"] #inspection-panel .inspection-row {
 grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
 gap: 4px;
}
body.graphite-app[data-mode="shell"] #inspection-panel h3 {
 margin: 0 0 5px;
 padding-bottom: 5px;
 border-bottom: 1px solid var(--line);
 font-size: 10px;
 line-height: 1.2;
}
body.graphite-app[data-mode="shell"] #inspection-panel .inspection-group > :last-child { margin-bottom: 0; }
body.graphite-app[data-mode="shell"] #inspection-panel .inspection-group > input[type="range"] {
 width: 100%;
 margin: 3px 0;
}
@media (max-width: 760px) {
 body.graphite-app[data-mode="shell"] #export-pane .export-settings-group { padding: 8px; }
}
