:root {
  color-scheme: light;
  --bg: #eef2f3;
  --ink: #101417;
  --ink-soft: #334149;
  --muted: #66757d;
  --surface: #fbfcfc;
  --surface-2: #f5f8f8;
  --surface-3: #e8eff0;
  --line: #ccd8dc;
  --line-strong: #9fb2ba;
  --header: #101719;
  --header-2: #172326;
  --cyan: #00a7b5;
  --teal: #087f8c;
  --lime: #6a9f26;
  --amber: #bd7414;
  --magenta: #c2386b;
  --violet: #7552cc;
  --positive: #127248;
  --negative: #b42318;
  --shadow: 0 16px 40px rgba(16, 20, 23, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(16, 23, 25, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 23, 25, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 36px;
  background:
    linear-gradient(135deg, rgba(0, 167, 181, 0.18), transparent 34%),
    linear-gradient(90deg, var(--header), var(--header-2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 36px rgba(16, 20, 23, 0.22);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #eaffff;
  background:
    linear-gradient(135deg, rgba(0, 167, 181, 0.86), rgba(106, 159, 38, 0.84)),
    #0c3035;
  font-weight: 900;
  letter-spacing: 0;
}

.topbar h1 {
  margin: 2px 0 0;
  color: #ffffff;
  font-size: 1.58rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-control {
  min-width: 136px;
}

.language-control select {
  min-height: 38px;
  border-color: rgba(143, 230, 237, 0.34);
  background: rgba(255, 255, 255, 0.08);
  color: #f5ffff;
  font-weight: 800;
}

.language-control select option {
  color: var(--ink);
  background: #ffffff;
}

.eyebrow {
  margin: 0;
  color: #8fe6ed;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(143, 230, 237, 0.28);
  border-radius: 6px;
  color: #d7fbfd;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #66e38f;
  box-shadow: 0 0 0 4px rgba(102, 227, 143, 0.12);
}

.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: var(--cyan);
  color: #061113;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
}

.button:hover {
  filter: brightness(1.05);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f5ffff;
  border-color: rgba(143, 230, 237, 0.46);
}

.button-ghost {
  background: transparent;
  color: #f5ffff;
  border-color: rgba(255, 255, 255, 0.24);
}

.button-secondary:hover,
.button-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.export-wrapper {
  position: relative;
}

.export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  min-width: 152px;
  padding: 6px;
  border: 1px solid rgba(143, 230, 237, 0.34);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(16, 20, 23, 0.18);
}

.export-menu[hidden] {
  display: none;
}

.export-menu button {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  text-align: left;
}

.export-menu button:hover,
.export-menu button:focus {
  background: var(--surface-2);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 438px) minmax(0, 1fr);
  gap: 18px;
  padding: 22px 36px 30px;
  align-items: start;
}

.input-panel,
.summary-band,
.method-panel,
.seo-panel,
.platform-card {
  background: rgba(251, 252, 252, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 118px);
  overflow: auto;
}

.section-title {
  padding: 18px 18px 8px;
  border-bottom: 1px solid var(--surface-3);
}

.section-title h2,
.method-panel h2 {
  margin: 0;
  font-size: 1.04rem;
  letter-spacing: 0;
}

.section-title p,
.method-panel p,
.footer p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-stack {
  display: grid;
  gap: 12px;
  padding: 14px 18px 18px;
}

fieldset {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 248, 248, 0.9)),
    var(--surface);
}

legend {
  padding: 0 7px;
  color: var(--teal);
  background: var(--surface);
  font-weight: 900;
  font-size: 0.84rem;
  letter-spacing: 0;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.79rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(16, 20, 23, 0.03);
}

input:hover,
select:hover {
  border-color: var(--teal);
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(0, 167, 181, 0.22);
  outline-offset: 1px;
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-top: 22px;
}

.checkbox-control input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.mode-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.mode-only[hidden] {
  display: none;
}

.results-panel {
  display: grid;
  gap: 16px;
}

.summary-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(0, 167, 181, 0.14), transparent 42%),
    linear-gradient(90deg, rgba(106, 159, 38, 0.11), rgba(189, 116, 20, 0.07)),
    var(--surface);
}

.summary-band h2 {
  margin: 2px 0 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.summary-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-metrics div {
  min-width: 126px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-metrics span,
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.summary-metrics strong {
  display: block;
  margin-top: 2px;
  font-size: 1.28rem;
  color: var(--ink);
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.platform-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.platform-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--accent);
}

.platform-card[data-platform="shopify"] {
  --accent: var(--lime);
}

.platform-card[data-platform="tiktok"] {
  --accent: var(--cyan);
}

.platform-card[data-platform="amazon"] {
  --accent: var(--amber);
}

.platform-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.platform-header h3 {
  margin: 0;
  font-size: 1.02rem;
}

.tag {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
  background: var(--surface-2);
}

.profit {
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}

.profit.positive {
  color: var(--positive);
}

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

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

.metric {
  min-width: 0;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: 8px;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.breakdown {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  gap: 4px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  background: #dde6e9;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  width: var(--width);
  background: var(--bar-color, var(--teal));
  border-radius: inherit;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.warning-note {
  color: var(--amber);
  font-weight: 800;
}

.method-panel,
.seo-panel {
  padding: 18px;
  box-shadow: none;
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  margin-top: 12px;
}

.method-grid h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.source-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
}

.seo-panel {
  display: grid;
  gap: 16px;
}

.seo-panel h2 {
  margin: 2px 0 0;
  font-size: 1.34rem;
  letter-spacing: 0;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.faq-grid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--surface-3);
  border-radius: 8px;
  background: var(--surface-2);
}

.faq-grid h3 {
  margin: 0;
  font-size: 0.95rem;
}

.faq-grid p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer {
  padding: 0 36px 30px;
}

.footer p {
  max-width: 980px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .topbar,
  .summary-band {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 16px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(136px, auto) auto repeat(4, minmax(82px, auto));
    justify-content: end;
  }

  .app-shell {
    padding: 16px;
  }

  .platform-grid,
  .method-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .summary-band h2 {
    font-size: 1.55rem;
  }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .topbar h1 {
    font-size: 1.22rem;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 34px 1fr 1fr;
    gap: 9px;
  }

  .language-control {
    grid-column: 2 / 4;
    grid-row: 1;
    min-width: 0;
  }

  .save-status {
    grid-row: 1 / 4;
    grid-column: 1;
    justify-content: center;
    min-height: 123px;
    padding: 0;
    border-color: rgba(143, 230, 237, 0.18);
  }

  .save-status .status-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .button {
    min-height: 38px;
    padding-inline: 10px;
  }

  .export-wrapper {
    width: 100%;
  }

  .export-menu {
    left: 0;
    right: auto;
    min-width: 100%;
  }

  .control-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .summary-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .summary-metrics div {
    min-width: 0;
  }

  .button {
    width: 100%;
  }

  .footer {
    padding-inline: 16px;
  }
}
