:root {
  --bg: #f4efe7;
  --bg-accent: radial-gradient(circle at top left, rgba(255, 171, 92, 0.35), transparent 32%),
    radial-gradient(circle at top right, rgba(39, 110, 241, 0.18), transparent 26%),
    linear-gradient(180deg, #f8f5ef 0%, #efe5d6 100%);
  --panel: rgba(255, 253, 249, 0.88);
  --panel-border: rgba(84, 61, 28, 0.12);
  --text: #261b12;
  --muted: #6f6258;
  --accent: #c55c1f;
  --accent-dark: #8e3f12;
  --good: #1e8e5a;
  --bad: #b9382f;
  --shadow: 0 18px 50px rgba(89, 57, 22, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--bg-accent);
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  height: 100vh;
  padding: 12px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

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

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dark);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 2vw, 1.95rem);
  line-height: 0.92;
  max-width: none;
}

.hero-copy,
.panel-header p,
.hero-card li {
  color: var(--muted);
}

.hero-copy {
  max-width: 56ch;
  margin: 2px 0 0;
  line-height: 1.1;
  font-size: 0.8rem;
}

.hero-main {
  min-width: 0;
}

.hero-card,
.panel,
.summary-card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero-card {
  border-radius: 22px;
  padding: 8px 12px;
  align-self: center;
}

.hero-card-label {
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.hero-assumptions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hero-assumptions span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(84, 61, 28, 0.08);
  color: var(--muted);
  font-size: 0.76rem;
}

.layout {
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.top-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(420px, 1.1fr);
  gap: 10px;
  align-items: stretch;
}

.panel {
  border-radius: 22px;
  padding: 10px 12px;
  min-height: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
  margin-bottom: 8px;
}

.panel-header p {
  margin: 0;
  max-width: 52ch;
  font-size: 0.8rem;
}

.panel-header h2 {
  font-size: 0.98rem;
  line-height: 1.05;
}

.controls-grid,
.summary-grid {
  display: grid;
  gap: 8px 10px;
}

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

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

.field span {
  font-size: 0.76rem;
  font-weight: 500;
}

.field-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.field-link:hover {
  color: var(--accent-dark);
}

.field-priority span {
  color: var(--accent-dark);
  font-weight: 700;
}

.field input,
.field select {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(85, 59, 30, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 7px 10px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.field-priority input,
.field-priority select {
  background: linear-gradient(180deg, rgba(255, 246, 236, 0.96) 0%, rgba(255, 240, 222, 0.92) 100%);
  border-color: rgba(197, 92, 31, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(197, 92, 31, 0.6);
  transform: translateY(-1px);
}

.field-priority input:focus,
.field-priority select:focus {
  border-color: rgba(197, 92, 31, 0.7);
  box-shadow: 0 0 0 3px rgba(197, 92, 31, 0.12);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.summary-card {
  border-radius: 14px;
  padding: 8px 10px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.summary-label {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
  font-size: 0.68rem;
}

.summary-card strong {
  font-size: 0.94rem;
  text-align: left;
}

.summary-panel .panel-header {
  align-items: center;
  margin-bottom: 4px;
}

.summary-panel {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.summary-panel .panel-header p {
  max-width: none;
  font-size: 0.66rem;
}

.summary-panel h2 {
  font-size: 0.86rem;
  line-height: 1.1;
}

.controls-panel,
.summary-panel {
  align-self: stretch;
}

.table-wrap {
  overflow: auto;
  min-height: 0;
  max-height: 100%;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

thead th {
  position: sticky;
  top: 0;
  background: #faefe1;
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

thead th:nth-child(9) {
  background: #f4d6b6;
}

th,
td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(84, 61, 28, 0.08);
  white-space: nowrap;
  font-size: 0.84rem;
}

tbody tr:hover {
  background: rgba(255, 169, 87, 0.08);
}

.inline-hint,
.table-note {
  color: var(--muted);
}

.market-cell strong {
  display: block;
}

.market-cell span {
  color: var(--muted);
  font-size: 0.8rem;
}

.gross-price-cell {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(197, 92, 31, 0.1);
}

.gross-price-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.gross-price-value {
  letter-spacing: 0.01em;
}

.copy-price-button {
  border: 1px solid rgba(197, 92, 31, 0.18);
  background: rgba(255, 252, 248, 0.92);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 2px 8px;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.copy-price-button:hover {
  background: rgba(255, 248, 241, 1);
  border-color: rgba(197, 92, 31, 0.32);
  transform: translateY(-1px);
}

.copy-price-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 92, 31, 0.14);
}

.profit-positive,
.margin-positive {
  color: var(--good);
  font-weight: 700;
}

.profit-negative,
.margin-negative {
  color: var(--bad);
  font-weight: 700;
}

.table-note {
  margin-top: 2px;
  line-height: 1;
  font-size: 0.58rem;
}

.table-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

@media (max-width: 980px) {
  body {
    height: auto;
    overflow: auto;
  }

  .hero,
  .panel-header {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .page-shell {
    width: min(100% - 20px, 1440px);
    height: auto;
    padding-top: 20px;
    display: block;
  }

  .panel,
  .hero-card {
    border-radius: 22px;
  }

  .layout {
    grid-template-rows: none;
  }

  .top-row {
    grid-template-columns: 1fr;
  }

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

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

  .table-wrap {
    max-height: none;
  }

  h1 {
    max-width: 14ch;
  }
}
