
#calcResult {
font-size: var(--fs-base);
}

.calcButton {
font-size: var(--fs-base);
  background: var(--bg-color);
  border: 2px solid var(--line-1);
  color: var(--fg-1);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
}
#connectBtn{
font-size: var(--fs-base);
  background: var(--bg-color);
  border: 2px solid var(--line-1);
    color: var(--fg-1);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
}

#disconnectBtn{
font-size: var(--fs-base);
background: var(--bg-color);
border: 2px solid var(--line-1);
  color: var(--fg-1);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
}

.calcButton:hover {
  background: var(--bg-color);
  border-color: var(--border-color);
  border: 2px solid var(--fg-3);
  box-shadow: 0 2px 10px var(--highlight-color);
}

#disconnectBtn:hover {
  background: var(--bg-color);
  border-color: var(--border-color);
  border: 2px solid var(--fg-3);
  box-shadow: 0 2px 10px var(--highlight-color);
}

#connectBtn:hover {
  background: var(--bg-color);
  border-color: var(--border-color);
  border: 2px solid var(--fg-3);
  box-shadow: 0 2px 10px var(--highlight-color);
}




.backend-control-group {
  font-size: var(--fs-base);
  max-width: 360px;
  margin: 0 0 var(--sp-5) 0;
  padding: 20px;
  background: var(--group-bg);
  border-radius: var(--radius-12);
  border: 1px solid var(--line-1);
  backdrop-filter: blur(10px);
}

/* Persistent potential picker sits directly above the Relax/MD switch; give it
   a clear gap so the two control groups don't read as one crowded block. */
#BackendPotentialSelector {
  margin-bottom: var(--sp-4);
}

.backend-control-group h1 {
  margin: 0 0 var(--sp-5) 0;
  color:  var(--warn);
  font-size: var(--fs-xl);
  font-weight: var(--fw-medium);
}

.backend-control-group h3 {
  margin: 0 0 var(--sp-5) 0;
  color: var(--bg-color);
  font-size: var(--fs-xl);
  font-weight: var(--fw-medium);
}

.acceptBtn {
 font-size: var(--fs-base);
  background: var(--bg-color);
  border: 2px solid var(--line-1);
  color: var(--fg-1);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
}


.acceptBtn:hover {
  background: var(--bg-color);
  border-color: var(--border-color);
  border: 2px solid var(--line-1);
  box-shadow: 0 2px 10px var(--highlight-color);
}

.denyBtn {
font-size: var(--fs-base);
  background: var(--bg-color);
  border: 2px solid var(--line-1);
  color: var(--fg-1);
  padding: var(--sp-3);
  border-radius: var(--radius-md);
}

.denyBtn:hover {
  border-color: var(--warn-soft);
  border: 2px solid var(--warn-soft);
  box-shadow: 0 2px 10px var(--danger);
}

.collision-warning-banner {
  background: rgb(var(--danger-rgb) / 0.18);
  border: 1px solid var(--danger);
  color: var(--fg-1);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-3-5);
  margin-top: var(--sp-3-5);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

.collision-warning-banner strong {
  color: rgb(var(--danger-rgb) / 1);
}

.collision-warning-banner ul {
  margin: var(--sp-1) 0 0 0;
  padding-left: 18px;
}

.add-anyway-btn {
  background: var(--danger) !important;
}

.add-anyway-btn:hover {
  background: rgb(var(--danger-rgb) / 1) !important;
}

/* Row in an atom-table editor flagged by AtomCollisionCheck.js as too close
   to another atom - lets the user find and fix it directly instead of only
   reading the warning banner text. */
.atom-row-conflict td {
  background: rgb(var(--danger-rgb) / 0.14);
}

.atom-row-conflict input {
  border-color: var(--danger) !important;
}

/* Coordinate/lattice number fields in the Add Atom / Add Structure panels -
   hide the native up/down spinner buttons (scoped to these; other numeric
   inputs app-wide, e.g. supercell nx/ny/nz, keep theirs). */
.coord-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Atom-table editor (AtomTableInput.js): scrolls after ~5 rows, with a
   slim green scrollbar matching the app's accent color. */
.atoms-table-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--highlight-color) var(--wash-1-5);
}

.atoms-table-scroll::-webkit-scrollbar {
  width: 8px;
}

.atoms-table-scroll::-webkit-scrollbar-track {
  background: var(--wash-1-5);
  border-radius: var(--radius-4);
}

.atoms-table-scroll::-webkit-scrollbar-thumb {
  background: var(--highlight-color);
  border-radius: var(--radius-4);
}

.atoms-table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.coord-input::-webkit-inner-spin-button,
.coord-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.segmented-backend-control {
  display: flex;
  flex-wrap: nowrap;
  background: var(--chrome-1);
  padding: 5px;
  border-radius: var(--radius-md);
  gap: var(--sp-1);
  margin-bottom: var(--sp-3-5);
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.segmented-backend-control button {
  border: none;
  background: none;
  color: var(--fg-75);
  padding: var(--sp-2) var(--sp-2);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  cursor: pointer;
  font-weight: var(--fw-medium);
  min-width: 0;
  flex: 1 1 0;
  white-space: normal;
  line-height: 1.2;
  overflow-wrap: break-word;
  text-align: center;
}

.segmented-backend-control button:hover {
  background: var(--hover-color);

}

.segmented-backend-control button.active {
  background: var(--accent-color);
  color: var(--fg-1);
  font-weight: var(--fw-medium);
}
.segmented-backend-control button.relax {
  background: var(--accent-color);
  color: var(--fg-1);
  font-weight: var(--fw-medium);
}

.segmented-backend-control button.md {
  background: var(--accent-color);
  color: var(--fg-1);
  font-weight: var(--fw-medium);
}

#BackendCalcPanel:empty {
  display: none;
}

#BackendCalcPanel:not(:empty) {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  margin: 0;
}

.atomistic-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.atomistic-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-3);
}

.atomistic-header-row h2 {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.backend-potential-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--chrome-1-9); /* was rgba(17, 17, 17, 0.9) — near-dupe folded into the rung */
  border: 1px solid var(--line-1);
  box-shadow: inset 0 1px 0 var(--wash-0);
}

.backend-potential-toggle button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-75);
  padding: var(--sp-2) 13px;
  border-radius: var(--radius-9);
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  cursor: pointer;
}

.backend-potential-toggle button.active {
  background: var(--wash-3);
  border-color: var(--wash-4);
  color: var(--fg-85);
}

.atomistic-source-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: var(--sp-2) var(--sp-3-5);
  border-radius: var(--radius-12);
  background: var(--wash-0);
  border: 1px solid var(--line-1);
}

.atomistic-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.atomistic-source-label {
  color: var(--fg-85);
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
}

.atomistic-source-state,
.atomistic-backend-state,
.atomistic-status,
.atomistic-result,
.atomistic-hint {
  line-height: var(--lh-normal);
}

.atomistic-source-state,
.atomistic-backend-state {
  color: var(--fg-85);
  font-size: var(--fs-base);
}

.atomistic-source-state:empty {
  display: none;
}

.atomistic-source-copy:has(.atomistic-source-state:not(:empty)) {
  padding-top: 2px;
}

.atomistic-source-state:not(:empty) {
  padding: 9px var(--sp-3-5);
  border-radius: var(--radius-md);
  background: var(--wash-0);
  border: 1px solid var(--wash-1-5);
}

.atomistic-backend-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.hidden {
  display: none !important;
}

.atomistic-body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.atomistic-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3-5);
  padding: var(--sp-4) var(--sp-4);
  border-radius: var(--radius-12);
  background: var(--wash-0);
  border: 1px solid var(--line-1);
  box-shadow: inset 0 1px 0 var(--wash-0);
}

.atomistic-card-compact {
  gap: var(--sp-3);
  padding: var(--sp-3-5) var(--sp-4);
}

.atomistic-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3-5);
}

.atomistic-card-title,
.atomistic-card-title-accent {
  font-size: var(--fs-xl);
  font-weight: 700;
}

.atomistic-card-title-accent {
  color: var(--fg-85)
}

.atomistic-card-pill {
  padding: 3px var(--sp-3);
  border-radius: 999px;
  background: var(--hover-color, var(--wash-2));
  border: 1px solid var(--line-1);
  color: var(--fg-75);
  font-size: var(--fs-sm);
}

.atomistic-card-metrics {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  color: var(--fg-75);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
}

.atomistic-efs-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}

.atomistic-efs-card:hover {
  border-color: var(--border-color, var(--line-2));
  background: var(--hover-color, var(--wash-0));
}

.atomistic-efs-card:active {
  transform: translateY(1px);
}

.atomistic-efs-title-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.atomistic-efs-refresh-hint {
  font-size: var(--fs-sm);
  color: var(--fg-3);
  font-weight: var(--fw-normal);
  letter-spacing: 0.01em;
}

.atomistic-efs-card:hover .atomistic-efs-refresh-hint {
  color: var(--accent-fg, var(--fg-2));
}

.atomistic-grid {
  display: grid;
  gap: var(--sp-3-5) var(--sp-4);
}

.atomistic-grid-compact {
  gap: 7px var(--sp-3-5);
}

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

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

.atomistic-grid label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3-5);
  color: var(--fg-85);
  font-size: var(--fs-md);
}

.atomistic-grid-compact label {
  gap: 5px;
  font-size: var(--fs-md);
}

.atomistic-grid input {
  border: 1px solid var(--wash-4);
  background: var(--chrome-1-9); /* was rgba(22, 22, 22, 0.88) — near-dupe folded into the rung */
  color: var(--fg-1);
  border-radius: var(--radius-12);
  padding: var(--sp-4) 14px;
  font-size: var(--fs-xl);
  min-height: 46px;
  box-sizing: border-box;
  width: 100%;
  box-shadow: inset 0 1px 0 var(--wash-0);
}

.atomistic-input-sm {
  padding: var(--sp-2) var(--sp-3-5) !important;
  font-size: var(--fs-lg) !important;
  min-height: var(--control-h) !important;
  border-radius: var(--radius) !important;
}

/* ---- Rattle card: two labeled inputs (coordinate / lattice) plus the action
   button, sharing one 3-column grid so the inputs get the same size and
   captions as every other atomistic control. ---- */

/* The "lattice" caption carries its own enable checkbox, which has to opt out
   of the full-width, 46px-tall .atomistic-grid input styling above. */
.atomistic-rattle-toggle-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.atomistic-rattle-grid input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-4);
}

/* Third column: no caption of its own, so push the button down onto the input
   row instead of letting it float against the captions.

   The margin is load-bearing, not cosmetic. styles.css has a global
   `label { margin: 15px 0 8px }`, so the two label columns each reserve 23px
   of vertical margin and the grid row grows to fit it. This div is not a
   label; without the same margins it stretches the full row and its
   bottom-aligned button sits 8px below the inputs — the row reads crooked. */
.atomistic-rattle-action {
  display: flex;
  align-items: flex-end;
  margin: var(--sp-5) 0 var(--sp-3);
}

/* Match .atomistic-input-sm exactly: .calcButton's own 8px padding + 2px
   border makes it 37px against the inputs' 34px, which shows as a 3px
   overhang once the bottoms line up. */
.atomistic-rattle-action .calcButton {
  width: 100%;
  height: var(--control-h);
  min-height: var(--control-h);
  padding: var(--sp-2) var(--sp-3-5);
}

.atomistic-anneal-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-1);
}

.atomistic-anneal-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
}

.atomistic-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.atomistic-button-row .calcButton {
  flex: 1 1 140px;
  min-height: var(--control-h-touch);
  font-size: var(--fs-md);
  border-radius: var(--radius-12);
  border: 1px solid var(--wash-2);
  font-weight: var(--fw-bold);
}

.atomistic-button-row-compact {
  gap: var(--sp-3);
  justify-content: center;
}

.atomistic-button-row-compact .calcButton {
  flex: 0 1 auto;
  min-height: 30px;
  padding: 5px 22px;
  font-size: var(--fs-md);
  border-radius: var(--radius);
}

.atomistic-primary-action {
  flex: 1 1 auto;
}

.atomistic-collapse-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.atomistic-inline-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--fg-85);
}

.atomistic-inline-toggle input {
  accent-color: var(--accent-color);
}

.atomistic-label-disabled {
  color: var(--danger-bright);
}

.atomistic-status {
  margin: 0;
  color: var(--fg-85);
}

.atomistic-result {
  margin: 0;
  color: var(--warn-bright);
  font-weight: var(--fw-medium);
}

.atomistic-hint {
  color: var(--fg-75);
}

/* The max-width:420px override for .atomistic-grid-2/-3 now lives in
   styles/responsive.css's tiny rung, per Wave 4's single-file @media
   rule. */

/* One-line explanation under the ensemble switch and the coupling inputs.
   Deliberately quiet: it is there to answer "what does NPT do here" the first
   time, not to compete with the controls. */
.atomistic-ensemble-hint {
  color: var(--fg-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  padding: var(--sp-1) 2px var(--sp-3);
}

.atomistic-ensemble-hint:empty {
  display: none;
}

/* The ensemble switch reuses .backend-potential-toggle, which is sized for the
   three-way potential chooser; two buttons should not stretch to fill. */
#mdEnsembleSwitch {
  flex: 0 0 auto;
}

/* Simulated Annealing is enabled by being expanded — there is no separate
   switch — so the header has to read as a state, not just a disclosure. */
.atomistic-anneal-badge {
  margin-left: var(--sp-1);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ok-bright);
  background: rgb(var(--ok-bright-rgb) / 0.14);
  border: 1px solid rgb(var(--ok-bright-rgb) / 0.35);
  opacity: 0;
  transition: opacity 120ms ease;
}

.atomistic-collapse-toggle.active .atomistic-anneal-badge {
  opacity: 1;
}

.atomistic-collapse-toggle.active .atomistic-anneal-title,
.atomistic-collapse-toggle.active > span:first-child {
  color: var(--ok-bright);
}
