:root {
  --ink: #172033;
  --ink-soft: #596274;
  --paper: #f3f0e9;
  --card: #fffefa;
  --line: #ddd8cd;
  --line-strong: #cac3b6;
  --accent: #f36f45;
  --accent-dark: #c94b28;
  --accent-soft: #fff0ea;
  --lime: #d8f06f;
  --nav: #152033;
  --success: #76a41c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 88% 7%, rgb(243 111 69 / 11%), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
summary {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(243 111 69 / 24%);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow-y: auto;
  padding: 28px 20px;
  background: var(--nav);
  color: white;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
  border-bottom: 1px solid rgb(255 255 255 / 11%);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--lime);
  color: var(--nav);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
  transform: rotate(-4deg);
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block strong {
  font-size: 18px;
  letter-spacing: -0.04em;
}

.brand-block div > span {
  margin-top: 2px;
  color: #aab3c2;
  font-size: 11px;
}

.mobile-module-picker {
  display: none;
}

.main-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding-top: 22px;
}

.nav-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #c8cfda;
  text-align: left;
  transition: 160ms ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgb(255 255 255 / 7%);
  color: white;
}

.nav-item.active {
  background: white;
  color: var(--nav);
  font-weight: 750;
}

.nav-index {
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  opacity: 0.55;
}

.nav-item em {
  color: #8791a1;
  font-size: 9px;
  font-style: normal;
  text-transform: uppercase;
}

.sidebar-note {
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 14px;
  background: rgb(255 255 255 / 5%);
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note span {
  color: var(--lime);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-note strong {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  width: min(1450px, 100%);
  padding: 36px clamp(24px, 4vw, 64px) 64px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.topbar h1,
.construction-page h1 {
  margin: 6px 0 0;
  font-size: clamp(31px, 4vw, 48px);
  letter-spacing: -0.058em;
  line-height: 1;
}

.topbar-copy {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.ghost-button,
.primary-button {
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
  transition: 150ms ease;
}

.ghost-button {
  padding: 10px 15px;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 52%);
  color: var(--ink-soft);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: white;
  color: var(--ink);
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  align-items: start;
  gap: 22px;
}

.form-panel,
.result-panel,
.channel-card,
.construction-page {
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgb(31 39 51 / 6%);
}

.form-panel {
  padding: clamp(22px, 3vw, 34px);
  background: var(--card);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.section-heading.compact {
  margin: 0 0 22px;
}

.settings-save {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f6f0;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
  user-select: none;
}

.settings-save:hover {
  border-color: var(--line-strong);
  background: white;
}

.settings-save input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.settings-save:has(input:checked) {
  border-color: #b8cd5d;
  background: #f4f8d8;
  color: #586b18;
}

.step-number {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  font-weight: 800;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.primary-fields {
  grid-template-columns: minmax(0, 1.35fr) minmax(170px, 0.65fr);
}

.production-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.field small {
  color: #7c8491;
  font-size: 10px;
}

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

.time-part {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.time-part > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.input-shell {
  position: relative;
}

.input-shell input {
  width: 100%;
  height: 49px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  outline: none;
  padding: 0 13px;
  transition: 150ms ease;
}

.input-shell input:hover {
  border-color: var(--line-strong);
}

.input-shell input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(243 111 69 / 12%);
}

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  z-index: 1;
  color: #7c8491;
  font-size: 11px;
  transform: translateY(-50%);
}

.input-prefix {
  left: 13px;
}

.input-suffix {
  right: 13px;
}

.input-shell input.has-prefix {
  padding-left: 39px;
}

.input-shell input.has-suffix {
  padding-right: 38px;
}

.advanced-settings {
  margin-top: 32px;
}

.advanced-content {
  margin-top: 0;
}

.range-field {
  display: grid;
  min-height: 49px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.margin-field {
  grid-column: span 2;
}

.profit-goal-field {
  margin: 0;
  padding: 0;
  border: 0;
  gap: 9px;
}

.profit-goal-heading {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profit-goal-heading > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.profit-goal-heading small {
  color: #7c8491;
  font-size: 10px;
  font-weight: 650;
  text-align: right;
}

.profit-goal-editor {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.profit-goal-editor .range-field {
  min-height: 46px;
  border: 0;
  border-radius: 0;
}

.fixed-profit-row {
  display: grid;
  min-height: 43px;
  grid-template-columns: minmax(0, 1fr) 124px;
  align-items: center;
  gap: 12px;
  padding: 5px 8px 5px 13px;
  border-top: 1px solid var(--line);
  background: #faf8f3;
}

.fixed-profit-row > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.compact-money-input input {
  height: 33px;
  border-radius: 8px;
  font-size: 13px;
}

.range-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: ew-resize;
}

.range-value {
  display: flex;
  min-width: 58px;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.range-value input {
  width: 42px;
  padding: 3px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
  text-align: right;
  -moz-appearance: textfield;
}

.range-value input::-webkit-inner-spin-button,
.range-value input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.range-value input:hover,
.range-value input:focus {
  border-bottom-color: var(--accent);
}

.result-panel {
  position: sticky;
  top: 24px;
  overflow: hidden;
  padding: 30px;
  background: var(--nav);
  color: white;
}

.result-panel::before {
  position: absolute;
  top: -70px;
  right: -55px;
  width: 180px;
  height: 180px;
  border: 34px solid rgb(216 240 111 / 15%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.result-kicker {
  position: relative;
  color: var(--lime);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.suggested-price {
  position: relative;
  display: block;
  margin-top: 9px;
  font-size: clamp(40px, 5vw, 60px);
  letter-spacing: -0.068em;
  line-height: 1;
}

.result-panel > p,
.result-panel #resultSuccess > p {
  position: relative;
  max-width: 32ch;
  margin: 12px 0 26px;
  color: #b5bdca;
  font-size: 12px;
  line-height: 1.5;
}

.result-panel #resultSuccess > p {
  margin-bottom: 16px;
}

.result-margin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding: 11px 12px;
  border: 1px solid rgb(216 240 111 / 22%);
  border-radius: 12px;
  background: rgb(216 240 111 / 8%);
}

.result-margin span {
  color: #c5ccd6;
  font-size: 10px;
  font-weight: 700;
}

.result-margin strong {
  color: var(--lime);
  font-size: 15px;
}

.result-margin-values {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.result-margin-values small {
  color: #8f99a9;
  font-size: 10px;
}

.result-error,
.result-empty {
  position: relative;
  margin: 12px 0 24px;
  padding: 14px;
  border-radius: 14px;
}

.result-error {
  border: 1px solid rgb(243 111 69 / 42%);
  background: rgb(243 111 69 / 12%);
}

.result-empty {
  border: 1px solid rgb(216 240 111 / 22%);
  background: rgb(216 240 111 / 8%);
}

.result-error strong,
.result-empty strong {
  font-size: 14px;
}

.result-error p,
.result-empty p {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.45;
}

.result-error p {
  color: #e3c5bc;
}

.result-empty p {
  color: #c5ccd6;
}

.cost-summary {
  position: relative;
  padding: 7px 0;
  border-top: 1px solid rgb(255 255 255 / 12%);
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}

.cost-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
}

.cost-summary span {
  color: #adb6c4;
  font-size: 11px;
}

.cost-summary strong {
  font-size: 12px;
}

.cost-summary .total-row {
  margin-top: 4px;
  padding-top: 13px;
  border-top: 1px dashed rgb(255 255 255 / 14%);
}

.total-row span,
.total-row strong {
  color: white;
  font-size: 13px;
}

.channels-section {
  margin-top: 36px;
}

.channels-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.channels-heading h2 {
  margin: 5px 0 0;
  font-size: 24px;
  letter-spacing: -0.045em;
}

.channels-heading > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.channels-heading > p strong {
  color: var(--ink);
  font-weight: 800;
}

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

.channel-card {
  min-width: 0;
  padding: 17px;
  border-radius: 17px;
  background: rgb(255 254 250 / 88%);
  box-shadow: 0 12px 34px rgb(31 39 51 / 4%);
}

.channel-card.featured {
  border-color: #eb9c82;
  box-shadow: inset 0 3px 0 var(--accent);
}

.channel-title {
  display: flex;
  min-height: 28px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.channel-title strong {
  font-size: 12px;
}

.channel-title span {
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
}

.channel-badges {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 4px;
}

.channel-title .custom-badge {
  background: #eef5d0;
  color: #597711;
}

.channel-profit {
  margin: 13px 0 15px;
}

.channel-profit span,
.channel-profit small,
.channel-profit strong {
  display: block;
}

.channel-profit span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.channel-profit strong {
  margin-top: 4px;
  font-size: 23px;
  letter-spacing: -0.05em;
}

.channel-profit small {
  margin-top: 2px;
  color: var(--success);
  font-size: 9px;
  font-weight: 750;
}

.channel-received {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 13px;
  padding: 8px 9px;
  border: 1px solid #e6e0d5;
  border-radius: 10px;
  background: #f8f6f0;
}

.channel-received span {
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.3;
}

.channel-received strong {
  flex: 0 0 auto;
  font-size: 12px;
  white-space: nowrap;
}

.channel-received.profit-positive {
  border-color: #d6e5b8;
  background: #f3f8e9;
}

.channel-received.profit-positive span,
.channel-received.profit-positive strong {
  color: #53711c;
}

.channel-received.profit-negative {
  border-color: #efd0c9;
  background: #fff1ee;
}

.channel-received.profit-negative span,
.channel-received.profit-negative strong {
  color: #a54334;
}

.channel-card details {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.channel-card summary {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.channel-card dl {
  margin: 12px 0 0;
}

.channel-card dl > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
}

.channel-card dt,
.channel-card dd {
  margin: 0;
  font-size: 9px;
  line-height: 1.35;
}

.channel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
}

.channel-actions button,
.channel-editor-buttons button {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 800;
}

.channel-actions button:first-child,
.channel-editor-buttons .save-fees {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.channel-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.channel-editor {
  margin-top: 11px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8f6f0;
}

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

.channel-editor label span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 750;
}

.channel-editor input {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
}

.channel-editor-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 9px;
}

.channel-card dt {
  color: var(--ink-soft);
}

.channel-card dd {
  max-width: 55%;
  font-weight: 700;
  text-align: right;
}

.rates-note {
  margin: 12px 0 0;
  color: #767c87;
  font-size: 10px;
  line-height: 1.5;
}

.construction-page {
  position: relative;
  display: flex;
  min-height: min(620px, calc(100vh - 72px));
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  padding: 48px 24px;
  background: var(--card);
  text-align: center;
}

.construction-page::before,
.construction-page::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.construction-page::before {
  top: -110px;
  right: -80px;
  width: 300px;
  height: 300px;
  border: 58px solid var(--accent-soft);
}

.construction-page::after {
  bottom: -95px;
  left: -70px;
  width: 260px;
  height: 260px;
  border: 50px solid #f4f8d8;
}

.construction-code {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 17px;
  background: var(--nav);
  color: var(--lime);
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  font-weight: 850;
  transform: rotate(-4deg);
}

.construction-page > * {
  position: relative;
  z-index: 1;
}

.construction-page > p {
  max-width: 48ch;
  margin: 16px 0 22px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.construction-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.construction-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(243 111 69 / 13%);
}

.primary-button {
  margin-top: 26px;
  padding: 12px 17px;
  border: 1px solid var(--nav);
  background: var(--nav);
  color: white;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgb(21 32 51 / 18%);
}

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

  .sidebar {
    padding-inline: 12px;
  }

  .brand-block {
    justify-content: center;
    padding-inline: 0;
  }

  .brand-block div,
  .nav-item > span:not(.nav-index),
  .nav-item em,
  .sidebar-note {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .channel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .production-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    display: flex;
    width: 100%;
    height: auto;
    min-height: auto;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    gap: 16px;
    overflow: visible;
    padding: 12px 16px;
  }

  .brand-block {
    justify-content: flex-start;
    padding: 0;
    border: 0;
  }

  .brand-block div {
    display: block;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .main-nav,
  .sidebar-note {
    display: none;
  }

  .mobile-module-picker {
    display: block;
  }

  .mobile-module-picker > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .mobile-module-picker select {
    width: min(45vw, 180px);
    height: 38px;
    border: 1px solid rgb(255 255 255 / 16%);
    border-radius: 10px;
    background: #202c40;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 0 10px;
  }

  .workspace {
    padding: 26px 16px 44px;
  }

  .channels-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .channel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 34px;
  }

  .ghost-button {
    align-self: stretch;
  }

  .form-panel,
  .result-panel {
    border-radius: 19px;
  }

  .section-heading.compact {
    flex-wrap: wrap;
  }

  .settings-save {
    margin-left: 48px;
  }

  .primary-fields,
  .production-fields,
  .channel-grid {
    grid-template-columns: 1fr;
  }

  .margin-field {
    grid-column: 1 / -1;
  }

  .channel-card {
    border-radius: 15px;
  }

  .construction-page {
    min-height: calc(100vh - 136px);
    border-radius: 19px;
  }
}
