/* ============================================================
   TikTok Shop Profit Calculator — Stylesheet
   All selectors scoped to #tspc-root to prevent theme conflicts.
   ============================================================ */

#tspc-root, #tspc-root * { box-sizing: border-box; }

#tspc-root {
  --tspc-bg: #0f1115;
  --tspc-surface: #ffffff;
  --tspc-surface-alt: #f7f8fa;
  --tspc-border: #e4e7ec;
  --tspc-border-strong: #cfd4dc;
  --tspc-text: #101828;
  --tspc-text-muted: #667085;
  --tspc-text-soft: #98a2b3;
  --tspc-primary: #fe2c55;
  --tspc-primary-dark: #d9214a;
  --tspc-accent: #25f4ee;
  --tspc-success: #12b76a;
  --tspc-success-bg: #ecfdf3;
  --tspc-warning: #f79009;
  --tspc-warning-bg: #fffaeb;
  --tspc-danger: #f04438;
  --tspc-danger-bg: #fef3f2;
  --tspc-radius: 14px;
  --tspc-radius-sm: 10px;
  --tspc-shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --tspc-shadow-lg: 0 12px 32px -8px rgba(16,24,40,.12), 0 4px 12px -2px rgba(16,24,40,.06);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--tspc-text);
  line-height: 1.5;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Hero */
#tspc-root .tspc-hero {
  background: linear-gradient(135deg, #0f1115 0%, #1a1d24 60%, #2a1620 100%);
  border-radius: var(--tspc-radius);
  padding: 32px 28px;
  color: #fff;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
#tspc-root .tspc-hero::before {
  content: "";
  position: absolute;
  top: -40%; right: -10%;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(254,44,85,.35) 0%, transparent 70%);
  pointer-events: none;
}
#tspc-root .tspc-hero::after {
  content: "";
  position: absolute;
  bottom: -50%; left: -5%;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(37,244,238,.18) 0%, transparent 70%);
  pointer-events: none;
}
#tspc-root .tspc-hero-content { position: relative; z-index: 1; }
#tspc-root .tspc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  margin-bottom: 14px;
  color: #fff;
}
#tspc-root .tspc-badge-dot {
  width: 6px; height: 6px;
  background: var(--tspc-success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(18,183,106,.25);
}
#tspc-root .tspc-hero h1 {
  font-size: clamp(24px, 3.5vw, 34px);
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -.02em;
  line-height: 1.15;
  color: #fff;
}
#tspc-root .tspc-hero p {
  margin: 0;
  color: rgba(255,255,255,.7);
  font-size: 15px;
  max-width: 640px;
}

/* Grid */
#tspc-root .tspc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  #tspc-root .tspc-grid { grid-template-columns: 1fr; }
}

/* Cards */
#tspc-root .tspc-card {
  background: var(--tspc-surface);
  border: 1px solid var(--tspc-border);
  border-radius: var(--tspc-radius);
  box-shadow: var(--tspc-shadow);
}
#tspc-root .tspc-card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--tspc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#tspc-root .tspc-card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.01em;
  color: var(--tspc-text);
}
#tspc-root .tspc-card-sub {
  font-size: 12px;
  color: var(--tspc-text-muted);
  margin-top: 2px;
}
#tspc-root .tspc-card-body { padding: 20px 22px 22px; }

/* Sections */
#tspc-root .tspc-section {
  padding: 18px 0;
  border-bottom: 1px dashed var(--tspc-border);
}
#tspc-root .tspc-section:first-child { padding-top: 4px; }
#tspc-root .tspc-section:last-child { border-bottom: 0; padding-bottom: 4px; }
#tspc-root .tspc-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tspc-text-muted);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#tspc-root .tspc-section-icon {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tspc-surface-alt);
  border-radius: 6px;
  font-size: 12px;
}

/* Form */
#tspc-root .tspc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  #tspc-root .tspc-row { grid-template-columns: 1fr; }
}
#tspc-root .tspc-field { margin-bottom: 12px; }
#tspc-root .tspc-field:last-child { margin-bottom: 0; }
#tspc-root .tspc-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--tspc-text);
  margin-bottom: 6px;
  gap: 8px;
}
#tspc-root .tspc-help {
  font-size: 11px;
  color: var(--tspc-text-soft);
  cursor: help;
  border-bottom: 1px dotted var(--tspc-text-soft);
}
#tspc-root .tspc-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
#tspc-root .tspc-input-prefix,
#tspc-root .tspc-input-suffix {
  position: absolute;
  color: var(--tspc-text-muted);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}
#tspc-root .tspc-input-prefix { left: 12px; }
#tspc-root .tspc-input-suffix { right: 12px; }
#tspc-root .tspc-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--tspc-border-strong);
  border-radius: var(--tspc-radius-sm);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--tspc-text);
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
  appearance: none;
  -moz-appearance: textfield;
  margin: 0;
  box-shadow: none;
}
#tspc-root .tspc-input::-webkit-outer-spin-button,
#tspc-root .tspc-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
#tspc-root .tspc-input.has-prefix { padding-left: 28px; }
#tspc-root .tspc-input.has-suffix { padding-right: 32px; }
#tspc-root .tspc-input:focus {
  outline: none;
  border-color: var(--tspc-primary);
  box-shadow: 0 0 0 3px rgba(254,44,85,.12);
}
#tspc-root select.tspc-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Buttons */
#tspc-root .tspc-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
#tspc-root .tspc-btn {
  flex: 1;
  height: 44px;
  border-radius: var(--tspc-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  text-decoration: none;
  line-height: 1;
}
#tspc-root .tspc-btn-primary {
  background: var(--tspc-primary);
  color: #fff;
}
#tspc-root .tspc-btn-primary:hover {
  background: var(--tspc-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(254,44,85,.4);
  color: #fff;
}
#tspc-root .tspc-btn-ghost {
  background: #fff;
  color: var(--tspc-text);
  border-color: var(--tspc-border-strong);
}
#tspc-root .tspc-btn-ghost:hover {
  background: var(--tspc-surface-alt);
  border-color: var(--tspc-text-muted);
  color: var(--tspc-text);
}

/* Results */
#tspc-root .tspc-results { position: sticky; top: 16px; }
#tspc-root .tspc-headline {
  background: linear-gradient(135deg, #fff5f7 0%, #fff 60%);
  padding: 24px;
  border-radius: var(--tspc-radius);
  border: 1px solid var(--tspc-border);
  margin-bottom: 14px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
#tspc-root .tspc-headline.is-profit {
  background: linear-gradient(135deg, #ecfdf3 0%, #fff 70%);
  border-color: #a6f4c5;
}
#tspc-root .tspc-headline.is-loss {
  background: linear-gradient(135deg, #fef3f2 0%, #fff 70%);
  border-color: #fda29b;
}
#tspc-root .tspc-headline-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--tspc-text-muted);
  margin-bottom: 6px;
}
#tspc-root .tspc-headline-value {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  margin: 0;
  color: var(--tspc-text);
  font-variant-numeric: tabular-nums;
}
#tspc-root .tspc-headline-value.is-profit { color: var(--tspc-success); }
#tspc-root .tspc-headline-value.is-loss { color: var(--tspc-danger); }
#tspc-root .tspc-headline-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--tspc-text-muted);
}

/* Metrics */
#tspc-root .tspc-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  #tspc-root .tspc-metrics { grid-template-columns: 1fr 1fr; }
  #tspc-root .tspc-metric:last-child { grid-column: span 2; }
}
#tspc-root .tspc-metric {
  background: var(--tspc-surface);
  border: 1px solid var(--tspc-border);
  border-radius: var(--tspc-radius-sm);
  padding: 14px;
  text-align: center;
}
#tspc-root .tspc-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tspc-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
#tspc-root .tspc-metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--tspc-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* Health bar */
#tspc-root .tspc-health {
  background: var(--tspc-surface);
  border: 1px solid var(--tspc-border);
  border-radius: var(--tspc-radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
#tspc-root .tspc-health-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
#tspc-root .tspc-health-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tspc-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
#tspc-root .tspc-health-status {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
#tspc-root .tspc-health-status.excellent { background: var(--tspc-success-bg); color: var(--tspc-success); }
#tspc-root .tspc-health-status.good { background: #eff8ff; color: #1570ef; }
#tspc-root .tspc-health-status.moderate { background: var(--tspc-warning-bg); color: var(--tspc-warning); }
#tspc-root .tspc-health-status.poor { background: var(--tspc-danger-bg); color: var(--tspc-danger); }
#tspc-root .tspc-health-bar {
  height: 8px;
  background: var(--tspc-surface-alt);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
#tspc-root .tspc-health-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tspc-danger), var(--tspc-warning), var(--tspc-success));
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
#tspc-root .tspc-health-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--tspc-text-soft);
}

/* Breakdown */
#tspc-root .tspc-breakdown {
  background: var(--tspc-surface);
  border: 1px solid var(--tspc-border);
  border-radius: var(--tspc-radius);
  overflow: hidden;
}
#tspc-root .tspc-breakdown-header {
  padding: 14px 18px;
  background: var(--tspc-surface-alt);
  border-bottom: 1px solid var(--tspc-border);
  font-size: 13px;
  font-weight: 700;
  color: var(--tspc-text);
}
#tspc-root .tspc-breakdown-list { padding: 4px 0; }
#tspc-root .tspc-breakdown-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  padding: 11px 18px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid var(--tspc-border);
  color: var(--tspc-text);
}
#tspc-root .tspc-breakdown-row:last-child { border-bottom: 0; }
#tspc-root .tspc-breakdown-row.revenue {
  background: linear-gradient(90deg, rgba(18,183,106,.05), transparent);
  font-weight: 600;
}
#tspc-root .tspc-breakdown-row.total {
  background: var(--tspc-surface-alt);
  font-weight: 700;
  border-top: 1px solid var(--tspc-border-strong);
}
#tspc-root .tspc-breakdown-row.profit {
  background: linear-gradient(90deg, rgba(254,44,85,.04), transparent);
  font-weight: 700;
  border-top: 2px solid var(--tspc-text);
}
#tspc-root .tspc-breakdown-row.profit.is-profit {
  background: linear-gradient(90deg, rgba(18,183,106,.08), transparent);
  border-top-color: var(--tspc-success);
  color: var(--tspc-success);
}
#tspc-root .tspc-breakdown-row.profit.is-loss {
  background: linear-gradient(90deg, rgba(240,68,56,.06), transparent);
  border-top-color: var(--tspc-danger);
  color: var(--tspc-danger);
}
#tspc-root .tspc-bd-pct {
  font-size: 11px;
  color: var(--tspc-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}
#tspc-root .tspc-breakdown-row.revenue .tspc-bd-pct,
#tspc-root .tspc-breakdown-row.total .tspc-bd-pct,
#tspc-root .tspc-breakdown-row.profit .tspc-bd-pct { color: inherit; opacity: .7; }
#tspc-root .tspc-bd-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 88px;
  text-align: right;
}

/* Projection */
#tspc-root .tspc-projection {
  margin-top: 14px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0f1115 0%, #1a1d24 100%);
  color: #fff;
  border-radius: var(--tspc-radius);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  text-align: center;
}
@media (max-width: 480px) {
  #tspc-root .tspc-projection { grid-template-columns: 1fr; }
}
#tspc-root .tspc-projection-item-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.55);
  margin-bottom: 4px;
}
#tspc-root .tspc-projection-item-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  color: #fff;
}
#tspc-root .tspc-projection-item + .tspc-projection-item {
  border-left: 1px solid rgba(255,255,255,.1);
}
@media (max-width: 480px) {
  #tspc-root .tspc-projection-item + .tspc-projection-item {
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: 12px;
  }
}

/* Break-even */
#tspc-root .tspc-breakeven {
  margin-top: 14px;
  background: var(--tspc-surface);
  border: 1px solid var(--tspc-border);
  border-radius: var(--tspc-radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
#tspc-root .tspc-breakeven-label {
  font-size: 12px;
  color: var(--tspc-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}
#tspc-root .tspc-breakeven-text { line-height: 1.3; }
#tspc-root .tspc-breakeven-text strong {
  display: block;
  font-size: 14px;
  color: var(--tspc-text);
  font-weight: 700;
  margin-top: 2px;
}
#tspc-root .tspc-breakeven-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--tspc-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* Tooltip */
#tspc-root .tspc-tip { position: relative; display: inline-block; }
#tspc-root .tspc-tip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #101828;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  width: 220px;
  line-height: 1.4;
  z-index: 10;
  box-shadow: var(--tspc-shadow-lg);
  text-transform: none;
  letter-spacing: 0;
}

/* Disclaimer */
#tspc-root .tspc-disclaimer {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--tspc-surface-alt);
  border: 1px solid var(--tspc-border);
  border-radius: var(--tspc-radius-sm);
  font-size: 12px;
  color: var(--tspc-text-muted);
  line-height: 1.55;
}
#tspc-root .tspc-disclaimer strong { color: var(--tspc-text); }
