:root {
  --bg: #f5efe4;
  --bg-glow: #e8dcc5;
  --surface: rgba(255, 250, 242, 0.88);
  --surface-strong: #fff8ee;
  --border: rgba(92, 65, 39, 0.14);
  --text: #2f241c;
  --muted: #6c5a4c;
  --accent: #c65d2d;
  --accent-soft: #efc9aa;
  --accent-deep: #87401f;
  --shadow: 0 28px 60px rgba(77, 48, 23, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 30%),
    radial-gradient(circle at right center, rgba(198, 93, 45, 0.12), transparent 25%),
    linear-gradient(135deg, var(--bg), var(--bg-glow));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(135, 64, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 64, 31, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 88%);
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  margin-bottom: 28px;
  padding: 28px 32px 12px;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0;
  max-width: 14ch;
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: clamp(2.4rem, 4.8vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 760px;
  margin-top: 18px;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.top-controls {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 32px 24px;
}

.view-switch {
  display: inline-flex;
  gap: 10px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.88);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.view-toggle {
  border-radius: 999px;
}

.view-toggle.active {
  background: linear-gradient(145deg, rgba(198, 93, 45, 0.95), rgba(135, 64, 31, 0.92));
  color: #fff7ed;
  border-color: rgba(135, 64, 31, 0.85);
}

.progress-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-actions .mini-note {
  margin-top: 0;
}

.calculator-view {
  display: none;
}

.calculator-view.active {
  display: grid;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.controls {
  padding: 24px;
  position: sticky;
  top: 18px;
}

.output {
  padding: 24px;
}

h2 {
  margin: 0 0 14px;
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

h3 {
  margin: 0 0 8px;
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: 0.98rem;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.field-hint {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid rgba(92, 65, 39, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

input[readonly] {
  background: rgba(247, 239, 225, 0.9);
  color: var(--accent-deep);
  font-weight: 600;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(198, 93, 45, 0.14);
  transform: translateY(-1px);
}

.note-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(198, 93, 45, 0.12), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(198, 93, 45, 0.12);
}

.preset-section {
  margin-bottom: 18px;
}

.preset-heading {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.preset-heading h3 {
  margin: 0;
}

.preset-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.preset-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-card strong {
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: 0.98rem;
}

.preset-card span {
  min-height: 38px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.preset-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

.preset-actions button {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
}

.reference-card {
  margin-top: 16px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

button {
  appearance: none;
  border: 1px solid rgba(92, 65, 39, 0.18);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(198, 93, 45, 0.4);
  box-shadow: 0 8px 18px rgba(77, 48, 23, 0.08);
}

button:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(198, 93, 45, 0.14);
}

.reference-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--text);
}

.reference-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(92, 65, 39, 0.12);
}

.reference-row span:last-child {
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
}

.mini-note {
  margin-top: 12px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: -4px 0 18px;
  color: var(--text);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
}

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

.summary-card {
  padding: 18px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 118px;
}

.summary-card span {
  color: var(--muted);
  font-size: 0.95rem;
}

.summary-card strong {
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: clamp(1.25rem, 1.7vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.summary-card.accent {
  background: linear-gradient(145deg, rgba(198, 93, 45, 0.95), rgba(135, 64, 31, 0.92));
  color: #fff7ed;
}

.summary-card.accent span {
  color: rgba(255, 247, 237, 0.84);
}

.sale-breakdown {
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.64);
}

.breakdown-list {
  display: grid;
  gap: 12px;
}

.breakdown-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(92, 65, 39, 0.12);
}

.breakdown-list div span {
  color: var(--muted);
}

.breakdown-list strong {
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
}

.breakdown-list .net-line {
  padding-top: 4px;
  border-bottom: none;
}

.table-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.table-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(255, 248, 238, 0.96);
  font-family: "Bahnschrift", "Arial Narrow", sans-serif;
  font-size: 0.9rem;
}

tbody tr:nth-child(even) {
  background: rgba(198, 93, 45, 0.04);
}

tbody tr:hover {
  background: rgba(198, 93, 45, 0.08);
}

.empty-state td {
  text-align: center;
  color: var(--muted);
}

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

  .controls {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 22px;
  }

  .hero {
    padding: 12px 8px 0;
  }

  .controls,
  .output {
    padding: 18px;
  }

  .top-controls {
    margin: 0 0 18px;
    flex-direction: column;
    align-items: stretch;
  }

  .view-switch {
    display: flex;
  }

  .progress-actions {
    justify-content: space-between;
  }

  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .preset-heading {
    align-items: start;
    flex-direction: column;
  }

  th,
  td {
    padding: 12px;
    font-size: 0.92rem;
  }
}
