/* Public profit calculator — mobile-first, light + dark. Scoped to .pc so the storefront chrome is unchanged. */
.pc {
  --pc-max: 1180px;
  --pc-radius: 18px;
  --pc-yellow: #f5c518;
  --pc-yellow-d: #d4a80b;
  --pc-gap: 16px;
  --pc-safe-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.pc *, .pc *::before, .pc *::after { box-sizing: border-box; }
.pc-wrap {
  width: 100%;
  max-width: var(--pc-max);
  margin: 0 auto;
  padding: 0 16px;
  min-width: 0;
}
@media (min-width: 768px) { .pc-wrap { padding: 0 24px; } }

/* Light */
.pc[data-theme="light"] {
  --pc-bg: #eef8f3;
  --pc-bg-2: #f7fffb;
  --pc-ink: #0b3d2e;
  --pc-muted: #3d6a5c;
  --pc-card: #ffffff;
  --pc-card-border: rgba(11, 61, 46, 0.1);
  --pc-shadow: 0 10px 30px rgba(11, 61, 46, 0.08);
  --pc-hero-a: #0f766e;
  --pc-hero-b: #047857;
  --pc-hero-c: #0ea5a0;
  --pc-hero-ink: #ffffff;
  --pc-line: rgba(11, 61, 46, 0.12);
  --pc-input: #f4faf7;
  --pc-input-border: rgba(11, 61, 46, 0.16);
  --pc-tab: #ffffff;
  --pc-tab-on: #0b3d2e;
  --pc-tab-on-ink: #ffffff;
  --pc-good: #047857;
  --pc-bad: #b42318;
  --pc-bar-track: #e5f3ec;
  --pc-glass: #ffffff;
  background: linear-gradient(180deg, var(--pc-bg) 0%, var(--pc-bg-2) 100%);
  color: var(--pc-ink);
}

/* Dark */
.pc[data-theme="dark"] {
  --pc-bg: #041f1c;
  --pc-bg-2: #06332d;
  --pc-ink: #e9fff6;
  --pc-muted: #9ecdbc;
  --pc-card: rgba(255, 255, 255, 0.08);
  --pc-card-border: rgba(255, 255, 255, 0.14);
  --pc-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --pc-hero-a: #022c26;
  --pc-hero-b: #065f54;
  --pc-hero-c: #0f766e;
  --pc-hero-ink: #ffffff;
  --pc-line: rgba(255, 255, 255, 0.12);
  --pc-input: rgba(0, 0, 0, 0.28);
  --pc-input-border: rgba(255, 255, 255, 0.16);
  --pc-tab: rgba(255, 255, 255, 0.08);
  --pc-tab-on: #f5c518;
  --pc-tab-on-ink: #0b3d2e;
  --pc-good: #34d399;
  --pc-bad: #fb7185;
  --pc-bar-track: rgba(255, 255, 255, 0.1);
  --pc-glass: rgba(255, 255, 255, 0.08);
  background: linear-gradient(165deg, #022c26 0%, #041f1c 40%, #064e46 100%);
  color: var(--pc-ink);
}
.pc[data-theme="dark"] .pc-card {
  background: var(--pc-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.pc-hero {
  background: linear-gradient(135deg, var(--pc-hero-a), var(--pc-hero-b) 50%, var(--pc-hero-c));
  color: var(--pc-hero-ink);
  padding: 28px 0 32px;
  position: relative;
}
.pc-hero__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pc-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 16ch;
}
.pc-hero p {
  margin: 0;
  max-width: 36em;
  font-size: 0.98rem;
  line-height: 1.5;
  opacity: 0.92;
}
.pc-theme {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.18);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.pc-theme:focus-visible { outline: 2px solid var(--pc-yellow); outline-offset: 2px; }
.pc-theme .pc-ico-sun, .pc[data-theme="light"] .pc-ico-moon { display: none; }
.pc[data-theme="light"] .pc-ico-sun, .pc[data-theme="dark"] .pc-ico-moon { display: block; }
.pc-theme svg { width: 22px; height: 22px; fill: currentColor; }

.pc-body { padding: 20px 0 28px; }
@media (max-width: 1023px) {
  .pc-body { padding-bottom: calc(100px + var(--pc-safe-bottom)); }
}

.pc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  width: 100%;
}
.pc-tab {
  appearance: none;
  border: 1px solid var(--pc-card-border);
  background: var(--pc-tab);
  color: var(--pc-ink);
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
}
.pc-tab.is-on {
  background: var(--pc-tab-on);
  color: var(--pc-tab-on-ink);
  border-color: transparent;
}
.pc-tab:focus-visible { outline: 2px solid var(--pc-yellow); outline-offset: 2px; }
@media (max-width: 359px) {
  .pc-tabs { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding-bottom: 4px; }
  .pc-tab { flex: 0 0 auto; }
}

.pc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  min-width: 0;
}
@media (min-width: 1024px) {
  .pc-grid { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); align-items: start; gap: 22px; }
}

.pc-card {
  background: var(--pc-card);
  border: 1px solid var(--pc-card-border);
  border-radius: var(--pc-radius);
  box-shadow: var(--pc-shadow);
  padding: 16px;
  min-width: 0;
  width: 100%;
}
@media (min-width: 768px) { .pc-card { padding: 20px; } }
.pc-card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
}

.pc-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) and (max-width: 1023px) {
  .pc-fields { grid-template-columns: 1fr 1fr; }
  .pc-fields .pc-span { grid-column: 1 / -1; }
}
.pc-label { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; font-weight: 600; min-width: 0; }
.pc-label span { color: var(--pc-muted); }
.pc input[type="number"],
.pc input[type="text"],
.pc select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--pc-input-border);
  background: var(--pc-input);
  color: var(--pc-ink);
  font-size: 16px; /* iOS: prevent auto-zoom */
  font-family: inherit;
}
.pc input:focus, .pc select:focus { outline: 2px solid var(--pc-hero-c); outline-offset: 1px; }
.pc-range { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-range input[type="range"] {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  margin: 0;
  accent-color: var(--pc-hero-b);
}
.pc-range b { min-width: 3.2ch; text-align: right; font-size: 0.95rem; }
.pc-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.pc-toggle {
  position: relative;
  width: 52px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 0;
  background: var(--pc-bar-track);
  cursor: pointer;
  padding: 0;
}
.pc-toggle i {
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.16s ease;
}
.pc-toggle.is-on { background: var(--pc-hero-b); }
.pc-toggle.is-on i { transform: translateX(20px); }
.pc-zlink {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pc[data-theme="dark"] .pc-zlink { color: var(--pc-yellow); }
.pc[data-theme="light"] .pc-zlink { color: #0f766e; }
.pc-fby, .pc-drop { display: none; }
.pc.is-fby .pc-fby, .pc.is-drop .pc-drop { display: block; }
.pc.is-drop .pc-std-cost, .pc.is-drop .pc-std-ship { display: none; }

.pc-net {
  text-align: left;
  margin-bottom: 14px;
}
.pc-net b {
  display: block;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--pc-good);
}
.pc-net.is-neg b { color: var(--pc-bad); }
.pc-net small { color: var(--pc-muted); font-weight: 600; }
.pc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}
.pc-stat {
  border: 1px solid var(--pc-line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.pc-stat span { display: block; color: var(--pc-muted); font-size: 0.78rem; font-weight: 600; }
.pc-stat b { font-size: 1.05rem; word-break: break-word; }

.pc-legend { list-style: none; margin: 12px 0 0; padding: 0; min-width: 0; }
.pc-legend li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--pc-line);
  font-size: 0.92rem;
  min-width: 0;
}
.pc-legend li span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-swatch { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.pc-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}
@media (min-width: 520px) { .pc-tiles { grid-template-columns: 1fr 1fr; } }
.pc-tile {
  border-radius: 12px;
  padding: 12px;
  background: var(--pc-input);
  border: 1px dashed var(--pc-input-border);
  min-width: 0;
}
.pc-tile span { display: block; color: var(--pc-muted); font-size: 0.8rem; font-weight: 600; }
.pc-tile b { font-size: 1.15rem; }

.pc-charts { display: grid; gap: 16px; min-width: 0; }
.pc-chart {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.pc-chart svg, .pc-chart canvas { display: block; width: 100%; height: auto; max-width: 100%; }
.pc-chart h3 { margin: 0 0 8px; font-size: 0.92rem; }

.pc-compare { display: none; }
.pc.is-compare .pc-grid { display: none; }
.pc.is-compare .pc-compare { display: block; }
.pc-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-width: 0;
}
@media (min-width: 1024px) {
  .pc-compare-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.pc-ccard h3 { margin: 0 0 8px; font-size: 1rem; }
.pc-hbar { display: grid; gap: 8px; margin-top: 12px; }
.pc-hbar p { display: flex; justify-content: space-between; margin: 0 0 4px; font-size: 0.85rem; }
.pc-hbar i {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--pc-bar-track);
  overflow: hidden;
}
.pc-hbar i em {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pc-hero-b), var(--pc-hero-c));
  max-width: 100%;
}

.pc-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--pc-yellow);
  color: #1a1400;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 0 var(--pc-yellow-d);
  text-align: center;
  width: 100%;
  margin-top: 16px;
}
.pc-cta:hover { filter: brightness(1.03); color: #1a1400; }
@media (min-width: 1024px) { .pc-cta { width: auto; } }
.pc-note { margin: 18px 0 0; color: var(--pc-muted); font-size: 0.85rem; }

.pc-sticky {
  display: none;
}
@media (max-width: 1023px) {
  .pc-sticky {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    padding: 10px 16px calc(10px + var(--pc-safe-bottom));
    background: var(--pc-card);
    border-top: 1px solid var(--pc-card-border);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.12);
    max-width: 100%;
  }
  .pc[data-theme="dark"] .pc-sticky { background: #06261f; }
  .pc-sticky__net { flex: 1; min-width: 0; }
  .pc-sticky__net b { display: block; font-size: 1.15rem; color: var(--pc-good); }
  .pc-sticky__net.is-neg b { color: var(--pc-bad); }
  .pc-sticky__net span { color: var(--pc-muted); font-size: 0.8rem; }
  .pc-sticky .pc-cta { width: auto; margin: 0; flex: 0 1 auto; min-height: 44px; padding: 10px 14px; font-size: 0.88rem; box-shadow: none; }
}
@media (min-width: 1024px) { .pc-sticky { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  .pc-toggle i, .pc-cta { transition: none; }
}

.pc-ship-wrap { position: relative; display: block; width: 100%; min-width: 0; }
.pc-ship-wrap .pc-lock {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--pc-muted);
  pointer-events: none;
  display: none;
  place-items: center;
}
.pc-std-ship.is-locked input {
  padding-right: 40px;
  background: var(--pc-bar-track);
  cursor: not-allowed;
  opacity: 1;
}
.pc-lock-note {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pc-muted);
}
.pc-std-ship.is-locked .pc-lock { display: grid; }
.pc-std-ship.is-locked .pc-lock-note { display: block; }
.pc-empty-msg {
  margin: 0 0 14px;
  color: var(--pc-muted);
  font-size: 0.95rem;
  font-weight: 600;
}
.pc.is-ready .pc-empty-msg { display: none; }
.pc-chart.is-empty { min-height: 0; }
.pc-range { flex-wrap: wrap; }
.pc-range input[type="number"] { flex: 1 1 8rem; min-width: 0; }
.pc-range input[type="range"] { flex: 1 1 100%; }
