:root {
  --bg-1: #f5efe6;
  --bg-2: #ebdcc7;
  --panel: #fffbf5;
  --ink: #2d261f;
  --muted: #665746;
  --line: #dccab3;
  --forest: #365a3f;
  --forest-2: #4d7a52;
  --amber: #c6762f;
  --amber-soft: #f6e3d0;
  --sky-soft: #dbe9e0;
  --shadow: 0 10px 30px rgba(70, 50, 30, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Sora", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, #fff7eb 0, rgba(255, 247, 235, 0) 44%),
    radial-gradient(circle at 90% 4%, #f1e2ce 0, rgba(241, 226, 206, 0) 45%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  line-height: 1.45;
}

.shell {
  width: min(1140px, calc(100% - 2.25rem));
  margin: 2rem auto 2.5rem;
  position: relative;
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, white 8%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: panel-rise 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero {
  padding: 1.45rem 1.4rem 1.6rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest);
  background: #e6efe7;
  padding: 0.24rem 0.62rem;
  border-radius: 999px;
  font-weight: 600;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  line-height: 1.06;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.48rem;
  margin-bottom: 1rem;
}

.lead {
  margin: 0 0 1.05rem;
  color: var(--muted);
  max-width: 62ch;
}

.preset-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.preset-btn {
  border: 1px solid #d6c8b6;
  background: #fff5e9;
  color: #5a4735;
  border-radius: 999px;
  padding: 0.48rem 0.85rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.preset-btn:hover {
  transform: translateY(-1px);
}

.preset-btn.active {
  background: #e7f2e5;
  border-color: #adc7af;
  color: #204326;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.calc-panel {
  padding: 1.25rem;
  animation-delay: 0.08s;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.field {
  display: grid;
  gap: 0.38rem;
}

.field span {
  color: var(--muted);
  font-size: 0.89rem;
  font-weight: 500;
}

.field input {
  width: 100%;
  border: 1px solid #d8c7b2;
  border-radius: 12px;
  padding: 0.66rem 0.72rem;
  font: inherit;
  background: #fffdf8;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: #6f9a74;
  box-shadow: 0 0 0 3px rgba(111, 154, 116, 0.2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 0.72rem;
}

.actions button {
  border: 0;
  border-radius: 12px;
  padding: 0.6rem 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.22s ease, filter 0.22s ease;
}

.actions button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn-primary {
  background: linear-gradient(120deg, var(--forest), var(--forest-2));
  color: #f6fff6;
}

.btn-secondary {
  background: var(--amber-soft);
  color: #583312;
}

.btn-ghost {
  background: #f4efe8;
  color: #4f4337;
}

.small-note {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-panel {
  padding: 1.25rem;
  animation-delay: 0.16s;
}

.empty-state {
  border: 1px dashed #d7c6b2;
  border-radius: 14px;
  background: #f8f0e4;
  color: #5c4f42;
  padding: 0.95rem;
}

.result-content {
  display: grid;
  gap: 0.95rem;
}

.total-box {
  border-radius: 16px;
  padding: 0.95rem;
  background:
    linear-gradient(125deg, #f2f8f0, #deebdf),
    linear-gradient(145deg, #f8f0e6, #f3e4d2);
  border: 1px solid #c7dbca;
}

.total-box p {
  margin: 0;
  color: #3b573d;
  font-weight: 600;
  font-size: 0.9rem;
}

.total-box strong {
  display: block;
  font-size: clamp(1.5rem, 3.1vw, 2.2rem);
  line-height: 1.05;
  margin: 0.3rem 0 0.2rem;
}

.total-box span {
  color: #466149;
  font-size: 0.88rem;
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.meta-row article {
  border: 1px solid #d8c9b5;
  border-radius: 12px;
  background: #fff7ee;
  padding: 0.7rem 0.75rem;
}

.meta-row p {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
}

.meta-row strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.16rem;
}

.line-items {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #dac9b6;
  border-radius: 12px;
  overflow: hidden;
}

.line-items li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.72rem;
  background: #fffdf8;
  border-bottom: 1px solid #ede2d3;
}

.line-items li:nth-child(2n) {
  background: #fff7ed;
}

.line-items li:last-child {
  border-bottom: 0;
}

.line-items span {
  color: #6b5a46;
}

.line-items strong {
  font-feature-settings: "tnum";
}

.split-chart {
  border: 1px solid #d8c8b6;
  border-radius: 12px;
  padding: 0.76rem;
  background: #fffbf4;
}

.split-chart h3 {
  font-size: 1.1rem;
  margin-bottom: 0.65rem;
}

.split-row {
  display: grid;
  grid-template-columns: 90px 1fr 48px;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.split-row:last-child {
  margin-bottom: 0;
}

.split-row span,
.split-row strong {
  font-size: 0.85rem;
}

.bar {
  height: 11px;
  border-radius: 999px;
  overflow: hidden;
  background: #efe2d1;
}

.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.45s ease;
}

#materialsBar {
  background: linear-gradient(90deg, #496f4e, #7ead7d);
}

#laborBar {
  background: linear-gradient(90deg, #c78649, #e2aa73);
}

#extrasBar {
  background: linear-gradient(90deg, #7a6655, #ab9175);
}

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

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

  .split-row {
    grid-template-columns: 80px 1fr 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
