/* Room by Room in the Apps for Humanity "Instrument" look, Lab Bench colourway: soft panels on a seafoam
   case, a plum key (the app's own colour, used only for the icon and the main action), and a blue light for each room that has
   something in it. A red light means something needs you (a copy to save).
   Fonts are this app's own files: the page loads nothing from anywhere else. */
@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans-ext.woff2) format("woff2"); font-weight: 400 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; src: url(fonts/plex-mono.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; src: url(fonts/plex-mono-ext.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --case: #d3e2da; --panel: #eef5f1; --well: #f6faf8; --ink: #0e211b; --muted: #4a655b; --line: #bcd0c6;
  --app: #6b3a74; --app-ink: #ffffff; --link: #1f4fd1; --signal: #2f6bff; --glow: rgba(47, 107, 255, .5); --off: #afc3b9;
  --warn: #c8352b;
  --press: inset 0 -3px 0 rgba(0, 0, 0, .28), 0 1px 2px rgba(0, 0, 0, .12);
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --case: #0b1512; --panel: #14211c; --well: #0f1a16; --ink: #e3efe9; --muted: #8aa59a; --line: #24362f;
    --app: #84509a; --app-ink: #ffffff; --link: #8fb0ff; --signal: #5b8cff; --glow: rgba(91, 140, 255, .55); --off: #2c3d37;
    --warn: #ff6a5f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--case); color: var(--ink);
  font: 17px/1.5 var(--sans);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .brand > span { font-weight: 600; letter-spacing: -.02em; }
a { color: var(--link); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.defs { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lock { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.ico { width: 22px; height: 22px; flex: none; }
/* Mono capitals name things and show numbers (labels, counts, status); sentences stay in Instrument Sans. */
.status, .private-pill, .kicker, .pc-meta, .readouts, .room-meta { font: 500 10.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
/* Raised parts: a bottom edge that darkens on hover. Each part sets only which edge it draws. */
.btn, .piece-card, .field select { --edge: var(--line); box-shadow: inset 0 -2px 0 var(--edge), 0 1px 1px rgba(0, 0, 0, .04); }
:is(.btn, .piece-card):hover { --edge: var(--muted); }

/* Keys: one solid plum key per screen for the next step; the rest are panels or outlines. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 18px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--panel); color: var(--ink); font-weight: 600; text-align: center;
}
.bar .btn { white-space: nowrap; }
.btn.primary { background: var(--app); color: var(--app-ink); box-shadow: var(--press); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.big { min-height: 54px; padding: 12px 22px; font-size: 17px; border-radius: 16px; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 15px; border-radius: 10px; }
.btn.quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--edge); }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 15px; min-height: 40px; padding: 0 4px; text-align: left; }
.link-btn:hover { color: var(--ink); }

/* Top bar (editor only) */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--case) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
body:not(.editing) .bar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; white-space: nowrap; }
.brand svg { width: 32px; height: 32px; flex: none; }
.status { margin-left: auto; color: var(--muted); text-align: right; }
.private-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 10px; cursor: pointer;
  background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink);
}
.private-pill .lock { width: 14px; height: 14px; stroke-width: 2.4; }
#saveTop.attention { box-shadow: var(--press), 0 0 0 3px color-mix(in srgb, var(--warn) 40%, transparent); }
@media (max-width: 560px) { .brand > span { display: none; } }
@media (max-width: 400px) {
  .bar { gap: 8px; }
  .private-pill { padding: 0 9px; }
  .private-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .status { font-size: 10px; }
}

/* Welcome */
.welcome { max-width: 620px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom)); }
.hero-mark { width: 52px; height: 52px; display: block; margin: 8px 0 22px; }
.kicker { font-size: 11px; color: var(--muted); }
.welcome h1 { font-size: clamp(30px, 7.6vw, 44px); line-height: 1.06; letter-spacing: -.03em; margin-top: 8px; text-wrap: balance; }
.lede { margin-top: 14px; font-size: 18px; color: var(--muted); text-wrap: pretty; }

.private-line {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; margin-top: 22px; padding: 14px 16px; cursor: pointer; text-align: left;
  border: 0; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink); font-size: 16px; line-height: 1.4;
}
.private-line > .lock { width: 24px; height: 24px; margin-top: 1px; }
.private-line b { font-weight: 600; }
.private-line u { color: var(--link); font-weight: 600; text-underline-offset: 3px; white-space: nowrap; }

.actions { display: grid; gap: 8px; margin-top: 18px; }
.btn.start { flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; border-radius: 18px; text-align: left; }
.btn.start span { font-size: 19px; }
.btn.start small { font-size: 14px; font-weight: 500; opacity: .85; }

/* The privacy panel: plain facts, each with a tick. */
.seal-card { margin-top: 30px; padding: 20px; border-radius: 20px; background: var(--panel); }
.seal-head { display: flex; align-items: center; gap: 10px; }
.seal-head .lock { width: 38px; height: 38px; padding: 9px; border-radius: 50%; background: var(--ink); color: var(--case); stroke-width: 2.2; }
.seal-card h2 { font-size: 22px; }
.seal-big { font-size: 18px; line-height: 1.4; margin-top: 12px; text-wrap: pretty; }
.seal-list { list-style: none; margin-top: 16px; display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.seal-list li { padding-left: 26px; position: relative; color: var(--muted); font-size: 15.5px; }
.seal-list li::before {
  content: ""; position: absolute; left: 3px; top: .5em; width: 11px; height: 6px;
  border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(-45deg);
}
.seal-list b { color: var(--ink); font-weight: 600; }
.seal-card > .btn { margin-top: 16px; width: 100%; }
.fine { margin-top: 16px; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.fine .link-btn { font-size: 14px; min-height: 32px; }

/* Editor: "Your home" */
.editor { max-width: 760px; margin: 0 auto; padding: 8px 16px calc(48px + env(safe-area-inset-bottom)); }
.hub-head { margin-top: 20px; }
.hub-head h1 { font-size: clamp(30px, 7vw, 38px); line-height: 1.1; letter-spacing: -.03em; overflow-wrap: anywhere; }
.readouts { color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums; }
.readouts:empty { display: none; }
.nudge {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 16px; padding: 14px 16px 14px 34px;
  position: relative; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); font-size: 15px;
}
.nudge::before { /* the "needs you" light */
  content: ""; position: absolute; left: 16px; top: 22px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 8px color-mix(in srgb, var(--warn) 60%, transparent);
}
.nudge p { flex: 1 1 260px; }
.msg { margin-top: 12px; font-size: 15px; font-weight: 600; }
.msg:empty { display: none; }
.msg.error { color: var(--warn); }
.after { margin-top: 10px; font-size: 15px; }

.group { margin-top: 30px; }
.group > h2 { font-size: 22px; }

.cards { display: grid; gap: 8px; margin-top: 12px; }
.cards:empty { display: none; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
.piece-card { /* a module with a status light */
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 12px 16px;
  text-align: left; cursor: pointer; border: 0; border-radius: 16px; background: var(--panel);
}
.pc-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.pc-title { font-weight: 600; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.pc-meta { color: var(--muted); }
.pc-thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--well); }
.stamp { flex: none; width: 8px; height: 8px; margin: 0 4px; border-radius: 50%; background: var(--off); }
.piece-card.done .stamp { background: var(--signal); box-shadow: 0 0 8px var(--glow); }

.add-room { margin-top: 14px; padding: 16px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 12px; }
.add-room h3 { font-size: 18px; }
.add-room.first { background: var(--panel); box-shadow: none; }
.add-room.first h3 { font-size: 24px; }
.add-form { display: flex; gap: 8px; }
.add-form input { flex: 1; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips:not(:has(.chip:not([hidden]))) { display: none; }
.chips > span { color: var(--muted); font-size: 14px; margin-right: 2px; }
.chip {
  border: 0; background: none; border-radius: 10px; padding: 6px 12px; min-height: 40px; box-shadow: inset 0 0 0 1px var(--line);
  font-size: 15px; color: var(--ink); cursor: pointer; text-align: left;
}
.chip::before { content: "+ "; color: var(--signal); font-weight: 700; }
.chip:hover { background: var(--panel); box-shadow: inset 0 0 0 1px var(--muted); }

/* Fields */
.field { display: grid; gap: 6px; }
.field > label { font-size: 15.5px; font-weight: 600; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.4; }
input[type="text"], textarea, .field select {
  width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--well);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06), inset 0 0 0 1px var(--line);
  font-size: 16px; line-height: 1.4; resize: none;
}
textarea { min-height: 76px; overflow: hidden; }
.field select { background: var(--panel); min-height: 46px; }

/* One room (or the cover page) at a time */
.back { display: inline-flex; align-items: center; gap: 4px; margin: 10px 0 0 -6px; min-height: 40px; padding: 0 8px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 15px; }
.back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.back:hover { color: var(--ink); }
.piece-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 6px; }
.piece-head h2 { font-size: clamp(28px, 6.8vw, 36px); line-height: 1.1; letter-spacing: -.03em; }
.sec-body { display: grid; gap: 16px; margin-top: 12px; }
.intro { color: var(--muted); font-size: 16px; }
input.room-name {
  margin-top: 6px; padding: 4px 8px; margin-left: -8px; width: calc(100% + 16px); background: transparent; box-shadow: none; border-radius: 10px;
  font-size: clamp(28px, 6.8vw, 36px); font-weight: 600; line-height: 1.15; letter-spacing: -.03em;
}
input.room-name:hover { box-shadow: inset 0 0 0 1px var(--line); }
input.room-name:focus { background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
.room-meta { color: var(--muted); font-variant-numeric: tabular-nums; }

.block { display: grid; gap: 10px; padding: 16px; border-radius: 18px; background: var(--panel); }
.block h3 { font-size: 19px; }
.block-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.block-buttons .btn { background: var(--case); }
.block-buttons .ico { width: 20px; height: 20px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.photos:empty { display: none; }
.thumb { display: block; padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in; aspect-ratio: 1; background: var(--well); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.items { display: grid; gap: 10px; }
.items:empty { display: none; }
.item { display: grid; gap: 10px; padding: 12px; border-radius: 14px; background: var(--well); box-shadow: inset 0 0 0 1px var(--line); }
/* Photos above the fields on a phone; beside them where there's room. */
.item-top { display: grid; gap: 12px; align-items: start; }
.item-photos { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 600px) { .item-top { grid-template-columns: auto 1fr; } .item-photos { max-width: 148px; } }
.item-photos .thumb { width: 64px; height: 64px; }
.add-photo {
  width: 64px; height: 64px; display: grid; place-items: center; border: 0; border-radius: 10px; cursor: pointer; color: var(--muted);
  background: none; box-shadow: inset 0 0 0 1.5px var(--line);
}
.add-photo:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--muted); }
.item-fields { display: grid; gap: 8px; min-width: 0; }
.item .field > label { font-size: 13.5px; color: var(--muted); }
.item input[type="text"], .item textarea { background: var(--panel); padding: 10px 12px; }
.pair { display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; }
.more summary { cursor: pointer; font-size: 15px; font-weight: 600; color: var(--muted); min-height: 36px; display: flex; align-items: center; }
.more summary:hover { color: var(--ink); }
.more[open] { display: grid; gap: 8px; }
.more-fields { display: grid; gap: 8px; }
@media (min-width: 600px) { .more-fields { grid-template-columns: 1fr 1fr; } .more-fields .wide { grid-column: 1 / -1; } }
.item .remove { justify-self: end; font-size: 14px; min-height: 32px; }

.room-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.room-foot .btn { min-width: 140px; }

/* Save panel */
.save-panel { margin-top: 36px; background: var(--panel); border-radius: 20px; padding: 20px 18px; scroll-margin-top: 72px; }
.save-panel h2 { font-size: 24px; }
.steps { margin: 12px 0 0 22px; display: grid; gap: 8px; color: var(--muted); font-size: 15.5px; }
.steps b { color: var(--ink); }
.save-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.extra { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.extra summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.extra p { color: var(--muted); font-size: 15px; margin-top: 6px; }
.extra .save-row { margin-top: 12px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }

/* Dialogs */
.dialog {
  width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 22px; overflow: auto;
  border: 0; border-radius: 24px; background: var(--panel); color: var(--ink);
}
.dialog::backdrop { background: rgba(4, 12, 9, .55); }
.dialog h2 { font-size: 24px; line-height: 1.2; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.proof { margin: 16px 0 0 20px; display: grid; gap: 12px; color: var(--muted); font-size: 15.5px; }
.proof b { color: var(--ink); display: block; }
.check { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.check-result { font-weight: 600; color: var(--ink); }
.check-result.ok { color: var(--signal); }
.photo-dialog { width: min(900px, calc(100% - 24px)); padding: 12px; }
.photo-dialog img { display: block; width: 100%; max-height: calc(100dvh - 140px); object-fit: contain; border-radius: 14px; background: var(--well); }
.photo-dialog .dialog-actions { margin: 12px 4px 4px; }

.toast {
  cursor: pointer; position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--case); font-size: 15px; box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}

/* High-contrast modes drop box-shadows and backgrounds, so give every control and box a real edge there. */
@media (forced-colors: active) {
  .btn, .private-pill, .private-line, .piece-card, .chip, input[type="text"], textarea, .field select, .nudge, .save-panel, .block, .item, .add-photo, .add-room, .thumb { border: 1px solid ButtonText; }
}

