.chemrytaas-page {
  min-height: 100vh;
  --chemrytaas-page-max: 1120px;
  --chemrytaas-font: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --chemrytaas-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --chemrytaas-bg: #eef3f8;
  --chemrytaas-card: #ffffff;
  --chemrytaas-border: #d7e0ea;
  --chemrytaas-ink: #16324a;
  --chemrytaas-muted: #5c7084;
  --chemrytaas-primary: #0d6e8a;
  --chemrytaas-primary-strong: #14532d;
  --chemrytaas-primary-soft: #e7f4fb;
  --chemrytaas-warn: #b45309;
  --chemrytaas-error: #b42318;
  --chemrytaas-shadow: 0 18px 40px rgba(20, 46, 67, 0.08);
  --chemrytaas-radius: 24px;
  --chemrytaas-field-height: 26px;
  background: linear-gradient(180deg, #eef3f8 0%, #f7fafc 48%, #eef3f8 100%);
  color: var(--chemrytaas-ink);
  font-family: var(--chemrytaas-font);
}

.chemrytaas-page *,
.chemrytaas-page *::before,
.chemrytaas-page *::after {
  box-sizing: border-box;
  font-family: inherit;
}

.chemrytaas-container {
  width: min(100%, var(--chemrytaas-page-max));
  max-width: var(--chemrytaas-page-max);
  margin: 2rem auto 3rem;
  padding-inline: 1.5rem;
}

.chemrytaas-card {
  background: var(--chemrytaas-card);
  border: 1px solid var(--chemrytaas-border);
  border-radius: var(--chemrytaas-radius);
  box-shadow: var(--chemrytaas-shadow);
  overflow: hidden;
}

.chemrytaas-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.35rem;
  margin-bottom: 1rem;
  color: #f5fbff;
  background: linear-gradient(135deg, #0e334d 0%, #1f6c86 100%);
}

.chemrytaas-hero__copy {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.chemrytaas-hero__actions {
  display: flex;
  justify-content: flex-end;
}

.chemrytaas-kicker,
.chemrytaas-card-kicker {
  margin: 0;
  color: var(--chemrytaas-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.chemrytaas-kicker {
  color: rgba(226, 244, 255, 0.9);
}

.chemrytaas-title,
.chemrytaas-card-title,
.chemrytaas-result-title {
  margin: 0;
  line-height: 1.08;
}

.chemrytaas-title {
  color: #f5fbff;
  font-size: 1.8rem;
}

.chemrytaas-card-title {
  color: var(--chemrytaas-ink);
  font-size: 1.05rem;
}

.chemrytaas-result-title {
  color: #17324d;
  font-size: 1rem;
}

.chemrytaas-subtitle,
.chemrytaas-chart-caption,
.chemrytaas-field-help,
.chemrytaas-inline-note,
.chemrytaas-result-copy {
  margin: 0;
  line-height: 1.5;
}

.chemrytaas-subtitle {
  max-width: 720px;
  color: rgba(233, 245, 255, 0.86);
  font-size: 0.98rem;
}

.chemrytaas-field-help,
.chemrytaas-inline-note,
.chemrytaas-chart-caption,
.chemrytaas-result-copy {
  color: var(--chemrytaas-muted);
  font-size: 0.9rem;
}

.chemrytaas-status {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 600;
}

.chemrytaas-status--info {
  background: var(--chemrytaas-primary-soft);
  border-color: #bddff0;
  color: #124f75;
}

.chemrytaas-status--success {
  background: #dff5e6;
  border-color: #bde4c7;
  color: var(--chemrytaas-primary-strong);
}

.chemrytaas-status--error {
  background: #fde7e5;
  border-color: #f5c3bd;
  color: var(--chemrytaas-error);
}

.chemrytaas-workspace {
  display: grid;
  gap: 1rem;
}

.chemrytaas-structure-card {
  min-width: 0;
}

.chemrytaas-structure-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  padding: 1.25rem;
}

.chemrytaas-structure-pane {
  min-width: 0;
}

.chemrytaas-structure-pane + .chemrytaas-structure-pane {
  padding-left: 1.25rem;
  margin-left: 1.25rem;
  border-left: 1px solid #e5edf4;
}

.chemrytaas-molecule-information {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.chemrytaas-pane-head {
  display: grid;
  gap: 0.15rem;
}

.chemrytaas-panel,
.chemrytaas-results {
  min-width: 0;
}

.chemrytaas-card-head,
.chemrytaas-card-body {
  padding: 1.25rem;
}

.chemrytaas-card-body {
  display: grid;
  gap: 1rem;
}

.chemrytaas-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e5edf4;
}

.chemrytaas-panel--method.is-collapsed .chemrytaas-card-head,
.chemrytaas-analysis-panel.is-collapsed .chemrytaas-card-head {
  border-bottom: 0;
}

.chemrytaas-card-head--actions-only {
  justify-content: flex-end;
}

.chemrytaas-card-head--toolbar {
  justify-content: flex-start;
}

.chemrytaas-card-head--toolbar .chemrytaas-card-actions {
  justify-content: flex-start;
  width: 100%;
}

.chemrytaas-card-actions,
.chemrytaas-action-bar,
.chemrytaas-form-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.chemrytaas-card-actions .chemrytaas-btn,
.chemrytaas-action-bar .chemrytaas-btn,
.chemrytaas-form-tools .chemrytaas-btn {
  flex: 0 0 auto;
  width: auto;
}

.chemrytaas-btn,
.chemrytaas-hero-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.chemrytaas-btn {
  height: 21px;
  min-height: 21px;
  max-width: 190px;
  padding: 0 10px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.chemrytaas-hero-link {
  min-height: 34px;
  padding: 0.45rem 0.85rem;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  color: #f5fbff;
  font-size: 0.9rem;
}

.chemrytaas-btn:hover,
.chemrytaas-btn:focus-visible,
.chemrytaas-hero-link:hover,
.chemrytaas-hero-link:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.chemrytaas-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.chemrytaas-btn--primary {
  background: linear-gradient(135deg, #0d6e8a 0%, #1793aa 100%);
  border-color: #0d6e8a;
  box-shadow: 0 14px 32px rgba(13, 110, 138, 0.22);
  color: #ffffff;
}

.chemrytaas-btn--secondary {
  background: #f4fafc;
  border-color: #d6e4ed;
  color: #163347;
}

.chemrytaas-btn--ghost {
  background: transparent;
  border-color: #d6e4ed;
  color: #5c7386;
}

.chemrytaas-jsme-shell {
  position: relative;
  min-height: 430px;
  height: 100%;
  padding: 0.85rem;
  border: 1px solid var(--chemrytaas-border);
  border-radius: 20px;
  background: #ffffff;
  overflow: hidden;
}

.chemrytaas-jsme {
  width: 100%;
  min-height: 400px;
  height: 400px;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
}

.chemrytaas-jsme-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chemrytaas-jsme-overlay:hover {
  background: rgba(55, 80, 105, 0.06);
}

.chemrytaas-jsme-overlay__hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--chemrytaas-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  color: #375069;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.chemrytaas-jsme-overlay:hover .chemrytaas-jsme-overlay__hint {
  opacity: 1;
}

.chemrytaas-form-grid,
.chemrytaas-summary-grid-inline,
.chemrytaas-results-grid,
.chemrytaas-results-detail-grid {
  display: grid;
  gap: 0.75rem;
}

.chemrytaas-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.chemrytaas-field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.chemrytaas-field--wide {
  grid-column: 1 / -1;
}

.chemrytaas-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chemrytaas-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 28px;
  padding: 0 0.6rem;
  border: 1px solid var(--chemrytaas-border);
  border-radius: 999px;
  background: #ffffff;
  color: #375069;
  font-size: 0.82rem;
  font-weight: 600;
}

.chemrytaas-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #14a4b8;
}

.chemrytaas-label {
  color: #375069;
  font-size: 0.85rem;
  font-weight: 700;
}

.chemrytaas-input,
.chemrytaas-select,
.chemrytaas-textarea {
  width: 100%;
  min-height: var(--chemrytaas-field-height);
  border: 1px solid #cdd8e3;
  border-radius: 10px;
  background: #fbfdff;
  color: var(--chemrytaas-ink);
  font-size: 0.86rem;
  line-height: 1.2;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chemrytaas-input,
.chemrytaas-select {
  height: var(--chemrytaas-field-height);
  padding: 0 0.55rem;
}

.chemrytaas-select {
  max-width: 220px;
}

.chemrytaas-textarea {
  min-height: 86px;
  padding: 0.45rem 0.6rem;
  resize: vertical;
}

.chemrytaas-textarea--mono {
  font-family: var(--chemrytaas-mono);
  font-size: 0.88rem;
}

.chemrytaas-textarea--compact {
  min-height: 104px;
}

.chemrytaas-input:focus,
.chemrytaas-select:focus,
.chemrytaas-textarea:focus {
  border-color: #0d6e8a;
  box-shadow: 0 0 0 3px rgba(13, 110, 138, 0.14);
  outline: none;
}

.chemrytaas-input.chemrytaas-input--invalid,
.chemrytaas-select.chemrytaas-input--invalid,
.chemrytaas-textarea.chemrytaas-input--invalid {
  border-color: var(--chemrytaas-error);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.chemrytaas-field-error {
  min-height: 18px;
  color: var(--chemrytaas-error);
  font-size: 0.82rem;
}

.chemrytaas-inline-note {
  padding: 0.7rem 0.85rem;
  border: 1px solid #d9e4ee;
  border-radius: 14px;
  background: #f8fbfd;
}

.chemrytaas-inline-note--error {
  color: var(--chemrytaas-error);
}

.chemrytaas-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #124f75;
  font-weight: 700;
}

.chemrytaas-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(13, 110, 138, 0.18);
  border-top-color: var(--chemrytaas-primary);
  border-radius: 50%;
  animation: chemrytaas-spin 0.8s linear infinite;
}

@keyframes chemrytaas-spin {
  to {
    transform: rotate(360deg);
  }
}

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

.chemrytaas-inline-summary {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.9rem;
  border-top: 1px solid #e5edf4;
}

.chemrytaas-inline-summary[hidden] {
  display: none !important;
}

.chemrytaas-inline-summary__head {
  display: grid;
  gap: 0.15rem;
}

.chemrytaas-summary-item,
.chemrytaas-metric-card,
.chemrytaas-result-panel {
  border: 1px solid #dbe6ee;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.chemrytaas-summary-item {
  display: grid;
  gap: 0.35rem;
  min-height: 54px;
  padding: 0.65rem 0.75rem;
}

.chemrytaas-summary-item--wide {
  grid-column: 1 / -1;
}

.chemrytaas-summary-label,
.chemrytaas-metric-label {
  color: #587087;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.chemrytaas-summary-value {
  color: #17324d;
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.chemrytaas-results-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.chemrytaas-metric-card,
.chemrytaas-result-panel {
  padding: 0.85rem;
}

.chemrytaas-metric-value {
  display: block;
  margin-top: 0.35rem;
  color: #14344b;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.1;
}

.chemrytaas-summary-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chemrytaas-summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid #e7eef4;
}

.chemrytaas-summary-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.chemrytaas-summary-term {
  color: var(--chemrytaas-muted);
  font-weight: 700;
}

.chemrytaas-summary-data {
  color: #17324d;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

.chemrytaas-analysis-grid,
.chemrytaas-calibration-output {
  display: grid;
  gap: 0.75rem;
}

.chemrytaas-analysis-grid {
  grid-template-columns: repeat(4, minmax(150px, max-content));
  align-items: end;
}

.chemrytaas-analysis-grid .chemrytaas-field--wide {
  grid-column: 1 / -1;
  width: min(100%, 760px);
}

.chemrytaas-analysis-grid .chemrytaas-input,
.chemrytaas-analysis-grid .chemrytaas-select {
  max-width: 220px;
}

.chemrytaas-analysis-grid .chemrytaas-field--wide .chemrytaas-input,
.chemrytaas-analysis-grid .chemrytaas-field--wide .chemrytaas-textarea {
  max-width: 760px;
}

.chemrytaas-analysis-grid--two {
  grid-template-columns: minmax(150px, max-content) minmax(150px, max-content);
}

.chemrytaas-field--actions {
  align-self: end;
  display: flex;
  justify-content: flex-start;
  width: max-content;
  max-width: 100%;
}

.chemrytaas-field--actions .chemrytaas-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 88px;
}

.chemrytaas-calibration-equation {
  display: grid;
  gap: 0.4rem;
}

.chemrytaas-graph-shell {
  padding-top: 0.75rem;
}

.chemrytaas-chart-stage {
  position: relative;
}

.chemrytaas-chart-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f1f7fb 100%);
}

.chemrytaas-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 1.25rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f1f7fb 100%);
  color: var(--chemrytaas-muted);
  text-align: center;
}

.chemrytaas-chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  min-width: 140px;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(14, 35, 53, 0.94);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.2);
  color: #f5fbff;
  font-size: 0.82rem;
  pointer-events: none;
  transform: translate(12px, 12px);
}

.chemrytaas-dialog {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
}

.chemrytaas-dialog::backdrop {
  background: rgba(16, 33, 45, 0.45);
}

.chemrytaas-dialog-form {
  padding: 1.35rem;
}

.chemrytaas-dialog-head {
  margin-bottom: 0.9rem;
}

.chemrytaas-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (max-width: 1100px) {
  .chemrytaas-structure-layout,
  .chemrytaas-results-grid,
  .chemrytaas-results-grid--four,
  .chemrytaas-results-detail-grid {
    grid-template-columns: 1fr;
  }

  .chemrytaas-structure-pane + .chemrytaas-structure-pane {
    padding-top: 1.25rem;
    padding-left: 0;
    margin-top: 1.25rem;
    margin-left: 0;
    border-top: 1px solid #e5edf4;
    border-left: 0;
  }

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

  .chemrytaas-analysis-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .chemrytaas-container {
    margin: 1.5rem auto 2.5rem;
    padding-inline: 1rem;
  }

  .chemrytaas-hero,
  .chemrytaas-card-head,
  .chemrytaas-card-actions,
  .chemrytaas-action-bar,
  .chemrytaas-form-tools,
  .chemrytaas-dialog-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chemrytaas-form-grid,
  .chemrytaas-summary-grid-inline {
    grid-template-columns: 1fr;
  }

  .chemrytaas-btn,
  .chemrytaas-hero-link {
    width: 100%;
  }

  .chemrytaas-jsme-shell {
    min-height: 290px;
    height: auto;
  }

  .chemrytaas-jsme {
    min-height: 260px;
    height: 260px;
  }
}
