:root {
  --bg: #f4f7f5;
  --panel: #ffffff;
  --panel-soft: #f9fbfa;
  --ink: #19211f;
  --muted: #60706a;
  --line: #d8e0dc;
  --line-strong: #bdc9c4;
  --green: #0f7a63;
  --green-dark: #095a49;
  --blue: #2f77b8;
  --amber: #c78124;
  --red: #c35347;
  --violet: #7560a8;
  --shadow: 0 16px 40px rgba(25, 33, 31, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    linear-gradient(120deg, rgba(15, 122, 99, 0.08), transparent 32%),
    linear-gradient(250deg, rgba(47, 119, 184, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(150px, 15vw, 230px);
  min-width: 140px;
  height: 58px;
  padding: 8px 12px;
  border: 1px solid rgba(18, 209, 200, 0.38);
  border-radius: 10px;
  background: rgba(2, 9, 44, 0.62);
  box-shadow: 0 0 0 4px rgba(18, 209, 200, 0.07), 0 0 28px rgba(2, 138, 199, 0.2);
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.45rem, 2vw, 2.2rem);
  line-height: 1.05;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

h3 {
  font-size: 0.96rem;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tab-panel {
  min-width: 0;
}

.button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 700;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(47, 119, 184, 0.28);
  outline-offset: 2px;
}

.button.primary {
  border-color: var(--green-dark);
  background: var(--green);
  color: #fff;
}

.button.quiet {
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.88rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(420px, 1.32fr) minmax(460px, 1.45fr);
  gap: 16px;
  align-items: start;
}

.stress-panel {
  margin-top: 16px;
  width: calc(100vw - 16px);
  margin-left: calc(50% - 50vw + 8px);
}

.advanced-panel {
  margin-top: 16px;
}

.advanced-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.48fr) minmax(760px, 1.52fr);
}

.advanced-controls {
  border-right: 1px solid var(--line);
}

.advanced-output {
  min-width: 0;
}

.advanced-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.advanced-form .field.full {
  grid-column: 1 / -1;
}

.advanced-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
}

.progress-shell {
  height: 10px;
  margin: 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf2ef;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 180ms ease;
}

.progress-text {
  min-height: 32px;
  padding: 8px 16px 14px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.advanced-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.advanced-metrics .metric:nth-child(3n) {
  border-right: 1px solid var(--line);
}

.advanced-metrics .metric:nth-child(4n) {
  border-right: 0;
}

.advanced-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.advanced-chart-grid .chart-area {
  border-bottom: 0;
}

.advanced-chart-grid .chart-area:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.advanced-chart-grid .chart-area:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

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

.advanced-table-block {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.advanced-table-block:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.risk-badge.low {
  background: rgba(15, 122, 99, 0.1);
  color: var(--green-dark);
}

.risk-badge.medium {
  background: rgba(47, 119, 184, 0.12);
  color: #245f95;
}

.risk-badge.high {
  background: rgba(199, 129, 36, 0.13);
  color: #86510e;
}

.risk-badge.critical {
  background: rgba(195, 83, 71, 0.13);
  color: #96372f;
}

.stress-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.62fr) minmax(680px, 1.38fr);
  gap: 0;
}

.stress-controls {
  border-right: 1px solid var(--line);
}

.stress-output {
  min-width: 0;
}

.stress-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.stress-form .field.full {
  grid-column: 1 / -1;
}

.stress-form .field.full.member-curve-section,
.stress-form .field.full.generation-curve-section {
  grid-column: 1 / -1;
}

.stress-preset-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(18, 209, 200, 0.18);
  border-radius: 8px;
  background: rgba(2, 138, 199, 0.08);
}

.preset-strip-label {
  color: #8dece7;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.preset-button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.preset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  gap: 6px;
}

.preset-button small {
  color: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  opacity: 0.78;
}

.preset-button.active {
  border-color: rgba(18, 209, 200, 0.72);
  color: #ffffff;
  background: rgba(18, 209, 200, 0.24);
}

.curve-control-section {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.curve-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.curve-section-head h3 {
  font-size: 0.95rem;
}

.curve-section-head p {
  max-width: 760px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.curve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  min-width: 0;
}

.curve-control {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.curve-control-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.curve-value {
  flex: 0 0 auto;
  min-width: 54px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(18, 209, 200, 0.12);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.curve-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-width: 0;
}

.curve-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border: 1px solid rgba(141, 236, 231, 0.34);
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      var(--brand-cyan) 0%,
      var(--brand-cyan) var(--range-fill, 0%),
      rgba(255, 255, 255, 0.28) var(--range-fill, 0%),
      rgba(255, 255, 255, 0.28) 100%
    );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 10px rgba(18, 209, 200, 0.1);
  cursor: pointer;
}

.curve-control input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: transparent;
}

.curve-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -5px;
  border: 3px solid var(--brand-cyan);
  border-radius: 999px;
  background: #0a1944;
  box-shadow:
    0 0 0 2px rgba(10, 25, 68, 0.9),
    0 0 14px rgba(18, 209, 200, 0.42);
}

.curve-control input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: transparent;
}

.curve-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--brand-cyan);
  border-radius: 999px;
  background: #0a1944;
  box-shadow:
    0 0 0 2px rgba(10, 25, 68, 0.9),
    0 0 14px rgba(18, 209, 200, 0.42);
}

.curve-control input[type="range"]:focus-visible {
  outline: 2px solid rgba(18, 209, 200, 0.88);
  outline-offset: 5px;
}

.curve-number-input {
  width: 72px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(18, 209, 200, 0.42);
  border-radius: 8px;
  background: #02092c;
  color: #ffffff;
  font-weight: 900;
  text-align: center;
}

.curve-scale {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #a8c8d9;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.25;
  min-width: 0;
}

.curve-preview {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(18, 209, 200, 0.2);
  border-radius: 8px;
  background: #061548;
}

.curve-preview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.curve-preview-top strong {
  display: block;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.25;
}

.curve-preview-top span {
  display: block;
  margin-top: 3px;
  color: #c0dbe4;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.35;
}

.curve-preview-chart {
  height: 118px;
  overflow: hidden;
  border: 1px solid rgba(18, 209, 200, 0.16);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(18, 209, 200, 0.08), rgba(2, 138, 199, 0.035)),
    #02092c;
}

.curve-preview-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.curve-gridline {
  stroke: rgba(168, 200, 217, 0.16);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.curve-area {
  fill: rgba(18, 209, 200, 0.2);
}

.curve-line {
  fill: none;
  stroke: #12d1c8;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px rgba(18, 209, 200, 0.42));
}

.curve-bar {
  fill: #12d1c8;
  opacity: 0.9;
  transition: fill 140ms ease, opacity 140ms ease, filter 140ms ease;
}

.curve-bar.is-selected,
.curve-bar-target.is-selected .curve-bar {
  fill: #ffffff;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(18, 209, 200, 0.65));
}

.curve-bar-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.curve-bar-static {
  cursor: help;
  outline: none;
}

.curve-bar-static .curve-bar-hit {
  cursor: help;
}

.curve-bar-target:hover .curve-bar,
.curve-bar-target:focus .curve-bar,
.curve-bar-target:focus-visible .curve-bar,
.curve-bar-static:hover .curve-bar,
.curve-bar-static:focus .curve-bar,
.curve-bar-static:focus-visible .curve-bar {
  fill: #8dece7;
  opacity: 1;
}

.curve-bar-target:focus,
.curve-bar-target:focus-visible,
.curve-bar-static:focus,
.curve-bar-static:focus-visible {
  outline: none;
}

.curve-preview-axis {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #8dece7;
  font-size: 0.72rem;
  font-weight: 900;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.section-title {
  border-top: 1px solid var(--line);
}

.section-title.compact {
  border-top: 0;
  padding-top: 8px;
}

.count-pill,
.status-pill,
.logic-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.good {
  border-color: rgba(15, 122, 99, 0.32);
  color: var(--green-dark);
  background: rgba(15, 122, 99, 0.08);
}

.status-pill.warn {
  border-color: rgba(199, 129, 36, 0.36);
  color: #8a530e;
  background: rgba(199, 129, 36, 0.1);
}

.status-pill.stop {
  border-color: rgba(195, 83, 71, 0.36);
  color: #96372f;
  background: rgba(195, 83, 71, 0.1);
}

.logic-pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.toggle-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.label-with-help,
.toggle-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.label-with-help > span:first-child,
.toggle-label-with-help > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.help-tip {
  position: relative;
  z-index: 30;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid #12d1c8;
  border-radius: 50%;
  background: #063a76;
  color: #e9fffd;
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 900;
  cursor: help;
  box-shadow: 0 0 0 2px rgba(18, 209, 200, 0.16);
}

.help-tip::after {
  position: absolute;
  z-index: 40;
  top: calc(100% + 9px);
  left: 50%;
  width: max-content;
  max-width: min(340px, calc(100vw - 48px));
  padding: 11px 12px;
  border: 1px solid #12d1c8;
  border-radius: 8px;
  background: #061548;
  color: #e9fffd;
  box-shadow: 0 16px 34px rgba(0, 7, 40, 0.56);
  content: attr(data-tooltip);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.38;
  opacity: 0;
  overflow-wrap: anywhere;
  pointer-events: none;
  text-transform: none;
  transform: translate(-50%, -4px);
  transition: opacity 150ms ease, transform 150ms ease;
  white-space: normal;
}

.help-tip::before {
  position: absolute;
  z-index: 39;
  top: calc(100% + 4px);
  left: 50%;
  width: 9px;
  height: 9px;
  border-top: 1px solid #12d1c8;
  border-left: 1px solid #12d1c8;
  background: #061548;
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
  transition: opacity 150ms ease;
}

.help-tip:hover::after,
.help-tip:focus-visible::after,
.help-tip:hover::before,
.help-tip:focus-visible::before {
  opacity: 1;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  transform: translate(-50%, 0);
}

.tooltip-cell {
  position: relative;
  cursor: help;
}

.tooltip-cell::after {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 8px;
  width: max-content;
  max-width: min(360px, calc(100vw - 48px));
  padding: 11px 12px;
  border: 1px solid #12d1c8;
  border-radius: 8px;
  background: #061548;
  color: #e9fffd;
  box-shadow: 0 16px 34px rgba(0, 7, 40, 0.56);
  content: attr(data-cell-tooltip);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.38;
  opacity: 0;
  overflow-wrap: anywhere;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
  white-space: normal;
}

.tooltip-cell::before {
  position: absolute;
  z-index: 59;
  top: calc(100% + 3px);
  right: 18px;
  width: 9px;
  height: 9px;
  border-top: 1px solid #12d1c8;
  border-left: 1px solid #12d1c8;
  background: #061548;
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: rotate(45deg);
  transition: opacity 150ms ease;
}

.tooltip-cell:hover::after,
.tooltip-cell:focus-visible::after,
.tooltip-cell:hover::before,
.tooltip-cell:focus-visible::before {
  opacity: 1;
}

.tooltip-cell:hover::after,
.tooltip-cell:focus-visible::after {
  transform: translateY(0);
}

.tooltip-portal-ready .help-tip::after,
.tooltip-portal-ready .help-tip::before,
.tooltip-portal-ready .tooltip-cell::after,
.tooltip-portal-ready .tooltip-cell::before {
  display: none !important;
}

.floating-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483647;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  padding: 11px 12px;
  border: 1px solid #12d1c8;
  border-radius: 8px;
  background: #061548;
  color: #f4fbff;
  box-shadow: 0 18px 42px rgba(0, 7, 40, 0.62);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.38;
  opacity: 0;
  overflow-wrap: anywhere;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translateY(-4px);
  transition: opacity 130ms ease, transform 130ms ease;
  white-space: normal;
}

.floating-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.floating-tooltip-arrow {
  position: absolute;
  left: var(--tooltip-arrow-left, 50%);
  width: 9px;
  height: 9px;
  border: 1px solid #12d1c8;
  border-right: 0;
  border-bottom: 0;
  background: #061548;
  transform: translateX(-50%) rotate(45deg);
}

.floating-tooltip[data-placement="bottom"] .floating-tooltip-arrow {
  top: -5px;
}

.floating-tooltip[data-placement="top"] .floating-tooltip-arrow {
  bottom: -5px;
  transform: translateX(-50%) rotate(225deg);
}

.stress-form .field:nth-child(5n) .help-tip::after,
.stress-form .field:nth-child(5n) .help-tip::before,
.stress-metrics .metric:nth-child(5n) .help-tip::after,
.stress-metrics .metric:nth-child(5n) .help-tip::before,
.toggle-row .help-tip::after,
.toggle-row .help-tip::before {
  right: 0;
  left: auto;
}

.stress-form .field:nth-child(5n) .help-tip::after,
.stress-metrics .metric:nth-child(5n) .help-tip::after,
.toggle-row .help-tip::after {
  transform: translate(0, -4px);
}

.stress-form .field:nth-child(5n) .help-tip:hover::after,
.stress-form .field:nth-child(5n) .help-tip:focus-visible::after,
.stress-metrics .metric:nth-child(5n) .help-tip:hover::after,
.stress-metrics .metric:nth-child(5n) .help-tip:focus-visible::after,
.toggle-row .help-tip:hover::after,
.toggle-row .help-tip:focus-visible::after {
  transform: translate(0, 0);
}

.stress-form .field:nth-child(5n) .help-tip::before,
.stress-metrics .metric:nth-child(5n) .help-tip::before,
.toggle-row .help-tip::before {
  transform: rotate(45deg);
}

.field input,
.field select,
.table-input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.toggle-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0 12px;
}

.compact-toggle {
  width: min(260px, 100%);
  min-height: 38px;
  background: rgba(2, 9, 44, 0.54);
}

.saved-scenario-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
}

.field-inline {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 900;
}

.field-inline input,
.field-inline select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(2, 9, 44, 0.84);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
}

.field-inline select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(126, 247, 241, 0.9) 50%),
    linear-gradient(135deg, rgba(126, 247, 241, 0.9) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  padding-right: 34px;
}

.saved-scenario-note {
  margin: 0 14px 14px;
}

.saved-scenario-table {
  min-width: 980px;
}

.scenario-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.saved-scenario-table th:last-child,
.saved-scenario-table td:last-child {
  text-align: right;
}

.share-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.share-snapshot-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.share-snapshot-card.full {
  grid-column: 1 / -1;
}

.share-snapshot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.share-snapshot-head strong {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.share-snapshot-text {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(2, 9, 44, 0.78);
  color: var(--ink);
  padding: 12px;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.5;
}

.share-snapshot-text.tall {
  min-height: 150px;
}

.share-snapshot-note {
  border-bottom: 0;
}

.rank-reward-head {
  align-items: center;
}

.table-section-label {
  margin: 12px 0 8px;
}

.rank-upgrade-table,
.rank-cap-table {
  table-layout: fixed;
}

.table-wrap > .rank-upgrade-table {
  width: 100%;
  min-width: 1120px;
}

.table-wrap > .rank-cap-table {
  width: 100%;
  min-width: 1420px;
}

.rank-upgrade-table th:nth-child(1),
.rank-upgrade-table td:nth-child(1),
.rank-cap-table th:nth-child(1),
.rank-cap-table td:nth-child(1) {
  width: 5%;
}

.rank-upgrade-table th:nth-child(2),
.rank-upgrade-table td:nth-child(2),
.rank-cap-table th:nth-child(2),
.rank-cap-table td:nth-child(2) {
  width: 12%;
}

.rank-upgrade-table th:nth-child(3),
.rank-upgrade-table td:nth-child(3),
.rank-upgrade-table th:nth-child(9),
.rank-upgrade-table td:nth-child(9),
.rank-upgrade-table th:nth-child(10),
.rank-upgrade-table td:nth-child(10) {
  width: 15.5%;
}

.rank-upgrade-table th:nth-child(5),
.rank-upgrade-table td:nth-child(5),
.rank-upgrade-table th:nth-child(6),
.rank-upgrade-table td:nth-child(6),
.rank-upgrade-table th:nth-child(7),
.rank-upgrade-table td:nth-child(7),
.rank-upgrade-table th:nth-child(8),
.rank-upgrade-table td:nth-child(8) {
  width: 7%;
}

.rank-upgrade-table th:nth-child(4),
.rank-upgrade-table td:nth-child(4) {
  width: 8.5%;
}

.rank-cap-table th:nth-child(3),
.rank-cap-table td:nth-child(3) {
  width: 9%;
}

.rank-cap-table th:nth-child(4),
.rank-cap-table td:nth-child(4) {
  width: 9%;
}

.rank-cap-table th:nth-child(5),
.rank-cap-table td:nth-child(5),
.rank-cap-table th:nth-child(10),
.rank-cap-table td:nth-child(10) {
  width: 5.5%;
  text-align: center;
}

.rank-cap-table th:nth-child(6),
.rank-cap-table td:nth-child(6),
.rank-cap-table th:nth-child(8),
.rank-cap-table td:nth-child(8),
.rank-cap-table th:nth-child(11),
.rank-cap-table td:nth-child(11),
.rank-cap-table th:nth-child(13),
.rank-cap-table td:nth-child(13) {
  width: 8.25%;
}

.rank-cap-table th:nth-child(7),
.rank-cap-table td:nth-child(7),
.rank-cap-table th:nth-child(9),
.rank-cap-table td:nth-child(9),
.rank-cap-table th:nth-child(12),
.rank-cap-table td:nth-child(12),
.rank-cap-table th:nth-child(14),
.rank-cap-table td:nth-child(14) {
  width: 5.5%;
  text-align: center;
}

.rank-reward-table th,
.rank-reward-table td {
  padding: 5px 8px;
  line-height: 1.15;
}

.rank-reward-input {
  max-width: 190px;
  min-height: 30px;
  padding: 0 8px;
  text-align: right;
}

.rank-percent-input {
  max-width: 104px;
}

.rank-count-input {
  max-width: 96px;
}

.rank-cap-toggle-cell {
  text-align: center;
  vertical-align: middle;
}

.leadership-control-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(520px, 1.28fr);
  gap: 14px;
  padding: 14px;
}

.leadership-control-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(2, 9, 44, 0.36);
}

.leadership-control-card.full {
  grid-column: 1 / -1;
}

.mini-title {
  border-top: 0;
  padding: 12px 14px;
}

.mini-title h3 {
  font-size: 0.95rem;
}

.leadership-rate-table {
  min-width: 440px;
}

.leadership-rank-table {
  min-width: 760px;
}

.reward-split-table {
  min-width: 760px;
}

.reward-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(420px, 1fr));
  gap: 12px;
  padding: 14px;
}

.reward-split-card {
  display: grid;
  grid-template-columns: minmax(130px, 0.86fr) minmax(170px, 1fr) minmax(58px, auto);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid rgba(25, 202, 214, 0.34);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(12, 33, 88, 0.66), rgba(4, 13, 54, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.reward-split-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.2;
}

.reward-split-control {
  min-width: 0;
}

.reward-split-control .percent-range-control {
  grid-template-columns: minmax(58px, 74px) minmax(88px, 1fr);
  gap: 8px;
}

.reward-split-control .percent-number {
  min-height: 30px;
  padding: 0 8px;
}

.reward-split-wallet {
  display: grid;
  gap: 2px;
  justify-items: end;
  min-width: 58px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.leadership-rate-table th,
.leadership-rate-table td,
.leadership-rank-table th,
.leadership-rank-table td,
.reward-split-table th,
.reward-split-table td {
  padding: 7px 10px;
}

.leadership-rate-table th:first-child,
.leadership-rate-table td:first-child {
  width: 118px;
}

.leadership-rank-table th:first-child,
.leadership-rank-table td:first-child {
  width: 86px;
}

.leadership-rank-table th:nth-child(2),
.leadership-rank-table td:nth-child(2) {
  width: 260px;
}

.leadership-rank-table th:nth-child(3),
.leadership-rank-table td:nth-child(3),
.leadership-rank-table th:nth-child(4),
.leadership-rank-table td:nth-child(4) {
  width: 120px;
}

.percent-range-control {
  display: grid;
  grid-template-columns: minmax(76px, 96px) minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
}

.percent-number,
.leadership-generation-input {
  min-height: 32px;
  text-align: right;
}

.leadership-generation-input {
  max-width: 92px;
  margin-left: auto;
}

.reward-wallet-preview {
  color: #8dece7;
  font-weight: 900;
}

.table-range {
  width: 100%;
  height: 34px;
  margin: 0;
  appearance: none;
  cursor: pointer;
  background: transparent;
  --range-fill: 0%;
}

.table-range::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid rgba(126, 247, 241, 0.36);
  border-radius: 999px;
  background:
    linear-gradient(90deg,
      var(--brand-cyan) 0%,
      var(--brand-cyan) var(--range-fill, 0%),
      rgba(255, 255, 255, 0.22) var(--range-fill, 0%),
      rgba(255, 255, 255, 0.22) 100%);
}

.table-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 3px solid #061138;
  border-radius: 50%;
  background: var(--brand-cyan);
  box-shadow: 0 0 0 2px rgba(18, 209, 200, 0.72), 0 0 18px rgba(18, 209, 200, 0.3);
}

.table-range::-moz-range-track {
  height: 8px;
  border: 1px solid rgba(126, 247, 241, 0.36);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.table-range::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--brand-cyan);
}

.table-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #061138;
  border-radius: 50%;
  background: var(--brand-cyan);
  box-shadow: 0 0 0 2px rgba(18, 209, 200, 0.72), 0 0 18px rgba(18, 209, 200, 0.3);
}

.table-range:focus-visible {
  outline: 2px solid rgba(18, 209, 200, 0.85);
  outline-offset: 3px;
}

.rank-cap-switch {
  width: 38px;
  height: 22px;
  margin: 0 auto;
}

.rank-cap-switch .switch-track::after {
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
}

.rank-cap-switch input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9d2ce;
  transition: background 140ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(25, 33, 31, 0.22);
  transition: transform 140ms ease;
}

.switch input:checked + .switch-track {
  background: var(--green);
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.package-section {
  padding-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.package-table th,
.package-table td {
  padding: 8px;
}

.package-table th:nth-child(1) {
  width: 38%;
}

.package-table th:nth-child(2),
.package-table th:nth-child(3),
.package-table th:nth-child(4) {
  width: 18%;
}

.stress-package-mix-table {
  min-width: 1080px;
  table-layout: fixed;
}

.stress-membership-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.stress-membership-table th,
.stress-membership-table td {
  padding: 7px 8px;
}

.stress-membership-table th:nth-child(1),
.stress-membership-table td:nth-child(1) {
  width: 36%;
}

.stress-membership-table th:nth-child(2),
.stress-membership-table td:nth-child(2),
.stress-membership-table th:nth-child(3),
.stress-membership-table td:nth-child(3) {
  width: 32%;
}

.stress-membership-table th {
  white-space: normal;
  line-height: 1.15;
}

.stress-membership-table .table-input {
  min-height: 34px;
  padding: 0 9px;
}

.membership-bonus-mode-grid {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 10px;
  margin: 10px 0 12px;
}

.membership-bonus-matrix-title {
  margin-top: 14px;
}

.stress-membership-bonus-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

.stress-membership-bonus-table th,
.stress-membership-bonus-table td {
  padding: 7px 8px;
  text-align: left;
}

.stress-membership-bonus-table th:first-child,
.stress-membership-bonus-table td:first-child {
  width: 124px;
}

.membership-bonus-input {
  min-height: 32px;
  padding: 0 8px;
}

.stress-package-mix-table th:nth-child(1),
.stress-package-mix-table td:nth-child(1) {
  width: 11%;
}

.stress-package-mix-table th:nth-child(2),
.stress-package-mix-table td:nth-child(2) {
  width: 10%;
}

.stress-package-mix-table th:nth-child(3),
.stress-package-mix-table td:nth-child(3) {
  width: 8%;
}

.stress-package-mix-table th:nth-child(4),
.stress-package-mix-table td:nth-child(4) {
  width: 18%;
}

.stress-package-mix-table th:nth-child(5),
.stress-package-mix-table td:nth-child(5) {
  width: 12%;
}

.stress-package-mix-table th:nth-child(6),
.stress-package-mix-table td:nth-child(6) {
  width: 16%;
}

.stress-package-mix-table th:nth-child(7),
.stress-package-mix-table td:nth-child(7) {
  width: 16%;
}

.stress-package-mix-table th:nth-child(8),
.stress-package-mix-table td:nth-child(8) {
  width: 9%;
}

.stress-package-mix-table .package-price-input,
.stress-package-mix-table .package-margin-input {
  min-height: 34px;
  padding: 0 8px;
}

.stress-package-mix-table .package-margin-input {
  text-align: right;
}

.stress-package-mix-table th {
  white-space: normal;
  line-height: 1.15;
}

.stress-package-mix-table td {
  vertical-align: middle;
}

.stress-package-mix-table .table-switch {
  display: inline-flex;
  width: 46px;
  height: 26px;
  min-height: 30px;
  justify-content: center;
  cursor: pointer;
}

.package-disabled-row {
  opacity: 0.58;
}

.package-disabled-row td[data-package-count],
.package-disabled-row td[data-package-volume],
.package-disabled-row td[data-package-margin],
.package-disabled-row td[data-package-share] {
  color: #8fa9b7;
}

.stress-package-mix-table td[data-package-count],
.stress-package-mix-table td[data-package-volume],
.stress-package-mix-table td[data-package-margin],
.stress-package-mix-table td[data-package-share] {
  color: #ffffff;
  font-weight: 900;
}

.remove-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--red);
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.stress-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  position: relative;
  min-height: 104px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  overflow: visible;
}

.metric:nth-child(3n) {
  border-right: 0;
}

.stress-metrics .metric:nth-child(3n) {
  border-right: 1px solid var(--line);
}

.stress-metrics .metric:nth-child(4n) {
  border-right: 0;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.metric-label-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.metric-value {
  display: block;
  margin-top: 9px;
  color: var(--ink);
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.metric-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.chart-area {
  height: 280px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.stress-chart-area {
  height: 320px;
}

#stress-chart {
  display: block;
  width: 100%;
  height: 100%;
}

.stress-table-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-bottom: 1px solid var(--line);
}

.stress-table-grid > div:first-child {
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.stress-cap-note {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(47, 119, 184, 0.07);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.result-table tbody tr.active-row {
  background: rgba(15, 122, 99, 0.07);
}

.money-positive {
  color: var(--green-dark);
  font-weight: 900;
}

.money-pending {
  color: #9a5e13;
  font-weight: 900;
}

.money-burned {
  color: #b83c36;
  font-weight: 900;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .results-panel {
    grid-column: 1 / -1;
  }

  .stress-layout,
  .stress-table-grid,
  .advanced-layout,
  .advanced-table-grid {
    grid-template-columns: 1fr;
  }

  .stress-controls,
  .stress-table-grid > div:first-child,
  .advanced-controls,
  .advanced-table-block:nth-child(odd) {
    border-right: 0;
  }

  .stress-controls,
  .advanced-controls {
    border-bottom: 1px solid var(--line);
  }

  .advanced-chart-grid {
    grid-template-columns: 1fr;
  }

  .advanced-chart-grid .chart-area:nth-child(odd) {
    border-right: 0;
  }

  .advanced-chart-grid .chart-area:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 800px) {
  .app-shell {
    width: min(100vw - 20px, 740px);
    padding: 14px 0;
  }

  .topbar,
  .brand {
    align-items: flex-start;
  }

  .topbar,
  .workspace,
  .toggle-grid,
  .metric-grid,
  .stress-form,
  .stress-metrics,
  .advanced-form,
  .advanced-metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .results-panel {
    grid-column: auto;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stress-metrics .metric:nth-child(3n) {
    border-right: 0;
  }

  .advanced-metrics .metric:nth-child(3n),
  .advanced-metrics .metric:nth-child(4n) {
    border-right: 0;
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .logic-pills {
    justify-content: flex-start;
  }

  .panel-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Plen Vida brand palette and dense data fit */
:root {
  --bg: #02092c;
  --panel: #061548;
  --panel-soft: #0a1d5f;
  --ink: #f4fbff;
  --muted: #a8c8d9;
  --line: rgba(18, 209, 200, 0.18);
  --line-strong: rgba(2, 138, 199, 0.4);
  --green: #12d1c8;
  --green-dark: #028ac7;
  --blue: #01249f;
  --amber: #d5a84a;
  --red: #e05d55;
  --violet: #00259e;
  --brand-cyan: #12d1c8;
  --brand-blue: #028ac7;
  --brand-deep: #01249f;
  --shadow: 0 24px 70px rgba(0, 7, 40, 0.48);
  color-scheme: dark;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(18, 209, 200, 0.18), transparent 32%),
    radial-gradient(circle at 84% 8%, rgba(2, 138, 199, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(1, 36, 159, 0.42), transparent 320px),
    repeating-linear-gradient(90deg, rgba(18, 209, 200, 0.04) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(0deg, rgba(2, 138, 199, 0.035) 0 1px, transparent 1px 84px),
    var(--bg);
}

.app-shell {
  width: min(1720px, calc(100vw - 28px));
  padding: 10px 0 24px;
}

.topbar {
  position: relative;
  z-index: 20;
  margin-bottom: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 9, 44, 0.84);
  box-shadow: 0 18px 60px rgba(0, 7, 40, 0.34);
  backdrop-filter: blur(18px);
}

h1 {
  color: #ffffff;
}

h2,
h3 {
  color: #f5fffc;
}

.brand p,
.panel-subtitle,
.metric-note,
.field label,
.toggle-row span {
  color: var(--muted);
}

.panel {
  border-color: var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(6, 21, 72, 0.94), rgba(2, 9, 44, 0.96)),
    var(--panel);
  box-shadow: var(--shadow);
}

.panel-head,
.section-title {
  border-color: var(--line);
  background: linear-gradient(90deg, rgba(18, 209, 200, 0.13), rgba(2, 138, 199, 0.1), rgba(1, 36, 159, 0.08));
}

.section-title.compact {
  background: rgba(255, 255, 255, 0.025);
}

.button {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.button:hover {
  border-color: rgba(18, 209, 200, 0.72);
  background: rgba(18, 209, 200, 0.1);
}

.button.primary {
  border-color: rgba(18, 209, 200, 0.8);
  background: linear-gradient(135deg, #12d1c8, #028ac7 52%, #01249f);
  color: #ffffff;
}

.button.quiet {
  color: var(--muted);
}

.button.danger {
  border-color: rgba(255, 102, 117, 0.5);
  color: #ffd4d8;
  background: rgba(255, 102, 117, 0.08);
}

.button.danger:hover {
  border-color: rgba(255, 102, 117, 0.82);
  background: rgba(255, 102, 117, 0.16);
}

.count-pill,
.status-pill,
.logic-pills span,
.risk-badge {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: #b7ccc5;
}

.field input,
.field select,
.table-input {
  border-color: var(--line-strong);
  background: rgba(2, 9, 44, 0.78);
  color: var(--ink);
}

.field input:hover,
.field select:hover,
.table-input:hover {
  border-color: rgba(18, 209, 200, 0.5);
}

.toggle-row {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.money-positive {
  color: #6df4ee;
}

.money-pending {
  color: #ffd16e;
}

.money-burned {
  color: #ff8d84;
}

.switch-track {
  background: rgba(255, 255, 255, 0.18);
}

.switch input:checked + .switch-track {
  background: linear-gradient(135deg, #12d1c8, #028ac7, #01249f);
}

.workspace {
  grid-template-columns: minmax(240px, 0.7fr) minmax(430px, 1.2fr) minmax(520px, 1.5fr);
}

.stress-panel {
  width: 100%;
  margin-left: 0;
}

.stress-layout {
  grid-template-columns: 1fr;
}

.stress-controls {
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.stress-form {
  grid-template-columns: repeat(5, minmax(148px, 1fr));
}

.stress-form .field.full {
  grid-column: span 2;
}

.stress-form .field.full.member-curve-section {
  grid-column: 1 / span 2;
}

.stress-form .field.full.generation-curve-section {
  grid-column: 3 / -1;
}

.generation-curve-section {
  width: 100%;
  max-width: none;
}

.generation-curve-section .curve-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 18px;
  align-items: start;
}

.generation-curve-section .curve-control-generationDepth .curve-number-input {
  width: 64px;
  min-width: 64px;
  padding-inline: 6px;
  text-align: center;
}

.generation-curve-section .curve-control-top {
  min-height: 34px;
}

.generation-curve-section .curve-control-top.has-exact-input {
  grid-template-columns: minmax(0, 1fr) auto;
}

.generation-curve-section .label-with-help {
  align-items: center;
}

.generation-curve-section .curve-preview {
  width: 100%;
}

.stress-output {
  width: 100%;
}

.dashboard-stack {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.dashboard-section {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012)),
    rgba(2, 9, 44, 0.28);
}

.stress-panel {
  overflow: visible;
}

.dashboard-section > .section-title:first-child {
  border-top: 0;
}

.section-title > div,
.panel-head > div {
  min-width: 0;
}

.section-title p {
  max-width: 980px;
  margin-top: 5px;
  color: #c0dbe4;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.45;
  white-space: normal;
}

.dashboard-section .chart-area,
.dashboard-section .stress-table-grid {
  border-bottom: 0;
}

.advanced-layout {
  grid-template-columns: minmax(360px, 0.42fr) minmax(900px, 1.58fr);
}

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

.metric {
  min-height: 98px;
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.metric-label {
  color: #8dece7;
  letter-spacing: 0.04em;
}

.metric-value {
  color: #ffffff;
  font-size: clamp(1.08rem, 1.65vw, 1.68rem);
}

.stress-metrics,
.advanced-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stress-metrics .metric:nth-child(4n),
.advanced-metrics .metric:nth-child(4n) {
  border-right: 1px solid var(--line);
}

.stress-metrics .metric:nth-child(5n),
.advanced-metrics .metric:nth-child(5n) {
  border-right: 0;
}

.chart-area,
.stress-chart-area {
  background: rgba(2, 9, 44, 0.38);
  border-color: var(--line);
}

.stress-cap-note {
  border-color: var(--line);
  background: linear-gradient(90deg, rgba(18, 209, 200, 0.12), rgba(2, 138, 199, 0.1), rgba(1, 36, 159, 0.12));
  color: #c0dbe4;
}

.stress-cap-note strong {
  color: #ffffff;
}

.stress-live-controls {
  display: grid;
  gap: 8px;
  min-width: min(380px, 100%);
}

.stress-panel > .panel-head {
  flex-wrap: wrap;
}

.stress-live-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.stress-live-status {
  color: #c0dbe4;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: right;
}

.stress-live-progress {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(18, 209, 200, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.stress-live-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #12d1c8, #028ac7, #01249f);
  box-shadow: 0 0 20px rgba(18, 209, 200, 0.28);
  transition: width 160ms ease;
}

.empty-stress-state {
  display: grid;
  gap: 6px;
  min-height: 132px;
  align-content: center;
  padding: 20px;
  border: 1px solid rgba(18, 209, 200, 0.24);
  border-radius: 8px;
  background: rgba(2, 12, 48, 0.68);
  color: #c0dbe4;
}

.empty-stress-state strong {
  color: #ffffff;
  font-size: 1rem;
}

.stress-chart-area {
  height: auto;
}

#stress-chart {
  display: none;
}

.stress-segment-explorer {
  width: 100%;
  min-height: 240px;
}

.segment-explorer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.segment-explorer-header p {
  max-width: 980px;
  margin-top: 6px;
  color: #c0dbe4;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.5;
}

.stress-segment-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
  padding: 12px;
}

.stress-segment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.stress-segment-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  color: #ffffff;
  font-weight: 900;
  line-height: 1.3;
}

.stress-segment-card summary span:first-child {
  overflow-wrap: anywhere;
}

.stress-segment-card summary span:last-child {
  flex: 0 0 auto;
  color: #8dece7;
  font-size: 0.8rem;
}

.stress-segment-card-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.segment-card-stat strong {
  display: block;
  color: #ffffff;
  font-size: 1.35rem;
}

.segment-card-stat span {
  color: #a8c8d9;
  font-size: 0.8rem;
  font-weight: 800;
}

.segment-metric-bar > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #a8c8d9;
  font-size: 0.8rem;
  font-weight: 800;
}

.segment-metric-bar strong {
  color: #ffffff;
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: rgba(18, 209, 200, 0.68) rgba(255, 255, 255, 0.08);
}

table {
  color: var(--ink);
}

th,
td {
  border-color: var(--line);
}

th {
  color: #8dece7;
  background: rgba(2, 9, 44, 0.88);
  letter-spacing: 0.04em;
}

td {
  background: rgba(255, 255, 255, 0.014);
}

tbody tr:hover td {
  background: rgba(18, 209, 200, 0.075);
}

.result-table th,
.result-table td {
  padding: 9px 10px;
  font-size: 0.9rem;
}

.stress-table-grid .result-table th,
.stress-table-grid .result-table td {
  padding: 8px 9px;
  font-size: clamp(0.78rem, 0.72vw, 0.94rem);
}

.stress-table-grid .result-table td:first-child,
.stress-table-grid .result-table th:first-child {
  min-width: 180px;
}

.stress-table-grid .result-table td:not(:first-child),
.stress-table-grid .result-table th:not(:first-child) {
  min-width: 84px;
}

.stress-table-grid .result-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.generation-table,
.scenario-table {
  min-width: 1320px;
}

.generation-table th,
.generation-table td,
.scenario-table th,
.scenario-table td {
  white-space: normal;
  vertical-align: top;
}

.scenario-table td:first-child {
  min-width: 220px;
}

.generation-table td:first-child {
  min-width: 76px;
}

.package-table th,
.package-table td {
  background: rgba(255, 255, 255, 0.018);
}

.advanced-table-grid {
  grid-template-columns: 1fr;
}

.advanced-table-block:nth-child(odd) {
  border-right: 0;
}

.table-note {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: #c0dbe4;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.55;
  background: rgba(18, 209, 200, 0.055);
}

.segment-explorer-table {
  min-width: 1180px;
  table-layout: fixed;
}

.segment-explorer-table th,
.segment-explorer-table td {
  white-space: normal;
  vertical-align: top;
}

.segment-explorer-table th:nth-child(1),
.segment-explorer-table td:nth-child(1) {
  width: 22%;
}

.segment-explorer-table th:nth-child(2),
.segment-explorer-table td:nth-child(2),
.segment-explorer-table th:nth-child(3),
.segment-explorer-table td:nth-child(3),
.segment-explorer-table th:nth-child(7),
.segment-explorer-table td:nth-child(7) {
  width: 12%;
}

.segment-explorer-table th:nth-child(4),
.segment-explorer-table td:nth-child(4),
.segment-explorer-table th:nth-child(5),
.segment-explorer-table td:nth-child(5),
.segment-explorer-table th:nth-child(6),
.segment-explorer-table td:nth-child(6) {
  width: 14%;
}

.segment-explorer-name summary {
  cursor: pointer;
  color: #ffffff;
  font-weight: 900;
  line-height: 1.35;
}

/* Wide data tables: keep values readable and make overflow swipeable. */
.panel,
.dashboard-section,
.stress-table-grid,
.stress-table-grid > div,
.advanced-table-block {
  min-width: 0;
}

.table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-color: rgba(18, 209, 200, 0.82) rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(90deg, #12d1c8, #028ac7);
}

.table-wrap > table {
  width: max-content;
  min-width: 100%;
}

.table-wrap > .stress-membership-table {
  width: 100%;
  min-width: 0;
}

.result-table th,
.result-table td,
.package-table th,
.package-table td,
.generation-table th,
.generation-table td,
.scenario-table th,
.scenario-table td,
.segment-explorer-table th,
.segment-explorer-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.package-table.stress-membership-table th {
  white-space: normal;
  line-height: 1.15;
}

.package-table.stress-membership-table td {
  white-space: nowrap;
}

.stress-table-grid .result-table td,
.generation-table td,
.scenario-table td,
.segment-explorer-table td {
  overflow: visible;
  text-overflow: clip;
}

.rank-reward-table th,
.rank-reward-table td {
  padding: 5px 8px;
  line-height: 1.15;
}

.rank-reward-table .table-input {
  min-height: 30px;
  padding: 0 8px;
}

.rank-cap-toggle-cell {
  text-align: center;
  vertical-align: middle;
}

.rank-cap-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 30px;
  margin: 0 auto;
  cursor: pointer;
  vertical-align: middle;
}

.rank-cap-switch .switch-track {
  box-sizing: border-box;
  border: 2px solid rgba(126, 247, 241, 0.78);
  background: #020b2d;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(0, 164, 255, 0.22),
    0 0 12px rgba(18, 209, 200, 0.12);
}

.rank-cap-switch .switch-track::after {
  box-sizing: border-box;
  top: 5px;
  left: 5px;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 7, 40, 0.58);
}

.rank-cap-switch input:checked + .switch-track {
  border-color: #12d1c8;
  background: rgba(18, 209, 200, 0.2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(18, 209, 200, 0.34),
    0 0 16px rgba(18, 209, 200, 0.3);
}

.rank-cap-switch input:checked + .switch-track::after {
  border-color: #ffffff;
  background: #12d1c8;
  transform: translateX(24px);
}

.rank-cap-switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(18, 209, 200, 0.9);
  outline-offset: 3px;
}

.segment-explorer-name summary::marker {
  color: var(--brand-cyan);
}

.segment-detail,
.cell-note {
  display: block;
  margin-top: 7px;
  color: #a8c8d9;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.data-bar-cell {
  min-width: 0;
}

.data-bar-value {
  margin-bottom: 7px;
  color: #ffffff;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.data-bar-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(18, 209, 200, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.data-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #12d1c8, #028ac7, #00a87c);
  box-shadow: 0 0 18px rgba(18, 209, 200, 0.28);
}

.segment-explorer-row:hover .data-bar-fill {
  box-shadow: 0 0 24px rgba(18, 209, 200, 0.44);
}

.progress-shell {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar {
  background: linear-gradient(90deg, #12d1c8, #028ac7, #01249f);
}

/* UI restructure: premium grouped simulator experience */
.stress-command-head {
  position: sticky;
  top: 150px;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(420px, 1fr);
  grid-template-areas:
    "copy pills"
    "live presets";
  align-items: start;
  gap: 12px 16px;
  border-radius: 10px 10px 0 0;
  backdrop-filter: blur(18px);
}

.stress-command-copy {
  grid-area: copy;
  min-width: 0;
}

.stress-command-head .logic-pills {
  grid-area: pills;
  justify-content: flex-end;
  margin-left: 0;
}

.stress-command-head .stress-live-controls {
  grid-area: live;
  justify-self: start;
}

.stress-command-presets {
  grid-area: presets;
  align-self: stretch;
  min-width: 0;
}

.stress-command-presets .stress-preset-strip {
  height: 100%;
}

.stress-live-controls {
  min-width: min(520px, 100%);
  padding: 10px;
  border: 1px solid rgba(18, 209, 200, 0.2);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(18, 209, 200, 0.1), rgba(1, 36, 159, 0.14)),
    rgba(2, 9, 44, 0.62);
}

.stress-live-actions .button {
  min-height: 36px;
}

.primary-control-section {
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(18, 209, 200, 0.09), rgba(2, 138, 199, 0.04) 38%, rgba(2, 9, 44, 0.68)),
    rgba(2, 9, 44, 0.36);
}

.advanced-control-section {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.014)),
    rgba(2, 9, 44, 0.3);
}

.stress-form {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}

.stress-control-group {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid rgba(18, 209, 200, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(12, 33, 88, 0.7), rgba(3, 13, 54, 0.76)),
    rgba(2, 9, 44, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 16px 40px rgba(0, 7, 40, 0.22);
}

.stress-control-group {
  grid-column: 1 / -1;
  padding: 14px;
}

.stress-control-group.simulation-overview,
.stress-control-group.network-activity,
.stress-control-group.generation-distribution {
  border-color: rgba(18, 209, 200, 0.28);
}

.control-group-head,
.form-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.form-group-head {
  display: grid;
  gap: 4px;
}

.control-group-head h3,
.form-group-head strong {
  margin-top: 3px;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.2;
}

.control-group-head p,
.form-group-head p {
  margin-top: 6px;
  max-width: 980px;
  color: #b9d5df;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.48;
}

.group-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 9px;
  border: 1px solid rgba(18, 209, 200, 0.28);
  border-radius: 999px;
  background: rgba(18, 209, 200, 0.1);
  color: #8dece7;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.setting-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 160px;
}

.setting-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(18, 209, 200, 0.22);
  border-radius: 999px;
  background: rgba(2, 138, 199, 0.12);
  color: #c7eef3;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.control-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  min-width: 0;
}

.control-group-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-group-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.stress-control-group .field {
  min-width: 0;
}

.stress-control-group .field.full {
  grid-column: 1 / -1;
}

.stress-control-group .field.compact-slider-field {
  grid-column: span 2;
  align-self: stretch;
}

.stress-control-group .toggle-row {
  min-height: 44px;
  background: rgba(2, 9, 44, 0.56);
}

.compact-slider-field .curve-control {
  height: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(18, 209, 200, 0.14);
  border-radius: 10px;
  background: rgba(2, 9, 44, 0.38);
}

.compact-slider-field .curve-control-top {
  gap: 8px;
}

.compact-slider-field .curve-value {
  min-width: 48px;
  padding: 3px 7px;
  font-size: 0.72rem;
}

.compact-slider-field .curve-input-row {
  margin-top: 1px;
}

.compact-slider-field .curve-control input[type="range"] {
  height: 8px;
}

.compact-slider-field .curve-control input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
}

.compact-slider-field .curve-control input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-width: 3px;
}

.compact-slider-field .curve-control input[type="range"]::-moz-range-track {
  height: 8px;
}

.compact-slider-field .curve-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-width: 3px;
}

.compact-slider-field .curve-scale {
  font-size: 0.68rem;
}

.curve-control-section {
  padding: 14px;
  border-color: rgba(18, 209, 200, 0.2);
  background:
    linear-gradient(145deg, rgba(18, 209, 200, 0.06), rgba(2, 9, 44, 0.5)),
    rgba(2, 9, 44, 0.38);
}

.member-curve-section .curve-grid.single-curve-grid {
  grid-template-columns: minmax(240px, 1fr);
}

.generation-curve-section .curve-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.curve-preview {
  border: 1px solid rgba(18, 209, 200, 0.18);
  border-radius: 10px;
  background: rgba(2, 12, 48, 0.62);
  padding: 10px;
}

.curve-preview-top strong,
.curve-preview-axis span {
  color: #ffffff;
}

.curve-preview-top span {
  color: #c0dbe4;
}

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

.saved-scenario-form {
  align-items: end;
}

.executive-summary-section {
  order: -1;
}

.metric {
  position: relative;
  overflow: hidden;
}

.metric::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(18, 209, 200, 0.5), transparent);
  content: "";
}

.section-title {
  gap: 12px;
}

.section-title h3 {
  letter-spacing: 0;
}

.field input,
.field select,
.table-input,
.field-inline input,
.field-inline select {
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.field input:focus-visible,
.field select:focus-visible,
.table-input:focus-visible,
.field-inline input:focus-visible,
.field-inline select:focus-visible {
  border-color: rgba(18, 209, 200, 0.82);
  box-shadow: 0 0 0 3px rgba(18, 209, 200, 0.16), 0 0 22px rgba(18, 209, 200, 0.12);
}

.table-wrap {
  border-radius: 10px;
}

.result-table,
.package-table {
  border-collapse: separate;
  border-spacing: 0;
}

.result-table th:first-child,
.package-table th:first-child {
  border-top-left-radius: 8px;
}

.result-table th:last-child,
.package-table th:last-child {
  border-top-right-radius: 8px;
}

.help-tip::after,
.tooltip-cell::after {
  background: #061548;
  color: #f4fbff;
}

@media (max-width: 1320px) {
  .stress-command-head {
    position: static;
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "pills"
      "live"
      "presets";
  }

  .stress-command-head .logic-pills {
    justify-content: flex-start;
  }

  .stress-command-head .stress-live-controls {
    justify-self: stretch;
  }

  .control-group-head {
    flex-direction: column;
  }

  .setting-badges {
    justify-content: flex-start;
  }

  .overview-grid,
  .control-group-grid.three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .leadership-control-grid {
    grid-template-columns: 1fr;
  }

  .curve-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .stress-form .field.full.member-curve-section,
  .stress-form .field.full.generation-curve-section {
    grid-column: 1 / -1;
  }

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

  .stress-metrics .metric,
  .advanced-metrics .metric {
    border-right: 1px solid var(--line);
  }

  .stress-metrics .metric:nth-child(3n),
  .advanced-metrics .metric:nth-child(3n) {
    border-right: 0;
  }

  .stress-metrics .metric:nth-child(3n) .help-tip::after,
  .stress-metrics .metric:nth-child(3n) .help-tip::before {
    right: 0;
    left: auto;
  }

  .stress-metrics .metric:nth-child(3n) .help-tip::after {
    transform: translate(0, -4px);
  }

  .stress-metrics .metric:nth-child(3n) .help-tip:hover::after,
  .stress-metrics .metric:nth-child(3n) .help-tip:focus-visible::after {
    transform: translate(0, 0);
  }

  .stress-metrics .metric:nth-child(3n) .help-tip::before {
    transform: rotate(45deg);
  }
}

@media (max-width: 980px) {
  .stress-form,
  .advanced-layout {
    grid-template-columns: 1fr;
  }

  .control-group-grid,
  .control-group-grid.two-col,
  .control-group-grid.three-col,
  .overview-grid,
  .compact-toggle-grid {
    grid-template-columns: 1fr;
  }

  .stress-control-group .field.compact-slider-field {
    grid-column: 1 / -1;
  }

  .stress-live-actions {
    justify-content: stretch;
  }

  .stress-live-actions .button {
    flex: 1 1 150px;
  }

  .stress-preset-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .preset-button-row {
    justify-content: stretch;
  }

  .preset-button {
    flex: 1 1 132px;
  }

  .curve-grid {
    grid-template-columns: 1fr;
  }

  .share-snapshot-grid {
    grid-template-columns: 1fr;
  }

  .share-snapshot-card.full {
    grid-column: auto;
  }

  .share-snapshot-head {
    align-items: stretch;
    flex-direction: column;
  }

  .generation-curve-section .curve-grid {
    grid-template-columns: 1fr;
  }

  .stress-form .field.full,
  .stress-form .field.full.member-curve-section,
  .stress-form .field.full.generation-curve-section {
    grid-column: 1 / -1;
  }

  .generation-curve-section .curve-control-generationDepth {
    grid-column: auto;
  }

  .percent-range-control {
    grid-template-columns: minmax(72px, 94px) minmax(120px, 1fr);
  }

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

  .reward-split-card {
    grid-template-columns: 1fr;
  }

  .reward-split-wallet {
    justify-items: start;
  }
}

/* 2026 workflow redesign: grouped navigation and cleaner simulator hierarchy */
body {
  background:
    linear-gradient(180deg, rgba(1, 36, 159, 0.44), transparent 360px),
    linear-gradient(120deg, rgba(18, 209, 200, 0.08), rgba(3, 13, 54, 0) 42%),
    repeating-linear-gradient(90deg, rgba(18, 209, 200, 0.035) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(2, 138, 199, 0.03) 0 1px, transparent 1px 96px),
    var(--bg);
}

.topbar {
  border-radius: 12px;
}

.brand-logo-link,
.panel,
.dashboard-section,
.stress-live-controls,
.workflow-nav,
.stress-control-group,
.leadership-control-card,
.share-snapshot-card {
  border-radius: 8px;
}

.stress-panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  margin-top: 4px;
}

.workflow-nav {
  position: static;
  z-index: 13;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
  padding: 8px;
  border: 1px solid rgba(18, 209, 200, 0.18);
  background:
    linear-gradient(180deg, rgba(8, 28, 78, 0.92), rgba(3, 13, 54, 0.9)),
    rgba(2, 9, 44, 0.82);
  box-shadow: 0 18px 48px rgba(0, 7, 40, 0.28);
  backdrop-filter: blur(18px);
}

.workflow-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid rgba(18, 209, 200, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: #d7eef4;
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.workflow-link span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(18, 209, 200, 0.12);
  color: #8dece7;
  font-size: 0.72rem;
}

.workflow-link:hover,
.workflow-link:focus-visible {
  border-color: rgba(18, 209, 200, 0.55);
  background: rgba(18, 209, 200, 0.09);
  color: #ffffff;
  transform: translateY(-1px);
}

.stress-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.stress-layout > .dashboard-stack {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
}

.stress-controls,
.stress-output {
  border: 0;
  min-width: 0;
}

.stress-layout .dashboard-section {
  grid-column: 1 / -1;
  min-width: 0;
}

.stress-layout [data-ui-section="full-simulation-controls"] {
  order: 10;
}

.stress-layout [data-ui-section="package-behavior-table"] {
  order: 20;
}

.stress-layout [data-ui-section="membership-packages"] {
  order: 30;
}

.stress-layout [data-ui-section="rank-rules"] {
  order: 40;
}

.stress-layout [data-ui-section="leadership-and-splits"] {
  order: 50;
}

.stress-layout [data-ui-section="executive-payout-summary"] {
  order: 60;
}

.stress-layout [data-ui-section="segment-explorer"] {
  order: 70;
}

.stress-layout [data-ui-section="results-and-analytics"] {
  order: 80;
}

.stress-layout [data-ui-section="generation-analytics"] {
  order: 90;
}

.stress-layout [data-ui-section="scenario-management"] {
  order: 100;
}

.stress-layout [data-ui-section="scenario-comparison"] {
  order: 110;
}

.stress-layout [data-ui-section="share-snapshot"] {
  order: 120;
}

.stress-layout [data-ui-section] {
  order: initial;
}

.dashboard-section[data-category],
.panel[data-category] {
  position: relative;
}

.dashboard-section[data-category]::before,
.panel[data-category]::before {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  margin: 14px 16px 0;
  padding: 0 10px;
  border: 1px solid rgba(18, 209, 200, 0.28);
  border-radius: 999px;
  background: rgba(18, 209, 200, 0.1);
  color: #8dece7;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  content: attr(data-category);
}

.panel[data-category]::before {
  border-color: rgba(15, 122, 99, 0.22);
  background: rgba(15, 122, 99, 0.08);
  color: #1b6f5b;
}

.dashboard-section[data-category] > .section-title:first-of-type,
.panel[data-category] > .panel-head:first-of-type {
  padding-top: 10px;
}

.dashboard-section > .section-title:first-child {
  border-top: 0;
}

.stress-command-head {
  top: 146px;
  position: static;
  border: 1px solid rgba(18, 209, 200, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(8, 28, 78, 0.92), rgba(3, 13, 54, 0.92)),
    rgba(2, 9, 44, 0.86);
}

.dashboard-section,
.panel,
#growth-controls-heading,
#package-mix-heading,
#membership-heading,
#rank-reward-controls-heading,
#leadership-controls-heading,
#executive-summary-heading,
#segment-explorer-heading,
#leader-rank-heading,
#generation-analytics-heading,
#saved-scenarios-heading,
#scenario-comparison-heading,
#share-snapshot-heading {
  scroll-margin-top: 156px;
}

.stress-command-head .stress-live-controls,
.stress-command-presets .stress-preset-strip {
  border-radius: 8px;
}

.stress-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stress-table-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 1200px) {
  .stress-layout [data-ui-section="package-behavior-table"] {
    grid-column: 1 / -1;
  }

  .stress-layout [data-ui-section="membership-packages"] {
    grid-column: 1 / -1;
  }

  .stress-layout [data-ui-section="scenario-management"] {
    grid-column: 1 / span 5;
  }

  .stress-layout [data-ui-section="scenario-comparison"] {
    grid-column: 6 / -1;
  }
}

@media (max-width: 1320px) {
  .workflow-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .workflow-nav {
    grid-template-columns: 1fr 1fr;
  }

  .workflow-link {
    justify-content: flex-start;
  }

  .stress-metrics {
    grid-template-columns: 1fr;
  }
}

/* Compact full-simulator workspace */
.full-simulator .panel-head,
.stress-command-head {
  gap: 10px;
  padding: 14px 16px;
}

.stress-command-copy h2,
.section-title h3,
.control-group-head strong {
  line-height: 1.15;
}

.stress-command-copy .panel-subtitle,
.section-title p,
.control-group-head p,
.stress-cap-note,
.panel-subtitle {
  font-size: 0.82rem;
  line-height: 1.35;
}

.workflow-nav {
  margin: 8px 0 12px;
  padding: 6px;
}

.workflow-link {
  min-height: 36px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.workflow-link span {
  width: 22px;
  min-width: 22px;
  height: 22px;
}

.stress-layout,
.stress-layout > .dashboard-stack,
.stress-form,
.leadership-control-grid,
.share-snapshot-grid,
.stress-table-grid {
  gap: 10px;
}

.dashboard-section {
  box-shadow: 0 12px 34px rgba(0, 8, 40, 0.22);
}

.dashboard-section[data-category]::before,
.panel[data-category]::before {
  min-height: 20px;
  margin: 10px 12px 0;
  padding: 0 8px;
  font-size: 0.66rem;
}

.dashboard-section[data-category] > .section-title:first-of-type,
.panel[data-category] > .panel-head:first-of-type {
  padding-top: 6px;
}

.section-title {
  gap: 10px;
  padding: 10px 14px;
}

.section-title.compact {
  padding: 8px 14px;
}

.stress-control-group,
.leadership-control-card,
.share-snapshot-card {
  padding: 12px;
}

.control-group-head {
  gap: 4px;
  margin-bottom: 10px;
}

.control-group-grid,
.toggle-grid,
.reward-split-grid,
.rank-access-grid,
.leadership-rate-grid {
  gap: 10px;
}

.field,
.stress-control-group .field {
  gap: 5px;
}

.field input,
.field select,
.table-input,
.share-snapshot-text {
  min-height: 34px;
}

.result-table th,
.result-table td,
.package-table th,
.package-table td {
  padding: 8px 10px;
}

.package-table.rank-reward-table th,
.package-table.rank-reward-table td {
  padding: 6px;
}

.package-table.rank-reward-table th {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.12;
}

.package-table.rank-reward-table td {
  white-space: nowrap;
}

.rank-reward-table .rank-reward-input {
  width: 100%;
  max-width: none;
  min-height: 28px;
  padding: 0 6px;
  box-sizing: border-box;
}

.package-table.rank-upgrade-table th:nth-child(1),
.package-table.rank-upgrade-table td:nth-child(1),
.package-table.rank-cap-table th:nth-child(1),
.package-table.rank-cap-table td:nth-child(1) {
  width: 5%;
}

.package-table.rank-upgrade-table th:nth-child(2),
.package-table.rank-upgrade-table td:nth-child(2),
.package-table.rank-cap-table th:nth-child(2),
.package-table.rank-cap-table td:nth-child(2) {
  width: 12%;
}

.package-table.rank-upgrade-table th:nth-child(3),
.package-table.rank-upgrade-table td:nth-child(3),
.package-table.rank-upgrade-table th:nth-child(9),
.package-table.rank-upgrade-table td:nth-child(9),
.package-table.rank-upgrade-table th:nth-child(10),
.package-table.rank-upgrade-table td:nth-child(10) {
  width: 15.5%;
}

.package-table.rank-upgrade-table th:nth-child(4),
.package-table.rank-upgrade-table td:nth-child(4) {
  width: 8.5%;
}

.package-table.rank-upgrade-table th:nth-child(5),
.package-table.rank-upgrade-table td:nth-child(5),
.package-table.rank-upgrade-table th:nth-child(6),
.package-table.rank-upgrade-table td:nth-child(6),
.package-table.rank-upgrade-table th:nth-child(7),
.package-table.rank-upgrade-table td:nth-child(7),
.package-table.rank-upgrade-table th:nth-child(8),
.package-table.rank-upgrade-table td:nth-child(8) {
  width: 7%;
}

.package-table.rank-cap-table th:nth-child(3),
.package-table.rank-cap-table td:nth-child(3),
.package-table.rank-cap-table th:nth-child(4),
.package-table.rank-cap-table td:nth-child(4) {
  width: 9%;
}

.package-table.rank-cap-table th:nth-child(5),
.package-table.rank-cap-table td:nth-child(5),
.package-table.rank-cap-table th:nth-child(10),
.package-table.rank-cap-table td:nth-child(10),
.package-table.rank-cap-table th:nth-child(7),
.package-table.rank-cap-table td:nth-child(7),
.package-table.rank-cap-table th:nth-child(9),
.package-table.rank-cap-table td:nth-child(9),
.package-table.rank-cap-table th:nth-child(12),
.package-table.rank-cap-table td:nth-child(12),
.package-table.rank-cap-table th:nth-child(14),
.package-table.rank-cap-table td:nth-child(14) {
  width: 5.5%;
}

.package-table.rank-cap-table th:nth-child(6),
.package-table.rank-cap-table td:nth-child(6),
.package-table.rank-cap-table th:nth-child(8),
.package-table.rank-cap-table td:nth-child(8),
.package-table.rank-cap-table th:nth-child(11),
.package-table.rank-cap-table td:nth-child(11),
.package-table.rank-cap-table th:nth-child(13),
.package-table.rank-cap-table td:nth-child(13) {
  width: 8.25%;
}

.rank-reward-table .rank-percent-input,
.rank-reward-table .rank-count-input {
  max-width: none;
}

.rank-reward-table .rank-cap-switch {
  width: 42px;
  height: 24px;
}

.rank-reward-table .rank-cap-switch .switch-track::after {
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
}

.rank-reward-table .rank-cap-switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.metric,
.stress-metrics .metric {
  min-height: 0;
  padding: 10px;
}

.stress-metrics .metric {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stress-metrics .metric:nth-child(5n) {
  border-right: 1px solid var(--line);
}

.stress-metrics .metric:nth-child(4n) {
  border-right: 0;
}

@media (max-width: 1320px) and (min-width: 761px) {
  .stress-metrics .metric:nth-child(4n),
  .stress-metrics .metric:nth-child(5n) {
    border-right: 1px solid var(--line);
  }

  .stress-metrics .metric:nth-child(3n) {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .stress-metrics .metric,
  .stress-metrics .metric:nth-child(3n),
  .stress-metrics .metric:nth-child(4n),
  .stress-metrics .metric:nth-child(5n) {
    border-right: 0;
  }
}

/* Simulation overview growth panel */
.member-overview-grid {
  grid-template-columns: 1fr;
}

.member-curve-section {
  padding: 16px;
}

.member-growth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.member-growth-preview {
  min-height: 100%;
  padding: 12px;
}

.member-growth-preview .curve-preview-chart {
  height: clamp(210px, 17vw, 280px);
}

.member-growth-control-rail {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(18, 209, 200, 0.18);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(18, 209, 200, 0.08), rgba(1, 36, 159, 0.08)),
    rgba(2, 9, 44, 0.46);
}

.member-growth-control-rail .field {
  gap: 5px;
}

.member-growth-control-rail .curve-grid.single-curve-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

.member-growth-control-rail .curve-control {
  padding: 11px;
  border: 1px solid rgba(18, 209, 200, 0.16);
  border-radius: 10px;
  background: rgba(2, 12, 48, 0.56);
}

.curve-point-target {
  cursor: crosshair;
  outline: none;
}

.curve-point-hit {
  fill: transparent;
  pointer-events: all;
}

.curve-point-guide,
.curve-point {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.curve-point-guide {
  stroke: rgba(141, 236, 231, 0.45);
  stroke-dasharray: 3 3;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.curve-point {
  fill: #ffffff;
  stroke: #12d1c8;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 7px rgba(18, 209, 200, 0.72));
  vector-effect: non-scaling-stroke;
}

.curve-point-target:hover .curve-point-guide,
.curve-point-target:focus .curve-point-guide,
.curve-point-target:focus-visible .curve-point-guide,
.curve-point-target:hover .curve-point,
.curve-point-target:focus .curve-point,
.curve-point-target:focus-visible .curve-point {
  opacity: 1;
}

@media (max-width: 1180px) {
  .member-growth-layout {
    grid-template-columns: 1fr;
  }

  .member-growth-control-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .member-growth-control-rail .curve-grid.single-curve-grid {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .member-curve-section {
    padding: 12px;
  }

  .member-growth-control-rail {
    grid-template-columns: 1fr;
  }
}

/* Command center visual refresh */
.stress-command-head {
  position: relative;
  top: auto;
  isolation: isolate;
  overflow: hidden;
  grid-template-columns: minmax(620px, 0.96fr) minmax(520px, 1.04fr);
  grid-template-areas:
    "copy pills"
    "live presets";
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(141, 236, 231, 0.34);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(18, 209, 200, 0.13), rgba(1, 36, 159, 0.05) 42%, transparent 70%),
    linear-gradient(180deg, rgba(9, 31, 90, 0.96), rgba(3, 13, 54, 0.94));
  box-shadow:
    0 24px 60px rgba(0, 7, 40, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.stress-command-head::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 3px;
  background: linear-gradient(90deg, #12d1c8, #028ac7, #01249f, #12d1c8);
  content: "";
}

.stress-command-head::after {
  position: absolute;
  inset: 10px;
  z-index: -1;
  border: 1px solid rgba(141, 236, 231, 0.08);
  border-radius: 10px;
  content: "";
  pointer-events: none;
}

.stress-command-copy {
  padding-left: 14px;
  border-left: 3px solid #12d1c8;
}

.stress-command-copy h2 {
  color: #ffffff;
  font-size: clamp(1.05rem, 1.35vw, 1.45rem);
  letter-spacing: 0;
}

.stress-command-copy .panel-subtitle {
  max-width: 660px;
  margin-top: 6px;
  color: #c6dce7;
}

.stress-command-head .logic-pills {
  align-content: start;
  gap: 8px;
}

.stress-command-head .logic-pills span {
  min-height: 34px;
  border-color: rgba(141, 236, 231, 0.24);
  background:
    linear-gradient(180deg, rgba(18, 209, 200, 0.13), rgba(255, 255, 255, 0.035)),
    rgba(2, 12, 48, 0.62);
  color: #d7eef4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stress-command-head .stress-live-controls {
  justify-self: stretch;
  min-width: 0;
}

.stress-command-presets {
  align-self: start;
}

.stress-live-controls {
  gap: 10px;
  padding: 14px;
  border-color: rgba(141, 236, 231, 0.3);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(18, 209, 200, 0.1), rgba(2, 138, 199, 0.06)),
    rgba(2, 12, 48, 0.76);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 18px 42px rgba(0, 7, 40, 0.22);
}

.stress-live-actions {
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
}

.stress-live-actions .button {
  min-height: 40px;
  border-color: rgba(141, 236, 231, 0.24);
  border-radius: 8px;
  background: rgba(5, 23, 70, 0.78);
  color: #eef9ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stress-live-actions .button.primary {
  border-color: rgba(18, 209, 200, 0.8);
  background: linear-gradient(135deg, #12d1c8, #028ac7 72%, #01249f);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(141, 236, 231, 0.16),
    0 12px 28px rgba(2, 138, 199, 0.28);
}

.stress-live-actions .button:disabled {
  opacity: 0.62;
}

.stress-live-actions .button[data-action="run-stress-scenarios"] {
  margin-left: auto;
}

.stress-live-status {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(141, 236, 231, 0.18);
  border-left: 3px solid #12d1c8;
  border-radius: 8px;
  background: rgba(3, 13, 54, 0.62);
  color: #d7eef4;
  text-align: left;
}

.stress-live-progress {
  height: 9px;
  border-color: rgba(141, 236, 231, 0.24);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 8px rgba(0, 7, 40, 0.34);
}

.stress-command-presets .stress-preset-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  min-height: 0;
  padding: 14px;
  border-color: rgba(141, 236, 231, 0.26);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(1, 36, 159, 0.18), rgba(18, 209, 200, 0.06)),
    rgba(2, 12, 48, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 18px 42px rgba(0, 7, 40, 0.18);
}

.preset-strip-label {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(141, 236, 231, 0.18);
  color: #8dece7;
  overflow: hidden;
}

.preset-button-row {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(auto-fit, minmax(min(154px, 100%), 1fr));
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.preset-button {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  align-items: center;
  justify-content: center;
  gap: 3px;
  overflow: hidden;
  min-width: 0;
  min-height: 72px;
  padding: 11px 12px;
  border-color: rgba(141, 236, 231, 0.22);
  border-radius: 8px;
  background: rgba(5, 23, 70, 0.82);
  color: #f2fbff;
  line-height: 1.1;
  text-align: center;
}

.preset-button span,
.preset-button small {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.preset-years {
  font-size: 0.92rem;
  font-weight: 950;
}

.preset-users {
  color: #d8f2ff;
  font-size: 0.74rem;
  font-weight: 850;
}

.preset-button.active,
.preset-button:hover,
.preset-button:focus-visible {
  border-color: rgba(18, 209, 200, 0.72);
  background:
    linear-gradient(135deg, rgba(18, 209, 200, 0.28), rgba(2, 138, 199, 0.18)),
    rgba(5, 23, 70, 0.86);
  color: #ffffff;
  box-shadow:
    inset 0 -3px 0 rgba(18, 209, 200, 0.95),
    0 0 0 1px rgba(18, 209, 200, 0.18);
}

.preset-button small,
.preset-gens {
  color: #b8dce9;
  font-size: 0.68rem;
  font-weight: 900;
  opacity: 1;
}

.workflow-nav {
  gap: 9px;
  margin: 12px 0 16px;
  padding: 9px;
  border-color: rgba(141, 236, 231, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(7, 25, 75, 0.94), rgba(3, 13, 54, 0.92)),
    rgba(2, 9, 44, 0.84);
  box-shadow: 0 18px 48px rgba(0, 7, 40, 0.28);
}

.workflow-link {
  position: relative;
  justify-content: flex-start;
  min-height: 44px;
  padding: 0 12px;
  border-color: rgba(141, 236, 231, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    rgba(7, 25, 75, 0.64);
}

.workflow-link::after {
  position: absolute;
  right: 12px;
  bottom: 7px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: rgba(18, 209, 200, 0);
  content: "";
  transition: background 140ms ease, box-shadow 140ms ease;
}

.workflow-link:hover::after,
.workflow-link:focus-visible::after {
  background: rgba(18, 209, 200, 0.88);
  box-shadow: 0 0 12px rgba(18, 209, 200, 0.44);
}

.workflow-link span {
  border: 1px solid rgba(141, 236, 231, 0.22);
  background: linear-gradient(135deg, rgba(18, 209, 200, 0.24), rgba(2, 138, 199, 0.14));
  color: #9df8f2;
}

@media (max-width: 1320px) {
  .stress-command-head {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "pills"
      "live"
      "presets";
    padding: 16px;
  }

  .stress-command-head .logic-pills {
    justify-content: flex-start;
  }

  .preset-button-row {
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  }
}

@media (max-width: 760px) {
  .stress-command-head {
    padding: 14px;
  }

  .stress-command-copy {
    padding-left: 10px;
  }

  .stress-command-head .logic-pills span {
    min-height: 30px;
    font-size: 0.72rem;
  }

  .stress-live-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stress-live-actions .button {
    min-width: 0;
  }

  .stress-live-actions .button[data-action="run-stress-scenarios"],
  .stress-live-actions .button[data-action="clear-stress-simulation"] {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .stress-command-presets .stress-preset-strip {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .preset-strip-label {
    justify-content: start;
    place-items: center start;
    padding-right: 0;
    padding-bottom: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(141, 236, 231, 0.18);
  }

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

  .workflow-link {
    min-height: 42px;
  }
}

/* Stable section category tags */
.dashboard-section[data-category],
.panel[data-category] {
  position: relative;
  padding-top: 44px;
}

.dashboard-section[data-category]::before,
.panel[data-category]::before {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 24px;
  margin: 0;
  padding: 0 11px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.dashboard-section.has-section-category-tag::before,
.panel.has-section-category-tag::before {
  display: none;
  content: none;
}

.section-category-tag {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 24px;
  padding: 0 11px;
  border: 1px solid rgba(18, 209, 200, 0.28);
  border-radius: 999px;
  background: rgba(18, 209, 200, 0.1);
  color: #8dece7;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.dashboard-section[data-category] > .section-title:first-of-type,
.panel[data-category] > .panel-head:first-of-type {
  padding-top: 12px;
}

.dashboard-section > .section-category-tag + .section-title,
.panel > .section-category-tag + .panel-head {
  border-top: 0;
}

@media (max-width: 760px) {
  .dashboard-section[data-category],
  .panel[data-category] {
    padding-top: 42px;
  }

  .dashboard-section[data-category]::before,
  .panel[data-category]::before {
    top: 12px;
    left: 12px;
    min-height: 22px;
    padding: 0 9px;
  }

  .section-category-tag {
    top: 12px;
    left: 12px;
    min-height: 22px;
    padding: 0 9px;
  }
}
