:root {
  --bg: #f3eee6;
  --bg-deep: #e9e0d2;
  --card: #fffcf7;
  --ink: #1c1916;
  --muted: #5c5348;
  --line: #e2d8c8;
  --gold: #8d6b2c;
  --gold-soft: #c4a46a;
  --gold-pale: #f3e6c8;
  --danger: #8a3b12;
  --ok: #1f6b3a;
  --shadow: 0 10px 30px rgba(28, 25, 22, 0.08);
  --radius: 18px;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 500px at 50% -80px, #fffaf0 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
}

.hero { text-align: center; margin-bottom: 22px; }
.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 6px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(32px, 7vw, 48px);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.lede {
  margin: 0 auto;
  max-width: 28rem;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.45;
}

.meta-card, .box-card, .actions {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.meta-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  margin-bottom: 18px;
}
.field { display: grid; gap: 6px; }
.field span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field textarea,
.dim input {
  font-family: var(--sans);
  font-size: 16px; /* keep iOS from zooming */
  color: var(--ink);
  background: #fff;
  border: 1px solid #ddd2c0;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
.field input:focus,
.field textarea:focus,
.dim input:focus,
.field input[type="tel"]:focus,
.field input[type="email"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(141, 107, 44, 0.18);
}
.field textarea { resize: vertical; min-height: 64px; }
.field .req {
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  font-size: 10px;
  color: var(--gold);
  margin-left: 4px;
}
.field.invalid input { border-color: var(--danger); background: #fff6ef; }
.customer, .set-fields { display: grid; gap: 14px; }

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.boxes {
  display: grid;
  gap: 18px;
}
@media (min-width: 840px) {
  .boxes { grid-template-columns: 1fr 1fr; }
  .customer { grid-template-columns: 1.1fr 1fr 1.3fr; }
  .set-fields { grid-template-columns: 1fr 1.2fr; }
}

.box-card { padding: 8px 8px 18px; overflow: visible; }
.box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.box-head h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  margin: 0;
}
.box-head .he {
  margin: 0;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 22px;
}


.view-wrap {
  position: relative;
  width: 100%;
  margin: 0 auto;
}
.diagram {
  width: 100%;
  height: auto;
  display: block;
}
.view-cap {
  margin: 16px 0 10px;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a8073;
}
.front-wrap { padding: 28px 62px 18px; }
.side-wrap  { padding: 28px 16px 10px; }
.dim-line {
  stroke: var(--gold);
  stroke-width: 1.6;
  fill: none;
}

.dim {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 2;
}
.dim .letter {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 2px rgba(28,25,22,0.2);
  z-index: 3;
}
.dim .input-wrap { position: relative; }
.dim input {
  width: 4.6rem;
  height: 2.55rem;
  padding: 0 22px 0 6px;
  text-align: center;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  border-color: var(--gold-soft);
  background: #fffdf8;
  box-shadow: 0 2px 6px rgba(28,25,22,0.06);
}
.dim .unit {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 650;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--gold);
  pointer-events: none;
}
.dim .hint {
  background: var(--card);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 6px;
}
.dim.warn input {
  border-color: var(--danger);
  background: #fff6ef;
}
.dim.invalid input {
  border-color: var(--danger);
}

/* Front-view anchors */
.front-wrap .dim-top    { left: 50%; top: 10px; transform: translate(-50%, 0); }
.front-wrap .dim-bottom { left: 50%; top: auto; bottom: 0; transform: translate(-50%, 0); }
.front-wrap .dim-left   { left: 2px; top: 62%; transform: none; }
.front-wrap .dim-right  { right: 2px; left: auto; top: 32%; transform: none; }

/* Side-view anchors */
.side-wrap .dim-side-top    { left: 38%; top: 10px; transform: translate(-50%, 0); }
.side-wrap .dim-side-bottom { left: 50%; top: auto; bottom: 0; transform: translate(-50%, 0); }

/* Top dims already sit on the arrow; hide the extra caption so it doesn't cover the bayit */
.dim-top .hint,
.dim-bottom .hint,
.dim-side-top .hint,
.dim-side-bottom .hint { display: none; }

@media (max-width: 399px) {
  .page { padding-left: 10px; padding-right: 10px; }
  .front-wrap { padding-left: 54px; padding-right: 54px; }
  .dim input { width: 4.25rem; height: 2.45rem; }
  .dim .hint { display: none; }
}

.alerts {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8efe6;
  border: 1px solid #e6c9a8;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.45;
}
.alerts ul { margin: 6px 0 0; padding-left: 1.1em; }

.actions {
  margin-top: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: rgba(255,252,247,0.96);
  backdrop-filter: blur(8px);
}
form { padding-bottom: 8px; }
.save {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--ink);
  color: #f8f1e4;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 14px 18px;
  border-radius: 12px;
  width: 100%;
}
.save:hover { background: #2a2520; }
.save:disabled { opacity: 0.55; cursor: default; }
.status {
  margin: 0;
  text-align: center;
  min-height: 1.3em;
  font-size: 14.5px;
  color: var(--muted);
}
.status.ok { color: var(--ok); font-weight: 650; }
.status.err { color: var(--danger); font-weight: 650; }
