/* ==========================================================================
   FlipPnL™ - Interactive Calculator Stylesheet (Unit Economics, Floors & Lots)
   ========================================================================== */

.calc-section {
  padding: 30px 0 50px;
  position: relative;
}

/* Rigid two-column workbench layout on desktop */
.calc-workbench {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 24px !important;
  align-items: start !important;
  width: 100% !important;
  overflow: hidden;
  position: relative;
  transition: border-color var(--transition-smooth);
  box-sizing: border-box !important;
}

.calc-workbench:hover {
  border-color: var(--border-hover);
}

/* Ensure child panes cannot force width expansion */
.calc-input-pane,
.calc-output-pane {
  min-width: 0 !important;
  width: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* --------------------------------------------------------------------------
   Left Pane: Inputs & Configuration
   -------------------------------------------------------------------------- */
.calc-input-pane {
  padding: 32px 28px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--bg-surface);
}

.calc-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calc-pane-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Simple vs Pro Mode Segment Toggle */
.mode-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mode-pill-group {
  display: inline-flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--border);
  gap: 2px;
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
}

.btn-mode:hover {
  color: var(--text-primary);
}

.btn-mode.active {
  background: var(--accent-emerald);
  color: #070c1a;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

/* Pro Logistics Section */
.pro-logistics-card,
.calc-grid .pro-logistics-card,
#proLogisticsSection {
  grid-column: span 2 !important;
  width: 100% !important;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box !important;
  transition: all var(--transition-smooth);
}

.pro-logistics-card .pro-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  width: 100%;
}

.pro-logistics-card .calc-field-row {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 12px;
  margin-top: 4px;
  width: 100%;
}

.pro-logistics-card .calc-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.pro-logistics-card .calc-input {
  padding: 10px 12px !important;
  font-size: 0.95rem;
  min-height: 44px;
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 600px) {
  .pro-logistics-card .calc-field-row {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
}

.calc-label-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.effective-cogs-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

/* Simple Mode Hidden Rules (Smooth Layout Adaptation) */
.calc-workbench.simple-mode .pro-logistics-card,
.calc-workbench.simple-mode #proLogisticsSection,
.calc-workbench.simple-mode .mode-toggle-card,
.calc-workbench.simple-mode #batch-lot-inputs,
.calc-workbench.simple-mode #batch-recovery-card,
.calc-workbench.simple-mode .target-margin-card,
.calc-workbench.simple-mode .pricing-floors-card,
.calc-workbench.simple-mode .tax-reserve-field-group,
.calc-workbench.simple-mode #calc-tax-reserve-group,
.calc-workbench.simple-mode #waterfallPrepRow,
.calc-workbench.simple-mode #ledger-tax-row,
.calc-workbench.simple-mode #ledger-retained-row,
.calc-workbench.simple-mode #micro-tax-disclaimer {
  display: none !important;
}

/* Marketplace Tab Selector */
.platform-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--bg-input);
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.platform-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.platform-tab-btn:hover {
  color: var(--text-primary);
}

.platform-tab-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.platform-tab-btn.active.amazon {
  border-bottom: 2px solid var(--badge-amazon);
  color: #ffb84d;
}

.platform-tab-btn.active.ebay {
  border-bottom: 2px solid var(--badge-ebay);
  color: #93c5fd;
}

.platform-tab-btn.active.mercari {
  border-bottom: 2px solid var(--badge-mercari);
  color: #fca5a5;
}

/* Mode Switch: Single Item vs Batch Lot */
.mode-toggle-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-toggle-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  transition: .3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-emerald-glow);
  border-color: var(--accent-emerald);
}

input:checked + .slider:before {
  transform: translateX(18px);
  background-color: var(--accent-emerald);
}

/* Batch Lot Inputs Container */
.batch-lot-box {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-in-out;
}

.batch-lot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.per-unit-cogs-chip {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* Isolated 50/50 Row */
.sourcing-row-50-50 {
  display: flex !important;
  flex-direction: row !important;
  gap: 12px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-bottom: 12px !important;
}

.sourcing-field-col {
  flex: 1 1 50% !important;
  min-width: 0 !important;
  width: 50% !important;
  box-sizing: border-box !important;
}

.sourcing-field-col .calc-input-wrapper {
  width: 100% !important;
}

.sourcing-field-col .calc-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Ensure Target ROI Card fills 100% of the pane */
.calc-input-pane > .target-margin-card {
  width: 100% !important;
  box-sizing: border-box !important;
  margin-bottom: 14px !important;
}

/* Strict 50/50 two-column grid */
.calc-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 14px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Ensure price and cost field groups share equal 50% space */
.calc-grid > .calc-field-group:not(.full-width) {
  min-width: 0 !important;
  width: 100% !important;
}

/* Target ROI card and other full-width items MUST span both columns */
.calc-grid > .target-margin-card,
.calc-grid > .full-width,
.calc-grid > .pro-logistics-card,
.calc-grid > .calc-field-row.full-width {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.calc-grid .calc-field-group .calc-input-wrapper {
  width: 100% !important;
}

.calc-grid .calc-field-group .calc-input {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Side-by-Side Flex Row for Input Pairs (Shipping + Ads, Batch Cost + Qty) */
.calc-field-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.calc-field-row .calc-field-group {
  flex: 1 1 0%;
  min-width: 0;
}

.calc-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calc-label-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.cogs-badge-auto {
  display: none;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.cogs-badge-auto.active {
  display: inline-block;
}

.calc-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100% !important;
}

.calc-prefix, .calc-suffix {
  position: absolute;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

.calc-prefix {
  left: 14px;
}

.calc-suffix {
  right: 14px;
}

.calc-input {
  width: 100% !important;
  box-sizing: border-box !important;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 28px;
  min-height: 48px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.calc-input.no-prefix {
  padding: 12px 14px;
}

.calc-input.has-suffix {
  padding-left: 14px;
  padding-right: 32px;
}

.calc-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.calc-input.cogs-locked {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-cyan);
  cursor: not-allowed;
}

.calc-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 48px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  box-sizing: border-box;
}

.calc-select:focus {
  border-color: var(--border-focus);
}

.calc-helper-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Target Goal (ROI Markup on Cost up to 200%) Card */
.target-margin-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.target-margin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.target-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
}

.preset-chip {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 8px 6px;
  min-height: 38px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.preset-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
}

.preset-chip.active {
  background: var(--accent-emerald-glow);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.margin-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.margin-slider {
  flex-grow: 1;
  height: 6px;
  accent-color: var(--accent-emerald);
  cursor: pointer;
  border-radius: 4px;
  background: var(--bg-input);
  outline: none;
}

.margin-slider-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-emerald);
  min-width: 76px;
  text-align: right;
}

.calc-reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 4px;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.calc-reset-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

/* --------------------------------------------------------------------------
   Right Pane: Live Output, High-Contrast Floors & Ledger
   -------------------------------------------------------------------------- */
.calc-output-pane {
  padding: 32px 28px;
  background: var(--bg-surface-elevated);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

/* Headline Profit */
.profit-headline-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.profit-primary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profit-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profit-value {
  font-size: 2.1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-emerald);
  line-height: 1;
}

.profit-value.negative {
  color: var(--accent-rose);
}

.profit-health-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

.profit-health-badge.healthy {
  background: var(--accent-emerald-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.profit-health-badge.moderate {
  background: var(--accent-amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-amber);
}

.profit-health-badge.loss {
  background: var(--accent-rose-glow);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-rose);
}

/* Dedicated High-Contrast Floor & Target Price Sub-Card */
.pricing-floors-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.pricing-floor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pricing-floor-row:not(:last-child) {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.pricing-floor-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pricing-floor-title {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-floor-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pricing-floor-badge.breakeven {
  background: var(--accent-amber-glow);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pricing-floor-badge.target {
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pricing-floor-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pricing-floor-val {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  text-align: right;
}

.pricing-floor-val-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-copy {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-icon-copy:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-surface-elevated);
}

.btn-icon-copy:active {
  transform: scale(0.95);
}

/* Secondary Metrics Bar */
.metrics-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-card-value {
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Itemized Waterfall Ledger */
.waterfall-ledger {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ledger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

/* Zero-deduction collapse rule */
.waterfall-ledger .ledger-item.zero-hidden,
#outboundShippingRow.zero-hidden,
#promotedAdsRow.zero-hidden,
#paymentProcessingRow.zero-hidden {
  display: none !important;
}

.ledger-name {
  color: var(--text-secondary);
}

.ledger-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.ledger-amount.deduction {
  color: var(--text-secondary);
}

.ledger-amount.tax-buffer {
  color: var(--accent-amber);
}

.ledger-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.ledger-item.total {
  font-size: 0.9rem;
  font-weight: 700;
}

.ledger-item.total .ledger-name {
  color: var(--text-primary);
}

.ledger-item.total .ledger-amount {
  color: var(--accent-emerald);
}

.ledger-item.total .ledger-amount.negative {
  color: var(--accent-rose);
}

.ledger-item.retained {
  background: rgba(16, 185, 129, 0.06);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 2px;
}

.ledger-item.retained .ledger-name {
  color: var(--text-primary);
  font-weight: 700;
}

.ledger-item.retained .ledger-amount {
  color: var(--accent-emerald);
  font-weight: 800;
}

/* Micro Disclaimer */
.micro-disclaimer {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

/* Batch Lot Recovery Card */
.batch-recovery-card {
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.batch-recovery-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
  display: flex;
  justify-content: space-between;
}

.batch-recovery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .batch-recovery-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.batch-stat-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.batch-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Summary Actions & Deal Copy */
.summary-actions-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.btn-secondary-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 18px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  width: 100%;
}

.btn-secondary-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.08);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.15);
}

.btn-secondary-outline:active {
  transform: scale(0.99);
}

.btn-secondary-outline.copied,
.btn-secondary-outline.active {
  background: var(--accent-emerald-glow) !important;
  border-color: var(--accent-emerald) !important;
  color: var(--accent-emerald) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.25) !important;
}

.copy-feedback-toast {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: var(--accent-emerald-glow);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-md);
  text-align: center;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.copy-feedback-toast.hidden {
  display: none;
  opacity: 0;
}

.copy-feedback-toast:not(.hidden) {
  display: flex;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Multi-Channel Arb Matrix Drawer
   -------------------------------------------------------------------------- */
.channel-matrix-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-smooth);
  margin-top: 4px;
}

.channel-matrix-container:hover {
  border-color: var(--border-hover);
}

.channel-matrix-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.channel-matrix-toggle:hover {
  background: rgba(255, 255, 255, 0.02);
}

.matrix-toggle-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.matrix-quick-summary {
  font-size: 0.74rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

.toggle-chevron {
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform var(--transition-smooth);
}

.channel-matrix-toggle[aria-expanded="true"] .toggle-chevron,
.toggle-chevron.expanded {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.channel-matrix-content {
  border-top: 1px solid var(--border);
  background: rgba(13, 20, 36, 0.5);
  padding: 10px 12px 14px;
  transition: all var(--transition-smooth);
}

.channel-matrix-content.hidden {
  display: none;
}

.channel-matrix-table-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box !important;
}

.channel-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.channel-matrix-table th {
  padding: 8px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.channel-matrix-table th:not(:first-child),
.channel-matrix-table td:not(:first-child) {
  text-align: right;
}

.channel-matrix-table td {
  padding: 8px 10px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  vertical-align: middle;
}

.channel-matrix-table tbody tr:last-child td {
  border-bottom: none;
}

.channel-name-cell {
  font-family: inherit;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.active-platform-row {
  background: rgba(56, 189, 248, 0.05);
}

.active-platform-row td {
  color: var(--text-primary);
}

.active-platform-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.matrix-net-positive {
  color: var(--accent-emerald);
  font-weight: 700;
}

.matrix-net-negative {
  color: var(--accent-rose);
  font-weight: 700;
}

.matrix-spread-pos {
  color: var(--accent-emerald);
  font-weight: 700;
}

.matrix-spread-neg {
  color: var(--accent-rose);
}

.matrix-spread-active {
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.72rem;
}

.matrix-spread-even {
  color: var(--text-muted);
}

.lot-subtext {
  font-size: 0.68rem;
  color: var(--accent-cyan);
  font-weight: 500;
  margin-top: 1px;
}

.matrix-footnote {
  font-size: 0.7rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 8px;
  padding-left: 2px;
}

/* --------------------------------------------------------------------------
   Recommended Reseller Gear Drawer
   -------------------------------------------------------------------------- */
.affiliate-gear-drawer {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-smooth);
  margin-top: 10px;
}

.affiliate-gear-drawer:hover {
  border-color: var(--border-hover);
}

.drawer-trigger-gear {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.drawer-trigger-gear:hover {
  background: rgba(255, 255, 255, 0.02);
}

.drawer-trigger-gear #gearArrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.affiliate-disclosure-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.gear-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .gear-grid-2x2 {
    grid-template-columns: 1fr;
  }
}

.gear-product-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.gear-product-card:hover {
  border-color: rgba(56, 189, 248, 0.35);
}

.gear-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.gear-badge-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  font-size: 17px;
  flex-shrink: 0;
}

.gear-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  line-height: 1.2;
}

.gear-card-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.gear-card-cta {
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.gear-card-cta:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Divine Community Partner Callout
   -------------------------------------------------------------------------- */
.partner-callout-wrapper {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 0 16px;
}

.partner-callout-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .partner-callout-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    gap: 16px;
  }
}

.partner-callout-content {
  flex: 1 1 auto;
}

.partner-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.partner-pill {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.partner-sub-disc {
  color: #64748b;
  font-size: 11px;
}

.partner-heading {
  color: #f8fafc;
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.partner-desc {
  color: #94a3b8;
  font-size: 13px;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.partner-perks-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #cbd5e1;
}

.partner-perk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.partner-callout-action {
  flex: 0 0 auto;
}

.btn-partner-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #38bdf8;
  color: #0f172a;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-partner-cta:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

.cta-arrow {
  font-size: 16px;
  transition: transform 0.15s ease;
}

.btn-partner-cta:hover .cta-arrow {
  transform: translateX(3px);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Responsive Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .calc-workbench {
    grid-template-columns: 1fr;
  }
  .calc-input-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 24px 20px;
  }
  .calc-output-pane {
    padding: 24px 20px;
  }
}

@media (max-width: 768px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .calc-field-group.full-width,
  .calc-field-row.full-width,
  .pro-logistics-card,
  .pro-feature-group.full-width,
  #proLogisticsSection {
    grid-column: span 1 !important;
  }
}

@media (max-width: 600px) {
  .channel-matrix-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding: 10px 8px 14px;
  }
  .channel-matrix-table {
    min-width: 520px;
  }
  .channel-matrix-table th,
  .channel-matrix-table td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .calc-input-pane,
  .calc-output-pane {
    padding: 18px 14px;
  }
  .profit-headline-box {
    padding: 14px 16px;
  }
  .profit-value {
    font-size: clamp(1.6rem, 7vw, 2.1rem);
  }
  .pricing-floors-card {
    padding: 14px 16px;
  }
  .pricing-floor-val {
    font-size: clamp(1.2rem, 5vw, 1.45rem);
  }
  .waterfall-ledger {
    padding: 12px 14px;
  }
}

@media (max-width: 420px) {
  .target-presets {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .calc-field-row {
    flex-direction: column;
    gap: 14px;
  }
  .calc-field-row .calc-field-group {
    width: 100%;
    flex: 1 1 auto;
  }
}

/* --------------------------------------------------------------------------
   Modal Dialog & Overlay (Legal Safeguards)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(7, 12, 26, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100000 !important;
  padding: 20px !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.modal-card {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-xl) !important;
  max-width: 500px !important;
  width: 100% !important;
  padding: 32px 28px !important;
  box-shadow: var(--shadow-lg) !important;
  position: relative !important;
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-overlay.active .modal-card {
  transform: scale(1) !important;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-amber);
  background: var(--accent-amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.modal-badge .dot {
  width: 6px;
  height: 6px;
  background: var(--accent-amber);
  border-radius: 50%;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--accent-amber);
}

.modal-icon {
  width: 26px;
  height: 26px;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.modal-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-modal-accept {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
}

.btn-modal-cancel {
  width: 100%;
  padding: 10px;
  font-size: 0.88rem;
}

/* --------------------------------------------------------------------------
   Recommended Reseller Gear Drawer
   -------------------------------------------------------------------------- */
.affiliate-gear-drawer {
  margin-top: 16px;
}

/* Ensure clicks register directly on the button element, not nested spans */
.drawer-trigger-gear {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface-elevated, rgba(30, 41, 59, 0.5));
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer !important;
  user-select: none !important;
  transition: background var(--transition-smooth), border-color var(--transition-smooth);
}

.drawer-trigger-gear * {
  pointer-events: none !important;
}

.drawer-trigger-gear:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* Recommended Reseller Gear Drawer Content */
.gear-drawer-content {
  display: block;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Ensure the hidden class overrides any inline style */
#gearDrawerContent.hidden,
.gear-drawer-content.hidden {
  display: none !important;
}

#gearArrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.gear-drawer-disclosure {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.gear-drawer-disclosure strong {
  color: var(--text-primary);
}

.gear-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gear-card {
  background: var(--bg-surface-elevated, rgba(30, 41, 59, 0.6));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.gear-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.gear-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gear-card-icon {
  font-size: 18px;
  line-height: 1;
}

.gear-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.gear-card-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.gear-card-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  transition: color var(--transition-fast);
}

.gear-card-link:hover {
  color: #0284c7;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Partner Callout Card (Divine) - Aligned to Calculator Width
   -------------------------------------------------------------------------- */
.partner-callout-wrapper {
  width: 100%;
  max-width: var(--calculator-max-width, 1200px);
  margin-top: 36px;
  margin-bottom: 24px;
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  box-sizing: border-box;
}

.partner-callout-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 16px 32px -4px rgba(0, 0, 0, 0.45);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.partner-callout-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 20px 38px -4px rgba(56, 189, 248, 0.2);
}

.partner-callout-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1 1 500px;
}

.partner-callout-emoji {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-lg);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.partner-callout-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.partner-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.partner-subtext {
  color: var(--text-muted);
  font-size: 11px;
}

.partner-title {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.partner-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.partner-brand-text {
  color: var(--text-primary);
}

.partner-perks-row,
.partner-features {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary, #cbd5e1);
}

.partner-callout-right {
  flex: 0 0 auto;
}

.partner-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-cyan);
  color: #0f172a;
  font-weight: 700;
  font-size: 14px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.partner-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

/* --------------------------------------------------------------------------
   AdSense Placement Containers
   -------------------------------------------------------------------------- */
.adsense-leaderboard-container,
.adsense-leaderboard-container ins,
.adsense-leaderboard-container iframe,
.adsense-rectangle-container,
.adsense-rectangle-container ins,
.adsense-rectangle-container iframe,
.adsbygoogle,
.adsbygoogle iframe {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.adsense-leaderboard-container {
  width: 100%;
  margin: 24px auto 0;
  text-align: center;
  overflow: hidden;
  min-height: 90px;
  background: transparent !important;
  border: none !important;
}

.adsense-rectangle-container {
  max-width: 336px;
  margin: 36px auto;
  text-align: center;
  min-height: 250px;
  background: transparent !important;
  border: none !important;
}

/* --------------------------------------------------------------------------
   Light Mode Theme Contrast Protection ([data-theme="light"])
   -------------------------------------------------------------------------- */
[data-theme="light"] .calc-workbench,
[data-theme="light"] .calc-input-pane,
[data-theme="light"] .calc-output-pane {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .calc-input,
[data-theme="light"] .calc-select {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .calc-input:focus,
[data-theme="light"] .calc-select:focus {
  border-color: var(--accent-emerald);
  background: #ffffff;
}

[data-theme="light"] .metric-card,
[data-theme="light"] .pricing-floors-card,
[data-theme="light"] .waterfall-ledger,
[data-theme="light"] .pro-logistics-card,
[data-theme="light"] .channel-matrix-container,
[data-theme="light"] .mode-toggle-card,
[data-theme="light"] .target-margin-card {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .partner-callout-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 16px 32px -4px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .partner-title,
[data-theme="light"] .partner-brand-text {
  color: #0f172a;
}

[data-theme="light"] .partner-desc {
  color: #334155;
}

[data-theme="light"] .partner-perks-row,
[data-theme="light"] .partner-features {
  color: #475569 !important;
}

[data-theme="light"] .drawer-trigger-gear {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.12);
  color: #334155;
}

[data-theme="light"] .drawer-trigger-gear:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .gear-drawer-content {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .gear-drawer-disclosure {
  border-bottom-color: rgba(15, 23, 42, 0.08);
  color: #64748b;
}

[data-theme="light"] .gear-drawer-disclosure strong {
  color: #0f172a;
}

[data-theme="light"] .gear-card {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .gear-card:hover {
  background: #f1f5f9;
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .gear-card-title {
  color: #0f172a;
}

[data-theme="light"] .gear-card-subtitle {
  color: #64748b;
}

[data-theme="light"] .gear-card-link {
  color: #0284c7;
}

[data-theme="light"] .preset-chip {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.15);
  color: #334155;
}

[data-theme="light"] .preset-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .preset-chip.active {
  background: var(--accent-emerald-glow);
  border-color: var(--accent-emerald);
  color: #047857;
}

[data-theme="light"] .btn-secondary-outline {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.18);
  color: #334155;
}

[data-theme="light"] .btn-secondary-outline:hover {
  border-color: var(--accent-cyan);
  color: #0284c7;
  background: rgba(6, 182, 212, 0.06);
}

[data-theme="light"] .channel-matrix-content {
  background: #ffffff;
}

[data-theme="light"] .channel-matrix-table td {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

/* --------------------------------------------------------------------------
   Summary & Export Action Buttons
   -------------------------------------------------------------------------- */
.btn-summary, .btn-summary-export {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

/* Copy button uses current look (lighter dark) */
.btn-summary {
  background: rgba(248, 250, 252, 0.05);
  color: #f8fafc;
  border: 1px solid rgba(248, 250, 252, 0.15);
}
.btn-summary:hover {
  background: rgba(248, 250, 252, 0.1);
}

/* Export button uses accent look (cyan/bright green) */
.btn-summary-export {
  background: #10b981; /* Default success green */
  color: #0f172a;
  border: none;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.btn-summary-export:hover {
  background: #34d399;
}

/* Loading State for Button */
.btn-summary-export.loading {
  background: #64748b;
  pointer-events: none;
  box-shadow: none;
  color: #cbd5e1;
}

/* Light Theme overrides for summary buttons */
[data-theme="light"] .btn-summary {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.18);
  color: #334155;
}
[data-theme="light"] .btn-summary:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   Brand Logo Icon + Typography Lockup
   -------------------------------------------------------------------------- */
.brand-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  display: block;
}

.footer-logo-img {
  height: 32px;
  width: auto;
  display: block;
}

.brand-text {
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
}

.brand-text .text-white {
  color: #ffffff;
}

.brand-text .text-emerald-400 {
  color: #22c55e;
}

.brand-text .trademark,
.brand-tm,
.brand-text .brand-tm {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  margin-left: 3px;
  display: inline-block;
  transform: translateY(-5px); /* Lifts TM up to align with upper-middle of 'L' */
  line-height: 1;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

/* Light Theme Contrast for Brand Text */
[data-theme="light"] .brand-text .text-white {
  color: #0f172a;
}

.deal-card-brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Workbench Action Buttons Row Layout (Side-by-Side with 1-Click Copy)
   -------------------------------------------------------------------------- */
.workbench-actions-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 16px;
  position: relative;
}

.btn-action-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-action-secondary:hover {
  background: #334155;
  color: #ffffff;
}

.btn-action-primary {
  flex: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  background: #22c55e;
  color: #022c22;
  border: 1px solid #16a34a;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-action-primary:hover {
  background: #16a34a;
  color: #ffffff;
}

.btn-action-primary.loading {
  background: #64748b;
  pointer-events: none;
  box-shadow: none;
  color: #cbd5e1;
  border-color: #64748b;
}

.btn-action-primary.bg-emerald-400 {
  background: #34d399;
  border-color: #34d399;
  color: #022c22;
}

.btn-action-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  box-sizing: border-box;
}

.btn-action-icon-only:hover {
  background: #334155;
  color: #ffffff;
}

.btn-action-icon-only.loading {
  background: #64748b;
  pointer-events: none;
  color: #cbd5e1;
  border-color: #64748b;
}

/* Light Theme Overrides for Action Buttons */
[data-theme="light"] .btn-action-secondary,
[data-theme="light"] .btn-action-icon-only {
  background: #f8fafc;
  color: #334155;
  border: 1px solid rgba(15, 23, 42, 0.18);
}

[data-theme="light"] .btn-action-secondary:hover,
[data-theme="light"] .btn-action-icon-only:hover {
  background: #f1f5f9;
  color: #0f172a;
}

@media (max-width: 640px) {
  .workbench-actions-row {
    flex-wrap: wrap;
  }
  .btn-action-secondary,
  .btn-action-primary {
    flex: 1 1 100%;
    width: 100%;
  }
  .btn-action-icon-only {
    flex: 1 1 100%;
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Standardized Brand Logo Wordmark (Fallback)
   -------------------------------------------------------------------------- */
.brand-logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.brand-logo .logo-flip {
  color: #f8fafc; /* Crisp white */
}
.brand-logo .logo-pnl {
  color: #10b981; /* Neon/emerald profit green */
}
.brand-logo .logo-tm {
  color: #64748b; /* Muted slate */
  font-size: 10px;
  font-weight: 600;
  margin-left: 2px;
}

[data-theme="light"] .brand-logo .logo-flip {
  color: #0f172a;
}

/* --------------------------------------------------------------------------
   Deal Card Template Styles (used by html2canvas for client-side rendering)
   -------------------------------------------------------------------------- */
.deal-card-template {
  width: 400px;
  background-color: #0f172a;
  color: #f8fafc;
  font-family: 'Inter', sans-serif;
  font-variant-numeric: normal;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  box-sizing: border-box;
}

.deal-card-template .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.deal-card-template .deal-card-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

.deal-card-template .logo {
  font-size: 18px;
  font-weight: 900;
  color: #10b981;
}

.deal-card-template .mkt-pill {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}

.deal-card-template .card-profit-row {
  text-align: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  padding-bottom: 12px;
}

.deal-card-template .card-profit-row .label {
  font-size: 14px;
  color: #94a3b8;
}

.deal-card-template .card-profit-row .profit-value {
  font-size: 36px;
  font-weight: 900;
  color: #10b981;
}

.deal-card-template .card-metrics-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.deal-card-template .metric-box {
  flex: 1;
  text-align: center;
  background: rgba(30, 41, 59, 0.6);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(248, 250, 252, 0.1);
}

.deal-card-template .metric-label {
  font-size: 12px;
  color: #94a3b8;
}

.deal-card-template .metric-value {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
}

.deal-card-template .card-pricing-waterfall {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 16px;
  line-height: 1.6;
}

.deal-card-template .card-pricing-waterfall .row {
  display: flex;
  justify-content: space-between;
}

.deal-card-template .card-pricing-waterfall .val {
  color: #f8fafc;
  font-weight: 700;
}

.deal-card-template .card-footer {
  text-align: center;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ==========================================================================
   Theme-Aware Sourcing Scratchpad & Modal Styles
   ========================================================================== */
.scratchpad-section {
  width: 100%;
  max-width: 1100px;
  margin: 28px auto 40px auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.scratchpad-container {
  background: var(--card-bg, var(--bg-surface, #111927));
  border: 1px solid var(--border-color, var(--border, #1e293b));
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--card-shadow, var(--shadow-md, 0 10px 15px -3px rgba(0, 0, 0, 0.3)));
  color: var(--text-primary, #f8fafc);
}

.scratchpad-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.scratchpad-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scratchpad-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  margin: 0;
}

.scratchpad-count {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.scratchpad-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn-scratchpad {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.btn-save-current { background: #10b981; color: #ffffff; }
.btn-save-current:hover { background: #059669; }

.btn-secondary {
  background: var(--input-bg, var(--bg-surface-elevated, #1e293b));
  color: var(--text-primary, #f8fafc);
  border: 1px solid var(--border-color, var(--border, #334155));
}
.btn-secondary:hover { opacity: 0.9; }

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: #ef4444; color: #ffffff; }

.btn-file-label { cursor: pointer; }

/* Active Editing Banner */
.editing-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid #3b82f6;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #93c5fd;
  font-size: 0.95rem;
}

.editing-banner-actions { display: flex; gap: 8px; }
.btn-banner { padding: 6px 12px; border-radius: 4px; font-weight: 600; cursor: pointer; border: none; font-size: 0.85rem; }
.btn-save-update { background: #3b82f6; color: #ffffff; }
.btn-cancel { background: #475569; color: #ffffff; }

/* Table Wrapper & Table */
.scratchpad-table-wrapper {
  overflow-x: auto;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-color, var(--border, #1e293b));
}

.scratchpad-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
  background: var(--bg-surface, #0f172a);
}

.scratchpad-table th,
.scratchpad-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, var(--border, #1e293b));
  color: var(--text-primary, #cbd5e1);
}

.scratchpad-table th {
  background: var(--table-header-bg, var(--bg-surface-elevated, #141f32));
  color: var(--text-secondary, #94a3b8);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.lead-title-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lead-name { font-weight: 600; color: var(--text-primary, #f8fafc); }
.lead-source-link { font-size: 0.75rem; color: #38bdf8; text-decoration: underline; }

.badge-lead {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.badge-roi { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.badge-profit { background: rgba(234, 179, 8, 0.2); color: #eab308; }

.platform-pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.platform-pill.amazon { background: rgba(255, 153, 0, 0.2); color: #ff9900; }
.platform-pill.ebay { background: rgba(0, 100, 210, 0.2); color: #38bdf8; }
.platform-pill.mercari { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.btn-row-action {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-color, var(--border, #334155));
  background: var(--input-bg, var(--bg-surface-elevated, #1e293b));
  color: var(--text-primary, #cbd5e1);
  cursor: pointer;
}
.btn-row-action:hover { opacity: 0.85; }
.btn-row-load { border-color: #10b981; color: #10b981; }
.btn-row-delete { border-color: rgba(239, 68, 68, 0.4); color: #ef4444; }

/* Modal Theme Support */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
}

.modal-card {
  background: var(--card-bg, var(--bg-surface, #111927));
  border: 1px solid var(--border-color, var(--border, #1e293b));
  border-radius: 12px;
  width: 90%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  color: var(--text-primary, #f8fafc);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--text-primary, #f8fafc); margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-secondary, #94a3b8); cursor: pointer; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary, #cbd5e1); margin-bottom: 6px; }
.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg, var(--bg-input, #0b1120));
  border: 1px solid var(--border-color, var(--border, #1e293b));
  border-radius: 6px;
  color: var(--text-primary, #f8fafc);
  font-size: 0.9rem;
  box-sizing: border-box;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Light Theme Direct Overrides */
[data-theme="light"] .scratchpad-container {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .scratchpad-title { color: #0f172a; }
[data-theme="light"] .scratchpad-table { background: #ffffff; }
[data-theme="light"] .scratchpad-table th { background: #f1f5f9; color: #475569; }
[data-theme="light"] .scratchpad-table td { border-color: rgba(15, 23, 42, 0.08); color: #0f172a; }
[data-theme="light"] .lead-name { color: #0f172a; }
[data-theme="light"] .btn-secondary { background: #f1f5f9; color: #0f172a; border-color: rgba(15, 23, 42, 0.15); }
[data-theme="light"] .btn-row-action { background: #f1f5f9; color: #0f172a; border-color: rgba(15, 23, 42, 0.15); }
[data-theme="light"] .modal-card { background: #ffffff; border-color: rgba(15, 23, 42, 0.1); color: #0f172a; }
[data-theme="light"] .modal-title { color: #0f172a; }
[data-theme="light"] .modal-close { color: #64748b; }
[data-theme="light"] .form-group label { color: #475569; }
[data-theme="light"] .form-group input { background: #ffffff; border-color: rgba(15, 23, 42, 0.15); color: #0f172a; }

