:root {
  color-scheme: light;
  --bg: #f3ede5;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --text: #231c16;
  --muted: #746353;
  --line: rgba(70, 53, 36, 0.14);
  --accent: #b89269;
  --accent-strong: #8c6742;
  --accent-soft: #efe3d5;
  --shadow: 0 24px 70px rgba(66, 47, 28, 0.12);
  --radius: 8px;
  --layout-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(184, 146, 105, 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(140, 103, 66, 0.12), transparent 28%),
    linear-gradient(180deg, #fbf8f4 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 78%);
}

.page-shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 52px;
}

.hero,
.layout {
  display: grid;
  gap: 20px;
}

.hero {
  grid-template-columns: var(--layout-columns);
  align-items: stretch;
  margin-bottom: 20px;
}

.hero__content,
.hero__panel-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero__content,
.hero__panel-card {
  min-height: 380px;
}

.hero__content {
  padding: 28px 30px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero__content::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(140deg, rgba(184, 146, 105, 0.18), transparent 40%),
    radial-gradient(circle at 86% 24%, rgba(184, 146, 105, 0.26), transparent 0 20%),
    radial-gradient(circle at 86% 66%, rgba(140, 103, 66, 0.12), transparent 0 25%);
  pointer-events: none;
}

.eyebrow,
.section-kicker,
.chart-card__label {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.hero__headline,
.panel__header > div,
.chart-card__head > div:first-child {
  position: relative;
  z-index: 1;
}

.hero__brand {
  margin: 10px 0 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: 0;
}

.hero__brand-x {
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 14ch;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 800;
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
}

.hero__lead,
.notes,
.hero__advantage,
.hero__link,
.field span,
th,
td,
input,
button,
output,
p,
a {
  font-size: 15px;
  line-height: 1.5;
}

.hero__lead {
  position: relative;
  z-index: 1;
  max-width: 52ch;
  margin: 14px 0 0;
  color: var(--muted);
}

.hero__bullets {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.hero__bullets li + li {
  margin-top: 8px;
}

.hero__panel-card {
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 242, 234, 0.96));
}

.hero__image-wrap {
  min-height: 0;
  border-radius: 8px;
  background:
    radial-gradient(circle at top, rgba(184, 146, 105, 0.15), transparent 45%),
    linear-gradient(180deg, #f8f1e9 0%, #ffffff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}

.hero__image {
  max-width: 100%;
  width: 100%;
  max-height: 250px;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
}

.hero__advantage {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.hero__link {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.layout {
  grid-template-columns: var(--layout-columns);
}

.controls,
.zones {
  grid-column: 1;
}

.results {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.panel {
  padding: 24px;
  border-radius: var(--radius);
}

.panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  color: var(--muted);
}

input[type="number"],
input[type="text"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 0 14px;
  font: inherit;
  color: var(--text);
}

.price-preset {
  margin-bottom: 16px;
}

.price-preset__label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 15px;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-chip {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(184, 146, 105, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.preset-chip.is-active {
  background: var(--accent-soft);
  border-color: rgba(184, 146, 105, 0.48);
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-strong);
}

.field__inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

#doctor-share-output {
  min-width: 56px;
  text-align: right;
  font-weight: 700;
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button {
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border-color: rgba(184, 146, 105, 0.28);
}

.notes {
  margin-top: 18px;
  color: var(--muted);
}

.notes a,
.zones__note a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.notes p,
.zones__note {
  margin: 0;
}

.chart-card {
  border-radius: 8px;
  border: 1px solid rgba(184, 146, 105, 0.22);
  background:
    linear-gradient(180deg, rgba(239, 227, 213, 0.72), rgba(255, 255, 255, 0.92));
  padding: 16px;
  margin-bottom: 14px;
}

.chart-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-card__value {
  display: block;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chart-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-legend__dot--line {
  background: var(--accent-strong);
}

.chart-legend__dot--target {
  background: var(--text);
}

.payback-chart {
  width: 100%;
  height: auto;
  display: block;
}

.results-grid,
.operations-grid {
  display: grid;
  gap: 12px;
}

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

.results-grid .result-card:last-child {
  grid-column: 1 / -1;
}

.operations-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.result-card,
.operation-card {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.result-card {
  padding: 16px;
}

.result-card--accent {
  background: linear-gradient(180deg, rgba(184, 146, 105, 0.18), rgba(255, 255, 255, 0.92));
}

.result-card__label,
.operation-card__label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.result-card__value,
.operation-card__value {
  display: block;
  font-size: 30px;
  line-height: 1.06;
  font-weight: 800;
}

.result-card__subtle,
.operation-card__subtle {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.operation-card {
  padding: 14px;
}


.zones__actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

@media print {
  body {
    background: white;
  }

  body::before {
    display: none;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

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

  .hero__content,
  .hero__panel-card,
  .panel,
  .chart-card,
  .result-card,
  .operation-card {
    box-shadow: none;
    backdrop-filter: none;
    background: white;
    break-inside: avoid;
  }

  .button,
  .icon-button,
  .zones__actions,
  .price-preset {
    display: none !important;
  }

  .zones-table {
    display: table;
    width: 100%;
    table-layout: fixed;
    min-width: 0;
  }

  .zones-table thead {
    display: table-header-group;
  }

  .zones-table tbody {
    display: table-row-group;
  }

  .zones-table tr {
    display: table-row;
    background: transparent;
    border: none;
  }

  .zones-table td,
  .zones-table th {
    display: table-cell;
    width: auto !important;
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
  }

  .zones-table td::before {
    display: none !important;
    content: none !important;
  }

  .zones-table .zone-row--zero {
    display: none;
  }
}

.table-wrap {
  overflow-x: auto;
}

.zones-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  vertical-align: middle;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-weight: 600;
}

.zones-table th:nth-child(1),
.zones-table td:nth-child(1) {
  width: 26%;
}

.zones-table th:nth-child(2),
.zones-table td:nth-child(2) {
  width: 13%;
}

.zones-table th:nth-child(3),
.zones-table td:nth-child(3) {
  width: 17%;
}

.zones-table th:nth-child(4),
.zones-table td:nth-child(4) {
  width: 16%;
}

.zones-table th:nth-child(5),
.zones-table td:nth-child(5) {
  width: 20%;
}

.zones-table th:nth-child(6),
.zones-table td:nth-child(6) {
  width: 8%;
  text-align: right;
}

.table-input {
  min-height: 42px;
}

.table-output {
  display: inline-block;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
}

.icon-button {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(184, 146, 105, 0.28);
  color: var(--accent-strong);
  font-weight: 800;
}

.zones__note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .results {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 12px, 1380px);
    padding-top: 8px;
    padding-bottom: 24px;
  }

  .hero__content,
  .hero__panel-card,
  .panel {
    padding: 16px;
  }

  .hero__content,
  .hero__panel-card {
    min-height: auto;
  }

  .hero__panel-card {
    grid-template-rows: auto auto auto;
  }

  .hero__image {
    max-height: 320px;
    object-fit: contain;
  }

  .hero__brand {
    font-size: clamp(44px, 16vw, 76px);
  }

  h1 {
    font-size: clamp(26px, 8.8vw, 40px);
  }

  .notes {
    font-size: 13px;
  }

  .preset-chips {
    gap: 8px;
  }

  .preset-chip {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }

  .notes p,
  .zones__note {
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.45;
  }

  .controls-grid,
  .results-grid,
  .operations-grid {
    grid-template-columns: 1fr;
  }

  .chart-card__head,
  .panel__header {
    flex-direction: column;
  }

  .panel__header {
    margin-bottom: 14px;
  }

  .panel__header .button {
    width: 100%;
  }

  h1 {
    max-width: none;
  }

  .result-card,
  .operation-card {
    padding: 14px;
  }

  .chart-card {
    padding: 12px;
  }

  .chart-card__value {
    font-size: 18px;
    line-height: 1.12;
  }

  .chart-legend {
    gap: 6px 10px;
    justify-content: flex-start;
  }

  .chart-legend__item {
    font-size: 12px;
  }

  .payback-chart {
    max-height: 180px;
  }

  .result-card__value,
  .operation-card__value {
    font-size: 22px;
    line-height: 1.08;
  }

  .result-card__subtle,
  .operation-card__subtle {
    font-size: 12px;
    line-height: 1.4;
  }

  .table-wrap {
    overflow: visible;
  }

  .zones-table,
  .zones-table tbody,
  .zones-table tr,
  .zones-table td {
    display: block;
    width: 100%;
  }

  .zones-table {
    min-width: 0;
    table-layout: auto;
  }

  .zones-table thead {
    display: none;
  }

  .zones-table tbody {
    display: grid;
    gap: 12px;
  }

  .zones-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
  }

  .zones-table td {
    border-bottom: none;
    padding: 0;
    min-width: 0;
    width: auto !important;
  }

  .zones-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }

  .zones-table td:nth-child(1) {
    grid-column: 1 / -1;
  }

  .zones-table td:nth-child(5) {
    grid-column: 1 / 2;
  }

  .zones-table td:nth-child(6) {
    grid-column: 2 / 3;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
  }

  .zones-table td:nth-child(6)::before {
    display: none;
  }

  .table-input {
    min-height: 44px;
    width: 100%;
  }

  .table-output {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 20px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .zones__actions .button {
    width: 100%;
  }
}
