[data-kw-shell="v1"] .tool-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
}

[data-kw-shell="v1"] .calculator-panel,
[data-kw-shell="v1"] .result-panel {
  min-width: 0;
  box-sizing: border-box;
  padding: 22px;
  border: 1px solid var(--kw-line, #d7e3dc);
  background: var(--kw-surface, #fff);
}

[data-kw-shell="v1"] .calculator-panel,
[data-kw-shell="v1"] #calc-form {
  display: grid;
  gap: 22px;
}

[data-kw-shell="v1"] .result-panel {
  background: var(--kw-page, #fbfdfb);
}

[data-kw-shell="v1"] .calculator-panel > h2,
[data-kw-shell="v1"] .result-panel h2,
[data-kw-shell="v1"] .result-panel h3,
[data-kw-shell="v1"] .scope-card h2 {
  margin: 0;
  color: var(--kw-ink, #14352a);
  font-size: 18px;
  line-height: 1.4;
}

[data-kw-shell="v1"] .result-panel h3 {
  margin-top: 24px;
  font-size: 16px;
}

[data-kw-shell="v1"] fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--kw-line, #d7e3dc);
}

[data-kw-shell="v1"] legend {
  padding: 0 7px;
  color: var(--kw-ink, #14352a);
  font-size: 14px;
  font-weight: 800;
}

[data-kw-shell="v1"] .reaction-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

[data-kw-shell="v1"] .species-card,
[data-kw-shell="v1"] .amount-card {
  display: grid;
  gap: 7px;
  min-width: 0;
}

[data-kw-shell="v1"] .species-card {
  position: relative;
  padding: 12px;
  border: 1px solid #c9ddd1;
  background: #f7fbf8;
}

[data-kw-shell="v1"] .species-product {
  border-color: #c9d7e8;
  background: #f7faff;
}

[data-kw-shell="v1"] .species-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--kw-ink, #14352a);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

[data-kw-shell="v1"] .species-product .species-mark {
  background: #315c92;
}

[data-kw-shell="v1"] .reaction-symbol {
  color: var(--kw-muted, #5b7368);
  font-size: 22px;
  font-weight: 800;
}

[data-kw-shell="v1"] label,
[data-kw-shell="v1"] .examples-title {
  color: var(--kw-ink, #14352a);
  font-size: 12px;
  font-weight: 700;
}

[data-kw-shell="v1"] input,
[data-kw-shell="v1"] select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--kw-line-strong, #abc5b5);
  border-radius: 2px;
  background: #fff;
  color: var(--kw-ink, #14352a);
  font: inherit;
  font-size: 15px;
}

[data-kw-shell="v1"] input:focus-visible,
[data-kw-shell="v1"] select:focus-visible,
[data-kw-shell="v1"] button:focus-visible {
  outline: 3px solid #f0a92e;
  outline-offset: 2px;
}

[data-kw-shell="v1"] input[aria-invalid="true"] {
  border-color: #ad3f32;
  background: #fff9f7;
}

[data-kw-shell="v1"] .amount-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

[data-kw-shell="v1"] .input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 7px;
}

[data-kw-shell="v1"] .help-text,
[data-kw-shell="v1"] .form-error,
[data-kw-shell="v1"] .scope-card p,
[data-kw-shell="v1"] .result-status,
[data-kw-shell="v1"] .diagram-note,
[data-kw-shell="v1"] .meaning-text {
  margin: 10px 0 0;
  color: var(--kw-muted, #5b7368);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

[data-kw-shell="v1"] .form-error {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid #ad3f32;
  background: #fff4f1;
  color: #8e2f25;
  font-weight: 700;
}

[data-kw-shell="v1"] .examples {
  display: grid;
  gap: 8px;
}

[data-kw-shell="v1"] .example-list,
[data-kw-shell="v1"] .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

[data-kw-shell="v1"] .button,
[data-kw-shell="v1"] .example-chip {
  min-height: 42px;
  box-sizing: border-box;
  padding: 8px 13px;
  border: 1px solid var(--kw-line-strong, #abc5b5);
  border-radius: 2px;
  background: #fff;
  color: var(--kw-ink, #14352a);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

[data-kw-shell="v1"] .example-chip {
  min-height: 36px;
  padding: 5px 9px;
}

[data-kw-shell="v1"] .button:hover,
[data-kw-shell="v1"] .example-chip:hover {
  border-color: var(--kw-accent, #258357);
}

[data-kw-shell="v1"] .button-primary {
  border-color: var(--kw-ink, #14352a);
  background: var(--kw-ink, #14352a);
  color: #fff;
}

[data-kw-shell="v1"] .button-quiet {
  color: var(--kw-muted, #5b7368);
}

[data-kw-shell="v1"] .scope-card {
  display: grid;
  gap: 5px;
  padding-top: 18px;
  border-top: 1px solid var(--kw-line, #d7e3dc);
}

[data-kw-shell="v1"] .scope-card p {
  margin-top: 0;
}

[data-kw-shell="v1"] .metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
}

[data-kw-shell="v1"] .metric {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--kw-line, #d7e3dc);
  background: #fff;
}

[data-kw-shell="v1"] .metric dt {
  color: var(--kw-muted, #5b7368);
  font-size: 11px;
}

[data-kw-shell="v1"] .metric dd {
  margin: 5px 0 0;
  color: var(--kw-ink, #14352a);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

[data-kw-shell="v1"] .metric-emphasis dd {
  color: var(--kw-accent, #258357);
  font-size: 17px;
}

[data-kw-shell="v1"] .ratio-diagram {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 15px;
  border: 1px solid var(--kw-line, #d7e3dc);
  background: #fff;
}

[data-kw-shell="v1"] .ratio-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) minmax(92px, auto);
  gap: 9px;
  align-items: center;
  min-width: 0;
}

[data-kw-shell="v1"] .ratio-name {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--kw-ink, #14352a);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

[data-kw-shell="v1"] .ratio-track {
  height: 18px;
  overflow: hidden;
  border: 1px solid #b9ccbf;
  background: #edf3ef;
}

[data-kw-shell="v1"] .ratio-fill {
  display: block;
  width: 0;
  height: 100%;
  transition: width 180ms ease;
}

[data-kw-shell="v1"] .ratio-fill-a {
  background: #2b8a5e;
}

[data-kw-shell="v1"] .ratio-fill-b {
  background: #3974b8;
}

[data-kw-shell="v1"] .ratio-row.is-limiting .ratio-track {
  border-color: #a33f32;
  box-shadow: 0 0 0 2px rgba(163, 63, 50, 0.12);
}

[data-kw-shell="v1"] .ratio-label {
  color: var(--kw-ink, #14352a);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

[data-kw-shell="v1"] .diagram-verdict {
  margin: 2px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--kw-line, #d7e3dc);
  color: var(--kw-ink, #14352a);
  font-size: 13px;
  font-weight: 800;
}

[data-kw-shell="v1"] .table-wrap {
  min-width: 0;
  max-width: 100%;
  margin-top: 10px;
  overflow-x: auto;
}

[data-kw-shell="v1"] #result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

[data-kw-shell="v1"] #result-table caption {
  padding: 0 0 8px;
  color: var(--kw-muted, #5b7368);
  text-align: left;
  font-size: 11px;
}

[data-kw-shell="v1"] #result-table th,
[data-kw-shell="v1"] #result-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--kw-line, #d7e3dc);
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
}

[data-kw-shell="v1"] #result-table th:first-child,
[data-kw-shell="v1"] #result-table td:first-child {
  text-align: left;
}

[data-kw-shell="v1"] #result-table thead th {
  color: var(--kw-muted, #5b7368);
  font-size: 10px;
}

[data-kw-shell="v1"] #result-table tbody th {
  color: var(--kw-ink, #14352a);
  font-size: 13px;
}

[data-kw-shell="v1"] #result-table .empty-row td {
  color: var(--kw-muted, #5b7368);
  text-align: left;
}

[data-kw-shell="v1"] .process-section ol {
  display: grid;
  gap: 7px;
  margin: 10px 0 0;
  padding-left: 22px;
}

[data-kw-shell="v1"] .process-section li {
  color: var(--kw-ink, #14352a);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

[data-kw-shell="v1"] .meaning-text {
  padding: 11px 12px;
  border-left: 4px solid var(--kw-accent, #258357);
  background: #f0f8f3;
  color: var(--kw-ink, #14352a);
}

@media (max-width: 1040px) {
  [data-kw-shell="v1"] .reaction-grid {
    grid-template-columns: 1fr;
  }

  [data-kw-shell="v1"] .reaction-symbol {
    justify-self: center;
    line-height: 1;
  }
}

@media (max-width: 900px) {
  [data-kw-shell="v1"] .tool-shell {
    grid-template-columns: 1fr;
  }

  [data-kw-shell="v1"] .reaction-grid {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  }
}

@media (max-width: 650px) {
  [data-kw-shell="v1"] .calculator-panel,
  [data-kw-shell="v1"] .result-panel {
    padding: 16px;
  }

  [data-kw-shell="v1"] fieldset {
    padding: 12px;
  }

  [data-kw-shell="v1"] .reaction-grid,
  [data-kw-shell="v1"] .amount-grid,
  [data-kw-shell="v1"] .metric-grid {
    grid-template-columns: 1fr;
  }

  [data-kw-shell="v1"] .reaction-symbol {
    justify-self: center;
    transform: rotate(90deg);
  }

  [data-kw-shell="v1"] .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  [data-kw-shell="v1"] .button {
    width: 100%;
    min-height: 44px;
  }

  [data-kw-shell="v1"] .example-chip {
    flex: 1 1 100%;
  }

  [data-kw-shell="v1"] .ratio-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  [data-kw-shell="v1"] .ratio-label {
    grid-column: 2;
  }

  [data-kw-shell="v1"] #result-table,
  [data-kw-shell="v1"] #result-table tbody,
  [data-kw-shell="v1"] #result-table tr,
  [data-kw-shell="v1"] #result-table th,
  [data-kw-shell="v1"] #result-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  [data-kw-shell="v1"] #result-table caption {
    display: block;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
  }

  [data-kw-shell="v1"] #result-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  [data-kw-shell="v1"] #result-table tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--kw-line, #d7e3dc);
    background: #fff;
  }

  [data-kw-shell="v1"] #result-table tbody th,
  [data-kw-shell="v1"] #result-table tbody td {
    display: grid;
    grid-template-columns: minmax(105px, 0.85fr) minmax(0, 1.15fr);
    gap: 10px;
    padding: 8px 10px;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  [data-kw-shell="v1"] #result-table tbody th::before,
  [data-kw-shell="v1"] #result-table tbody td::before {
    content: attr(data-label);
    color: var(--kw-muted, #5b7368);
    font-size: 10px;
    font-weight: 700;
    text-align: left;
  }

  [data-kw-shell="v1"] #result-table .empty-row td {
    display: block;
    text-align: left;
  }

  [data-kw-shell="v1"] #result-table .empty-row td::before {
    content: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-kw-shell="v1"] *,
  [data-kw-shell="v1"] *::before,
  [data-kw-shell="v1"] *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
  }
}
