:root {
  --bg: #05070a;
  --surface: #0d1117;
  --surface2: #121821;
  --line: #222b36;
  --text: #f5f7fa;
  --muted: #8793a3;
  --green: #39ff88;
  --red: #ff3b5c;
  --amber: #ff9f43;
  --yellow: #ffe14d;
  --cyan: #38d9ff;
  --radius: 18px;

  font-family: Inter, system-ui, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, #123127 0, transparent 30%),
    var(--bg);
}

.app-shell {
  width: min(100%, 860px);
  margin: auto;
  padding: 0 16px 100px;
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #2dff96;
  border-radius: 12px;
  color: var(--green);
  font: 800 22px/1 "Space Grotesk";
  box-shadow: 0 0 20px #39ff8828;
}

.brand div {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font: 700 18px "Space Grotesk";
}

.brand small,
.section-title small,
.helper {
  color: var(--muted);
}

button,
input {
  font: inherit;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: #dbe3ec;
  font-size: 20px;
  cursor: pointer;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.money-field {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.money-field.primary {
  border-color: #2bbf70;
  box-shadow: 0 0 25px #39ff8812;
}

.money-field > span {
  color: var(--muted);
  font-size: 13px;
}

.money-field div {
  display: flex;
  align-items: center;
  margin-top: 7px;
}

.money-field b {
  color: var(--muted);
  font-size: 17px;
}

.money-field input {
  width: 100%;
  min-width: 0;
  padding: 0 0 0 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  font: 700 clamp(25px, 5vw, 34px) "Space Grotesk";
}

.money-field div input + b {
  padding-left: 7px;
}

.panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #10151c, #0b0f14);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.segmented button {
  min-height: 42px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #080b10;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented button.active {
  border-color: #2bad68;
  background: #163927;
  color: var(--green);
}

.hero-result {
  position: relative;
  overflow: hidden;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--status);
  border-radius: 22px;
  background:
    linear-gradient(
      130deg,
      color-mix(in srgb, var(--status) 12%, #0b1015),
      #090c11
    );
  box-shadow:
    0 0 28px
    color-mix(in srgb, var(--status) 10%, transparent);
}

.hero-result::after {
  position: absolute;
  top: -70px;
  right: -55px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--status);
  content: "";
  filter: blur(90px);
  opacity: 0.12;
}

.hero-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dot {
  color: var(--status);
  font-size: 10px;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 15px;
  margin-top: 24px;
}

.hero-stats div {
  display: flex;
  flex-direction: column;
}

.hero-stats small {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.hero-stats strong {
  color: var(--status);
  font: 700 clamp(21px, 4vw, 32px) "Space Grotesk";
  text-shadow:
    0 0 15px
    color-mix(in srgb, var(--status) 35%, transparent);
}

.status-loss {
  --status: var(--red);
}

.status-tight {
  --status: var(--amber);
}

.status-low {
  --status: var(--yellow);
}

.status-good {
  --status: var(--green);
}

.suggested-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.suggested-input {
  display: flex;
  flex: 1;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #2c814f;
  border-radius: 13px;
  background: #0a1911;
  color: var(--green);
}

.suggested-input input {
  width: 100%;
  min-width: 0;
  padding-left: 6px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--green);
  font: 700 25px "Space Grotesk";
}

.secondary-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
  color: #dbe3ec;
  font-size: 12px;
  cursor: pointer;
}

.suggested-meta {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.suggested-meta b {
  margin-left: 5px;
  color: #dfe7ee;
}

.warning {
  padding: 10px;
  border: 1px solid #714714;
  border-radius: 10px;
  background: #2a1a08;
  color: #ffbd63;
  font-size: 13px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 26px 2px 12px;
}

.section-heading small,
.page-heading small {
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.section-heading h2,
.page-heading h1 {
  margin: 3px 0 0;
  font: 700 22px "Space Grotesk";
}

.section-heading > span {
  color: var(--muted);
  font-size: 13px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.scenario-card {
  --status: var(--green);

  position: relative;
  overflow: hidden;
  padding: 14px;
  border:
    1px solid
    color-mix(in srgb, var(--status) 55%, var(--line));
  border-radius: 16px;
  background: var(--surface);
}

.scenario-card::after {
  position: absolute;
  right: -20px;
  bottom: -35px;
  width: 90px;
  height: 90px;
  background: var(--status);
  content: "";
  filter: blur(55px);
  opacity: 0.13;
}

.scenario-card h3 {
  margin: 0;
  font-size: 13px;
}

.scenario-card .cost-tag {
  height: 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.scenario-numbers {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 17px 0;
}

.scenario-numbers span {
  display: flex;
  flex-direction: column;
  color: var(--muted);
  font-size: 10px;
}

.scenario-numbers b {
  margin-top: 3px;
  color: var(--status);
  font: 700 19px "Space Grotesk";
}

.recommended-line {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.recommended-line b {
  color: #e6edf4;
}

.breakdown summary {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.breakdown summary::-webkit-details-marker {
  display: none;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #18202a;
  color: var(--muted);
  font-size: 13px;
}

.breakdown-row b {
  color: #dae2ea;
}

.breakdown-row.total {
  padding-top: 14px;
  border: 0;
  color: white;
  font-weight: 800;
}

.breakdown-row.profit b {
  color: var(--status);
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0;
}

.helper {
  margin: 0 0 16px;
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.setting-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.setting-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.setting-input {
  display: flex;
  align-items: center;
}

.setting-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  font: 700 22px "Space Grotesk";
}

.setting-input b {
  color: var(--green);
}

.danger-button {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #5b2631;
  border-radius: 13px;
  background: #211015;
  color: #ff7c92;
  font-weight: 700;
  cursor: pointer;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.save-button,
.settings-actions .danger-button {
  width: 100%;
  margin: 0;
  padding: 14px;
  border-radius: 13px;
  font-weight: 700;
  cursor: pointer;
}

.save-button {
  border: 1px solid #2bad68;
  background: #163927;
  color: var(--green);
  box-shadow: 0 0 20px #39ff8815;
}

.save-message {
  margin: 10px 0 0;
  padding: 11px;
  border: 1px solid #2bad68;
  border-radius: 11px;
  background: #0d2418;
  color: var(--green);
  font-size: 13px;
  text-align: center;
}

.three-d-inputs,
.pricing-inputs {
  margin-top: 14px;
}

.piece-cost-card {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  padding: 20px;
  border: 1px solid #2bad68;
  border-radius: 20px;
  background:
    radial-gradient(
      circle at 80% 0,
      #17452d,
      transparent 45%
    ),
    #0b1210;
}

.piece-cost-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.piece-cost-card strong {
  margin: 6px 0;
  color: var(--green);
  font: 700 clamp(34px, 7vw, 50px) "Space Grotesk";
  text-shadow: 0 0 18px #39ff8840;
}

.piece-cost-card span {
  color: var(--muted);
  font-size: 12px;
}

.markup-field {
  border-color: #2e7390;
  box-shadow: 0 0 25px #38d9ff10;
}

.markup-field input,
.markup-field div b {
  color: var(--cyan);
}

.pricing-note {
  margin: 8px 3px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-section-title {
  grid-column: 1 / -1;
  margin: 10px 2px 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  bottom: 12px;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(calc(100% - 28px), 560px);
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #0d1219e8;
  box-shadow: 0 15px 50px #000;
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.bottom-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav button.active {
  background: #17241c;
  color: var(--green);
}

.bottom-nav span {
  font-size: 16px;
}

@media (max-width: 580px) {
  .app-shell {
    padding-inline: 12px;
  }

  .input-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .money-field {
    padding: 12px 10px;
  }

  .segmented {
    grid-template-columns: 1fr 1fr;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .hero-stats div:first-child {
    grid-column: 1 / -1;
  }

  .scenario-grid {
    grid-template-columns: 1fr 1fr;
  }

  .scenario-numbers {
    flex-direction: column;
    margin: 13px 0;
  }

  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }

  .suggested-row {
    flex-direction: column;
  }

  .secondary-button {
    min-height: 40px;
  }

  .suggested-meta {
    justify-content: space-between;
    gap: 5px;
  }
}

@media (max-width: 390px) {
  .scenario-grid,
  .settings-grid,
  .settings-actions {
    grid-template-columns: 1fr;
  }

  .money-field input {
    font-size: 23px;
  }

  .hero-stats strong {
    font-size: 22px;
  }

  .bottom-nav button {
    gap: 4px;
    font-size: 11px;
  }
}