/* The calculator keeps its original palette and geometry; this is its finish. */
.app-page {
  --finish-shadow: 0 2px 4px #20372b04, 0 8px 22px #20372b08;
  --finish-raised-shadow: 0 3px 6px #20372b06, 0 12px 24px #20372b0e;
}

.app-page .card {
  box-shadow: var(--finish-shadow);
}

.app-page .topbar {
  box-shadow: 0 3px 12px #20372b04;
}

.app-page .nav-item {
  position: relative;
  transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.app-page .nav-item.active {
  box-shadow: inset 0 0 0 1px #13856316, 0 3px 8px #13856308;
}

.app-page .nav-item.active::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: var(--green);
  transform: translateY(-50%);
}

.app-page .sidebar-note {
  background-image: linear-gradient(135deg, #ffffff85, transparent 75%);
  box-shadow: inset 0 1px 0 #fff, 0 4px 12px #20372b04;
}

.app-page .icon-tile,
.app-page .metric-icon,
.app-page .note-icon {
  box-shadow: inset 0 1px 0 #ffffffb3, 0 3px 6px #20372b07;
}

/* Branded selection is visible without changing tab dimensions. */
.app-page :is([data-marketplace-tab], [data-creator-channel]) {
  --tab-accent: #138563;
  --tab-line: #9fc8b2;
  --tab-surface: #f6fbf8;
}

.app-page :is([data-marketplace-tab="shopee"], [data-creator-channel="shopee"]) {
  --tab-accent: #b94627;
  --tab-line: #ee9b83;
  --tab-surface: #fff8f5;
}

.app-page :is([data-marketplace-tab="tiktok"], [data-creator-channel="tiktok"]) {
  --tab-accent: #25474d;
  --tab-line: #788588;
  --tab-surface: #f7f9f9;
}

.app-page :is([data-marketplace-tab="mercadolivre"], [data-creator-channel="mercadolivre"]) {
  --tab-accent: #796412;
  --tab-line: #d7c653;
  --tab-surface: #fffdf1;
}

.app-page :is([data-marketplace-tab="amazon"], [data-creator-channel="amazon"]) {
  --tab-accent: #8a5c11;
  --tab-line: #d8bd86;
  --tab-surface: #fff7e9;
}

.app-page :is([data-marketplace-tab="magalu"], [data-creator-channel="magalu"]) {
  --tab-accent: #1d659a;
  --tab-line: #a2c5df;
  --tab-surface: #eef7ff;
}

.app-page :is([data-marketplace-tab="shein"], [data-creator-channel="shein"]) {
  --tab-accent: #454545;
  --tab-line: #a7a7a7;
  --tab-surface: #f6f6f6;
}

.app-page .marketplace-tabs [role="tab"],
.app-page #creator-view .creator-channel-tabs > [role="tab"] {
  position: relative;
  box-shadow: 0 2px 5px #20372b05;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.app-page .marketplace-tabs :is(#tab-shopee, #tab-tiktok, #tab-mercadolivre, #tab-amazon, #tab-magalu, #tab-shein, #tab-manual)[aria-selected="true"],
.app-page #creator-view .creator-channel-tabs > [role="tab"][aria-selected="true"] {
  color: var(--tab-accent);
  border-color: var(--tab-line);
  background: var(--tab-surface);
  box-shadow: inset 0 3px 0 var(--tab-accent), 0 0 0 1px var(--tab-line), 0 6px 14px #20372b0b;
}

.app-page .marketplace-tabs [aria-selected="true"] .tab-brand-icon,
.app-page #creator-view .creator-channel-tabs > [aria-selected="true"] .tab-brand-icon {
  box-shadow: 0 2px 5px #20372b10;
}

/* These corner forms are decorative, never a chart or an implied metric. */
.app-page :is(.profit-card, .suggested-price-card, .comparison-hero) {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-image: linear-gradient(115deg, #ffffff30, transparent 65%);
  box-shadow: inset 0 1px 0 #ffffffb3, 0 3px 5px #20372b04, 0 10px 22px #20372b0c;
}

.app-page :is(.profit-card, .suggested-price-card, .comparison-hero)::before,
.app-page :is(.profit-card, .suggested-price-card, .comparison-hero)::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  color: inherit;
}

.app-page :is(.profit-card, .suggested-price-card, .comparison-hero)::before {
  width: 246px;
  height: 246px;
  top: -116px;
  right: -55px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 31px, currentColor 32px 33px, transparent 34px 62px);
  opacity: .12;
}

.app-page :is(.profit-card, .suggested-price-card, .comparison-hero)::after {
  width: 150px;
  height: 150px;
  top: 54px;
  right: -58px;
  border: 1px solid currentColor;
  border-radius: 32px;
  background: currentColor;
  opacity: .045;
  transform: rotate(-24deg);
}

.app-page .profit-decoration {
  display: none;
}

.app-page .status-pill,
.app-page .best-chip {
  box-shadow: inset 0 1px 0 #ffffff70, 0 2px 4px #20372b06;
}

.app-page .comparison-channel.is-best {
  box-shadow: inset 0 3px 0 #399d76, 0 0 0 1px #93c9ac, var(--finish-shadow);
}

.app-page .section-heading h2,
.app-page #creator-view .creator-output-heading h2 {
  position: relative;
}

.app-page .section-heading h2::before,
.app-page #creator-view .creator-output-heading h2::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -12px;
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: var(--green);
  opacity: .7;
  transform: translateY(-50%);
}

.app-page .active-marketplace-brand h2::before {
  display: none;
}

.app-page .allocation-bar {
  box-shadow: inset 0 1px 2px #20372b08, 0 1px 0 #fff;
}

.app-page .breakdown-total,
.app-page .pricing-unit-total {
  background-image: linear-gradient(90deg, #e8f6ef50, transparent 85%);
}

/* Form emphasis stays stationary so editing never moves the controls. */
.app-page .input-panel,
.app-page #creator-view .creator-facts-card,
.app-page .form-section {
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.app-page .input-panel:focus-within,
.app-page #creator-view .creator-facts-card:focus-within {
  border-color: #a8cdb8;
  box-shadow: 0 0 0 1px #1385630c, var(--finish-shadow);
}

.app-page .form-section:focus-within {
  border-color: #a8cdb8;
  border-radius: 6px;
  background-color: #f6fbf8;
  box-shadow: 0 0 0 8px #f6fbf8;
}

.app-page .form-section:focus-within h3,
.app-page .form-section:focus-within h3 svg,
.app-page #creator-view .creator-field:focus-within > label {
  color: var(--green-dark);
}

.app-page .input-wrap:focus-within,
.app-page .forecast-input-wrap:focus-within,
.app-page .field > input:focus-visible,
.app-page .select-wrap select:focus-visible,
.app-page #creator-view :is(.creator-field input, .creator-field textarea, .creator-output-card textarea):focus-visible {
  border-color: #77b99e;
  outline: 0;
  box-shadow: 0 0 0 4px #13856318, 0 2px 4px #20372b04;
}

.app-page .input-wrap.invalid:focus-within,
.app-page .field > input.invalid:focus-visible {
  border-color: var(--red);
  box-shadow: 0 0 0 4px #bd484818;
}

/* Motion belongs to the surrounding surfaces, never the calculated figures. */
@media (prefers-reduced-motion: no-preference) {
  .app-page .page-content > section:not([hidden]) > .page-heading {
    animation: app-finish-enter 420ms cubic-bezier(.2, .7, .3, 1) both;
  }

  .app-page #simulator-view:not([hidden]) > .marketplace-tabs,
  .app-page #creator-view:not([hidden]) > .creator-channel-tabs {
    animation: app-finish-enter 460ms 45ms cubic-bezier(.2, .7, .3, 1) both;
  }

  .app-page #simulator-view:not([hidden]) .marketplace-panel,
  .app-page #creator-view:not([hidden]) > .creator-context-card {
    animation: app-finish-enter 480ms 80ms cubic-bezier(.2, .7, .3, 1) both;
  }

  .app-page #pricing-results:not([hidden]),
  .app-page #comparison-results:not([hidden]),
  .app-page #creator-generated:not([hidden]) {
    animation: app-finish-enter 460ms cubic-bezier(.2, .7, .3, 1) both;
  }
}

@keyframes app-finish-enter {
  from { opacity: .7; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) and (pointer: fine) {
  .app-page :is(.summary-card, .performance-card, .breakdown-card, .roas-target-card, .comparison-channel, .pricing-breakdown) {
    transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  }

  .app-page :is(.summary-card, .performance-card, .breakdown-card, .roas-target-card, .comparison-channel, .pricing-breakdown):hover {
    transform: translateY(-2px);
    border-color: #bdd4c6;
    box-shadow: var(--finish-raised-shadow);
  }

  .app-page .comparison-channel.is-best:hover {
    border-color: #93c9ac;
    box-shadow: inset 0 3px 0 #399d76, 0 0 0 1px #93c9ac, var(--finish-raised-shadow);
  }

  .app-page .marketplace-tabs [role="tab"]:hover,
  .app-page #creator-view .creator-channel-tabs > [role="tab"]:hover {
    border-color: var(--tab-line);
    box-shadow: 0 4px 10px #20372b0a;
  }

  .app-page .marketplace-tabs :is(#tab-shopee, #tab-tiktok, #tab-mercadolivre, #tab-amazon, #tab-magalu, #tab-shein, #tab-manual)[aria-selected="true"]:hover,
  .app-page #creator-view .creator-channel-tabs > [role="tab"][aria-selected="true"]:hover {
    box-shadow: inset 0 3px 0 var(--tab-accent), 0 0 0 1px var(--tab-line), 0 8px 16px #20372b10;
  }
}

@media (max-width: 600px) {
  .app-page .nav-item.active::before {
    height: 19px;
  }

  .app-page :is(.profit-card, .suggested-price-card, .comparison-hero)::before {
    right: -103px;
    top: -129px;
    opacity: .1;
  }

  .app-page :is(.profit-card, .suggested-price-card, .comparison-hero)::after {
    right: -92px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-page *,
  .app-page *::before,
  .app-page *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .app-page :is(.summary-card, .performance-card, .breakdown-card, .roas-target-card, .comparison-channel, .pricing-breakdown):hover {
    transform: none;
  }
}
