:root {
  --brand-dark: #0f172a;
  --brand-navy: #1e293b;
  --brand-red: #dc2626;
  --brand-orange: #ea580c;
  --brand-yellow: #ca8a04;
  --brand-green: #059669;
  --brand-teal: #0d9488;
  --gradient-warm: linear-gradient(135deg, #dc2626 0%, #ea580c 55%, #ca8a04 100%);
  --gradient-brand: linear-gradient(135deg, #0f766e 0%, #059669 100%);
  --gradient-frame: linear-gradient(135deg, #0f766e, #059669);
  --bg-root: #eef2f7;
  --bg-panel: #ffffff;
  --bg-soft: #f8fafc;
  --bg-blue: #f1f5f9;
  --ink: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --line-strong: #94a3b8;
  --accent: #0d9488;
  --accent-2: #0f766e;
  --accent-link: #0369a1;
  --good: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.06), 0 20px 40px rgba(15, 23, 42, 0.12);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --mono: "Cascadia Mono", "Consolas", monospace;
  --sans: "Montserrat", "Segoe UI", "Aptos", sans-serif;
}

body.dark {
  --bg-root: #0b1120;
  --bg-panel: #151f32;
  --bg-soft: #111827;
  --bg-blue: #131c2e;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #334155;
  --line-strong: #475569;
  --accent: #2dd4bf;
  --accent-2: #14b8a6;
  --accent-link: #38bdf8;
  --good: #34d399;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.25), 0 20px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--bg-root);
}

body.dark {
  background: var(--bg-root);
}

button, .button, select, input, textarea {
  font: inherit;
}

button, .button, .file-button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--ink);
  padding: 7px 11px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

button:hover, .button:hover, .file-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

button.primary, .button.primary {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.01em;
}

button.primary:hover, .button.primary:hover {
  border-color: var(--brand-navy);
  background: var(--brand-navy);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
  color: #ffffff;
}

body.dark button.primary, body.dark .button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-dark);
}

body.dark button.primary:hover, body.dark .button.primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--brand-dark);
}

button.ghost, .button.ghost {
  background: var(--bg-soft);
}

select, input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--bg-panel);
  padding: 7px 9px;
}

select:focus, input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid rgba(13, 148, 136, 0.5);
  outline-offset: 1px;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 210px;
  font-family: var(--mono);
}

pre {
  margin: 0;
  white-space: pre-wrap;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.github-promo-banner {
  position: relative;
  overflow: hidden;
  padding: 12px 20px;
  background: linear-gradient(120deg, #0c4a6e 0%, #0f766e 38%, #059669 72%, #047857 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(15, 118, 110, 0.35);
}

.github-promo-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 120% at 0% 50%, rgba(255, 255, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 100% at 100% 0%, rgba(255, 255, 255, 0.1), transparent 50%);
  pointer-events: none;
}

.github-promo-banner::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: github-promo-shine 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes github-promo-shine {
  0%, 100% { left: -120%; }
  45%, 55% { left: 140%; }
}

.github-promo-banner__inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  max-width: 1180px;
  margin: 0 auto;
}

.github-promo-banner__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.github-promo-banner__icon svg {
  width: 22px;
  height: 22px;
}

.github-promo-banner__copy {
  flex: 1 1 260px;
  min-width: 0;
  text-align: left;
}

.github-promo-banner__headline {
  margin: 0 0 8px;
  font-size: clamp(0.9rem, 1.6vw, 1.02rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.github-promo-banner strong {
  font-weight: 800;
}

.github-promo-banner__highlight {
  display: inline-block;
  padding: 1px 8px;
  margin-left: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 700;
  white-space: nowrap;
}

.github-promo-banner__features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.github-promo-banner__features li {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.github-promo-banner__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: #fff;
  border: none;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.github-promo-banner__cta-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.github-promo-banner__cta:hover {
  transform: translateY(-2px);
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28), inset 0 1px 0 #fff;
}

.github-promo-banner__cta:active {
  transform: translateY(0);
}

@media (max-width: 720px) {
  .github-promo-banner {
    padding: 14px 16px;
  }

  .github-promo-banner__inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .github-promo-banner__icon {
    margin: 0 auto;
  }

  .github-promo-banner__copy {
    text-align: center;
  }

  .github-promo-banner__features {
    justify-content: center;
  }

  .github-promo-banner__cta {
    width: 100%;
  }
}

.beta-banner-layer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.beta-banner-layer[hidden] {
  display: none !important;
}

.beta-banner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.beta-banner {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  padding: 22px 56px 22px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

body.dark .beta-banner {
  background: var(--bg-panel);
  border-color: var(--line);
}

.beta-banner-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.beta-banner-close:hover {
  background: var(--bg-soft);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}

.beta-banner-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 28px;
  flex-wrap: wrap;
}

.beta-banner-copy {
  flex: 1;
  min-width: min(100%, 240px);
}

.beta-banner-title {
  margin: 0 0 6px;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.beta-banner-text {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.beta-banner-cta {
  flex-shrink: 0;
}

.beta-banner-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: min(100%, 300px);
}

.beta-banner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 280px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-dark);
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  line-height: 1.35;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.beta-banner-btn--web {
  background: var(--bg-panel);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: none;
}

.beta-banner-btn--web:hover {
  background: var(--bg-soft);
  border-color: var(--brand-dark);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

body.dark .beta-banner-btn--web {
  background: var(--bg-soft);
  color: var(--ink);
  border-color: var(--line);
}

body.dark .beta-banner-btn--web:hover {
  background: var(--bg-blue);
  border-color: var(--accent);
  color: var(--ink);
}

.beta-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}

body.dark .beta-banner-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-dark);
}

body.dark .beta-banner-btn:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--brand-dark);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

body.dark .topbar {
  background: var(--bg-panel);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-logo {
  height: 52px;
  width: auto;
  display: block;
  border-radius: var(--radius-md);
}

.brand-copy {
  min-width: 0;
}

.tagline-accent {
  display: inline-block;
  width: 24px;
  height: 2px;
  border-radius: 99px;
}

.brand-tagline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

body.dark .brand-tagline {
  color: var(--muted);
}

.tagline-warm {
  background: var(--brand-orange);
}

.tagline-green {
  background: var(--brand-green);
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.brand-auto {
  color: var(--brand-dark);
  font-weight: 800;
}

.brand-chemy {
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

.top-switches {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

.switch {
  width: 44px;
  height: 24px;
  border-radius: 99px;
  padding: 2px;
  background: #cbd5e1;
  position: relative;
}

.switch span {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .16s ease;
}

.switch.is-on {
  background: var(--brand-green);
}

.switch.is-on span {
  transform: translateX(18px);
}

.main-layout {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 16px;
  padding: 0 14px 14px;
}

body.ic-module-active .app-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.ic-module-active .main-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
  align-items: stretch;
}

body.ic-module-active .sidebar {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

body.ic-module-active .workspace {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: calc(100vh - 88px);
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.sidebar-title {
  margin: 0;
  padding: 4px 12px 8px;
  background: transparent;
  color: var(--ink);
  letter-spacing: 0.02em;
  font-size: 24px;
  font-weight: 800;
  text-transform: none;
  display: flex;
  align-items: center;
  gap: 3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.sidebar-nav-label {
  margin: 0 0 8px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-nav-divider {
  height: 1px;
  margin: 14px 12px;
  background: var(--line);
}

.sidebar .nav-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 16px 18px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted);
  border: none;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-btn:hover {
  transform: none;
  border: none;
  box-shadow: none;
  background: var(--bg-soft);
  color: var(--ink);
}

.sidebar .nav-btn.is-active {
  background: rgba(13, 148, 136, 0.1);
  color: var(--accent-2);
  font-weight: 700;
  border: none;
  box-shadow: inset 4px 0 0 var(--accent);
  padding-left: 14px;
}

body.dark .sidebar .nav-btn.is-active {
  background: rgba(45, 212, 191, 0.12);
  color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.sidebar-note {
  margin-top: auto;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.sidebar-note strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.sidebar-note p {
  margin: 0;
}

.sidebar-note em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}

.workspace {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
}

.module {
  display: none;
  pointer-events: none;
}

.module.is-active {
  display: block;
  pointer-events: auto;
}

.project-bar, .module-head, .toolbar, .ref-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.project-bar {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  box-shadow: 0 2px 10px rgba(26, 32, 44, 0.04);
}

.project-bar select, .project-bar input, .ref-row select, .short-input {
  width: auto;
  min-width: 150px;
}

.module-head {
  justify-content: space-between;
}

.module-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

.hint {
  color: var(--muted);
  font-size: 12px;
}

.warning {
  color: var(--warn);
  font-size: 12px;
}

.cm-warning {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

#inputCreator .cm-warning {
  margin: 6px 0 0;
  font-size: 11px;
}

.split.two-cols {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 12px;
}

#inputCreator.is-active {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#inputCreator .project-bar,
#inputCreator .module-head {
  flex-shrink: 0;
  margin-bottom: 8px;
}

#inputCreator .project-bar .hint {
  display: none;
}

#inputCreator .module-head h2 {
  font-size: 18px;
}

#inputCreator .ic-layout {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

#inputCreator .ic-left,
#inputCreator .ic-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 8px 8px 10px;
}

#inputCreator .ic-left {
  display: grid;
  grid-template-rows: auto minmax(100px, min(36%, 300px)) minmax(72px, 1fr) auto;
  gap: 0;
}

#inputCreator .ic-left .tabs {
  flex-shrink: 0;
  padding: 4px;
  margin-bottom: 8px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #e2e8f0;
  scrollbar-width: none;
}

body.dark #inputCreator .ic-left .tabs {
  background: #1a2332;
}

#inputCreator .ic-left .tabs::-webkit-scrollbar {
  display: none;
}

#inputCreator .ic-left .tab {
  flex: 1 1 auto;
  min-width: max-content;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
  transform: none;
}

#inputCreator .ic-left .tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.65);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

#inputCreator .ic-left .tab.is-active {
  background: var(--bg-panel);
  color: var(--accent-2);
  font-weight: 700;
  border: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

#inputCreator .ic-left .tab.is-active:hover {
  background: var(--bg-panel);
  color: var(--accent-2);
  border-color: var(--line);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
  transform: none;
}

body.dark #inputCreator .ic-left .tab.is-active {
  background: var(--bg-panel);
  color: var(--accent);
  border-color: var(--line);
}

body.dark #inputCreator .ic-left .tab.is-active:hover {
  background: var(--bg-panel);
  color: var(--accent);
  border-color: var(--line);
}

#inputCreator .ic-tab-body {
  min-height: 0;
  max-height: none;
  overflow: hidden;
  position: relative;
  padding: 10px;
  border-radius: 12px;
  background: #e8edf3;
  border: 1px solid var(--line);
}

body.dark #inputCreator .ic-tab-body {
  background: #0c1220;
  border-color: var(--line);
}

#inputCreator .ic-tab-body .tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 2px 6px 8px 2px;
  scrollbar-gutter: stable;
}

#inputCreator .ic-tab-body .tab-panel.is-active {
  display: block;
}

/* Input Creator — clean config layout (Theory & Job Type tab) */
#inputCreator .ic-config {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#inputCreator .ic-section {
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

#inputCreator .ic-section + .ic-section {
  margin-top: 10px;
}

#inputCreator .ic-section--last {
  padding-bottom: 12px;
}

#inputCreator .ic-section-title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

#inputCreator .ic-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-top: 0;
}

#inputCreator .ic-field-row + .ic-field-row {
  margin-top: 10px;
}

#inputCreator .ic-field-row--2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

#inputCreator .ic-field-row--3 {
  display: grid;
  grid-template-columns: 88px 110px minmax(0, 1fr);
  align-items: end;
}

#inputCreator .ic-field-row--scan {
  display: none;
}

#inputCreator .ic-options-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 11px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

body.dark #inputCreator .ic-options-card {
  background: #1a2438;
  border-color: var(--line-strong);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}

#inputCreator .scan-atoms-row,
#inputCreator .scan-params-row,
#inputCreator .constraint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

#inputCreator .scan-atoms-row {
  margin-bottom: 12px;
}

#inputCreator .scan-params-row {
  padding-top: 4px;
  border-top: 1px dashed rgba(148, 163, 184, 0.55);
}

#inputCreator .scan-atom-group,
#inputCreator .constraint-atom-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#inputCreator .ic-atom-box {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  min-height: 34px;
  padding: 6px 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

body.dark #inputCreator .ic-atom-box {
  background: var(--bg-soft);
}

#inputCreator .constraint-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

#inputCreator .constraint-row .constraint-type {
  width: auto;
  min-width: 96px;
  flex-shrink: 0;
}

#inputCreator .constraint-row .constraint-del {
  margin-left: auto;
  min-width: 28px;
  padding-inline: 6px;
}

/* Atom picker modal */
.atom-picker-modal-body {
  padding: 12px 16px 16px;
}

.atom-picker-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.atom-picker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.75fr);
  gap: 12px;
  min-height: 420px;
}

.atom-picker-canvas-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-panel);
}

.atom-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.atom-picker-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-2);
}

.atom-picker-canvas {
  flex: 1;
  width: 100%;
  min-height: 360px;
  display: block;
  background: #fff;
}

body.dark .atom-picker-canvas {
  background: #0b1220;
}

.atom-picker-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: 460px;
  background: var(--bg-panel);
}

.atom-picker-item {
  display: grid;
  grid-template-columns: 28px 28px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  box-shadow: none;
  transform: none;
}

.atom-picker-item:hover {
  background: rgba(13, 148, 136, 0.08);
  transform: none;
  box-shadow: none;
}

.atom-picker-item.is-selected {
  background: rgba(13, 148, 136, 0.16);
  font-weight: 700;
}

.atom-picker-idx {
  font-weight: 800;
  color: var(--accent-2);
}

.atom-picker-sym {
  font-weight: 700;
}

.atom-picker-coords {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .atom-picker-layout {
    grid-template-columns: 1fr;
  }

  .atom-picker-list {
    max-height: 220px;
  }
}

#inputCreator .ic-options-hint {
  margin: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

#inputCreator .scan-params-row .ic-field--narrow {
  flex: 1 1 88px;
  min-width: 72px;
}

#inputCreator .ic-field--narrow input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#inputCreator .ic-field-row--inline {
  align-items: center;
  gap: 14px;
}

#inputCreator .ic-label--inline {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
}

#inputCreator .ic-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  margin: 0;
}

#inputCreator .ic-field--grow {
  flex: 1 1 160px;
}

#inputCreator .ic-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.2;
}

#inputCreator .ic-field select,
#inputCreator .ic-field input {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.dark #inputCreator .ic-field select,
body.dark #inputCreator .ic-field input {
  background: var(--bg-soft);
  border-color: var(--line-strong);
}

#inputCreator .ic-field select:focus,
#inputCreator .ic-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

#inputCreator .ic-field-action {
  flex-shrink: 0;
  align-self: flex-end;
  white-space: nowrap;
  min-height: 34px;
  height: 34px;
  line-height: 1;
}

#inputCreator #spinFrame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

#inputCreator #autoSpin {
  height: 28px;
  min-height: 28px;
  padding: 3px 8px;
  font-size: 10px;
}

#inputCreator .ic-note {
  margin: 0;
  align-self: center;
  font-size: 11px;
  line-height: 1.35;
}

#inputCreator .ic-note.warning {
  color: var(--warn);
}

#inputCreator .job-type-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 14px;
}

#inputCreator .job-type-selects {
  display: flex;
  flex: 1 1 240px;
  flex-wrap: wrap;
  gap: 10px 12px;
  min-width: 0;
}

#inputCreator .job-type-selects .ic-field {
  flex: 1 1 140px;
  min-width: 120px;
}

#inputCreator .job-type-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

#inputCreator .option-block {
  margin-top: 0;
}

#inputCreator .option-block:not(:empty) {
  margin-top: 2px;
}

button.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
}

button.btn-xs {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: 0.02em;
  min-height: 0;
  line-height: 1.2;
}

/* xTB tab: full-width focus layout (matches Python xTB focus) */
#inputCreator.ic-xtb-focus .ic-layout {
  grid-template-columns: 1fr;
}

#inputCreator.ic-xtb-focus .ic-preview {
  display: none !important;
}

#inputCreator.ic-xtb-focus .geometry-panel {
  display: none !important;
}

#inputCreator.ic-xtb-focus .ic-tab-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

#inputCreator.ic-xtb-focus .ic-left {
  max-width: none;
  grid-template-rows: auto minmax(120px, 1fr) auto;
}

#inputCreator.ic-xtb-focus #icXtb.tab-panel.is-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#inputCreator.ic-xtb-focus .xtb-tab {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#inputCreator.ic-xtb-focus .xtb-main-grid {
  flex: 1;
  min-height: 0;
}

#inputCreator.ic-xtb-focus .xtb-left-stack,
#inputCreator.ic-xtb-focus .xtb-right-stack {
  min-height: 0;
  overflow: hidden;
}

#inputCreator.ic-xtb-focus .xtb-log-block,
#inputCreator.ic-xtb-focus .xtb-subtabs {
  min-height: 0;
}

#inputCreator.ic-xtb-focus .xtb-right-stack .acv-host {
  flex: 1;
  min-height: 180px;
}

#inputCreator.ic-xtb-focus .xtb-actions-row {
  flex-shrink: 0;
}

#inputCreator .ic-left .form-section {
  margin: 0 0 10px;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

#inputCreator .ic-left .form-section:last-child {
  margin-bottom: 0;
}

#inputCreator .ic-left .form-section h3 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
}

#inputCreator .ic-left .inline-fields,
#inputCreator .ic-left .grid-fields {
  margin-top: 6px;
  gap: 6px;
}

#inputCreator .ic-left .selector-hint,
#inputCreator .ic-left .selector-caption {
  display: none;
}

#inputCreator .ic-left .selector-btn {
  padding: 8px 12px;
  font-size: 13px;
}

#inputCreator .geometry-panel {
  min-height: 0;
  max-height: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#inputCreator .geometry-panel .panel-head {
  padding: 6px 10px;
}

#inputCreator .geometry-panel .panel-head h3 {
  font-size: 13px;
}

#inputCreator .geometry-panel .geom-hint {
  margin: 0 10px 6px;
  font-size: 11px;
  line-height: 1.4;
}

#inputCreator .geometry-panel .geom-hint code {
  font-family: var(--mono);
  font-size: 10px;
}

.script-field.hidden,
.script-local-hint.hidden {
  display: none !important;
}

.script-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.script-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
}

.script-section-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.script-machine-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.script-machine-top label {
  font-weight: 600;
  font-size: 13px;
}

.script-machine-top select {
  width: 100%;
  min-width: 0;
}

.script-machine-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.script-run-notice-lead {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.script-run-notice-list {
  margin: 0 0 12px;
  padding-left: 1.25rem;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.script-run-notice .button {
  display: inline-block;
  text-decoration: none;
}

.script-mode-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 0;
}

.script-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.script-action-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  min-width: 0;
}

.script-action-group-primary {
  border-color: rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.04);
}

.script-action-group-muted {
  background: var(--bg-soft);
}

.script-action-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.script-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.script-action-btns button {
  white-space: nowrap;
}

.script-job-status {
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
}

.script-machine-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.script-machine-row label {
  font-weight: 700;
  font-size: 13px;
}

.script-machine-row select {
  width: auto;
  min-width: 140px;
  flex: 1;
}

.script-mode-select {
  width: 100%;
  font-weight: 600;
}

.script-panel.hidden {
  display: none !important;
}

.script-status-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-soft);
}

.script-status-head {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 13px;
}

.script-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.script-status-main {
  margin-bottom: 6px;
}

.script-status-main #localOrcaStatusText {
  flex: 1;
  min-width: 160px;
  font-size: 13px;
}

.script-status-actions {
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.script-status-spacer {
  flex: 1;
}

.orca-light {
  font-size: 18px;
  font-weight: 700;
}

.orca-light.ok {
  color: var(--good);
}

.orca-light.warn {
  color: var(--warn);
}

.orca-path-select {
  width: auto;
  min-width: 220px;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 11px;
}

.info-btn {
  padding: 2px 6px;
  color: var(--accent);
  font-weight: 700;
}

.script-help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  font-style: italic;
}

.script-help-links a {
  color: var(--accent);
}

.script-resources-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.script-resources-row .cores-input {
  width: 64px;
  margin-left: 6px;
}

.script-local-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
}

.script-btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.local-job-log {
  flex: 1;
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  background: #1e1e1e;
  color: #d9ffd9;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
}

#icScript.is-active,
#icScript.tab-panel.is-active {
  display: flex;
}

.modal.modal-wide {
  width: min(1200px, calc(100vw - 28px));
  max-height: 92vh;
}

.modal.modal-wide .modal-body {
  max-height: calc(92vh - 58px);
}

.modal-body.machine-modal-body {
  padding: 10px 14px 14px;
}

.machine-modal-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(420px, 1.35fr);
  gap: 16px;
  min-height: 520px;
}

.machine-modal-left,
.machine-modal-right {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.machine-form-grid label {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 3px 0;
  font-size: 13px;
}

.machine-form-grid label.machine-form-span {
  grid-template-columns: 1fr;
}

.machine-radio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
  font-size: 13px;
}

.machine-radio-row strong {
  margin-right: 4px;
}

.machine-radio-row.indent {
  padding-left: 18px;
}

.machine-type-block.hidden,
.machine-part-block.hidden,
.machine-script-editor.hidden,
.machine-var-toolbar.hidden,
.machine-part-extra.hidden {
  display: none !important;
}

.machine-part-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-soft);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.machine-part-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.machine-part-table-wrap {
  flex: 1;
  min-height: 120px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
}

.machine-part-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.machine-part-table th,
.machine-part-table td {
  border-bottom: 1px solid var(--line);
  padding: 5px 8px;
  text-align: left;
}

.machine-part-table tr.selected {
  background: rgba(37, 99, 235, 0.12);
}

.machine-part-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.machine-part-form label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.machine-part-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.machine-script-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.machine-script-head strong {
  font-size: 13px;
}

.machine-script-head strong.mode-info {
  color: var(--accent);
}

.machine-parse-feedback {
  margin: 0;
  font-size: 12px;
  color: var(--accent-2);
  min-height: 18px;
}

.machine-var-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.machine-var-toolbar input[type="text"] {
  width: 90px;
}

#machineScriptInput {
  flex: 1;
  min-height: 340px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
}

#machineScriptInput.hidden,
#machineSaveQueueBtn.hidden,
#machineDetectBtn.hidden {
  display: none !important;
}

.machine-modal-right {
  min-height: 520px;
}

.machine-hpc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.machine-hpc-grid label {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.machine-hpc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.modal-actions.machine-modal-actions {
  justify-content: flex-end;
  gap: 8px;
}

#inputCreator .geometry-panel textarea {
  min-height: 0;
  flex: 1 1 auto;
  height: 100%;
  resize: none;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.35;
}

#inputCreator .ic-action-bar {
  flex-shrink: 0;
  flex-grow: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

#inputCreator .ic-action-bar button {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  min-height: 46px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

#inputCreator .ic-action-bar button.primary {
  min-width: 168px;
  padding: 12px 24px;
  font-size: 15px;
}

#inputCreator .ic-preview .panel-head {
  flex-shrink: 0;
  padding: 8px 10px;
}

#inputCreator .ic-preview .panel-head h3 {
  font-size: 14px;
}

#inputCreator .ic-preview-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#inputCreator .ic-preview-code-pane {
  flex: 0 0 var(--ic-preview-split, 50%);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#inputCreator .ic-preview-code-pane .codebox {
  flex: 1;
  min-height: 0;
}

#inputCreator .ic-preview-grip {
  flex-shrink: 0;
  height: 8px;
  margin: 0 6px;
  border-radius: 4px;
  cursor: row-resize;
  background: linear-gradient(180deg, var(--line) 0%, var(--bg-soft) 45%, var(--line) 100%);
  position: relative;
  touch-action: none;
  user-select: none;
}

#inputCreator .ic-preview-grip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--muted) 0 4px,
    transparent 4px 7px
  );
  opacity: 0.55;
}

#inputCreator .ic-preview-grip:hover,
#inputCreator .ic-preview-grip.is-dragging {
  background: linear-gradient(180deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 35%, var(--bg-soft)) 50%, var(--accent) 100%);
}

#inputCreator .ic-preview-structure-pane {
  flex: 1 1 0;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#inputCreator .ic-preview .codebox {
  min-height: 0;
  overflow: auto;
}

#inputCreator .ic-preview .structure-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#inputCreator .ic-preview .structure-head {
  flex-shrink: 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

#inputCreator .ic-preview .structure-head h3 {
  font-size: 13px;
  margin: 0;
}

#inputCreator .ic-preview .structure-head .acv-toolbar {
  margin-bottom: 0;
}

#inputCreator .ic-preview .structure-card canvas {
  flex: 1;
  min-height: 0;
  max-height: 100%;
}

#inputCreator .ic-preview .structure-host {
  flex: 1;
  min-height: 120px;
}

body.ic-preview-resizing {
  cursor: row-resize;
  user-select: none;
}

body.ic-preview-resizing * {
  cursor: row-resize !important;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.stack {
  padding: 10px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3, .form-section h3 {
  margin: 0;
  font-size: 15px;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.tab {
  white-space: nowrap;
  font-size: 13px;
}

.tab.is-active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #ffffff;
  font-weight: 700;
}

body.dark .tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-dark);
}

.tab-panel, .preview {
  display: none;
}

.tab-panel.is-active, .preview.is-active {
  display: block;
}

.form-section {
  margin: 8px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}

.inline-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.inline-fields.wrap, .toolbar.wrap {
  flex-wrap: wrap;
}

.inline-fields label {
  white-space: nowrap;
}

.grid-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

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

.grid-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  color: var(--ink);
}

.check input {
  width: auto;
}

.selector-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 2px groove var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

body.dark .selector-btn {
  background: var(--bg-soft);
  color: var(--accent-2);
}

.selector-btn-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-btn-caret {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  opacity: 0.85;
}

.selector-caption {
  margin: 0 0 6px;
  font-size: 10px;
  color: var(--muted);
}

.selector-hint {
  margin: 0 0 8px;
}

.option-block {
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.info {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(13, 148, 136, 0.12);
  color: var(--accent);
  font-size: 12px;
  cursor: help;
}

.geometry-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.geometry-panel textarea {
  border: 0;
  border-radius: 0;
  min-height: 260px;
}

#inputCreator .geometry-panel textarea {
  min-height: 0;
}

.action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.preview-panel {
  overflow: hidden;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
}

.segmented button {
  border: 0;
  padding: 5px 9px;
}

.segmented button.is-active {
  background: var(--accent);
  color: #fff;
}

.codebox {
  min-height: 0;
  padding: 12px;
  overflow: auto;
  color: #d9ffd9;
  background: #1e1e1e;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}

#inputCreator .ic-preview .codebox {
  min-height: 0;
}

.structure-card {
  padding: 0;
  min-height: 0;
  background: var(--bg-soft);
}

#inputCreator .ic-preview .structure-card {
  padding: 0;
  min-height: 0;
}

.structure-card canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.mini-table {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(48px, 72px) minmax(7.5rem, max-content) auto;
  gap: 6px;
  align-items: center;
}

.mini-row select.mini-kind {
  width: auto;
  min-width: 7.5rem;
  max-width: 100%;
}

.sp-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.sp-file-row .file-button {
  white-space: nowrap;
}

.sp-file-name {
  font-size: 12px;
  color: var(--muted, #64748b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-parse-status {
  margin: 8px 0 0;
  font-size: 12.5px;
  min-height: 16px;
}

.sp-parse-status.ok { color: #0a7a3e; }
.sp-parse-status.warn { color: #b45309; }
body.dark .sp-parse-status.ok { color: #6ee7a8; }
body.dark .sp-parse-status.warn { color: #f0c96a; }

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.input-file-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.input-file-row input {
  flex: 1;
  min-width: 0;
}

.browse-btn {
  flex-shrink: 0;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 7px 10px;
}

.pes-grid {
  display: grid;
  grid-template-rows: minmax(230px, 32vh) minmax(340px, 1fr) auto;
  gap: 12px;
}

.plot-panel-compact {
  min-height: 0;
}

.pes-plot-placeholder {
  padding: 20px 16px;
  text-align: center;
  color: var(--muted, #64748b);
  font-size: 13px;
  line-height: 1.5;
  border: 1px dashed var(--line, #e2e8f0);
  border-radius: 10px;
  background: var(--bg-panel-2, #f8fafc);
}

.pes-plot-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1200;
}

.pes-plot-window {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1280px, calc(100vw - 24px));
  height: min(820px, calc(100vh - 24px));
  max-height: calc(100vh - 24px);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

body.dark .pes-plot-window {
  background: var(--bg-panel);
  border-color: var(--line);
}

.pes-plot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
}

.pes-plot-head h3 {
  margin: 0;
  font-size: 17px;
}

#pesPlotClose,
#manualPlotClose {
  font-size: 22px;
  line-height: 1;
  padding: 4px 10px;
}

.pes-plot-head--with-back {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.pes-plot-head--with-back h3 {
  text-align: center;
}

.pes-back-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-panel-2, #f8fafc);
  color: var(--text);
  cursor: pointer;
}

.pes-back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pes-manual-window {
  z-index: 1202;
}

#manualPlotBackdrop {
  z-index: 1201;
}

.pes-manual-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 0;
  overflow: hidden;
}

.pes-manual-side {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg-panel-2, #f8fafc);
}

body.dark .pes-manual-side {
  background: #0f172a;
}

.pes-manual-side h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.pes-manual-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.pes-manual-row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.pes-manual-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.pes-manual-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.pes-manual-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
}

.pes-manual-canvas-wrap {
  flex: 1;
  min-height: 280px;
}

.pes-manual-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.mini-row .mini-energy {
  max-width: 72px;
}

.pes-manual-side .mini-table {
  gap: 8px;
}

.pes-manual-side .mini-row {
  grid-template-columns: minmax(5rem, 1.5fr) minmax(3.5rem, 0.85fr) minmax(5.5rem, 1fr) 32px;
  gap: 8px;
}

.pes-manual-side .mini-row input {
  width: 100%;
  min-width: 0;
}

.pes-manual-side .mini-row .mini-energy {
  max-width: none;
}

.pes-manual-side .mini-row select.mini-kind {
  min-width: 0;
  width: 100%;
}

.pes-manual-side .mini-row button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  justify-self: end;
}

.pes-plot-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
  font-size: 12px;
}

.pes-plot-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.pes-plot-toolbar select {
  min-width: 0;
  font-size: 12px;
  padding: 4px 6px;
}

.pes-pop-mini {
  width: 88px;
}

.pes-plot-canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #fff;
}

body.dark .pes-plot-canvas-wrap {
  background: #0f172a;
}

.pes-plot-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

.pes-plot-drag-hint {
  position: absolute;
  left: 12px;
  bottom: 8px;
  margin: 0;
  padding: 4px 10px;
  font-size: 11px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}

body.dark .pes-plot-drag-hint {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.88);
}

.pes-step-dialog .pes-step-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.pes-step-dialog .pes-step-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
}

.pes-step-dialog .pes-step-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.pes-step-dialog .pes-step-actions #pesStepAdd {
  margin-right: auto;
}

.pes-plot-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 12px;
  border-top: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
  font-size: 12px;
}

.pes-plot-footer label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.table-wrap {
  overflow: auto;
  height: calc(100% - 45px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-blue);
}

tr.selected {
  background: rgba(37, 99, 235, 0.16);
}

tr.error-row {
  background: #fee2e2;
}

.flow-panel, .plot-panel {
  overflow: hidden;
}

.canvas-host {
  width: 100%;
  height: calc(100% - 45px);
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
}

body.dark .canvas-host {
  background: #0f172a;
}

.canvas-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.flow-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.flow-toolbar button {
  padding: 4px 9px;
  font-size: 12px;
}

.flow-toolbar button.is-active {
  background: var(--brand-dark);
  color: #ffffff;
  border-color: var(--brand-dark);
  font-weight: 700;
}

body.dark .flow-toolbar button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-dark);
}

.flow-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line, #e2e8f0);
  margin: 2px 4px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.45);
}

.modal {
  position: fixed;
  z-index: 100;
  top: 7vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, calc(100vw - 28px));
  max-height: 86vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
}

.modal-body {
  padding: 14px;
  max-height: calc(86vh - 58px);
  overflow: auto;
}

.selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.selector-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.selector-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selector-mode {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink);
}

.selector-mode input {
  width: auto;
}

.selector-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 180px;
  font-size: 12px;
  color: var(--ink);
}

.selector-search input {
  min-width: 0;
}

.selector-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.selector-group {
  min-width: 180px;
  max-width: 240px;
  flex: 1 1 180px;
}

.selector-group-title {
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 13px;
}

.selector-group-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choice-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  cursor: pointer;
}

.choice-card.is-recommended {
  background: #dcfce7;
  border-color: #22c55e;
}

body.dark .choice-card.is-recommended {
  background: rgba(34, 197, 94, 0.16);
  border-color: #22c55e;
}

.choice-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.choice-card strong {
  color: var(--accent);
}

.choice-info {
  color: var(--accent);
  cursor: help;
  font-size: 14px;
}

.choice-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.choice-card-actions button {
  padding: 3px 8px;
  font-size: 11px;
}

.choice-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-form {
  display: grid;
  gap: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.pes-mode-intro {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.pes-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.pes-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.pes-mode-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.pes-mode-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.pes-mode-card-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.pes-mode-card-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
}

body.dark .pes-mode-card {
  background: #1e293b;
}

@media (max-width: 640px) {
  .pes-mode-grid {
    grid-template-columns: 1fr;
  }
}

.about-module {
  min-height: calc(100vh - 88px);
}

.about-scroll {
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  padding: 32px 40px 56px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.14), transparent 42%),
    radial-gradient(circle at 85% 8%, rgba(16, 185, 129, 0.12), transparent 38%),
    linear-gradient(180deg, #fafbfd 0%, #f1f5f9 100%);
  box-shadow: var(--shadow);
}

body.dark .about-scroll {
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.18), transparent 42%),
    radial-gradient(circle at 85% 8%, rgba(16, 185, 129, 0.12), transparent 38%),
    linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
}

.about-page {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 12px 12px 8px;
}

.about-logo {
  display: block;
  max-width: min(420px, 62%);
  max-height: 120px;
  width: auto;
  height: auto;
  margin-bottom: 4px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.about-logo-fallback {
  font-size: 48px;
  line-height: 1;
}

.about-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.dark .about-pill {
  background: var(--bg-soft);
  border-color: var(--line);
  color: var(--accent);
}

.about-hero-kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

body.dark .about-hero-kicker {
  color: #94a3b8;
}

.about-hero-headline {
  margin: 0;
  max-width: 820px;
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  line-height: 1.08;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.about-hero-headline span {
  display: inline;
  font-weight: 700;
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.dark .about-hero-headline {
  color: #f8fafc;
}

.about-hero-sub {
  margin: 0;
  max-width: 720px;
  font-size: 16px;
  line-height: 1.65;
  color: #475569;
}

body.dark .about-hero-sub {
  color: #cbd5e1;
}

.about-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@keyframes about-tile-float {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.08), 0 8px 16px rgba(15, 23, 42, 0.04);
  }
  50% {
    transform: translateY(-10px);
    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.14), 0 12px 24px rgba(15, 23, 42, 0.08);
  }
}

@keyframes about-tile-float-dark {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28), 0 8px 16px rgba(0, 0, 0, 0.16);
  }
  50% {
    transform: translateY(-10px);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.38), 0 12px 24px rgba(0, 0, 0, 0.22);
  }
}

.about-feature-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.92);
  animation: about-tile-float 5s ease-in-out infinite;
  will-change: transform, box-shadow;
}

.about-feature-card:nth-child(1) { animation-delay: 0s; }
.about-feature-card:nth-child(2) { animation-delay: 0.8s; }
.about-feature-card:nth-child(3) { animation-delay: 1.6s; }
.about-feature-card:nth-child(4) { animation-delay: 2.4s; }

.about-feature-card:hover {
  animation-play-state: paused;
  transform: translateY(-12px);
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.16), 0 14px 28px rgba(15, 23, 42, 0.1);
}

body.dark .about-feature-card {
  background: rgba(22, 32, 51, 0.92);
  border-color: rgba(148, 163, 184, 0.16);
  animation-name: about-tile-float-dark;
}

body.dark .about-feature-card:hover {
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.42), 0 14px 28px rgba(0, 0, 0, 0.26);
}

.about-feature-card h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

body.dark .about-feature-card h3 {
  color: #f8fafc;
}

.about-feature-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: #475569;
}

body.dark .about-feature-card p {
  color: #cbd5e1;
}

.about-feature-btn {
  align-self: flex-start;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-dark);
  background: var(--brand-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.about-feature-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}

body.dark .about-feature-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-dark);
}

body.dark .about-feature-btn:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--brand-dark);
}

.about-team-block {
  padding: 32px 24px 28px;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

body.dark .about-team-block {
  background: rgba(22, 32, 51, 0.82);
  border-color: rgba(148, 163, 184, 0.16);
}

.about-team-heading {
  margin: 0 0 24px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}

body.dark .about-team-heading {
  color: #f8fafc;
}

.about-team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.about-team-card {
  width: 220px;
  padding: 20px 16px 18px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.92);
  animation: about-tile-float 5s ease-in-out infinite;
  will-change: transform, box-shadow;
}

.about-team-card:nth-child(1) { animation-delay: 0s; }
.about-team-card:nth-child(2) { animation-delay: 0.8s; }
.about-team-card:nth-child(3) { animation-delay: 1.6s; }

.about-team-card:hover {
  animation-play-state: paused;
  transform: translateY(-12px);
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 32px 64px rgba(15, 23, 42, 0.16), 0 14px 28px rgba(15, 23, 42, 0.1);
}

body.dark .about-team-card {
  background: rgba(22, 32, 51, 0.92);
  border-color: rgba(148, 163, 184, 0.16);
  animation-name: about-tile-float-dark;
}

body.dark .about-team-card:hover {
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.42), 0 14px 28px rgba(0, 0, 0, 0.26);
}

.about-team-photo-wrap {
  overflow: hidden;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.about-team-photo-wrap--white {
  background: #ffffff;
}

body.dark .about-team-photo-wrap--white {
  background: #ffffff;
}

.about-team-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.about-team-photo-wrap--white .about-team-photo {
  object-fit: contain;
  object-position: center center;
  background: #ffffff;
}

.about-team-name {
  margin: 14px 0 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

body.dark .about-team-name {
  color: #f8fafc;
}

.about-team-modules {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}

body.dark .about-team-modules {
  color: #cbd5e1;
}

.about-team-label {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2563eb;
}

body.dark .about-team-label {
  color: #60a5fa;
}

.about-team-thanks {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
}

body.dark .about-team-thanks {
  color: #cbd5e1;
}

@media (prefers-reduced-motion: reduce) {
  .about-feature-card {
    animation: none;
  }

  .about-team-card {
    animation: none;
  }

  .github-promo-banner::after {
    animation: none;
  }

  .github-promo-banner__cta:hover {
    transform: none;
  }
}

@media (max-width: 1050px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    min-height: auto;
  }
  .split.two-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #inputCreator .ic-field-row--3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #inputCreator .ic-field-row--3 .ic-field--grow {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar, .project-bar, .module-head, .ref-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .grid-fields, .grid-fields.compact {
    grid-template-columns: 1fr;
  }
  .inline-fields {
    align-items: stretch;
    flex-direction: column;
  }
  #inputCreator .ic-field-row--2,
  #inputCreator .ic-field-row--3 {
    grid-template-columns: 1fr;
  }
  #inputCreator .job-type-bar {
    flex-direction: column;
    align-items: stretch;
  }
  #inputCreator .job-type-actions {
    justify-content: flex-end;
  }
  .action-row {
    flex-wrap: wrap;
  }
  .about-scroll {
    padding: 24px 16px 32px;
  }
  .about-feature-grid {
    grid-template-columns: 1fr;
  }
  .about-feature-card {
    animation: none;
  }
  .about-team-card {
    animation: none;
  }
  .about-team-grid {
    flex-direction: column;
    align-items: center;
  }
  .beta-banner-layer {
    padding: 14px;
  }
  .beta-banner {
    padding: 20px 48px 20px 18px;
  }
  .beta-banner-body {
    flex-direction: column;
    align-items: stretch;
  }
  .beta-banner-actions {
    width: 100%;
    min-width: 0;
  }
  .beta-banner-btn {
    width: 100%;
    min-width: 0;
  }
}

/* AutoChemy Viewer (ACV) */
.acv-host {
  position: relative;
  flex: 1;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-panel);
}

.acv-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  cursor: grab;
}

.acv-host canvas:active {
  cursor: grabbing;
}

.acv-host.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.acv-toolbar,
.xtb-viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.acv-toolbar button,
.xtb-viewer-toolbar button {
  font-size: 12px;
  padding: 4px 8px;
}

.structure-card {
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.structure-host {
  flex: 1;
  min-height: 280px;
}

.xtb-viewer-toggle.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* xTB Pre-submission tab */
.xtb-tab {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 520px;
}

.xtb-top-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.xtb-top-left h3 {
  margin: 0 0 6px;
}

.xtb-warn {
  margin: 0;
  font-size: 12px;
  color: #b45309;
  max-width: 520px;
  line-height: 1.45;
}

.xtb-top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.xtb-credit {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.xtb-local-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(13, 148, 136, 0.35);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: rgba(13, 148, 136, 0.07);
}

.xtb-local-notice-copy {
  flex: 1;
  min-width: min(100%, 260px);
}

.xtb-local-notice-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.xtb-local-notice-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.xtb-download-dialog .xtb-download-lead {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--ink);
}

.xtb-setup-dialog .xtb-setup-lead {
  margin: 0 0 14px;
  line-height: 1.5;
  color: var(--muted);
}

.xtb-setup-panel {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(13, 148, 136, 0.35);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  background: rgba(13, 148, 136, 0.05);
}

.xtb-setup-panel .xtb-setup-lead {
  margin: 0 0 14px;
  line-height: 1.5;
  color: var(--ink);
  font-size: 14px;
}

.xtb-setup-os-hint {
  margin-bottom: 10px !important;
  color: var(--ink) !important;
}

#xtbPreviewWorkspace[hidden] {
  display: none !important;
}

.xtb-setup-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.xtb-setup-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--surface);
}

.xtb-setup-card--primary {
  border-color: rgba(13, 148, 136, 0.45);
  background: rgba(13, 148, 136, 0.05);
}

.xtb-setup-card-head {
  margin-bottom: 8px;
}

.xtb-setup-card-head h4 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

.xtb-setup-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0a7a3e;
  background: #ecfbf2;
  border: 1px solid #9fd4b8;
}

.xtb-setup-card p {
  margin: 0 0 10px;
  line-height: 1.5;
  color: var(--muted);
  font-size: 13px;
}

.xtb-setup-server-ok {
  color: #9a6700 !important;
}

.xtb-setup-steps {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.xtb-setup-path-row label {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.xtb-setup-path-row input {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.xtb-setup-path-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.xtb-setup-path-status {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.xtb-setup-path-status.ok {
  color: #0a7a3e;
}

.xtb-setup-path-status.err {
  color: #b42318;
}

.xtb-setup-path-status.pending {
  color: var(--muted);
}

.xtb-download-dialog p {
  margin: 0 0 10px;
  line-height: 1.5;
  color: var(--muted);
}

.xtb-download-list {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--ink);
  line-height: 1.55;
}

.xtb-download-actions {
  margin-top: 16px;
  flex-wrap: wrap;
}

.xtb-run-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.xtb-run-btn {
  font-weight: 600;
  padding: 8px 16px;
}

.xtb-method-label {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.xtb-job-label {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}

.xtb-backend-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xtb-backend-status.ok {
  color: #0a7a3e;
  border-color: #9fd4b8;
  background: #ecfbf2;
}

.xtb-backend-status.warn {
  color: #9a6700;
  border-color: #e6c878;
  background: #fff8e6;
}

.xtb-backend-status.off,
.xtb-backend-status.pending {
  color: var(--muted);
  background: var(--panel-2, #f5f5f5);
}

.xtb-backend-status.is-clickable {
  cursor: pointer;
}

.xtb-backend-status.is-clickable:hover {
  filter: brightness(0.97);
  text-decoration: underline;
}

body.dark .xtb-backend-status.ok {
  color: #6ee7a8;
  border-color: #1f6b45;
  background: #0f2a1c;
}

body.dark .xtb-backend-status.warn {
  color: #f0c96a;
  border-color: #7a5a12;
  background: #2a220f;
}

.xtb-main-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
  gap: 12px;
  flex: 1;
  min-height: 380px;
}

.xtb-left-stack,
.xtb-right-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  gap: 8px;
}

.xtb-log-block {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

.xtb-log-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 13px;
}

.xtb-console {
  flex: 1;
  min-height: 140px;
  margin: 0;
  padding: 8px 10px;
  background: #1e1e1e;
  color: #00ff00;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.xtb-subtabs {
  flex: 1;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-soft);
}

.xtb-subtab-bar {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}

.xtb-subtab-bar button {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.xtb-subtab-bar button.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.xtb-data-panel {
  flex: 1;
  min-height: 100px;
  margin: 0;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  border: none;
  resize: none;
  background: var(--bg-panel);
  display: none;
}

.xtb-data-panel.is-active {
  display: block;
}

.xtb-viewer-tabs {
  display: flex;
  gap: 4px;
}

.xtb-viewer-tabs button {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px 8px 0 0;
}

.xtb-viewer-tabs button.is-active {
  background: var(--brand-dark);
  color: #ffffff;
  border-color: var(--brand-dark);
  font-weight: 700;
}

body.dark .xtb-viewer-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-dark);
}

.xtb-view-panel {
  flex: 1;
  min-height: 260px;
  display: none;
  flex-direction: column;
}

.xtb-view-panel.is-active {
  display: flex;
}

.xtb-toolbar-label {
  font-size: 12px;
  color: var(--muted);
}

.xtb-scan-canvas {
  flex: 1;
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-panel);
}

.xtb-use-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 6px;
}

.xtb-folder-path {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.xtb-actions-row {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.xtb-ext-dropdown {
  position: relative;
}

.xtb-ext-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  z-index: 20;
  min-width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
}

.xtb-ext-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.xtb-ext-menu button:hover {
  background: var(--bg-soft);
}

.xtb-right-stack .acv-host {
  flex: 1;
  min-height: 260px;
}

@media (max-width: 960px) {
  .xtb-main-grid {
    grid-template-columns: 1fr;
  }
  .xtb-top-head {
    flex-direction: column;
  }
  .xtb-top-right {
    align-items: flex-start;
  }
}

/* ── AutoChemy brand theme polish ── */
.sidebar-title .brand-auto {
  color: var(--ink);
}

.sidebar-title .brand-chemy {
  background: var(--gradient-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel-head h3, .form-section h3, .pes-plot-head h3, .modal-head h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.form-section h3 {
  font-size: 14px;
}

a:not(.button):not(.nav-btn):not(.beta-banner-btn):not(.about-feature-btn):not(.github-promo-banner__cta) {
  color: var(--accent-link);
  font-weight: 600;
}

a:not(.button):not(.nav-btn):not(.beta-banner-btn):not(.about-feature-btn):hover {
  color: var(--accent);
}

table th {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  border-bottom: 2px solid var(--line);
}

body.dark table th {
  color: var(--ink);
  background: var(--bg-soft);
}

.species-table tr.selected, .data-table tr.selected {
  background: rgba(13, 148, 136, 0.1);
}

.about-hero-headline {
  color: var(--ink);
}

.about-hero-sub {
  color: var(--muted);
}

.status-pill.ok {
  background: rgba(5, 150, 105, 0.12);
  color: var(--good);
  border-color: rgba(5, 150, 105, 0.3);
}

.status-pill.warn {
  background: rgba(217, 119, 6, 0.1);
  color: var(--warn);
}

.hint, .muted, .selector-caption {
  color: var(--muted);
}

.panel {
  border-color: var(--line);
}

.project-bar {
  border-color: var(--line);
  background: var(--bg-panel);
}

/* 3D Visualizer module */
body.acv3d-module-active .main-layout {
  height: calc(100vh - 88px);
  max-height: calc(100vh - 88px);
  overflow: hidden;
  align-items: stretch;
}

body.acv3d-module-active .sidebar {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
}

body.acv3d-module-active .workspace {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#acv3dVisualizer.is-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#acv3dVisualizer .module-head {
  margin-bottom: 12px;
  flex-shrink: 0;
}

#acv3dVisualizer .module-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.acv3d-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.acv3d-input-pane,
.acv3d-view-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.acv3d-input-head {
  flex-wrap: wrap;
  gap: 8px;
}

.acv3d-input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.acv3d-xyz-input {
  flex: 1;
  min-height: 200px;
  width: 100%;
  resize: vertical;
  margin-top: 6px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
  color: var(--text);
}

.acv3d-status {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.acv3d-host {
  flex: 1;
  min-height: 0;
}

.acv3d-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .acv3d-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .acv3d-host {
    min-height: 300px;
  }
}

/* ── Mobile & touch-friendly layout ── */
@media (max-width: 1050px) {
  .sidebar {
    min-height: auto;
    padding: 10px 12px;
    gap: 0;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  body.ic-module-active .main-layout,
  body.ic-module-active .sidebar,
  body.ic-module-active .workspace,
  #inputCreator.is-active {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #inputCreator .ic-left,
  #inputCreator .ic-preview {
    height: auto;
    overflow: visible;
  }

  .sidebar-title,
  .sidebar-nav-label,
  .sidebar-nav-divider,
  .sidebar-note {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    gap: 6px;
    padding: 2px 0;
  }

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

  .sidebar .nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    padding: 10px 16px;
    white-space: nowrap;
    scroll-snap-align: start;
    text-align: center;
    border-radius: 10px;
  }

  .sidebar .nav-btn.is-active {
    padding-left: 16px;
    box-shadow: inset 0 -3px 0 var(--accent);
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
  }

  .brand-logo {
    height: 40px;
    flex-shrink: 0;
  }

  .brand-sub {
    display: none;
  }

  .brand-tagline {
    font-size: 9px;
    letter-spacing: 0.06em;
    gap: 6px;
    flex-wrap: wrap;
  }

  .tagline-accent {
    display: none;
  }

  .top-switches {
    flex-shrink: 0;
    font-size: 12px;
  }

  .main-layout {
    padding: 0 8px 10px;
    gap: 8px;
  }

  body.ic-module-active .main-layout,
  body.ic-module-active .sidebar,
  body.ic-module-active .workspace,
  #inputCreator.is-active {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #inputCreator .ic-left,
  #inputCreator .ic-preview {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #inputCreator .ic-tab-body {
    flex: none;
    max-height: min(52vh, 420px);
    min-height: 200px;
  }

  #inputCreator .ic-preview-body {
    min-height: min(70vh, 560px);
  }

  #inputCreator .ic-left .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  #inputCreator .ic-left .tabs::-webkit-scrollbar {
    display: none;
  }

  #inputCreator .ic-left .tab {
    flex: 0 0 auto;
    min-width: max-content;
    scroll-snap-align: start;
    min-height: 40px;
    padding: 10px 14px;
  }

  .split.two-cols {
    grid-template-columns: 1fr;
  }

  .project-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }

  .project-bar > label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 0;
  }

  .project-bar select,
  .project-bar input,
  .project-bar button,
  .project-bar .hint,
  .project-bar .file-button {
    width: 100%;
    min-width: 0;
  }

  .project-bar .hint {
    grid-column: 1 / -1;
    font-size: 11px;
    line-height: 1.45;
  }

  .module-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .module-head h2 {
    font-size: 18px;
  }

  .head-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .head-actions > * {
    flex: 1 1 auto;
    min-width: min(100%, 140px);
    text-align: center;
    justify-content: center;
  }

  .toolbar.wrap {
    gap: 6px;
  }

  .toolbar.wrap button,
  .toolbar.wrap .file-button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    text-align: center;
    justify-content: center;
  }

  .ref-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .ref-row label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }

  .ref-row select {
    width: 100%;
    min-width: 0;
  }

  .ref-row .hint {
    width: 100%;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .panel-head > div,
  .panel-head .segmented,
  .panel-head .flow-toolbar,
  .panel-head .acv-toolbar,
  .panel-head .acv3d-input-actions {
    width: 100%;
  }

  .segmented {
    width: 100%;
    justify-content: stretch;
  }

  .segmented button {
    flex: 1 1 50%;
    min-height: 40px;
    text-align: center;
  }

  .flow-toolbar {
    gap: 6px;
  }

  .flow-toolbar button {
    min-height: 40px;
    padding: 8px 10px;
  }

  .pes-grid {
    grid-template-rows: auto;
    gap: 10px;
  }

  .species-panel {
    min-height: 0;
  }

  .species-panel .table-wrap {
    height: auto;
    max-height: min(50vh, 360px);
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .flow-panel .canvas-host {
    height: min(50vh, 380px);
    min-height: 260px;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .action-row button,
  .action-row .file-button,
  .action-row .xtb-ext-dropdown {
    width: 100%;
  }

  #inputCreator .ic-action-bar button.primary {
    min-width: 0;
    width: 100%;
  }

  .grid-fields.compact {
    grid-template-columns: 1fr;
  }

  .mini-row {
    grid-template-columns: minmax(0, 1fr) minmax(48px, 72px) minmax(7.5rem, max-content) auto;
  }

  .script-machine-top {
    grid-template-columns: 1fr;
  }

  .script-action-bar {
    flex-direction: column;
  }

  .script-action-group {
    width: 100%;
  }

  .script-action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .script-action-btns button {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
  }

  .script-status-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .script-resources-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .xtb-run-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .xtb-viewer-toolbar {
    gap: 6px;
  }

  .xtb-viewer-toolbar button,
  .xtb-viewer-toolbar select {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    min-height: 40px;
  }

  .xtb-local-notice {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .xtb-use-row {
    flex-direction: column;
    align-items: stretch;
  }

  .xtb-use-row button {
    width: 100%;
  }

  .acv3d-input-head {
    flex-direction: column;
    align-items: stretch;
  }

  .acv3d-input-actions button,
  .acv3d-input-actions .file-button {
    flex: 1 1 calc(50% - 3px);
  }

  .pes-plot-window {
    left: 0;
    top: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .pes-manual-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .pes-manual-side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 38vh;
  }

  .pes-plot-toolbar,
  .pes-plot-footer {
    gap: 8px;
    padding: 10px 12px;
  }

  .pes-plot-toolbar label,
  .pes-plot-footer label {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .pes-plot-toolbar select,
  .pes-plot-footer select,
  .pes-plot-footer input {
    width: 100%;
  }

  .pes-plot-footer button {
    flex: 1 1 calc(50% - 4px);
    min-height: 44px;
  }

  .pes-plot-drag-hint {
    display: none;
  }

  .modal {
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .modal-body {
    max-height: calc(100dvh - 58px);
    -webkit-overflow-scrolling: touch;
  }

  .modal.modal-wide {
    width: 100%;
  }

  .selector-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .selector-search {
    width: 100%;
    min-width: 0;
  }

  .selector-group {
    max-width: none;
    flex: 1 1 100%;
  }

  .atom-picker-layout {
    min-height: auto;
  }

  .atom-picker-canvas {
    min-height: 240px;
  }

  .about-scroll {
    padding: 20px 12px 32px;
    border-radius: 14px;
  }

  .about-team-card {
    width: min(100%, 260px);
  }

  .about-team-photo-wrap {
    width: min(200px, 72vw);
    height: min(200px, 72vw);
  }

  button,
  .button,
  .file-button,
  select,
  input,
  textarea {
    font-size: 16px;
  }

  button.btn-sm {
    font-size: 14px;
    min-height: 40px;
  }

  button,
  .button,
  .file-button {
    min-height: 44px;
  }

  .switch {
    width: 48px;
    height: 28px;
  }

  .switch span {
    width: 24px;
    height: 24px;
  }

  .switch.is-on span {
    transform: translateX(20px);
  }
}

@media (max-width: 480px) {
  .brand-tagline {
    display: none;
  }

  .project-bar {
    grid-template-columns: 1fr;
  }

  .toolbar.wrap button,
  .toolbar.wrap .file-button {
    flex: 1 1 100%;
  }

  .pes-plot-toolbar label,
  .pes-plot-footer label,
  .pes-plot-footer button {
    flex: 1 1 100%;
  }

  #inputCreator .ic-field-row--3 {
    grid-template-columns: 1fr;
  }
}

@media (hover: none) and (pointer: coarse) {
  button:hover,
  .button:hover,
  .file-button:hover,
  .beta-banner-btn:hover,
  .beta-banner-btn--web:hover {
    transform: none;
  }
}
