﻿:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #607d8b;
  --line: #d6e1e6;
  --line-strong: #9eb1bc;
  --cell: #263238;
  --plane: #00897b;
  --direction: #ef6c00;
  --blue: #0277bd;
  --yellow: #ffb300;
  --shadow: 0 18px 40px rgba(38, 50, 56, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, var(--bg) 58%, #e8f0f3 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "brand"
    "nav";
  row-gap: 10px;
  align-items: center;
  min-height: 112px;
  padding: 12px 22px 14px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.workspace {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.module-view {
  min-height: calc(100vh - 112px);
  min-width: 0;
}

.module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 14px 22px;
  border-top: 1px solid rgba(158, 177, 188, 0.42);
  color: #607d8b;
  background: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  line-height: 1.55;
}

.module-footer-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.module-footer-copy strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.module-footer-qr {
  display: grid;
  justify-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin: 0;
  color: #607d8b;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.module-footer-qr img {
  display: block;
  width: 92px;
  height: 92px;
  padding: 4px;
  border: 1px solid #d6e1e6;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.control-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 36px rgba(23, 33, 39, 0.08);
  overflow-y: auto;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
  border: 2px solid var(--cell);
  object-fit: contain;
  background: #fff;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 760;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.org-card {
  grid-area: org;
  display: inline-grid;
  grid-template-columns: 46px auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 5px 10px 5px 6px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.org-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(38, 50, 56, 0.1);
  transform: translateY(-1px);
}

.org-card img {
  display: block;
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.org-card span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.org-card strong {
  font-size: 14px;
  line-height: 1.1;
  font-weight: 760;
}

.org-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.module-nav {
  grid-area: nav;
  min-width: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
}

.module-nav::-webkit-scrollbar {
  display: none;
}

.module-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #37474f;
  background: #f7fafb;
  cursor: pointer;
  white-space: nowrap;
}

.module-tab.is-active {
  color: #fff;
  background: var(--cell);
  border-color: var(--cell);
}

.module-tab:disabled {
  color: #90a4ae;
  cursor: default;
  background: #f1f4f5;
}

.control-section {
  display: grid;
  gap: 10px;
}

.compact-section {
  gap: 8px;
}

.control-label {
  color: #37474f;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f5;
  gap: 4px;
}

.segment {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  color: #455a64;
  background: transparent;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.segment.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 14px rgba(25, 32, 36, 0.12);
}

.mode-segmented .segment {
  min-height: 48px;
  font-size: 17px;
  font-weight: 760;
}

.mode-segmented .segment.is-active {
  box-shadow:
    inset 0 -3px 0 var(--plane),
    0 4px 14px rgba(25, 32, 36, 0.12);
}

.mode-segmented [data-mode="direction"].is-active {
  box-shadow:
    inset 0 -3px 0 var(--direction),
    0 4px 14px rgba(25, 32, 36, 0.12);
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.index-input,
.small-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

.index-input::placeholder {
  color: #8b979e;
}

.index-input:focus,
.small-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 114, 178, 0.18);
}

.small-input {
  max-width: 130px;
}

.input-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.primary-button,
.ghost-button,
.chip {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  min-width: 72px;
  padding: 0 15px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(0, 114, 178, 0.22);
}

.ghost-button {
  padding: 0 13px;
  color: #263139;
  background: #fff;
  border-color: var(--line-strong);
}

.primary-button:hover,
.ghost-button:hover,
.chip:hover {
  filter: brightness(0.98);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 0 11px;
  color: #37474f;
  background: #eef5f6;
  border-color: #d8e5e9;
  font-size: 13px;
}

.readout-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.status-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: #263238;
  font-size: 14px;
  line-height: 1.45;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 99px;
  background: var(--plane);
}

.status-dot.is-error {
  background: var(--direction);
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.metric-list div {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e4ebee;
}

.metric-list dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.metric-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.tool-section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-section .ghost-button {
  width: 100%;
}

.iron-carbon-module {
  padding: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.66) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.66) 1px, transparent 1px),
    linear-gradient(145deg, #f5f9fa 0%, #e7f0f3 100%);
  background-size: 36px 36px, 36px 36px, 100% 100%;
}

.fe-workspace {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  gap: 16px;
}

.fe-chart-panel,
.fe-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(23, 33, 39, 0.08);
}

.fe-chart-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.fe-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.fe-panel-head h2,
.fe-card-title h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.16;
  font-weight: 760;
  letter-spacing: 0;
}

.fe-panel-head h2 {
  font-size: 23px;
}

.fe-panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.fe-carbon-field {
  display: grid;
  grid-template-columns: auto 92px;
  gap: 8px;
  align-items: center;
  color: #37474f;
  font-size: 13px;
  font-weight: 700;
}

.fe-carbon-field input {
  width: 92px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.fe-carbon-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 114, 178, 0.16);
}

.fe-chart-shell {
  min-height: 0;
  overflow: auto;
  border: 1px solid #dbe6ea;
  border-radius: 8px;
  background: #fbfdfe;
}

.fe-chart-host {
  min-width: 780px;
}

.fe-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.fe-plot-bg {
  fill: #f9fbfc;
  stroke: #c7d6dd;
  stroke-width: 1.5;
}

.fe-grid line {
  stroke: #d8e4e8;
  stroke-width: 1;
}

.fe-grid,
.fe-phase-lines,
.fe-axes,
.fe-chart-labels {
  pointer-events: none;
}

.fe-region {
  cursor: pointer;
  opacity: 0.76;
  stroke: #f9fbfc;
  stroke-width: 1.2;
  transition:
    opacity 160ms ease,
    filter 160ms ease,
    stroke 160ms ease;
}

.fe-region:hover,
.fe-region.is-selected {
  opacity: 0.96;
  stroke: #263238;
  stroke-width: 2.4;
  filter: saturate(1.08);
}

.fe-region-selection {
  pointer-events: none;
  fill-opacity: 0.18;
  stroke: #263238;
  stroke-width: 4;
  stroke-linejoin: round;
  paint-order: stroke fill;
}

.fe-phase-lines polyline {
  fill: none;
  stroke: #2e3b42;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.fe-phase-lines .is-critical {
  stroke: #00897b;
  stroke-width: 2.6;
}

.fe-axes line {
  stroke: #263238;
  stroke-width: 1.7;
}

.fe-axes text,
.fe-chart-labels text {
  fill: #2b3940;
  font-size: 16px;
  font-weight: 650;
}

.fe-axis-title {
  font-size: 18px;
  font-weight: 760;
}

.fe-chart-labels text {
  fill: #455a64;
  paint-order: stroke;
  stroke: rgba(249, 251, 252, 0.88);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.fe-axis-hit {
  fill: transparent;
  cursor: ew-resize;
  pointer-events: all;
}

.fe-carbon-cursor {
  cursor: ew-resize;
  pointer-events: all;
}

.fe-carbon-cursor line {
  stroke: var(--direction);
  stroke-width: 3;
  stroke-dasharray: 9 7;
}

.fe-carbon-cursor circle {
  fill: var(--direction);
  stroke: #fff;
  stroke-width: 4;
}

.fe-carbon-cursor text {
  fill: #fff;
  stroke: none;
  font-size: 16px;
  font-weight: 760;
  paint-order: stroke;
}

.fe-composition-strip {
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dbe6ea;
  border-radius: 8px;
  background: #f7fafb;
}

.fe-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
}

.fe-composition-strip strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 760;
}

.fe-carbon-range {
  width: 100%;
  accent-color: var(--direction);
}

.fe-info-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.fe-card {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.fe-card-title h3 {
  font-size: 20px;
}

.fe-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

.fe-detail-list div {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e0eaee;
  border-radius: 8px;
  background: #fff;
}

.fe-detail-list dt {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
}

.fe-detail-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
}

.fe-note {
  margin: 0;
  color: #455a64;
  font-size: 14px;
  line-height: 1.55;
}

.fe-bar-list,
.fe-breakdown {
  display: grid;
  gap: 10px;
}

.fe-bar-list > div,
.fe-structure-item {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.fe-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #37474f;
  font-size: 13px;
  line-height: 1.2;
}

.fe-bar-label strong {
  color: var(--ink);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.fe-bar-fill {
  display: block;
  height: 9px;
  max-width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--plane), #4db6ac);
}

.fe-bar-cementite {
  background: linear-gradient(90deg, var(--direction), #ffb300);
}

.structure-module {
  padding: 18px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.66) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.66) 1px, transparent 1px),
    linear-gradient(145deg, #f5f9fa 0%, #e7f0f3 100%);
  background-size: 36px 36px, 36px 36px, 100% 100%;
}

.structure-workspace {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  gap: 16px;
}

.structure-control-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.structure-card,
.structure-view-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(23, 33, 39, 0.08);
}

.structure-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.structure-head-card h2,
.structure-info-title h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.16;
  font-weight: 760;
}

.structure-head-card h2 {
  font-size: 22px;
}

.structure-head-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.structure-list-card {
  max-height: 330px;
  overflow: hidden;
}

.structure-select {
  display: none;
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 12px;
  border: 1px solid #d2e0e6;
  border-radius: 8px;
  color: var(--ink);
  background: #f8fafb;
  font: inherit;
  font-size: 15px;
  font-weight: 720;
  outline: none;
}

.structure-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2, 119, 189, 0.14);
}

.structure-list {
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
}

.structure-list-item {
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid #dbe6ea;
  border-radius: 8px;
  color: #263238;
  background: #f8fafb;
  text-align: left;
  cursor: pointer;
}

.structure-list-item span {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 760;
}

.structure-list-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.structure-list-item.is-active {
  color: #fff;
  border-color: var(--cell);
  background: var(--cell);
}

.structure-list-item.is-active small {
  color: rgba(255, 255, 255, 0.72);
}

.structure-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.structure-tools .ghost-button.is-active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.structure-tools .ghost-button:disabled {
  color: #90a4ae;
  cursor: default;
  background: #eef3f5;
  border-color: #dbe6ea;
}

.structure-slider {
  display: grid;
  gap: 6px;
  color: #37474f;
  font-size: 13px;
  font-weight: 700;
}

.structure-slider input {
  width: 100%;
  accent-color: var(--blue);
}

.structure-info-title h3 {
  font-size: 19px;
}

.structure-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.structure-meta div {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid #e0eaee;
  border-radius: 8px;
  background: #fff;
}

.structure-meta dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
}

.structure-meta dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 740;
  overflow-wrap: anywhere;
}

.structure-link {
  color: var(--blue);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  text-decoration: none;
}

.structure-link:hover {
  text-decoration: underline;
}

.structure-view-panel {
  position: relative;
  align-self: start;
  overflow: hidden;
  height: min(720px, calc(100vh - 132px));
  min-height: 560px;
  background:
    radial-gradient(circle at 42% 20%, rgba(255, 255, 255, 0.96), transparent 36%),
    radial-gradient(circle at 58% 70%, rgba(0, 137, 123, 0.07), transparent 32%),
    linear-gradient(145deg, #f7fafb 0%, #e9f1f4 100%);
}

.structure-viewer-host {
  position: absolute;
  inset: 0;
}

.structure-viewer-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.structure-legend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 9px 11px;
  border: 1px solid rgba(170, 183, 191, 0.72);
  border-radius: 8px;
  color: #263139;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  font-size: 13px;
  line-height: 1.2;
}

.structure-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.structure-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.viewer-panel {
  position: relative;
  min-width: 0;
  min-height: calc(100vh - 112px);
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.82) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.82) 1px, transparent 1px),
    linear-gradient(145deg, #f5f9fa 0%, #e5eff3 100%);
  background-size: 42px 42px, 42px 42px, 100% 100%;
}

.scene-host {
  position: absolute;
  inset: 0;
}

.scene-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.legend {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: calc(100% - 44px);
  padding: 10px 12px;
  color: #263139;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(170, 183, 191, 0.72);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  font-size: 13px;
  line-height: 1.2;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.swatch-cell {
  background: var(--cell);
}

.swatch-plane {
  background: var(--plane);
}

.swatch-direction {
  background: var(--direction);
}

.is-hidden {
  display: none;
}

@media (max-width: 820px) {
  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "nav";
    gap: 8px;
    min-height: 0;
    padding: 8px 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  h1 {
    font-size: 17px;
  }

  .brand p {
    display: none;
  }

  .org-card {
    grid-template-columns: 38px;
    gap: 0;
    padding: 4px;
  }

  .org-card img {
    width: 38px;
    height: 38px;
  }

  .org-card span {
    display: none;
  }

  .module-nav {
    justify-content: flex-start;
    margin: 0;
    padding-bottom: 2px;
  }

  .module-tab {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .workspace {
    min-height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(420px, 60vh) auto;
  }

  .module-view {
    min-height: auto;
  }

  .module-footer {
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 11px;
  }

  .module-footer-copy {
    gap: 2px;
  }

  .module-footer-copy strong {
    font-size: 12px;
  }

  .module-footer-qr {
    font-size: 10px;
  }

  .module-footer-qr img {
    width: 72px;
    height: 72px;
    padding: 3px;
  }

  .control-panel {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 12px;
    max-height: none;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 12px;
    box-shadow: 0 -14px 30px rgba(23, 33, 39, 0.08);
    font-size: 14px;
  }

  .viewer-panel {
    order: 1;
    min-height: 420px;
  }

  .mode-section,
  .index-section,
  .readout-panel,
  .tool-section {
    grid-column: 1 / -1;
  }

  .mode-section {
    order: -3;
  }

  .system-section {
    order: -2;
  }

  .layer-section {
    order: -1;
  }

  .index-section {
    order: 0;
  }

  .control-section {
    gap: 7px;
  }

  .control-label,
  .input-hint,
  .metric-list dt {
    font-size: 12px;
  }

  .segment,
  .index-input,
  .small-input,
  .primary-button,
  .ghost-button,
  .chip,
  .status-row,
  .metric-list dd,
  .legend {
    font-size: 14px;
  }

  .segmented {
    gap: 3px;
    padding: 3px;
  }

  .segment,
  .primary-button,
  .ghost-button,
  .chip {
    min-height: 36px;
  }

  .mode-segmented .segment {
    min-height: 38px;
    font-size: 14px;
  }

  .index-input,
  .small-input {
    min-height: 38px;
    padding: 0 10px;
  }

  .primary-button {
    min-width: 62px;
    padding: 0 12px;
    box-shadow: 0 6px 14px rgba(0, 114, 178, 0.18);
  }

  .ghost-button {
    padding: 0 10px;
  }

  .chip-row {
    gap: 6px;
  }

  .chip {
    padding: 0 9px;
  }

  .readout-panel {
    padding: 12px;
    gap: 10px;
  }

  .status-row {
    line-height: 1.35;
  }

  .metric-list div {
    padding: 8px 7px;
  }

  .tool-section {
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef3f5;
  }

  .tool-section .ghost-button {
    border: 0;
    border-radius: 6px;
    background: #fff;
  }

  .legend {
    right: 14px;
    bottom: 14px;
  }

  .iron-carbon-module {
    padding: 10px;
  }

  .fe-workspace {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .fe-chart-panel,
  .fe-card {
    box-shadow: 0 10px 24px rgba(23, 33, 39, 0.08);
  }

  .fe-chart-panel {
    padding: 12px;
    gap: 12px;
  }

  .fe-panel-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .fe-panel-head h2 {
    font-size: 20px;
  }

  .fe-panel-head p,
  .fe-note,
  .fe-detail-list dd,
  .fe-bar-label {
    font-size: 14px;
  }

  .fe-chart-host {
    min-width: 0;
  }

  .fe-composition-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .fe-carbon-range {
    grid-column: 1 / -1;
  }

  .fe-info-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .fe-card {
    padding: 12px;
    gap: 11px;
  }

  .fe-card-title h3 {
    font-size: 18px;
  }

  .structure-module {
    padding: 10px;
  }

  .structure-workspace {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .structure-view-panel {
    order: 1;
    height: auto;
    min-height: 440px;
  }

  .structure-control-panel {
    order: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .structure-card {
    padding: 12px;
  }

  .structure-head-card,
  .structure-list-card,
  .structure-info-card {
    grid-column: 1 / -1;
  }

  .structure-head-card h2 {
    font-size: 20px;
  }

  .structure-list-card {
    max-height: none;
  }

  .structure-select {
    display: block;
  }

  .structure-list {
    display: none;
  }

  .structure-list-item {
    min-height: 50px;
  }

  .structure-list-item span,
  .structure-meta dd,
  .structure-legend {
    font-size: 13px;
  }

  .structure-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 7px 10px;
  }

  h1 {
    font-size: 16px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .org-card {
    grid-template-columns: 34px;
  }

  .org-card img {
    width: 34px;
    height: 34px;
  }

  .workspace {
    grid-template-rows: minmax(430px, 58vh) auto;
  }

  .control-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
    gap: 10px;
  }

  .viewer-panel {
    min-height: 430px;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 6px;
  }

  .metric-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .readout-panel {
    padding: 10px;
    gap: 9px;
  }

  .metric-list div {
    padding: 8px 6px;
  }

  .tool-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fe-info-panel {
    grid-template-columns: 1fr;
  }

  .fe-panel-head {
    grid-template-columns: 1fr;
  }

  .fe-carbon-field {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .fe-carbon-field input {
    width: 100%;
  }

  .fe-chart-host {
    min-width: 0;
  }

  .fe-detail-list {
    grid-template-columns: 1fr;
  }

  .structure-view-panel {
    min-height: 390px;
  }

  .structure-control-panel {
    grid-template-columns: 1fr;
  }

  .structure-list {
    grid-template-columns: 1fr;
  }

  .structure-meta {
    grid-template-columns: 1fr;
  }

  .structure-legend {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .module-tab {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .legend {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}
