/* Command Center and dashboard-owned interface rules. */
@media (min-width: 821px) {
  .dashboard-body {
    font-size: 12.8px;
  }

  .guide-link-button {
    min-width: 96px;
  }
}

.strategy-tabs {
  min-width: 164px;
  min-height: 42px;
}

.session-pill {
  min-width: 180px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fffdf3;
  color: var(--muted);
  padding: 10px 18px;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: 0 10px 22px rgba(138, 101, 15, 0.1);
}

.session-pill.ready {
  border-color: #8bdc94;
  background: var(--green-soft);
  color: #00491c;
}

.home-body {
  min-height: 100vh;
  overflow-x: clip;
}

@supports not (overflow: clip) {
  .home-body {
    overflow-x: hidden;
    overflow-y: visible;
  }
}

.home-shell {
  display: grid;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 32px 0;
  place-items: center;
}

.command-center {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  width: 100%;
  padding: 0;
  text-align: center;
}

.command-brand {
  display: grid;
  justify-items: center;
  gap: 18px;
  max-width: 100%;
}

.command-logo {
  display: block;
  width: clamp(68px, 8vw, 104px);
  height: clamp(68px, 8vw, 104px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-lift);
  object-fit: contain;
  padding: clamp(9px, 1.2vw, 14px);
}

.command-title {
  margin: 0;
  font-size: clamp(1.78rem, 6.9vw, 5.1rem);
  line-height: 0.96;
  max-width: 100%;
  white-space: nowrap;
}

.command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.command-card {
  display: inline-flex;
  min-width: 156px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(20, 34, 27, 0.08);
  color: var(--ink);
  padding: 12px 22px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.command-card:hover,
.command-card:focus-visible {
  border-color: var(--green);
  background: var(--green);
  color: #001707;
  box-shadow: 0 18px 40px rgba(0, 200, 5, 0.16);
  transform: translateY(-2px);
}

.session-pill.missing {
  border-color: #e8ce80;
  background: #fff7d8;
  color: #684a00;
}

.session-pill.warning {
  border-color: #e8ce80;
  background: #fff7d8;
  color: #684a00;
}

.session-pill.error {
  border-color: #ff8a96;
  background: #fff0f1;
  color: #b00020;
  font-weight: 850;
}

.connection-band.helper-warning {
  border-color: #e8ce80;
  background: #fffdf3;
}

.connection-band.helper-error {
  border-color: #ff8a96;
  background: #fff7f8;
}

.connection-band.helper-error #connectionSubtitle {
  color: #b00020;
  font-weight: 800;
}

.guide-link-button {
  min-width: 112px;
}

.connection-band,
.control-band {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-glass);
  box-shadow: var(--shadow-soft);
}

.control-band {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, max-content);
  align-items: start;
  justify-content: space-between;
  gap: 6px;
  padding: 15px 16px;
  overflow: hidden;
}

.connection-panel {
  display: contents;
}

.connection-panel > div:first-child {
  min-width: 0;
}

.connection-subtitle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  max-width: 920px;
}

.connection-help-link {
  white-space: nowrap;
}

.connection-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-items: center;
  align-self: center;
  gap: 12px;
}

.connection-disclosure {
  display: grid;
  max-width: none;
  gap: 4px;
  padding-right: 0;
}

.connection-disclosure p {
  margin: 0;
}

.connection-disclosure p:first-child {
  white-space: nowrap;
}

#runButton {
  flex: 0 0 84px;
  width: 84px;
  min-width: 84px;
}

#exportButton {
  flex: 0 0 112px;
  width: 112px;
  min-width: 112px;
}

#manageScreenersButton {
  min-width: 62px;
  padding-inline: 8px;
}

#runButton.run-scan,
#runButton.run-refresh {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(7, 17, 13, 0.15);
}

#runButton.run-busy {
  border-color: #647069;
  background: #647069;
  color: #ffffff;
}

#runButton:disabled {
  cursor: wait;
}

body[data-strategy="cc"] .csp-screener-control,
body[data-strategy="cc"] .portfolio-control {
  display: none;
}

.portfolio-control {
  flex: 0 0 116px;
  width: 116px;
}

.control-band .portfolio-control input {
  font-size: 0.88rem;
}

.control-group {
  display: flex;
  align-items: end;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}

.control-group-left {
  justify-content: flex-start;
}

.control-group-right {
  justify-content: flex-end;
}

.return-field {
  flex: 0 0 auto;
  min-width: 0;
}

.csp-screener-control {
  flex: 0 0 300px;
  width: 300px;
}

.source-control {
  flex: 0 0 190px;
  width: 190px;
}

.csp-screener-control select {
  font-size: 0.84rem;
  padding-inline: 8px;
}

body[data-strategy="cc"] .control-group-left {
  justify-content: flex-start;
}

body[data-strategy="cc"] .control-group-right {
  justify-content: flex-end;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] .csp-screener-control {
  display: none;
}

.field > span,
.metric span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.return-field {
  align-items: stretch;
}

.selection-criteria-row {
  display: flex;
  align-items: start;
  gap: 5px;
  min-width: 0;
}

.return-input-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 86px;
  gap: 5px;
  align-items: end;
}

.selection-rule-modes {
  flex: 0 0 214px;
  width: 214px;
  grid-template-columns: 0.95fr 1.45fr 0.8fr;
  min-height: 46px;
}

.selection-rule-field {
  flex: 0 0 214px;
  width: 214px;
  gap: 4px;
}

.selection-rule-field .selection-rule-modes {
  width: 100%;
}

.selection-rule-field .cc-above-cost-control {
  gap: 5px;
  justify-self: start;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1;
  min-height: 14px;
  text-transform: none;
  white-space: nowrap;
}

.selection-rule-field .cc-above-cost-control input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: var(--green-deep);
}

.selection-rule-field .cc-above-cost-control span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-transform: none;
  white-space: nowrap;
}

.selection-rule-modes .segment {
  padding-inline: 5px;
  font-size: 0.8rem;
}

.chance-profit-field {
  flex: 0 0 100px;
  width: 100px;
  max-width: 100px;
}

.chance-profit-field span {
  font-size: 0.66rem;
}

.numeric-stepper {
  position: relative;
  width: 100%;
  min-width: 0;
}

.numeric-stepper input {
  padding-right: 36px;
}

.numeric-stepper-buttons {
  position: absolute;
  top: 3px;
  right: 3px;
  bottom: 3px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  width: 28px;
  overflow: hidden;
  border-left: 1px solid rgba(204, 216, 202, 0.9);
  border-radius: 5px;
}

.numeric-stepper-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 28px;
  height: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #60706c;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}

.numeric-stepper-button::before {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}

.numeric-stepper-button[data-stepper="up"]::before {
  border-bottom: 5px solid currentColor;
}

.numeric-stepper-button[data-stepper="down"]::before {
  border-top: 5px solid currentColor;
}

.numeric-stepper-button:hover,
.numeric-stepper-button:focus-visible {
  background: rgba(0, 200, 5, 0.08);
  color: var(--green-deep);
  outline: none;
}

.numeric-stepper-inline {
  display: inline-block;
  width: auto;
  vertical-align: middle;
}

.screener-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  min-width: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.metric {
  min-height: 94px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-elevated);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.15;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid #c9dfc6;
  border-radius: 8px;
  background: #f2faf1;
  color: #1e4d24;
  padding: 13px 16px;
  box-shadow: 0 8px 18px rgba(20, 34, 27, 0.045);
}

.notice.error {
  border-color: #e6a5aa;
  background: #fff1f2;
  color: var(--red);
}

body:has(.control-band) .table-section {
  margin-bottom: 128px;
}

.table-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px);
  align-items: start;
  gap: 18px 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-elevated);
}

.release-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-surface);
  background: rgba(238, 243, 236, 0.72);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.release-panel div {
  display: grid;
  gap: 4px;
}

.release-panel span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.release-panel strong {
  font-size: 0.96rem;
}

.table-heading-copy {
  min-width: 0;
}

.table-source-toolbar {
  display: grid;
  justify-items: end;
  justify-self: end;
  gap: 8px;
  width: min(340px, 100%);
  min-width: 0;
}

.table-source-control {
  width: 100%;
  min-width: 0;
}

.table-header .check-control {
  justify-self: end;
  margin-top: 1px;
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.check-control input {
  width: 15px;
  height: 15px;
  accent-color: var(--green-deep);
}

.table-wrap {
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.58);
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 10px;
  text-align: right;
  vertical-align: middle;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  white-space: nowrap;
}

.highlight-column {
  color: var(--ink);
  font-weight: 700;
}

th.highlight-column {
  font-weight: 800;
}

th[data-column="symbol"],
td[data-column="symbol"],
th[data-column="status"],
td[data-column="status"] {
  text-align: left;
}

tbody tr:hover {
  background: rgba(231, 248, 230, 0.28);
}

tbody tr:last-child td {
  border-bottom: 0;
}

th[data-column="rank"],
td[data-column="rank"] {
  width: 4%;
}

th[data-column="symbol"],
td[data-column="symbol"] {
  width: 10%;
}

th[data-column="status"],
td[data-column="status"] {
  width: 8%;
}

th[data-column="current"],
td[data-column="current"] {
  width: 6%;
}

th[data-column="min"],
td[data-column="min"],
th[data-column="avg"],
td[data-column="avg"],
th[data-column="max"],
td[data-column="max"] {
  width: 5%;
}

th[data-column="allocation"],
td[data-column="allocation"] {
  width: 8%;
}

th[data-column="target"],
td[data-column="target"] {
  width: 7%;
}

th[data-column="strike"],
td[data-column="strike"] {
  width: 6%;
}

th[data-column="bid"],
td[data-column="bid"] {
  width: 5%;
}

th[data-column="return"],
td[data-column="return"],
th[data-column="chance"],
td[data-column="chance"] {
  width: 7%;
}

th[data-column="contracts"],
td[data-column="contracts"] {
  width: 8%;
}

th[data-column="used"],
td[data-column="used"] {
  width: 9%;
}

td[data-column="allocation"],
td[data-column="target"],
td[data-column="used"],
td[data-column="total-return"] {
  font-size: 0.84rem;
  letter-spacing: 0;
}

td[data-column="used"],
td[data-column="total-return"] {
  padding-right: 6px;
  padding-left: 6px;
}

td[data-column="total-return"] {
  font-size: 0.82rem;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: break-word;
}

body[data-strategy="cc"] th[data-column="symbol"],
body[data-strategy="cc"] td[data-column="symbol"] {
  width: 13%;
  text-align: left;
}

.cc-symbol-header {
  min-width: 0;
  white-space: nowrap;
}

.cc-header-remove-spacer {
  display: inline-block;
  width: 28px;
  margin-right: 10px;
  vertical-align: middle;
}

.cc-header-label {
  display: inline-block;
  white-space: nowrap;
  vertical-align: middle;
}

body[data-strategy="cc"] th[data-column="status"],
body[data-strategy="cc"] td[data-column="status"] {
  width: 7%;
  text-align: left;
}

body[data-strategy="cc"] th[data-column="average-cost"],
body[data-strategy="cc"] td[data-column="average-cost"] {
  width: 8%;
  text-align: right;
}

body[data-strategy="cc"] th[data-column="current"],
body[data-strategy="cc"] td[data-column="current"] {
  width: 6%;
}

body[data-strategy="cc"] th[data-column="min"],
body[data-strategy="cc"] td[data-column="min"],
body[data-strategy="cc"] th[data-column="avg"],
body[data-strategy="cc"] td[data-column="avg"],
body[data-strategy="cc"] th[data-column="max"],
body[data-strategy="cc"] td[data-column="max"],
body[data-strategy="cc"] th[data-column="bid"],
body[data-strategy="cc"] td[data-column="bid"] {
  width: 6%;
}

body[data-strategy="cc"] th[data-column="strike"],
body[data-strategy="cc"] td[data-column="strike"],
body[data-strategy="cc"] th[data-column="return"],
body[data-strategy="cc"] td[data-column="return"],
body[data-strategy="cc"] th[data-column="chance"],
body[data-strategy="cc"] td[data-column="chance"] {
  width: 7%;
}

body[data-strategy="cc"] th[data-column="contracts"],
body[data-strategy="cc"] td[data-column="contracts"] {
  width: 8%;
}

body[data-strategy="cc"] th[data-column="total-return"],
body[data-strategy="cc"] td[data-column="total-return"] {
  width: 13%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="symbol"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="symbol"] {
  width: 13%;
  text-align: left;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="status"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="status"] {
  width: 7%;
  text-align: left;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="current"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="current"] {
  width: 6%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="min"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="min"],
body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="avg"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="avg"],
body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="max"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="max"],
body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="strike"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="strike"] {
  width: 6%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="allocation"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="allocation"] {
  width: 8%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="target"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="target"],
body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="return"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="return"],
body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="chance"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="chance"] {
  width: 7%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="bid"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="bid"] {
  width: 4%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="used"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="used"] {
  width: 7%;
}

body[data-strategy="csp"][data-csp-input-mode="manual"] th[data-column="contracts"],
body[data-strategy="csp"][data-csp-input-mode="manual"] td[data-column="contracts"] {
  width: 8%;
}

@media (min-width: 821px) {

  .strategy-tabs {
    min-width: 132px;
    min-height: 36px;
  }

  .session-pill {
    min-width: 144px;
    padding: 8px 14px;
    font-size: 0.95rem;
  }

  .home-shell {
    padding: 26px 0;
  }

  .command-center {
    gap: 22px;
  }

  .command-brand {
    gap: 15px;
  }

  .command-logo {
    width: clamp(58px, 6vw, 84px);
    height: clamp(58px, 6vw, 84px);
    border-radius: 19px;
  }

  .command-title {
    font-size: clamp(2.2rem, 6.2vw, 5rem);
  }

  .command-card {
    min-width: 132px;
    min-height: 38px;
    padding: 9px 18px;
  }

  .control-band {
    gap: 6px;
    padding: 15px 16px;
  }

  .field > span,
  .metric span {
    font-size: 0.8rem;
  }

  .summary-grid {
    gap: 13px;
    margin: 17px 0;
  }

  .metric {
    min-height: 75px;
    padding: 13px 16px;
  }

  .metric span {
    margin-bottom: 6px;
  }

  .metric strong {
    font-size: 1.55rem;
  }

  .notice {
    margin-bottom: 15px;
    padding: 10px 13px;
  }

  .table-header {
    gap: 14px 20px;
    padding: 16px 18px;
  }

  .table-source-toolbar {
    gap: 6px;
    width: min(310px, 100%);
  }

  .check-control {
    gap: 7px;
    font-size: 0.95rem;
  }

  .check-control input {
    width: 13px;
    height: 13px;
  }

  th,
  td {
    padding: 9px 8px;
    font-size: 0.9rem;
    line-height: 1.2;
  }

  th {
    font-size: 0.72rem;
  }

  .cc-list-row td,
  .manual-csp-row td {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .cc-list-actions {
    padding: 13px 16px;
  }

  .settings-dialog-content,
  .onboarding-content {
    padding: 19px;
  }
}

.control-band .primary-button,
.control-band .secondary-button {
  font-size: 0.82rem;
  padding-inline: 10px;
}

.control-band .segment {
  font-size: 0.82rem;
  padding-inline: 5px;
}

.control-band .segment.active {
  font-size: 0.82rem;
}

.control-band .selection-rule-modes .segment,
.control-band .selection-rule-modes .segment.active {
  font-size: 0.8rem;
  padding-inline: 5px;
}

.control-band input[type="number"],
.control-band input[type="text"],
.control-band select {
  font-size: 0.84rem;
  padding-inline: 8px;
}

.control-band .mini-field input {
  font-size: 0.82rem;
  padding-inline: 6px;
}

.control-band .numeric-stepper input {
  padding-right: 22px;
}

.control-band .mini-field .numeric-stepper input {
  padding-right: 20px;
}

.control-band .field > span {
  font-size: 0.72rem;
}

.control-band .source-control .segment {
  padding-inline: 4px;
}

@media (max-width: 1500px) and (min-width: 1241px) {

  .portfolio-control {
    flex-basis: 112px;
    width: 112px;
  }

  #runButton {
    flex-basis: 80px;
    width: 80px;
    min-width: 80px;
  }

  #exportButton {
    flex-basis: 106px;
    width: 106px;
    min-width: 106px;
  }

  #manageScreenersButton {
    min-width: 58px;
    padding-inline: 7px;
  }

  .csp-screener-control {
    flex-basis: 292px;
    width: 292px;
  }

  .source-control {
    flex-basis: 184px;
    width: 184px;
  }

  .selection-criteria-row {
    gap: 4px;
  }

  .return-input-grid {
    grid-auto-columns: 82px;
    gap: 4px;
  }

  .selection-rule-modes,
  .selection-rule-field {
    flex-basis: 190px;
    width: 190px;
  }

  .chance-profit-field {
    flex-basis: 96px;
    width: 96px;
    max-width: 96px;
  }

  .control-band .selection-rule-modes .segment,
  .control-band .selection-rule-modes .segment.active {
    font-size: 0.76rem;
    padding-inline: 3px;
  }
}

.cc-list-row td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.manual-csp-row td {
  padding-top: 9px;
  padding-bottom: 9px;
}

.cc-symbol-cell {
  display: grid;
  grid-template-columns: 28px minmax(8ch, 10ch);
  align-items: center;
  justify-content: start;
  gap: 10px;
  min-width: 0;
}

.manual-symbol-cell {
  display: grid;
  grid-template-columns: 28px minmax(8ch, 12ch);
  align-items: center;
  justify-content: start;
  gap: 10px;
  min-width: 0;
}

.cc-inline-input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 520;
  padding: 6px 8px;
  text-align: right;
}

.cc-inline-input:focus {
  border-color: var(--green);
  outline: 2px solid rgba(0, 200, 5, 0.18);
  outline-offset: 1px;
}

.cc-inline-input[readonly] {
  background: #f8faf7;
  color: var(--ink);
}

.cc-symbol-input {
  width: 10ch;
  max-width: 10ch;
  text-align: left;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 850;
}

.manual-csp-symbol-input {
  width: 10ch;
  max-width: 10ch;
  text-align: left;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 850;
}

.cc-average-cost-stepper {
  width: 128px;
  max-width: 128px;
}

.cc-contracts-stepper {
  width: 8ch;
  max-width: 8ch;
}

.cc-average-cost-stepper .cc-average-cost-input,
.cc-contracts-stepper .cc-contracts-input {
  width: 100%;
  max-width: 100%;
}

.cc-average-cost-stepper .cc-average-cost-input {
  padding-right: 30px;
}

.cc-contracts-input {
  font-weight: 700;
  text-align: center;
}

.cc-remove-button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid #f0b5b8;
  border-radius: 999px;
  background: #fff4f5;
  color: var(--red);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.cc-remove-button:hover,
.cc-remove-button:focus-visible {
  border-color: var(--red);
  background: #ffe7e9;
  outline: none;
}

.cc-list-actions {
  align-items: center;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: center;
  padding: 16px 20px;
  background: rgba(251, 253, 249, 0.66);
}

.add-entry-button {
  min-width: 132px;
}

.symbol-link {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.symbol-link:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 850;
}

.status.eligible {
  background: var(--green-soft);
  color: #005c20;
}

.status.ineligible {
  background: #edf0ea;
  color: var(--muted);
}

.status.unused {
  background: #fff7df;
  color: var(--amber);
}

.status.skip {
  background: #fff3e6;
  color: #9a4f00;
}

.status.unavailable,
.status.missing-data,
.status.missing-current {
  background: #fff0f1;
  color: var(--red);
}

.empty-cell {
  color: var(--muted);
  padding: 36px 16px;
  text-align: center !important;
}

.empty-row .empty-cell {
  width: 100%;
  text-align: center !important;
}

.onboarding-dialog {
  width: min(620px, calc(100% - 32px));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow-lift);
}

.onboarding-dialog::backdrop {
  background: rgba(7, 17, 13, 0.38);
}

.settings-dialog {
  width: min(720px, calc(100% - 32px));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow-lift);
}

.settings-dialog::backdrop {
  background: rgba(7, 17, 13, 0.38);
}

.settings-dialog-content {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.settings-dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.settings-dialog-heading h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

.settings-dialog-heading p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.screener-manager-list {
  display: grid;
  gap: 10px;
}

.screener-manager-row,
.screener-add-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.screener-manager-row input,
.screener-add-row input {
  min-width: 0;
}

.screener-add-row {
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.select-screener-button,
.delete-screener-button {
  min-width: 84px;
  height: 40px;
}

.delete-screener-button {
  border-color: #f0b5b8;
  background: #fff4f5;
  color: var(--red);
}

.delete-screener-button:disabled {
  opacity: 0.42;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.onboarding-content {
  padding: 24px;
}

.onboarding-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.onboarding-heading h2 {
  max-width: 470px;
  font-size: 1.45rem;
  line-height: 1.18;
}

.onboarding-steps {
  display: grid;
  gap: 12px;
  margin: 20px 0 22px;
  padding: 0;
  list-style: none;
  counter-reset: onboarding-step;
}

.onboarding-steps li {
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 12px;
  counter-increment: onboarding-step;
}

.onboarding-steps li::before {
  display: inline-flex;
  width: 30px;
  height: 30px;
  grid-row: span 2;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
  content: counter(onboarding-step);
  font-size: 0.82rem;
  font-weight: 850;
}

.onboarding-steps span {
  color: var(--muted);
  font-size: 0.92rem;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 1240px) {
  .control-band {
    grid-template-columns: 1fr;
  }

  .control-group-left,
  .control-group-right {
    flex-wrap: wrap;
    width: 100%;
  }

  .control-group-right {
    margin-left: 0;
    justify-content: stretch;
  }

  .control-group-right > .field,
  .control-group-right > button {
    flex: 1 1 220px;
  }

  .source-control,
  .csp-screener-control {
    width: auto;
  }
}

@media (max-width: 980px) {
  .selection-criteria-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 820px) {
  .home-shell {
    width: min(100% - 28px, 1180px);
    padding: 26px 0;
  }

  .command-center {
    gap: 24px;
    padding: 0;
  }

  .command-actions {
    width: min(100%, 380px);
  }

  .command-card {
    min-height: 48px;
    min-width: 150px;
    padding: 12px 20px;
  }

  .table-header {
    grid-template-columns: 1fr;
  }

  .release-panel {
    grid-template-columns: 1fr;
  }

  .table-source-toolbar {
    justify-items: stretch;
    justify-self: stretch;
    width: 100%;
  }

  .table-header .check-control {
    justify-self: start;
  }

  .session-pill {
    width: 100%;
  }

  .connection-band {
    grid-template-columns: 1fr;
  }

  .connection-panel {
    display: grid;
    gap: 14px;
  }

  .connection-actions {
    grid-column: auto;
    grid-row: auto;
    align-self: stretch;
    align-items: stretch;
    flex-direction: column;
  }

  .connection-actions .secondary-button {
    width: 100%;
  }

  .connection-disclosure {
    max-width: none;
    padding-right: 0;
  }

  .connection-disclosure p:first-child {
    white-space: normal;
  }

  .connection-subtitle-row {
    max-width: none;
  }

  .control-band {
    display: grid;
    grid-template-columns: 1fr;
  }

  .control-group-left,
  .control-group-right {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 12px;
  }

  .portfolio-control,
  .return-field,
  .source-control,
  .csp-screener-control,
  #runButton,
  #exportButton {
    width: 100%;
    max-width: none;
  }

  .selection-criteria-row,
  .return-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
  }

  .selection-rule-modes {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .selection-rule-field {
    grid-column: 1 / -1;
    width: 100%;
  }

  .return-input-grid {
    grid-column: 1 / -1;
  }

  .chance-profit-field {
    width: 100%;
    max-width: none;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .check-control {
    align-items: flex-start;
    white-space: normal;
  }

  .table-wrap {
    overflow-x: hidden;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tbody tr {
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }

  tbody tr:last-child {
    border-bottom: 0;
  }

  th,
  td,
  th[data-column],
  td[data-column] {
    width: 100%;
  }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 0;
    padding: 8px 0;
    text-align: right;
    font-size: 0.94rem;
  }

  td::before {
    flex: 0 0 auto;
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.74rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  td.highlight-column::before {
    color: var(--ink);
    font-weight: 800;
  }

  td[data-column="symbol"],
  td[data-column="status"] {
    text-align: right;
  }

  .cc-symbol-cell {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .manual-symbol-cell {
    width: min(100%, 240px);
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .cc-symbol-input,
  .manual-csp-symbol-input,
  .cc-average-cost-input,
  .cc-contracts-input,
  .cc-average-cost-stepper,
  .cc-contracts-stepper {
    width: 100%;
    max-width: none;
  }

  .empty-cell {
    display: block;
    text-align: center;
  }

  .empty-cell::before {
    content: "";
  }
}

@media (max-width: 540px) {

  .home-shell {
    width: min(100% - 24px, 1180px);
    padding: 24px 0;
  }

  .command-logo {
    width: 66px;
    height: 66px;
    border-radius: 18px;
  }

  .command-title {
    font-size: clamp(1.72rem, 7.2vw, 2.1rem);
    line-height: 1.02;
    white-space: normal;
  }

  .command-actions {
    gap: 10px;
  }

  .command-card {
    min-width: 142px;
    min-height: 46px;
    padding: 11px 16px;
    font-size: 0.95rem;
  }

  .connection-band,
  .control-band,
  .table-header {
    padding: 14px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .screener-select-row {
    grid-template-columns: 1fr;
  }

  .csp-input-mode-control .segment,
  .cc-input-mode-control .segment {
    font-size: 0.9rem;
  }
}
