:root {
  --paper: #f5efe4; --card: #fffdf8; --ink: #23262b; --muted: #636770; --line: #e3d9c6;
  --accent: #5a6e5c; --accent-dk: #46584a; --clay: #c9824f; --late: #a8492a; --pencil: #4b4a46;
  --radius: 14px; --shadow: 0 1px 0 rgba(35,38,43,.04), 0 6px 18px rgba(35,38,43,.06);
  --hand: "Segoe Print", "Bradley Hand", "Comic Neue", "Chalkboard SE", cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink);
  background: var(--paper) radial-gradient(circle at 12% 8%, rgba(201,130,79,.07), transparent 40%), radial-gradient(circle at 90% 30%, rgba(90,110,92,.08), transparent 45%); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.opt { font-weight: 400; color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 980px; margin: 0 auto; padding: 18px 18px 6px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; font-family: Georgia, "Iowan Old Style", serif; }
.sub { margin: 0; color: var(--muted); font-size: .92rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

main { max-width: 980px; margin: 0 auto; padding: 6px 18px 32px; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; padding: 10px 14px; border-radius: 12px; background: #e6ebe3; color: var(--accent-dk); font-size: .93rem; }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-dk); text-decoration: underline; font-weight: 600; cursor: pointer; }

button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; min-height: 42px; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(90,110,92,.35); outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.primary:hover { background: var(--accent-dk); }
.ghost { background: transparent; border-color: var(--line); }
.ghost:hover { background: #f1eadc; }
.sm { min-height: 34px; min-width: 34px; padding: 4px 9px; font-weight: 700; }
.danger { color: var(--late); }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 22px; align-items: center;
  background: linear-gradient(155deg, #fffdf8 0%, #f3ede1 60%, #ece8dc 100%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.net-wrap { margin: 0; }
.net { background: #fbf8f1; border: 1px solid #ece3d2; border-radius: 10px; padding: 6px; aspect-ratio: 1 / 1; display: grid; place-items: center;
  background-image: linear-gradient(rgba(120,140,170,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(120,140,170,.08) 1px, transparent 1px); background-size: 18px 18px; }
.net svg { width: 100%; height: 100%; display: block; }
.net .wall { opacity: .92; }
.net .edge { fill: none; stroke: var(--pencil); stroke-width: 2; stroke-linejoin: round; opacity: .7; }
.net .ceil { fill: #fbfaf6; stroke: none; }
.net .fold { fill: none; stroke: var(--pencil); stroke-width: 2; stroke-dasharray: 9 7; opacity: .55; }
.net .cut { fill: #fbf8f1; stroke: var(--pencil); stroke-width: 2.4; }
.net .mull { stroke: var(--pencil); stroke-width: 1.6; opacity: .7; }
.net .knob { fill: var(--pencil); }
.net .lbl { fill: #3b3a36; font-family: ui-sans-serif, system-ui, sans-serif; }
.net .lbl.hand { font-family: var(--hand); fill: var(--clay); font-weight: 700; }
.net .lbl.dim { fill: var(--muted); }
.net .lbl.small { font-size: 70%; fill: var(--muted); font-weight: 400; }
.net .wall-shade { fill: none; stroke: rgba(0,0,0,.08); stroke-width: 10; }
.net-blank { color: var(--muted); font-style: italic; text-align: center; padding: 30px; max-width: 260px; }
.net-wrap figcaption { color: var(--muted); font-size: .86rem; margin-top: 6px; font-family: var(--hand); }
.hero-kicker { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
.hero-title { margin: 0 0 6px; font-family: Georgia, "Iowan Old Style", serif; font-size: 1.75rem; line-height: 1.2; }
.hero-title .emph { color: var(--clay); }
.hero-sub { margin: 14px 0 0; color: var(--muted); font-size: .95rem; }
.hero.empty-hero .hero-title { color: var(--muted); font-size: 1.3rem; font-weight: 400; }

.tins { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; align-items: flex-end; gap: 8px; margin-top: 16px; padding: 10px 6px 0; border-bottom: 9px solid #8a7058; border-radius: 0 0 4px 4px; box-shadow: 0 8px 0 -4px rgba(60,40,20,.15); min-height: 30px; }
.tins:empty { display: none; }
.tin { flex: none; display: grid; justify-items: center; width: 44px; }
.tin-lid { width: 42px; height: 8px; border-radius: 50%; background: #c9c3b8; border: 1px solid #8c867c; position: relative; z-index: 1; }
.tin-body { position: relative; width: 40px; height: var(--h); margin-top: -4px; border-radius: 0 0 6px 6px; background: linear-gradient(90deg, #d8d3c9, #f3f0ea 40%, #c9c3b8); border: 1px solid #8c867c; border-top: 0; overflow: hidden; }
.tin-band { position: absolute; left: 0; right: 0; top: 30%; height: 42%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.tin-size { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: .62rem; font-weight: 800; color: #3b3a36; }
.tin-name { font-size: .66rem; color: var(--muted); text-align: center; line-height: 1.1; margin: 4px 0 6px; max-width: 50px; min-height: 2.2em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.tin-more { font-weight: 800; color: var(--muted); align-self: center; }

/* steps */
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 18px; margin-bottom: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-head h2 { margin: 0; font-size: 1.1rem; font-family: Georgia, "Iowan Old Style", serif; }
.step-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem; flex: none; }
.step-aside { margin-left: auto; color: var(--muted); font-size: .86rem; text-align: right; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 4px; min-height: 1.3em; }
.empty { color: var(--muted); font-style: italic; margin: 8px 0; }
.sm-empty { font-size: .9rem; margin: 2px 0 6px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.room-tab { display: inline-flex; align-items: center; gap: 8px; background: #fbf8f1; border: 1px solid var(--line); border-radius: 99px; min-height: 36px; padding: 5px 13px; font-size: .92rem; }
.room-tab .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); flex: none; }
.room-tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.room-tab.bad:not(.on) { border-style: dashed; color: var(--late); }

.field { margin: 0 0 12px; min-width: 0; }
.field > label, .label-row .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.label-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.label-row .opt { font-size: .85rem; }
.mt { margin-top: 10px; }
input[type="text"], input[type="number"], select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fffefb; min-height: 40px; width: 100%; min-width: 0; }
input.invalid { border-color: var(--late); background: #fff6f2; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.span2 { grid-column: span 2; }
.check-field { display: flex; align-items: flex-end; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.colour-row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
input[type="color"] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fffefb; cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.swatch { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50% 46% 52% 48%; background: var(--c); border: 1px solid rgba(0,0,0,.15); box-shadow: inset 0 -3px 6px rgba(0,0,0,.08); }
.swatch:hover { transform: scale(1.08); }
.stepper { display: grid; grid-template-columns: 40px 1fr 40px; gap: 6px; }
.stepper input { text-align: center; }

.openings { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.opening { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, .8fr)) auto; gap: 6px; align-items: center; padding: 6px; border: 1px dashed var(--line); border-radius: 10px; background: #fbf8f1; }
.opening.invalid { border-color: var(--late); background: #fff6f2; }
.o-f { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); }
.o-f input { min-height: 36px; padding: 6px 8px; }
.o-label { min-height: 36px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 99px; min-height: 32px; padding: 3px 11px; font-size: .85rem; }
.chip:hover { border-color: var(--accent); color: var(--accent-dk); }
.msg { margin: 8px 0 0; font-size: .92rem; color: var(--muted); }
.msg.err { color: var(--late); }

.shopping { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffefb; }
.sw { width: 34px; height: 34px; border-radius: 48% 52% 46% 54%; border: 1px solid rgba(0,0,0,.14); box-shadow: inset 0 -4px 8px rgba(0,0,0,.08); }
.line-title, .line-meta, .line-mix, .line-cost { margin: 0; }
.line-title { overflow-wrap: anywhere; }
.line-for { color: var(--muted); font-size: .88rem; }
.line-meta, .line-cost { color: var(--muted); font-size: .86rem; }
.line-buy { text-align: right; }
.line-mix { font-weight: 700; font-family: Georgia, "Iowan Old Style", serif; font-size: 1.05rem; white-space: nowrap; }
.total { font-weight: 800; margin: 12px 2px 0; text-align: right; font-size: 1.05rem; }
.breakdown-wrap { margin-top: 10px; }
.breakdown-wrap summary { cursor: pointer; font-weight: 600; color: var(--accent-dk); }
.table-scroll { overflow-x: auto; }
.breakdown { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .9rem; }
.breakdown th, .breakdown td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.breakdown th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.breakdown tr.bad td { color: var(--late); font-style: italic; }

.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.product { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fbf8f1; min-width: 0; }
.product h3 { margin: 0 0 8px; font-size: .98rem; font-family: Georgia, "Iowan Old Style", serif; }
.product label { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; font-size: .85rem; color: var(--muted); }
.product input { min-height: 36px; padding: 6px 8px; }
.rate { margin-bottom: 8px; }
.tin-rows { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.tin-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.u { font-size: .8rem; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 10; font-size: .92rem; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast-act { color: #f3c79f; }
.foot { color: var(--muted); font-size: .84rem; text-align: center; margin-top: 8px; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .net { max-width: 420px; margin: 0 auto; }
}
@media (max-width: 560px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: span 2; }
  .brand h1 { font-size: 1.3rem; }
  .hero-title { font-size: 1.4rem; }
  .opening { grid-template-columns: 1fr 1fr 1fr auto; }
  .opening .o-label { grid-column: 1 / -1; }
  .line { grid-template-columns: 28px minmax(0, 1fr); }
  .line-buy { grid-column: 2; text-align: left; }
  .sw { width: 28px; height: 28px; }
}
@media print {
  body { background: #fff; }
  .top-actions, .banner, #step-rooms, #step-tins, .foot, .net-wrap, .tins, .toast { display: none !important; }
  .hero { display: block; box-shadow: none; border: 0; padding: 0; background: none; }
  .step { box-shadow: none; border: 0; padding: 0; }
  .breakdown-wrap { display: block; }
  .breakdown-wrap > summary { display: none; }
  .breakdown-wrap:not([open]) > .table-scroll { display: block; }
}
