:root {
  --teal: #0d9e8a;
  --teal-dark: #087b6e;
  --teal-soft: #f5fefc;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d9e2ec;
  --panel: #ffffff;
  --bg: #f7fafc;
  --warning: #fa8c16;
  --error: #ff4d4f;
  --success: #12b76a;
  --blue: #1677ff;
  --shadow: 0 10px 30px rgba(31, 41, 51, 0.08);
}

:root[data-theme="dark"] {
  --teal: #2dd4bf;
  --teal-dark: #5eead4;
  --teal-soft: #102a2a;
  --ink: #f4f7fb;
  --muted: #a9b5c5;
  --line: #2f3d4f;
  --panel: #111827;
  --bg: #070d16;
  --warning: #f59e0b;
  --error: #f87171;
  --success: #34d399;
  --blue: #60a5fa;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background: var(--bg);
}

:root[data-theme="dark"] .guide-card {
  border-color: rgba(45, 212, 191, 0.38);
  background: linear-gradient(135deg, rgba(16, 42, 42, 0.94), rgba(17, 24, 39, 0.94));
}

:root[data-theme="dark"] .guide-card ol,
:root[data-theme="dark"] .guide-card h2,
:root[data-theme="dark"] .mapping-source,
:root[data-theme="dark"] .line-total,
:root[data-theme="dark"] .calculation-list strong,
:root[data-theme="dark"] .field > span,
:root[data-theme="dark"] .line-title,
:root[data-theme="dark"] .metric-value,
:root[data-theme="dark"] .capacity-figures strong {
  color: var(--ink);
}

:root[data-theme="dark"] .intro,
:root[data-theme="dark"] .empty-state p,
:root[data-theme="dark"] .helper,
:root[data-theme="dark"] .container-echo,
:root[data-theme="dark"] .methodology,
:root[data-theme="dark"] .support-note {
  color: var(--muted);
}

:root[data-theme="dark"] .guide-card p,
:root[data-theme="dark"] .excluded-details summary {
  color: var(--teal-dark);
}

:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .example-chip,
:root[data-theme="dark"] select,
:root[data-theme="dark"] input {
  background: #0b1220;
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="dark"] .secondary-button {
  color: var(--teal-dark);
}

:root[data-theme="dark"] .secondary-button:hover,
:root[data-theme="dark"] .option-card:hover {
  border-color: rgba(45, 212, 191, 0.74);
}

:root[data-theme="dark"] .upload-card {
  border-color: rgba(45, 212, 191, 0.46);
  background: rgba(16, 42, 42, 0.78);
}

:root[data-theme="dark"] .upload-card.is-dragging {
  border-color: var(--teal);
  background: rgba(20, 83, 77, 0.52);
}

:root[data-theme="dark"] .import-panel,
:root[data-theme="dark"] .option-card,
:root[data-theme="dark"] .shipment-line,
:root[data-theme="dark"] .result-card,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .chart-card,
:root[data-theme="dark"] .empty-state {
  background: var(--panel);
  border-color: var(--line);
}

:root[data-theme="dark"] .import-message.info,
:root[data-theme="dark"] .import-message.loading {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.44);
  color: #bfdbfe;
}

:root[data-theme="dark"] .import-message.error {
  background: rgba(127, 29, 29, 0.32);
  border-color: rgba(248, 113, 113, 0.52);
  color: #fecaca;
}

:root[data-theme="dark"] .import-message.warning,
:root[data-theme="dark"] .assumption-strip {
  background: rgba(120, 53, 15, 0.34);
  border-color: rgba(245, 158, 11, 0.52);
  color: #fde68a;
}

:root[data-theme="dark"] .import-message.success,
:root[data-theme="dark"] .fit-badge.is-good {
  background: rgba(6, 95, 70, 0.35);
  border-color: rgba(52, 211, 153, 0.48);
  color: #bbf7d0;
}

:root[data-theme="dark"] .fit-badge.is-neutral {
  background: rgba(51, 65, 85, 0.68);
  color: #cbd5e1;
}

:root[data-theme="dark"] .fit-badge.is-warning {
  background: rgba(120, 53, 15, 0.34);
  color: #fde68a;
}

:root[data-theme="dark"] .fit-badge.is-info {
  background: rgba(30, 64, 175, 0.32);
  color: #bfdbfe;
}

:root[data-theme="dark"] .fit-badge.is-danger {
  background: rgba(127, 29, 29, 0.32);
  color: #fecaca;
}

:root[data-theme="dark"] .progress-track,
:root[data-theme="dark"] .gauge-bg {
  background: #1f2937;
}

:root[data-theme="dark"] .excluded-details,
:root[data-theme="dark"] .detail-row,
:root[data-theme="dark"] .calculation-list li,
:root[data-theme="dark"] .metric-breakdown {
  border-color: var(--line);
}

:root[data-theme="dark"] .chart-grid {
  stroke: #243044;
}

button,
input,
select {
  font: inherit;
}

textarea,
select,
input {
  font: inherit;
}

button {
  min-height: 44px;
}

.app-shell {
  display: grid;
  gap: 20px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.form-panel,
.result-panel {
  min-width: 0;
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-header {
  padding: 6px 0 2px;
}

.eyebrow,
.form-section h2,
.metric-label {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.06;
  letter-spacing: 0;
}

.intro,
.empty-state p,
.helper,
.container-echo,
.methodology,
.support-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.intro {
  max-width: 58ch;
  margin: 0;
}

.guide-card,
.form-section,
.result-card,
.empty-state,
.metric-card,
.chart-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.guide-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 16px 48px 16px 16px;
  background: var(--teal-soft);
  border-color: #a8eee3;
}

.guide-card.is-hidden {
  display: none;
}

.guide-card h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

.guide-card ol {
  margin: 0;
  padding-left: 18px;
  color: #344054;
  font-size: 14px;
  line-height: 1.55;
}

.guide-card p {
  margin: 8px 0 0;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 600;
}

.guide-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.guide-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.example-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 700;
  text-decoration: none;
}

.secondary-button {
  border: 1px solid var(--teal);
  background: #fff;
  color: var(--teal-dark);
  cursor: pointer;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(13, 158, 138, 0.18);
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section {
  padding: 16px;
}

.form-section h2 {
  margin-bottom: 12px;
}

.section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading-row h2 {
  margin-bottom: 4px;
}

.shipment-section {
  display: grid;
  gap: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-card {
  display: grid;
  gap: 12px;
  align-items: center;
  border: 1px dashed #8fd8cc;
  border-radius: 8px;
  padding: 14px;
  background: var(--teal-soft);
}

.upload-card.is-dragging {
  border-color: var(--teal);
  background: #e9fbf8;
}

.upload-card strong {
  display: block;
  margin-bottom: 2px;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.import-panel[hidden] {
  display: none;
}

.import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.import-head h3 {
  margin: 4px 0 4px;
  font-size: 18px;
  line-height: 1.2;
}

.import-message {
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 10px 12px;
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
}

.import-message.loading,
.import-message.info {
  background: #eff8ff;
  border-color: #b2ddff;
  color: #175cd3;
}

.import-message.error {
  background: #fff1f0;
  border-color: #ffa39e;
  color: #b42318;
}

.import-message.warning {
  background: #fff7e6;
  border-color: #ffd591;
  color: #7a4b00;
}

.import-message.success {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #027a48;
}

.unit-overrides,
.mapping-list {
  display: grid;
  gap: 10px;
}

.mapping-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.mapping-source {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.excluded-details {
  border-top: 1px solid #eef2f6;
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.excluded-details summary {
  cursor: pointer;
  color: var(--teal-dark);
  font-weight: 800;
}

.excluded-details p {
  margin: 8px 0 0;
}

.import-actions {
  display: flex;
}

.compact-primary {
  width: auto;
  min-height: 40px;
  padding: 0 14px;
}

.compact-primary:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shipment-lines {
  display: grid;
  gap: 12px;
}

.shipment-line {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.line-header {
  display: grid;
  gap: 10px;
}

.line-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.line-number {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.text-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--teal-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.line-grid {
  display: grid;
  gap: 12px;
}

.line-grid.dimensions {
  grid-template-columns: 1fr;
}

.line-settings {
  display: grid;
  gap: 10px;
}

.field-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.line-unit-row,
.line-stack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-unit-row {
  margin-top: 4px;
}

.line-stack-row .segmented,
.line-unit-row .segmented {
  min-height: 38px;
}

.line-stack-row .segment,
.line-unit-row .segment {
  min-height: 32px;
  min-width: 56px;
}

.row-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 26px;
}

.shipment-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid #eef2f6;
  padding-top: 12px;
}

.shipment-live {
  margin-top: 0;
}

.unit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  min-height: 44px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f2f4f7;
}

.segmented.wide {
  width: 100%;
  grid-template-columns: 1fr 1fr;
}

.segment {
  min-width: 68px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.segment.is-active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 2px 6px rgba(13, 158, 138, 0.25);
}

.input-grid {
  display: grid;
  gap: 12px;
}

.input-grid.three {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(13, 158, 138, 0.16);
}

.field.has-error input {
  border-color: var(--error);
  outline-color: rgba(255, 77, 79, 0.16);
}

.field.has-error input:focus {
  outline-color: rgba(255, 77, 79, 0.16);
}

.error {
  min-height: 18px;
  color: var(--error);
  font-size: 14px;
  line-height: 1.35;
}

.error:empty {
  display: none;
}

.helper {
  display: block;
  margin: 0;
}

.live-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.live-line,
.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.live-line {
  background: #f2f4f7;
  color: #475467;
}

.tag-pill.success {
  background: #ecfdf3;
  color: #027a48;
}

.tag-pill.warning {
  background: #fff7e6;
  color: #ad4e00;
}

.tag-pill.info {
  background: #eff8ff;
  color: #175cd3;
}

.tag-pill.error {
  background: #fff1f0;
  color: #b42318;
}

.container-options {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.option-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
}

.option-card input {
  grid-row: span 2;
  width: 18px;
  min-height: 18px;
  margin: 3px 0 0;
  accent-color: var(--teal);
}

.option-card span {
  font-weight: 800;
}

.option-card small {
  color: var(--muted);
  font-size: 12px;
}

.option-card.is-selected {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: inset 3px 0 0 var(--teal);
}

.container-echo {
  margin: 10px 0 0;
}

.actions {
  padding-bottom: 8px;
}

.result-panel {
  display: flex;
  flex-direction: column;
}

.result-root {
  min-height: 100%;
}

.empty-state {
  padding: 24px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.empty-state h2 {
  margin: 10px 0 8px;
  font-size: 24px;
  line-height: 1.15;
}

.result-card {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.disclaimer-strip {
  padding: 12px 16px;
  background: #fff7e6;
  border-bottom: 1px solid #ffd591;
  color: #7a4b00;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.result-content {
  padding: 16px;
}

.verdict-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.verdict-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.verdict-badge.success {
  background: var(--success);
}

.verdict-badge.warning {
  background: var(--warning);
}

.verdict-badge.error {
  background: var(--error);
}

.verdict-block h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.verdict-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 14px 0;
}

.metric-card {
  position: relative;
  min-height: 154px;
  padding: 12px;
  border-left: 4px solid var(--teal);
}

.metric-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 20px;
}

.metric-value {
  margin: 12px 0 2px;
  font-size: 24px;
  font-weight: 850;
  line-height: 1.1;
}

.metric-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.recommendation-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border-radius: 999px;
  margin-top: 12px;
  padding: 6px 10px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 800;
}

.recommendation-chip strong {
  color: var(--ink);
  font-size: 16px;
}

.circle-meter {
  width: 88px;
  height: 88px;
  margin-top: 8px;
}

.circle-meter circle {
  fill: none;
  stroke-width: 10;
}

.circle-bg {
  stroke: #edf2f7;
}

.circle-fg {
  stroke: var(--teal);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.circle-fg.warning {
  stroke: var(--warning);
}

.circle-fg.error {
  stroke: var(--error);
}

.summary-stack {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.summary-card .summary-stack {
  margin-top: 12px;
}

.summary-stack div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.summary-stack strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.primary-summary div:first-child strong {
  font-size: 22px;
}

.chart-card {
  padding: 14px;
  margin-bottom: 14px;
}

.contributor-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  border-top: 1px solid #eef2f6;
  padding-top: 10px;
}

.contributor-list div {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.contributor-list strong {
  color: var(--ink);
  font-size: 13px;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-title h3,
.supporting-details h3 {
  margin: 0;
  font-size: 15px;
}

.stacked-bar {
  overflow: hidden;
  height: 18px;
  border-radius: 999px;
  background: #eef2f6;
}

.stacked-fill {
  height: 100%;
  background: var(--teal);
}

.stacked-fill.warning {
  background: var(--warning);
}

.stacked-fill.error {
  background: var(--error);
}

.bar-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.capacity-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.capacity-figures div {
  display: grid;
  gap: 2px;
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px;
}

.capacity-figures span,
.capacity-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.capacity-figures strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.capacity-figures strong.warning {
  color: #ad4e00;
}

.capacity-figures strong.error {
  color: #b42318;
}

.capacity-note {
  margin: 8px 0 0;
}

.planning-notes {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  border-top: 1px solid #eef2f6;
  padding-top: 12px;
}

.planning-notes h3 {
  margin: 0;
  font-size: 15px;
}

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

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.supporting-details {
  margin-bottom: 14px;
}

.supporting-details summary {
  min-height: 44px;
  cursor: pointer;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  gap: 8px;
  padding-top: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eef2f6;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.detail-row strong {
  color: var(--ink);
  text-align: right;
}

.methodology {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.support-note {
  margin: 8px 0 0;
  color: #ad4e00;
}

@media (min-width: 640px) {
  .input-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .line-grid.quantity-weight {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .line-settings {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .shipment-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .upload-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

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

  .mapping-row {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  }

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

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

  .primary-button {
    width: auto;
    min-width: 220px;
  }
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: minmax(360px, 40%) minmax(0, 60%);
    align-items: start;
    gap: 24px;
    padding: 24px;
  }

  .form-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding-right: 2px;
  }

  .result-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow: auto;
  }
}

@media (max-width: 767px) {
  .app-shell {
    padding: 12px;
  }

  .result-panel {
    margin-top: 4px;
  }

  .empty-state {
    display: none;
  }

  .result-content {
    padding: 12px;
  }

  .metric-card {
    min-height: 132px;
  }

  .section-heading-row {
    flex-direction: column;
  }

  .section-heading-row .compact-button {
    width: 100%;
  }

  .line-actions {
    justify-content: stretch;
  }

  .line-actions .text-button {
    flex: 1 1 auto;
  }

  .upload-actions,
  .upload-actions .compact-button,
  .import-actions,
  .import-actions .primary-button {
    width: 100%;
  }

  .import-head {
    flex-direction: column;
  }

  .line-unit-row,
  .line-stack-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-unit-row {
    align-items: center;
    flex-direction: row;
  }

  .line-unit-row .segmented,
  .line-stack-row .segmented {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .chart-card,
  .supporting-details {
    padding: 12px;
  }

  .capacity-figures {
    grid-template-columns: 1fr;
  }
}
