:root {
  --bg: #f4efe7;
  --panel: rgba(255, 252, 246, 0.84);
  --panel-border: rgba(64, 46, 22, 0.12);
  --text: #221b13;
  --muted: #6b5b4b;
  --accent: #b86b2f;
  --accent-dark: #7b4318;
  --shadow: 0 24px 60px rgba(80, 48, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(184, 107, 47, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(90, 122, 91, 0.18), transparent 28%),
    linear-gradient(180deg, #f8f2ea 0%, var(--bg) 100%);
}

.app-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--accent-dark);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  line-height: 0.95;
  max-width: 10ch;
  margin-bottom: 14px;
}

.hero-copy,
.panel-header p,
.result-notes,
.stat-label {
  color: var(--muted);
}

.hero-copy {
  max-width: 54ch;
  font-size: 1.02rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(10px);
}

.panel + .panel {
  margin-top: 20px;
}

.planner-form,
.cuts-section {
  display: grid;
  gap: 20px;
}

.field-grid,
.cuts-list,
.stats-grid {
  display: grid;
  gap: 16px;
}

.field-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.field,
.cut-row {
  display: grid;
  gap: 8px;
}

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

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(74, 54, 34, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  padding: 14px 16px;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(184, 107, 47, 0.25);
  border-color: var(--accent);
}

.cuts-header,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cut-row {
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto;
  align-items: end;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(74, 54, 34, 0.08);
}

.primary-button,
.secondary-button,
.icon-button {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background-color 0.16s ease;
}

.primary-button,
.secondary-button {
  padding: 14px 20px;
}

.primary-button {
  background: var(--accent);
  color: #fff7f0;
}

.secondary-button,
.icon-button {
  background: rgba(184, 107, 47, 0.12);
  color: var(--accent-dark);
}

.icon-button {
  padding: 14px 18px;
}

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

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 20px;
}

.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(74, 54, 34, 0.08);
}

.stat-card strong {
  display: block;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-top: 10px;
}

.result-notes {
  margin-top: 20px;
  font-size: 0.96rem;
  line-height: 1.55;
}

.layout-block {
  margin-top: 28px;
}

.layout-summary {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.layout-canvas {
  display: grid;
  gap: 18px;
}

.layout-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(74, 54, 34, 0.08);
}

.layout-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.layout-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(184, 107, 47, 0.08), rgba(184, 107, 47, 0.02)),
    rgba(248, 242, 234, 0.9);
}

.layout-empty {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.hidden,
.sheet-only.hidden {
  display: none;
}

.panel-header.with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.print-summary {
  display: none;
}

.print-title {
  margin: 0 0 16px;
}

.print-summary-block {
  margin-bottom: 16px;
}

.print-summary-block h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.print-cuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.print-cuts-table th,
.print-cuts-table td {
  text-align: left;
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid rgba(74, 54, 34, 0.16);
}

@page {
  size: A4;
  margin: 12mm;
}

body.printing .hero,
body.printing .planner-panel,
body.printing .no-print {
  display: none !important;
}

body.printing .app-shell {
  width: auto;
  max-width: none;
  padding: 0;
  margin: 0;
}

body.printing .panel + .panel {
  margin-top: 0;
}

body.printing .results-panel {
  box-shadow: none;
  backdrop-filter: none;
  border: none;
  padding: 0;
  transform-origin: top left;
}

body.printing .print-summary {
  display: block;
}

body.printing .layout-canvas {
  gap: 10px;
}

body.printing .layout-card {
  border: 1px solid rgba(74, 54, 34, 0.2);
  page-break-inside: avoid;
}

body.printing .print-summary-block,
body.printing .stat-card {
  page-break-inside: avoid;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1100px);
    padding-top: 28px;
  }

  .panel {
    padding: 18px;
  }

  .cuts-header,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

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