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

:root {
  --base:#1E2620; --base-2:#283129; --stone:#E6E3D9; --surface:#F1EFE7;
  --ink:#20261F; --ink-soft:#586056; --green:#2C4435; --ember:#C16A2E;
  --steel:#8A8F86; --line:#CCC7B6; --light:#E9E6DC; --danger:#B23A30;
  --shadow:0 10px 40px rgba(30,38,32,.28);
}

html, body { height: 100%; }
body {
  display: flex; flex-direction: column;
  background: var(--stone); color: var(--ink);
  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }
em { font-style: normal; color: var(--steel); font-size: .85em; }

/* ── app bar ── */
.appbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
  background: var(--base); color: var(--light);
  padding: 0 12px; height: 50px; flex: none; border-bottom: 1px solid #000;
  overflow-x: auto; overflow-y: hidden;
}
.appbar::-webkit-scrollbar { height: 0; }
.brand, .appname, .tools { flex: none; }
.brand { font-weight: 800; letter-spacing: -.02em; color: var(--light); text-decoration: none; font-size: 16px; }
.brand:hover { color: var(--ember); }
.appname { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--steel); }
.spacer { flex: 1; }
.tools { display: flex; gap: 4px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--base-2); color: var(--light); border: 1px solid #00000033;
  border-radius: 8px; padding: 5px 9px; font: 600 13px 'Archivo', sans-serif;
}
.tool:hover { background: #33402F; }
.tool.active { background: var(--green); outline: 2px solid var(--ember); }
.tool .glyph { font-size: 14px; line-height: 1; }
.tool kbd { font: 600 10px 'IBM Plex Mono', monospace; background: #00000033; border-radius: 4px; padding: 1px 4px; color: var(--steel); }

.actions { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; flex: none; justify-content: flex-end; }
button {
  cursor: pointer; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px;
  font: 600 13px 'Archivo', sans-serif;
}
button:hover { border-color: var(--steel); }
button:disabled { opacity: .5; cursor: default; }
button.icon { width: 32px; padding: 6px 0; text-align: center; font-size: 15px; }
.appbar button { background: var(--base-2); color: var(--light); border-color: #00000033; padding: 5px 9px; font-size: 12.5px; }
.appbar button:hover { background: #33402F; }
button.primary, .appbar button.primary { background: var(--ember); color: #fff; border-color: #9c521f; }
button.primary:hover { background: #ad5c28; }
/* undo/redo — high-visibility (bright glyph on a lighter, clearly-bordered button) */
.appbar #a_undo, .appbar #a_redo { width: 36px; font-size: 22px; font-weight: 700; line-height: 1; color: #fff; background: #3c4d35; border-color: #627457; }
.appbar #a_undo:hover, .appbar #a_redo:hover { background: #4c5f43; border-color: #7b8d70; }
/* prominent call-to-action button (e.g. Request an Official Quote) */
/* primary call-to-action — inviting green (the key action; rest of the UI stays ember) */
button.cta { font-size: 15px; font-weight: 800; letter-spacing: .3px; padding: 13px 26px; border-radius: 10px; color: #fff; border-color: #234f31;
  background: linear-gradient(180deg, #3C8A55 0%, #2C6B41 100%); box-shadow: 0 5px 16px rgba(44,107,65,.45); }
button.cta:hover { transform: translateY(-1px); background: linear-gradient(180deg, #45975F 0%, #2F7547 100%); box-shadow: 0 8px 22px rgba(44,107,65,.55); }
/* prominent green "Request a quote" in the top bar (id beats .appbar button.primary) */
#a_quote { background: linear-gradient(180deg, #3C8A55 0%, #2C6B41 100%); color: #fff; border-color: #234f31; font-weight: 800; font-size: 13.5px; padding: 7px 16px; box-shadow: 0 2px 10px rgba(44,107,65,.5); }
#a_quote:hover { background: linear-gradient(180deg, #45975F 0%, #2F7547 100%); }
button.danger { background: #fff; color: var(--danger); border-color: #e0b6b1; }
button.danger:hover { background: #fbeceb; }
button.mini { padding: 3px 7px; font-size: 11px; }

/* ── workspace ── */
.workspace { flex: 1; display: flex; min-height: 0; }
.canvaswrap { flex: 1; position: relative; min-width: 0; background: var(--surface); }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.zoomctl { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
.zoomctl button { width: 38px; height: 38px; padding: 0; font-size: 19px; line-height: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 2px 8px rgba(30,38,32,.16); color: var(--ink); }
.zoomctl button:hover { background: #fff; border-color: var(--steel); }

.sidebar {
  width: 366px; flex: none; background: var(--surface); border-left: 1px solid var(--line);
  overflow-y: auto; display: flex; flex-direction: column;
}
.panel { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel h2 { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.bomsec { flex: 1; }

h3.sec { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--steel); margin: 12px 0 4px; }
h3.sec:first-child { margin-top: 0; }

/* fields */
.field { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.field .flabel { flex: 1; color: var(--ink-soft); font-size: 13px; }
.field.col { flex-direction: column; align-items: stretch; gap: 3px; }
.field input[type=number], .field input[type=text], .field input[type=email], .field input[type=tel], .field select {
  width: 122px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px;
  font: 13px 'Archivo', sans-serif; background: #fff; color: var(--ink);
}
.field.col input, .field.col textarea, .field.col select { width: 100%; }
.field textarea { width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 5px; font: 13px 'IBM Plex Mono', monospace; background: #fff; resize: vertical; }
.field input[type=range] { width: 130px; }
.field.price input { width: 78px; }
.hint { color: var(--steel); font-size: 11px; font-family: 'IBM Plex Mono', monospace; }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.btnlike { display: inline-flex; align-items: center; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; font: 600 13px 'Archivo', sans-serif; }

/* BOM */
.bomgroup { margin-bottom: 10px; }
.bomhead { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); padding-bottom: 3px; margin-bottom: 3px; }
.bomline { display: grid; grid-template-columns: 28px 1fr 60px 66px; gap: 6px; align-items: baseline; font-size: 12.5px; padding: 2px 0; }
.bomline .q { color: var(--green); font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.bomline .d { color: var(--ink); }
.bomline .u { color: var(--steel); text-align: right; font-size: 11.5px; }
.bomline .t { text-align: right; }
.bomline.missing .d { color: var(--ember); font-style: italic; }

#totals { margin-top: 8px; }
.tgrid { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; font-size: 12.5px; margin-bottom: 8px; }
.tgrid .tk { color: var(--ink-soft); }
.tgrid .tv { text-align: right; }
.totline { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.totline.grand { font-weight: 800; font-size: 17px; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 6px; }
.totline.rebate { color: var(--ink-soft); font-size: 12px; font-style: italic; }
.warnbox { margin-top: 10px; background: #f7ede3; border: 1px solid #e6c9a9; border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.warnbox strong { display: block; color: var(--ember); margin-bottom: 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.warn { color: var(--ink-soft); margin: 2px 0; }
.disclaimer { font-size: 11px; color: var(--steel); font-style: italic; margin-top: 12px; }

/* status bar */
.statusbar { flex: none; height: 28px; background: var(--base); color: var(--steel); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; font-size: 12px; font-family: 'IBM Plex Mono', monospace; }
#status { color: var(--light); }

/* modals */
#modals { position: fixed; inset: 0; pointer-events: none; }
.modal { position: absolute; inset: 0; background: rgba(20,24,18,.45); display: none; align-items: center; justify-content: center; pointer-events: auto; padding: 20px; }
.modal.open { display: flex; }
.sheet { background: var(--surface); border-radius: 14px; width: min(580px, 96vw); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; }
.sheethead { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheethead h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.sheethead .x { border: none; background: none; font-size: 24px; line-height: 1; color: var(--ink-soft); width: 32px; }
.sheetbody { padding: 16px 18px; overflow-y: auto; }
.status { margin-top: 10px; font-size: 13px; min-height: 18px; }
.status.ok { color: var(--green); font-weight: 600; }
.status.error { color: var(--danger); font-weight: 600; }
.gotcha { position: absolute !important; left: -5000px !important; width: 1px; height: 1px; }
.designrow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.help ul { margin: 8px 0 8px 18px; }
.help li { margin: 5px 0; font-size: 14px; }
.field.price .flabel { font-size: 12.5px; }

/* tutorial cards */
.tcard { padding: 2px 2px 8px; min-height: 132px; }
.tnum { color: var(--ember); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.tcard h3 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 9px; }
.tcard p { font-size: 14.5px; color: var(--ink); line-height: 1.55; }
.tcard b { font-weight: 700; }
.tnav { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.tnav .btnrow { margin-top: 0; }
.tdots { display: flex; gap: 7px; }
.tdot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); cursor: pointer; }
.tdot.active { background: var(--ember); }

/* admin gating — hide admin-only bits unless body.admin is set */
body:not(.admin) .admin-only { display: none !important; }
.adminbadge { font-family: 'IBM Plex Mono', monospace; font-size: 9px; background: var(--ember); color: #fff; padding: 1px 5px; border-radius: 4px; vertical-align: middle; letter-spacing: .5px; }
.qbanner { background: var(--green); color: #fff; padding: 7px 10px; border-radius: 7px; font-size: 12px; margin-bottom: 10px; }

/* Request-a-Quote dialog */
.kicker { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ember); }
.calc { text-align: center; padding: 16px 6px 6px; }
.calc h3 { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.spinner { width: 42px; height: 42px; margin: 4px auto 16px; border: 4px solid var(--line); border-top-color: var(--ember); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.calcbar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 0 auto 12px; max-width: 320px; }
.calcbar i { display: block; height: 100%; width: 0; background: var(--ember); border-radius: 6px; animation: fill 15s linear forwards; }
@keyframes fill { to { width: 100%; } }
.calcmsg { min-height: 20px; font-size: 13px; }
.reveal { text-align: center; padding: 10px 4px; }
.reveal h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.reveal .btnrow { justify-content: center; }
.bignum { font-size: 46px; font-weight: 900; letter-spacing: -.03em; margin: 6px 0 12px; color: var(--ink); }
/* submitted success screen */
.bigcheck { width: 58px; height: 58px; margin: 2px auto 12px; border-radius: 50%; color: #fff; font-size: 30px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #3C8A55, #2C6B41); box-shadow: 0 5px 16px rgba(44,107,65,.45); }
.reveal.submitted h3 { color: var(--green); font-size: 22px; }
/* persistent confirmation banner over the canvas (stays until dismissed) */
.confirmbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6; max-width: 92%;
  display: flex; align-items: center; gap: 11px; background: linear-gradient(180deg, #3C8A55, #2C6B41); color: #fff;
  padding: 11px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(30,38,32,.32); font-size: 14px; line-height: 1.4; }
.cb-check { font-size: 18px; font-weight: 900; flex: none; }
.cb-text b { font-weight: 800; }
.cb-x { flex: none; background: rgba(255,255,255,.2); border: none; color: #fff; width: 26px; height: 26px; border-radius: 7px; font-size: 17px; line-height: 1; cursor: pointer; }
.cb-x:hover { background: rgba(255,255,255,.34); }

/* responsive — collapse the toolbar progressively so the CTA never clips */
@media (max-width: 1340px) { .tool kbd { display: none; } .tool span:not(.glyph) { display: none; } .tool { padding: 6px 8px; } }
@media (max-width: 1120px) { .appname { display: none; } }
@media (max-width: 920px) {
  .workspace { flex-direction: column; }
  .sidebar { width: 100%; max-height: 45%; border-left: none; border-top: 1px solid var(--line); }
  .canvaswrap { min-height: 280px; }
  .appname { display: none; }
}

/* print: just the estimate */
@media print {
  body { overflow: visible; height: auto; display: block; }
  .appbar, .statusbar, .canvaswrap, #modals, #params, #selpanel, .disclaimer { display: none !important; }
  .workspace { display: block; }
  .sidebar { width: 100%; border: none; overflow: visible; }
  .panel { border: none; }
  .bomline { font-size: 11px; }
}
