.chemrytftir-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(13, 78, 102, 0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(20, 80, 66, 0.1), transparent 28%),
    linear-gradient(180deg, #eef4f6 0%, #f7fafb 46%, #edf3f7 100%);
  color: #173447;
}

.chemrytftir-page *,
.chemrytftir-page *::before,
.chemrytftir-page *::after {
  box-sizing: border-box;
}

.chemrytftir-shell {
  width: min(100%, 1120px);
  max-width: 1120px;
  margin: 2rem auto 3rem;
  padding: 0 1.5rem;
}

.chemrytftir-card {
  background: #ffffff;
  border: 1px solid #d8e3ea;
  border-radius: 24px;
  box-shadow: 0 20px 44px rgba(17, 53, 76, 0.08);
}

.chemrytftir-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 1rem;
  padding: 1.35rem 1.6rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #113c5a, #1b6c6c);
  color: #f8fdff;
}

.chemrytftir-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 760px;
}

.chemrytftir-kicker,
.chemrytftir-card-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  font-weight: 700;
}

.chemrytftir-title,
.chemrytftir-card-title,
.chemrytftir-subtitle,
.chemrytftir-helper,
.chemrytftir-field-help,
.chemrytftir-inline-note,
.chemrytftir-chart-caption,
.chemrytftir-confidence-copy,
.chemrytftir-empty-state {
  margin: 0;
}

.chemrytftir-title {
  font-size: 1.55rem;
  line-height: 1.05;
}

.chemrytftir-subtitle {
  font-size: 0.96rem;
  font-weight: 700;
  color: rgba(248, 253, 255, 0.94);
}

.chemrytftir-helper,
.chemrytftir-chart-caption,
.chemrytftir-field-help,
.chemrytftir-inline-note,
.chemrytftir-empty-state {
  color: #5a7488;
  line-height: 1.55;
  font-size: 0.92rem;
}

.chemrytftir-helper {
  color: rgba(248, 253, 255, 0.9);
  max-width: 720px;
}

.chemrytftir-hero-badge {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  min-width: 220px;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.94rem;
  font-weight: 700;
}

.chemrytftir-hero-badge span {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(248, 253, 255, 0.82);
}

.chemrytftir-status {
  margin-bottom: 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 16px;
  border: 1px solid #d6e3ec;
  font-weight: 700;
}

.chemrytftir-status--info {
  background: #ebf6fb;
  color: #1d5b7b;
}

.chemrytftir-status--success {
  background: #ebf8ef;
  color: #1f6944;
}

.chemrytftir-status--warning {
  background: #fff7e8;
  color: #925f13;
}

.chemrytftir-status--error {
  background: #fff0ed;
  color: #9a392f;
}

.chemrytftir-grid {
  display: grid;
  grid-template-columns: minmax(400px, 0.92fr) minmax(540px, 1.08fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.chemrytftir-panel {
  overflow: hidden;
}

.chemrytftir-card-head,
.chemrytftir-card-body {
  padding: 22px 24px;
}

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

.chemrytftir-card-title {
  font-size: 1.16rem;
  color: #173447;
}

.chemrytftir-card-actions,
.chemrytftir-action-group {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.chemrytftir-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

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

.chemrytftir-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.chemrytftir-btn--primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-color: #1d4ed8;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.chemrytftir-btn--secondary {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfd6ff;
}

.chemrytftir-btn--ghost {
  background: #f8fbff;
  color: #30506c;
  border-color: #d3e0eb;
}

.chemrytftir-jsme-shell {
  min-height: 410px;
  padding: 0.9rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #f3f9fb, #edf4f8);
  border: 1px solid #dbe7ef;
}

.chemrytftir-editor {
  width: 100%;
  min-height: 380px;
}

.chemrytftir-field {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}

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

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

.chemrytftir-input,
.chemrytftir-textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 0.88rem;
  border: 1px solid #cfdde7;
  border-radius: 14px;
  background: #fbfdfe;
  color: #173447;
  font-size: 0.95rem;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.chemrytftir-textarea {
  min-height: 92px;
  resize: vertical;
}

.chemrytftir-textarea--mono {
  font-family: Consolas, "Courier New", monospace;
}

.chemrytftir-input:focus,
.chemrytftir-textarea:focus {
  outline: none;
  border-color: #77a7da;
  box-shadow: 0 0 0 4px rgba(75, 131, 196, 0.12);
  background: #fff;
}

.chemrytftir-input[readonly],
.chemrytftir-textarea[readonly] {
  background: #f4f8fb;
}

.chemrytftir-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 0.95rem;
}

.chemrytftir-field-help {
  font-size: 0.82rem;
}

.chemrytftir-inline-note {
  margin-top: 0.9rem;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: #f4f8fb;
}

.chemrytftir-inline-validation {
  margin-top: 0.65rem;
  min-height: 1.3rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #9a392f;
}

.chemrytftir-inline-validation--success {
  color: #1f6944;
}

.chemrytftir-field-error {
  min-height: 1rem;
  font-size: 0.79rem;
  color: #a03f34;
}

.chemrytftir-field--invalid .chemrytftir-input,
.chemrytftir-field--invalid .chemrytftir-textarea,
.chemrytftir-input.chemrytftir-input--invalid {
  border-color: #dc7d71;
  background: #fff7f5;
  box-shadow: 0 0 0 3px rgba(220, 125, 113, 0.12);
}

.chemrytftir-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.chemrytftir-loading {
  font-size: 0.9rem;
  font-weight: 700;
  color: #35576f;
}

.chemrytftir-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chemrytftir-chart-shell {
  padding: 0 1.45rem 1.1rem;
}

.chemrytftir-spectrum-canvas {
  width: 100%;
  min-height: 420px;
  display: block;
  border-radius: 18px;
  border: 1px solid #dfeaf1;
  background: linear-gradient(180deg, #ffffff, #f7fbfd);
}

.chemrytftir-chart-caption {
  padding: 0 1.45rem 1.2rem;
}

.chemrytftir-results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chemrytftir-empty-state {
  padding: 1rem 1.45rem 1.2rem;
}

.chemrytftir-table-wrap {
  padding: 0 1.45rem 1.25rem;
  overflow-x: auto;
}

.chemrytftir-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.chemrytftir-table th,
.chemrytftir-table td {
  padding: 0.72rem 0.5rem;
  border-bottom: 1px solid #e7eef4;
  text-align: left;
}

.chemrytftir-table th {
  color: #446278;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chemrytftir-assignment-list {
  padding: 0 1.45rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.chemrytftir-assignment-card {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: #f7fbfd;
  border: 1px solid #dfeaf1;
}

.chemrytftir-assignment-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.28rem;
  font-weight: 700;
  color: #173447;
}

.chemrytftir-assignment-meta,
.chemrytftir-assignment-note {
  color: #5a7488;
  font-size: 0.88rem;
  line-height: 1.45;
}

.chemrytftir-confidence {
  padding: 1.2rem 1.45rem 1.35rem;
}

.chemrytftir-confidence-value {
  font-size: 2.3rem;
  line-height: 1;
  font-weight: 800;
  color: #114f79;
  margin-bottom: 0.55rem;
}

.chemrytftir-confidence-copy {
  color: #5a7488;
  line-height: 1.55;
}

.chemrytftir-summary {
  padding: 1rem 1.45rem 1.25rem;
}

.chemrytftir-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.chemrytftir-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: #f7fbfd;
  border: 1px solid #e0eaf1;
}

.chemrytftir-summary-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #5f788a;
  font-weight: 800;
}

.chemrytftir-summary-value {
  font-size: 0.92rem;
  color: #173447;
  line-height: 1.45;
}

#chemrytftir-custom-solvent-wrap[hidden] {
  display: none;
}

@media (max-width: 980px) {
  .chemrytftir-grid,
  .chemrytftir-results-grid,
  .chemrytftir-summary-grid,
  .chemrytftir-fields {
    grid-template-columns: 1fr;
  }

  .chemrytftir-action-bar,
  .chemrytftir-hero,
  .chemrytftir-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .chemrytftir-hero-badge {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .chemrytftir-shell {
    padding: 0 1rem;
  }

  .chemrytftir-card-head,
  .chemrytftir-card-body,
  .chemrytftir-chart-shell,
  .chemrytftir-chart-caption,
  .chemrytftir-empty-state,
  .chemrytftir-table-wrap,
  .chemrytftir-assignment-list,
  .chemrytftir-confidence,
  .chemrytftir-summary {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}
