* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #10151c; --panel: #171e27; --panel2: #1e2733; --line: #2a3543;
  --txt: #e8edf3; --muted: #93a1b3; --acc: #f5a623; --acc2: #ffc75e;
  --good: #4caf7d; --bad: #e05d5d;
}
html, body { height: 100%; }
body { font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--txt); }

#app { display: flex; height: 100vh; }
#sidebar { width: 460px; min-width: 380px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding-bottom: 40px; }
#mapWrap { flex: 1; position: relative; }
#map { position: absolute; inset: 0; background: #000; }

#brand { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #1b2430, var(--panel)); }
.logo { font-size: 17px; font-weight: 800; letter-spacing: .5px; color: var(--acc); }
.sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.step { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.step h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; color: var(--txt); }
.step h2 .n { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; background: var(--acc); color: #10151c; border-radius: 50%; font-size: 12px; margin-right: 8px; }

.row { display: flex; gap: 8px; margin-bottom: 10px; }
.row input[type=text] { flex: 1; }

input, select, button {
  font: inherit; color: var(--txt); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px;
}
input:focus, select:focus { outline: none; border-color: var(--acc); }
button { cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--acc); }
button.primary { background: var(--acc); color: #10151c; font-weight: 700; border-color: var(--acc); }
button.primary:hover { background: var(--acc2); }

.hint { color: var(--muted); font-size: 12px; margin: 8px 0; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.field select, .field input { width: 100%; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.stat label { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat output { font-size: 16px; font-weight: 700; color: var(--acc2); }

/* ---------- QUOTE PAGE ---------- */
.hidden { display: none !important; }
#quotePage { position: fixed; inset: 0; background: #f2f2f0; z-index: 5000; overflow-y: auto; }
.quote-toolbar { position: sticky; top: 0; display: flex; gap: 10px; justify-content: space-between; padding: 12px 24px; background: #10151c; z-index: 10; }

#quoteDoc { max-width: 860px; margin: 24px auto 60px; background: #fff; color: #1a1a1a; padding: 46px 52px; box-shadow: 0 4px 30px rgba(0,0,0,.25); }
#quoteDoc h1 { font-size: 22px; color: #b47408; }
#quoteDoc .qhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #f5a623; padding-bottom: 14px; margin-bottom: 18px; }
#quoteDoc .qhead .co { text-align: right; font-size: 12px; color: #555; }
#quoteDoc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 30px; font-size: 13px; margin-bottom: 18px; }
#quoteDoc .meta b { color: #333; }
#quoteDoc .roofshot { width: 100%; max-height: 340px; object-fit: cover; border-radius: 6px; margin: 6px 0 18px; border: 1px solid #ddd; }
#quoteDoc h3 { font-size: 14px; margin: 18px 0 8px; color: #333; text-transform: uppercase; letter-spacing: .5px; }
#quoteDoc table { width: 100%; border-collapse: collapse; font-size: 13px; }
#quoteDoc th { text-align: left; background: #faf3e3; padding: 7px 8px; border-bottom: 2px solid #f5a623; font-size: 11px; text-transform: uppercase; }
#quoteDoc td { padding: 7px 8px; border-bottom: 1px solid #eee; vertical-align: top; }
#quoteDoc td.num, #quoteDoc th.num { text-align: right; white-space: nowrap; }
#quoteDoc input { background: #fffbe9; border: 1px solid #e5d9b0; color: #1a1a1a; border-radius: 4px; padding: 3px 6px; width: 84px; text-align: right; }
#quoteDoc input.wide { width: 100%; text-align: left; }
#quoteDoc .totals { margin-top: 12px; margin-left: auto; width: 320px; font-size: 14px; }
#quoteDoc .totals div { display: flex; justify-content: space-between; padding: 4px 8px; }
#quoteDoc .totals .grand { border-top: 2px solid #f5a623; font-weight: 800; font-size: 17px; padding-top: 8px; }
#quoteDoc .params { font-size: 12px; color: #555; columns: 2; column-gap: 40px; }
#quoteDoc .params div { margin-bottom: 3px; }
#quoteDoc .foot { margin-top: 26px; font-size: 11px; color: #888; border-top: 1px solid #eee; padding-top: 10px; }

/* leaflet draw toolbar tweak on dark bg */
.leaflet-draw-toolbar a { background-color: #fff; }
.leaflet-container { font: inherit; }

@media print {
  body > #app, .noprint { display: none !important; }
  #quotePage { position: static; background: #fff; overflow: visible; }
  #quoteDoc { box-shadow: none; margin: 0; max-width: none; padding: 0; }
  #quoteDoc input { border: none; background: transparent; }
}
