/* Profit calculator workspace */
.profit-inline-status {
  margin-block: 10px;
}

.profit-saved-reference {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-block: 14px;
  padding: 12px 16px;
  background: var(--color-canvas);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
}

.profit-saved-reference > div {
  display: grid;
  gap: 4px;
}

.profit-saved-reference span,
.profit-saved-reference small {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-saved-reference strong {
  color: var(--color-accent-hover);
  font-size: var(--text-body);
}

.profit-page {
  color: var(--color-text);
}

.profit-page,
.profit-page * {
  min-width: 0;
}.profit-page select,
.profit-page a {
  cursor: pointer;
}.profit-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.profit-scenario-head > div > span,
.profit-compare-head > div > span {
  color: var(--color-accent);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.profit-heading h1 {
  color: var(--color-text);
  margin: 0;
}

.profit-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: none;
}

.profit-heading-actions button {
  color: var(--color-accent-hover);
  font-weight: 700;
}

.profit-heading-actions button span {
  display: inline-grid;
  min-width: 1.35em;
  margin-left: 4px;
  place-items: center;
  color: var(--color-text-on-accent);
  background: var(--color-accent);
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
}

.profit-purpose-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.profit-purpose-switch button {
  display: grid;
  gap: 3px;
  padding: 11px 14px;
  text-align: left;
}

.profit-purpose-switch button strong {
  color: var(--color-text);
  font-size: var(--text-small);
}

.profit-purpose-switch button span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-purpose-switch button.active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.profit-purpose-switch button.active strong {
  color: var(--color-accent-hover);
}

.profit-source-strip,
.profit-context-bar,
.profit-source-picker,
.profit-scenarios,
.profit-comparison,
.profit-savebar {
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
}

.profit-source-strip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.profit-source-strip > button:last-child {
  flex: none;
  margin-left: auto;
  color: var(--color-accent-hover);
  font-weight: 700;
}.profit-source-identity {
  display: grid;
  gap: 8px;
  flex: 1 1 0;
  overflow-wrap: anywhere;
}

.profit-source-summary {
  display: grid;
  gap: 4px;
}

.profit-source-summary > span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  line-height: 1.5;
}

.profit-source-summary > .profit-source-warning {
  color: var(--color-warning);
  font-weight: 700;
}

.profit-source-summary > strong {
  font-size: var(--text-body);
  line-height: 1.5;
}

.profit-details {
  font-size: var(--text-caption);
  font-weight: 400;
  color: var(--color-text-secondary);
  overflow-wrap: anywhere;
}

.profit-details > summary {
  width: fit-content;
  max-width: 100%;
  border-radius: var(--radius-xs);
  padding: 4px 0;
  color: var(--color-accent-hover);
  cursor: pointer;
}

.profit-details > summary:hover {
  background: var(--color-accent-soft);
}.profit-details-body {
  padding-top: 8px;
  line-height: 1.6;
}

.profit-details dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
}

.profit-details dl > div { display: contents; }
.profit-details dt { color: var(--color-text-secondary); }
.profit-details dd { margin: 0; color: var(--color-text); }
.profit-details p { margin: 0; }

.profit-rate-control {
  display: grid;
  gap: 5px;
  align-content: start;
}.profit-context-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, .85fr);
  align-items: start;
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.profit-context-bar label,
.profit-savebar label {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  font-weight: 700;
}

.profit-context-bar label > span,
.profit-savebar label > span {
  letter-spacing: .15px;
}

.profit-fx {
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 0 10px;
  border-left: 1px solid var(--color-line);
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-fx strong {
  color: var(--color-text);
  font-size: var(--text-body);
}

.profit-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(350px, .9fr);
  align-items: start;
  gap: 20px;
}

.profit-inputs,
.profit-results {
  min-width: 0;
}

.profit-results {
  position: sticky;
  top: 20px;
}

.profit-input-section,
.profit-result-ready,
.profit-result-state {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.profit-input-section {
  padding: 18px;
  margin-bottom: 12px;
}

.profit-section-title,
.profit-result-subhead,
.profit-scenario-head,
.profit-compare-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.profit-section-title {
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--color-line);
}

.profit-section-title h2,
.profit-result-subhead h2,
.profit-scenario-head h2,
.profit-compare-head h2 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--text-h3);
}

.profit-section-title > span,
.profit-result-subhead > span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-grid,
.profit-price-row {
  display: grid;
  gap: 13px;
}

.profit-grid.two,
.profit-price-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profit-field {
  display: grid;
  align-content: start;
  gap: 5px;
}

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

.profit-field > span,
.profit-dimension-group > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--color-text);
  font-size: var(--text-small);
  font-weight: 700;
}

.profit-field > span em {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  font-style: normal;
  font-weight: 500;
}

.profit-field small,
.profit-dimension-group small,
.profit-price-card small,
.profit-logistics small {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-override input::placeholder {
  color: var(--color-text-secondary);
}

.profit-dimension-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
}

.profit-dimension-group > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.profit-dimension-group label {
  display: grid;
  gap: 4px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-page .profit-reset {
  border: 0;
  background: transparent;
  color: var(--color-accent);
  min-height: auto;
  padding: 0;
  font-size: var(--text-caption);
}

.profit-fx-note,
.profit-result-state {
  display: grid;
  gap: 6px;
}

.profit-estimate-box {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.profit-estimate-box > span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

[data-purchase-confirmation] {
  grid-column: 1 / -1;
}

.profit-purchase-confirmation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.profit-purchase-confirmation.confirmed {
  border-color: var(--color-line);
  background: var(--color-accent-soft);
}

.profit-purchase-confirmation > div {
  display: grid;
  gap: 3px;
}

.profit-purchase-confirmation span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  line-height: 1.45;
}

.profit-purchase-confirmation label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--color-text);
  font-size: var(--text-caption);
  font-weight: 700;
}

.profit-purchase-confirmation input {
  accent-color: var(--color-accent);
}

.profit-evidence {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-radius: var(--radius-lg);
  background: var(--color-accent-soft);
  font-size: var(--text-caption);
}

.profit-evidence > span { color: var(--color-text-secondary); font-weight: 700; }
.profit-evidence a { color: var(--color-accent); text-decoration: none; font-weight: 700; }
.profit-evidence a:hover { text-decoration: underline; }

.profit-evidence-basis {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  font-weight: 700;
}

.profit-fx-note {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-result-ready {
  overflow: hidden;
  padding: 18px;
}

.profit-hero-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}

.profit-hero-metrics article {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--color-canvas);
}

.profit-hero-metrics article.primary {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
}

.profit-hero-metrics article.loss {
  background: var(--color-danger);
}

.profit-hero-metrics span,
.profit-hero-metrics small {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-hero-metrics .primary span,
.profit-hero-metrics .primary small {
  color: var(--color-text-on-accent);
}

.profit-hero-metrics strong {
  color: var(--color-text);
  font-size: var(--text-number);
  line-height: 1.15;
}

.profit-hero-metrics .primary strong {
  color: var(--color-text-on-accent);
}

.profit-hero-metrics strong em {
  font-size: var(--text-caption);
  font-style: normal;
  font-weight: 600;
}

.profit-ledger,
.profit-breakdown,
.profit-logistics,
.profit-recommendations {
  border-top: 1px solid var(--color-line);
  padding-top: 15px;
  margin-top: 15px;
}

.profit-ledger-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-row-line);
  font-size: var(--text-small);
}

.profit-ledger-row:last-child {
  border-bottom: 0;
}

.profit-ledger-row strong {
  font-size: var(--text-body);
}

.profit-ledger-row em {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  font-style: normal;
}

.profit-ledger-row.cost strong {
  color: var(--color-danger);
}

.profit-ledger-row.total {
  color: var(--color-accent-hover);
  font-weight: 800;
}

.profit-bar-row {
  display: grid;
  grid-template-columns: minmax(74px, .8fr) minmax(80px, 1.4fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--text-caption);
}

.profit-bar-row > div {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--color-surface-muted);
}

.profit-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent);
}

.profit-bar-row strong {
  min-width: 56px;
  text-align: right;
}

.profit-bar-row em {
  min-width: 56px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  font-style: normal;
  text-align: right;
}

.profit-logistics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profit-logistics > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.profit-logistics span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-logistics strong {
  font-size: var(--text-small);
}

.profit-result-state {
  place-items: start;
  padding: 32px 22px;
  color: var(--color-text-secondary);
  text-align: left;
}

.profit-missing-inputs {
  display: grid;
  gap: 6px;
  margin: 4px 0 0;
  padding-left: 20px;
  font-size: var(--text-small);
}

.profit-result-state strong {
  color: var(--color-text);
}

.profit-result-state p {
  margin: 0;
  font-size: var(--text-small);
}

.profit-result-state.working span {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-line);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: profit-spin .8s linear infinite;
}

.profit-result-state.error {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}

.profit-result-state.error strong,
.profit-inline-error {
  color: var(--color-danger);
}

.profit-price-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 11px;
}

.profit-price-card {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.profit-price-card > span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-price-card > strong {
  color: var(--color-accent-hover);
  font-size: var(--text-h2);
}

.profit-price-card > strong em {
  font-size: var(--text-caption);
  font-style: normal;
}

.profit-price-card button {
  justify-self: start;
  color: var(--color-accent-hover);
}

.profit-price-card.unavailable {
  background: var(--color-surface-subtle);
}

.profit-scenarios,
.profit-comparison,
.profit-source-picker {
  padding: 16px;
  margin-bottom: 18px;
}

.profit-scenario-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.profit-scenario-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--color-row-line);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.profit-scenario-row.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.profit-scenario-row > div {
  display: grid;
  gap: 2px;
  overflow: hidden;
}

.profit-scenario-row > div span,
.profit-scenario-row > div small {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-scenario-row button,
.profit-compare-actions button {
}

.profit-scenario-row button.selected {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent-hover);
}

.profit-picker-head {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.profit-picker-head form {
  display: flex;
  flex: 1 1 320px;
  gap: 8px;
}

.profit-picker-head form input {
  flex: 1;
}

.profit-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-check input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--color-accent);
}

.profit-picker-results {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.profit-picker-item {
  display: grid;
  justify-items: start;
  gap: 2px;
  width: 100%;
  min-height: auto;
  padding: 10px 12px;
  text-align: left;
}

.profit-picker-item span {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-picker-item.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.profit-source-selection {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.profit-source-selection label {
  display: grid;
  gap: 5px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  font-weight: 700;
}

.profit-offer-selected {
  grid-column: 1 / -1;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
}

.profit-offer-selected {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.profit-offer-selected span,
.profit-offer-selected small {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-source-maintenance {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-source-maintenance a,
.profit-source-maintenance button {
  color: var(--color-accent-hover);
  font-size: var(--text-caption);
  font-weight: 700;
}

.profit-source-maintenance button {
}

.profit-picker-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-inline-error {
  margin-top: 10px;
}

.profit-comparison {
  overflow-x: auto;
}

.profit-comparison > * {
  min-width: max(560px, calc(var(--compare-count) * 150px + 130px));
}

.profit-compare-head {
  margin-bottom: 11px;
}

.profit-compare-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) repeat(var(--compare-count), minmax(120px, 1fr));
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--color-row-line);
  font-size: var(--text-small);
}

.profit-compare-row > span {
  color: var(--color-text-secondary);
}

.profit-compare-row.names strong {
  color: var(--color-accent-hover);
}

.profit-compare-actions {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) repeat(var(--compare-count), minmax(120px, 1fr));
  gap: 10px;
  padding-top: 9px;
}

.profit-savebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .8fr) auto;
  align-items: end;
  gap: 14px;
  padding: 13px 14px;
  margin-top: 18px;
}

.profit-savebar > div:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

.profit-save-status.dirty {
  color: var(--color-warning);
  font-weight: 700;
}

.profit-savebar.reader {
  display: block;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}

@keyframes profit-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .profit-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(310px, .85fr);
  }

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

  .profit-fx {
    border-left: 0;
    border-top: 1px solid var(--color-line);
    padding: 10px 0 0;
  }
}

@media (max-width: 820px) {
  .profit-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .profit-source-strip {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .profit-source-identity {
    order: 3;
    flex-basis: 100%;
  }

  .profit-source-strip > button:last-child {
    margin-left: auto;
  }

  .profit-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .profit-results {
    position: static;
  }

  .profit-savebar {
    grid-template-columns: 1fr 1fr;
  }

  .profit-savebar > button:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .profit-purpose-switch,
  .profit-context-bar,
  .profit-grid.two,
  .profit-price-row,
  .profit-source-selection,
  .profit-logistics,
  .profit-price-cards,
  .profit-savebar {
    grid-template-columns: 1fr;
  }

  .profit-input-section,
  .profit-result-ready,
  .profit-result-state,
  .profit-scenarios,
  .profit-comparison,
  .profit-source-picker {
    padding: 14px;
  }

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

  .profit-hero-metrics article.primary {
    grid-column: 1 / -1;
  }

  .profit-ledger-row {
    grid-template-columns: 1fr auto;
  }

  .profit-ledger-row em {
    grid-column: 2;
    grid-row: 2;
  }

  .profit-scenario-row {
    grid-template-columns: 1fr 1fr;
  }

  .profit-scenario-row > div {
    grid-column: 1 / -1;
  }

  .profit-scenario-row button {
    width: 100%;
  }

  .profit-dimension-group > div {
    grid-template-columns: 1fr;
  }

}

.profit-quote-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}
.profit-quote-heading,
.profit-quote-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.profit-quote-scope,
.profit-quote-row small {
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
}
.profit-quote-summary {
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.profit-quote-list {
  display: grid;
  gap: 6px;
}
.profit-quote-list .profit-quote-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(100px, 1fr) minmax(100px, 1fr) minmax(160px, 2fr);
  gap: 10px 16px;
  align-items: start;
  width: 100%;
  padding: 12px;
  text-align: left;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.profit-quote-row span,
.profit-quote-row small {
  display: block;
}
.profit-quote-row.selected {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}
.profit-quote-row .profit-quote-reasons {
  grid-column: 1 / -1;
  color: var(--color-danger);
}
@media (max-width: 700px) {
  .profit-quote-list .profit-quote-row { grid-template-columns: 1fr 1fr; }
}

/* Batch trial workbench */
.profit-batch-page {
  width: 100%;
  max-width: 100%;
  padding-bottom: 12px;
  overflow: visible;
  font-size: var(--text-body);
  line-height: 1.45;
}

.profit-batch-page button,
.profit-batch-page input,
.profit-batch-page select {
  font-size: var(--text-body);
}

.profit-batch-page .profit-heading h1 {
  font-size: var(--text-h1);
}

.profit-batch-page button {
}

.profit-batch-page button:disabled {
  cursor: not-allowed;
}

.profit-batch-page .profit-batch-help {
  margin-left: 5px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-caption);
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
}

.profit-batch-plan {
  margin-block: 8px 12px;
  padding: 10px 0;
  border-block: 1px solid var(--color-line);
  background: transparent;
}

.profit-batch-plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
}

.profit-batch-plan-identity {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex: 1 1 420px;
  min-width: 0;
}

.profit-batch-plan-identity label {
  display: grid;
  grid-template-columns: auto minmax(150px, min(300px, 36vw));
  align-items: center;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-plan-identity input {
  width: 100%;
}

.profit-batch-plan-state {
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-plan-state.dirty,
.profit-batch-plan-state.stale {
  color: var(--color-warning);
}

.profit-batch-plan-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.profit-batch-plan-more {
  position: relative;
}

.profit-batch-plan-more > summary {
  padding: 6px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.profit-batch-plan-picker {
  margin-top: 10px;
  padding: 10px 12px;
  border-block: 1px solid var(--color-line);
  background: var(--color-surface);
}

.profit-batch-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.profit-batch-plan-head h2 {
  margin: 0;
  font-size: var(--text-body);
}

.profit-batch-market {
  margin-block: 14px 18px;
}

.profit-batch-market.compact {
  margin-block: 4px;
}

.profit-batch-market-head {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-block: 8px;
}

.profit-batch-market-head h2 {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
}

.profit-batch-market-head label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-market-head label select {
  max-width: 210px;
}

.profit-batch-market-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.profit-batch-market-actions button,
.profit-batch-market-actions > details > summary {
}

.profit-batch-market-actions > details {
  position: relative;
}

.profit-batch-market-actions > details > summary {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  list-style-position: inside;
  white-space: nowrap;
}

.profit-batch-market-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 6;
  display: grid;
  min-width: 190px;
  padding: 4px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.profit-batch-market-menu button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  text-align: left;
}

.profit-batch-detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-block: 12px 6px;
}

.profit-batch-detail-heading h2,
.profit-batch-detail-heading strong {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
}

.profit-batch-detail-heading small,
.profit-batch-detail-heading span {
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-detail-heading .profit-batch-market-actions {
  margin-left: 0;
}

.profit-batch-page .table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.profit-batch-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-body);
  line-height: 1.35;
}

.profit-batch-table th,
.profit-batch-table td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--color-line);
  text-align: left;
  vertical-align: middle;
}

.profit-batch-table th {
  color: var(--color-text-secondary);
  background: var(--color-canvas);
  font-size: var(--text-small);
  font-weight: 500;
  white-space: nowrap;
}

.profit-batch-table td {
  background: var(--profit-batch-row-bg, var(--color-surface));
}

.profit-batch-table tbody tr:last-child > td {
  border-bottom-color: var(--color-line);
}

.profit-batch-table input,
.profit-batch-table select {
  width: 100%;
  min-width: 64px;
}

.profit-batch-table input[type="number"],
.profit-batch-table .profit-batch-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.profit-batch-table th:nth-child(2),
.profit-batch-table td:nth-child(2):not([colspan]) {
  width: 90px;
}

.profit-batch-table th:nth-child(3),
.profit-batch-table td:nth-child(3):not([colspan]) {
  width: 110px;
}

.profit-batch-table .profit-batch-col-source,
.profit-batch-table td:first-child:not([colspan]) {
  min-width: 205px;
  max-width: 280px;
}

.profit-batch-table th:first-child,
.profit-batch-table td.profit-batch-col-source,
.profit-batch-table td:first-child:not([colspan]) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--profit-batch-row-bg, var(--color-surface));
}

.profit-batch-table th:first-child {
  z-index: 3;
  background: var(--color-canvas);
}

.profit-batch-table th:last-child,
.profit-batch-table td.profit-batch-row-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 64px;
  min-width: 64px;
  background: var(--profit-batch-row-bg, var(--color-surface));
}

.profit-batch-table th:last-child {
  z-index: 3;
  background: var(--color-canvas);
}

.profit-batch-table tr.profit-batch-margin-negative {
  --profit-batch-row-bg: var(--color-danger-soft);
}

.profit-batch-table tr.profit-batch-margin-low {
  --profit-batch-row-bg: var(--color-warning-soft);
}

.profit-batch-product-name {
  display: inline;
  color: var(--color-text);
  font-size: var(--text-body);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.profit-batch-source-tag {
  display: inline-block;
  margin-left: 5px;
  vertical-align: 1px;
}

.profit-batch-source .profit-batch-source-tag {
  display: inline-block;
  width: fit-content;
}

.profit-batch-market-head h2 .profit-batch-hint {
  display: inline;
  white-space: nowrap;
}

.profit-batch-source {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: var(--text-small);
}

.profit-batch-source > span,
.profit-batch-source small {
  color: var(--color-text-secondary);
  font-size: var(--text-small);
  overflow-wrap: anywhere;
}

.profit-batch-summary-cell {
  color: var(--color-text-secondary);
  font-size: var(--text-small);
  vertical-align: middle;
}

.profit-batch-summary-cell .profit-batch-cell-button {
  font-size: var(--text-small);
}

.profit-batch-page .profit-batch-cell-button {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.profit-batch-cell-button:hover {
  text-decoration: underline;
}

.profit-batch-row-actions {
  white-space: nowrap;
  text-align: center;
}

.profit-batch-row-actions button {
}

.profit-batch-action-row > td {
  padding: 7px 12px;
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-action-row button {
  margin-left: 8px;
}

.profit-batch-carton {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 4px;
  min-width: 205px;
}

.profit-batch-carton label span,
.profit-batch-manual label span,
.profit-batch-editor-grid label span {
  display: block;
  margin-bottom: 2px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-manual {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 6px;
  min-width: 360px;
}

.profit-batch-hint {
  display: block;
  margin-top: 3px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-result {
  display: grid;
  gap: 2px;
  min-width: 168px;
  font-size: var(--text-small);
  line-height: 1.4;
}

.profit-batch-result strong {
  color: var(--color-accent-hover);
}

.profit-batch-result span {
  color: var(--color-text-secondary);
}

.profit-batch-status {
  min-width: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-status.error {
  color: var(--color-danger);
}

.profit-batch-status.missing strong,
.profit-batch-exclusions {
  color: var(--color-warning);
}

.profit-batch-status ul {
  margin: 4px 0 0;
  padding-left: 16px;
}

.profit-batch-status.stale {
  margin-bottom: 4px;
  color: var(--color-warning);
}

.profit-batch-status.stale strong {
  margin-right: 4px;
}

.profit-batch-editor-row > td {
  padding: 10px 14px;
  background: var(--color-accent-soft);
  vertical-align: top;
}

.profit-batch-editor {
  display: grid;
  gap: 12px;
  min-width: 0;
  white-space: normal;
}

.profit-batch-editor section {
  min-width: 0;
}

.profit-batch-editor section h3 {
  margin: 0 0 5px;
  color: var(--color-accent-hover);
  font-size: var(--text-small);
}

.profit-batch-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 7px 10px;
}

.profit-batch-editor-grid input,
.profit-batch-editor-grid select {
  width: 100%;
  min-width: 0;
}

.profit-batch-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.profit-batch-summary {
  margin-block: 14px 10px;
  border-top: 1px solid var(--color-line);
}

.profit-batch-summary > summary {
  padding-block: 9px;
  color: var(--color-text);
  font-size: var(--text-body);
  font-weight: 500;
  cursor: pointer;
}

.profit-batch-summary > [data-batch-summary] {
  padding: 3px 0 12px;
}

.profit-batch-summary h2 {
  margin: 0 0 8px;
  font-size: var(--text-body);
}

.profit-batch-saved-summary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-line);
}

.profit-batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 16px;
}

.profit-batch-summary-market {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-top: 1px solid var(--color-line);
  font-size: var(--text-small);
}

.profit-batch-summary-market h3 {
  margin: 0;
  color: var(--color-accent-hover);
  font-size: var(--text-small);
}

.profit-batch-summary-market span {
  color: var(--color-text-secondary);
}

.profit-batch-totalbar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  border-top: 2px solid var(--color-accent);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  font-size: var(--text-small);
}

.profit-batch-total-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  flex-wrap: wrap;
}

.profit-batch-total-head button {
}

.profit-batch-total-count {
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-total-metrics {
  display: flex;
  align-items: baseline;
  gap: 8px 24px;
  flex-wrap: wrap;
}

.profit-batch-total-metric {
  display: grid;
  gap: 2px;
  min-width: max-content;
}

.profit-batch-total-metric > span {
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-total-metric > strong {
  color: var(--color-text);
  font-size: var(--text-h3);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.profit-batch-total-metric:first-child > strong {
  color: var(--color-accent-hover);
  font-size: var(--text-number);
}

.profit-batch-exclusions {
  max-height: min(128px, 20dvh);
  overflow-y: auto;
  padding: 6px 9px;
  background: var(--color-canvas);
  font-size: var(--text-small);
}

@media (max-height: 600px) {
  .profit-batch-totalbar {
    position: static;
  }
}

.profit-batch-cost-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-exclusions button {
  margin: 2px 4px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.profit-batch-import {
  margin-block: 8px;
  padding: 10px 12px;
  border-block: 1px solid var(--color-line);
  background: var(--color-surface);
}

.profit-batch-import-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 5px;
}

.profit-batch-import-head h3 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--text-small);
}

.profit-batch-import-head label {
  display: flex;
  flex: 1 1 240px;
  align-items: center;
  gap: 8px;
  color: var(--color-text-secondary);
  font-size: var(--text-small);
}

.profit-batch-import-head label input {
  flex: 1;
}

.profit-batch-import .profit-scenario-list {
  max-height: 320px;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .profit-batch-plan-toolbar {
    align-items: flex-start;
  }

  .profit-batch-plan-identity {
    flex: 1 1 100%;
  }

  .profit-batch-plan-actions {
    justify-content: flex-start;
  }

  .profit-batch-editor-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 600px) {
  .profit-batch-plan-identity {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profit-batch-plan-identity label {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .profit-batch-plan-actions,
  .profit-batch-market-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .profit-batch-market-head label {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .profit-batch-market-head label select {
    max-width: none;
    flex: 1;
  }

  .profit-batch-detail-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .profit-batch-table th:last-child,
  .profit-batch-table td.profit-batch-row-actions {
    position: static;
    right: auto;
    border-left: 0;
  }

  .profit-batch-totalbar {
    gap: 6px;
    padding-inline: 10px;
  }

  .profit-batch-total-metrics {
    gap: 6px 14px;
  }

  .profit-batch-total-metric:first-child > strong {
    font-size: var(--text-h2);
  }

  .profit-batch-editor-grid {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  }
}
