@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-400.ttf'); font-weight: 400; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-500.ttf'); font-weight: 500; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/DMSans-700.ttf'); font-weight: 700; }

:root {
  --teal: #0e5561; --deep: #0a3c45; --ground: #eef3f3; --panel: #ffffff; --wash: #e3ecec;
  --line: #d0dcdd; --muted: #5d7276; --ink: #16282b;
  --rE: #0e5561; --rG: #2b7a5f; --rF: #b0731a; --rD: #b3402f; --rNA: #6d7d80;
  --radius: 10px; --tap: 52px;
  font-size: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'DM Sans', system-ui, sans-serif; color: var(--ink); background: var(--ground); line-height: 1.45;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0); }
body.noscroll { overflow: hidden; }
h1 { font-size: 1.65rem; line-height: 1.2; margin: .2rem 0 .6rem; color: var(--deep); letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; color: var(--deep); }
h3 { font-size: 1.02rem; margin: 0; font-weight: 500; }
a { color: var(--teal); }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.lede { color: var(--muted); max-width: 44rem; }
.boot { padding: 2rem; }
:focus-visible { outline: 3px solid #5bb3c1; outline-offset: 2px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .9rem; padding: .55rem 1.1rem;
  background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; }
.tb-home { text-decoration: none; }
.mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; background: var(--teal); color: #fff; font-weight: 700; font-size: 1.2rem; }
.tb-mid { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.tb-title { font-weight: 700; color: var(--deep); }
.tb-right { display: flex; align-items: center; gap: 1rem; }
.save-state { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.save-state.err { color: var(--rD); font-weight: 700; }
.progress { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.progress .bar { width: 120px; height: 8px; border-radius: 4px; background: var(--wash); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--teal); transition: width .3s; }
.progress.wide .bar { width: 220px; }

.chip { display: inline-block; font-size: .74rem; font-weight: 500; padding: .12rem .55rem; border-radius: 99px; background: var(--wash); color: var(--deep); white-space: nowrap; }
.chip.final { background: var(--deep); color: #fff; }
.chip.draft { background: #fff4de; color: #7a4d06; }
.chip.demo { background: #fbe3df; color: #8f2a1c; }
.chip.out { background: #e6e2f3; color: #3d2f75; }
.chip.changed { background: #fbe3df; color: #8f2a1c; }

/* Buttons */
.btn { font: inherit; font-size: .95rem; font-weight: 500; min-height: 44px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--deep); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.good { background: #e4f1ec; border-color: #9ccab8; color: #1d5a45; }
.btn.big { min-height: var(--tap); font-size: 1rem; padding: .6rem 1.3rem; }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; font-size: .82rem; padding: .3rem .7rem; }
.btn.round { width: var(--tap); height: var(--tap); border-radius: 50%; font-size: 1.5rem; padding: 0; }
.btn.danger-quiet { color: var(--rD); border-color: #e9c7c1; }
.btn.cam::before { content: ''; width: 18px; height: 14px; border: 2px solid currentColor; border-radius: 3px; box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px currentColor; }
.btn.primary.cam::before { box-shadow: inset 0 0 0 3px var(--teal), inset 0 0 0 5px currentColor; }
.btn.seg { min-height: var(--tap); }
.btn.seg.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.seg.on.bad { background: var(--rD); border-color: var(--rD); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .7rem 0; }

/* Pages */
.page { padding: 1.4rem 1.4rem 4rem; }
.page.narrow { max-width: 900px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.crumb { margin: 0 0 .3rem; font-size: .88rem; }
.crumb a { text-decoration: none; }
.crumb a::before { content: '‹ '; }
.file-list { display: grid; gap: .6rem; margin: 1rem 0; }
.file-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); min-height: 72px; }
.file-status { display: grid; text-align: right; font-size: .85rem; color: var(--muted); }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.tools { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; }
.insp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-top: 1rem; }
.insp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.insp-card h2 { margin: 0 0 .4rem; display: flex; gap: .5rem; align-items: center; }
.insp-card.is-final { border-left: 5px solid var(--deep); }

/* Inspection layout */
.insp { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 60px); }
.insp.final { grid-template-columns: 1fr; }
.steps { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); overflow: auto; padding: 1rem .6rem; border-right: 1px solid var(--line); background: var(--panel); }
.steps a { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: .5rem; padding: .6rem .6rem; border-radius: 8px; text-decoration: none; color: var(--ink); min-height: 48px; }
.steps a.on { background: var(--wash); font-weight: 500; }
.steps .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); font-size: .78rem; color: var(--muted); }
.steps a.on .n { background: var(--teal); border-color: var(--teal); color: #fff; }
.steps .cnt { font-size: .75rem; min-width: 26px; text-align: center; border-radius: 99px; padding: .05rem .4rem; }
.steps .cnt.open { background: #fff0d6; color: #7a4d06; }
.steps .cnt.done { color: var(--rG); font-weight: 700; }
.pane { padding: 1.2rem 1.6rem 5rem; max-width: 920px; width: 100%; }
.insp.final .pane { margin: 0 auto; }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; margin: 1rem 0; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.field { display: grid; gap: .3rem; margin: .6rem 0; }
.field > span { font-size: .86rem; color: var(--muted); font-weight: 500; }
.field.dim { opacity: .55; }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--ink); background: #fff; border: 1px solid #b9cacc; border-radius: 8px; padding: .65rem .75rem; min-height: 48px; width: 100%; }
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 2px solid #b7dde3; }
.check { display: flex; gap: .55rem; align-items: center; font-size: .92rem; min-height: 44px; }
.check input { width: 24px; height: 24px; min-height: 0; flex: none; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem 1.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; }
.facts div { padding: .35rem 0; border-bottom: 1px dotted var(--line); }
.facts span { display: block; font-size: .76rem; color: var(--muted); }
.info { background: #e6f0f2; border-radius: 8px; padding: .8rem 1rem; margin: 1rem 0; }
.demo-note { background: #fbe3df; color: #8f2a1c; padding: .6rem .9rem; border-radius: 8px; font-weight: 500; }
details.rules { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin: 1.2rem 0; }
details.rules summary { font-weight: 500; cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--deep); }
details.rules p { max-width: 46rem; font-size: .95rem; }
.scale { display: grid; gap: .2rem; margin: .5rem 0; }
.basis { background: var(--wash); padding: .6rem .8rem; border-radius: 8px; }

/* Items — the rating keys are the heart of the app */
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem 1rem; margin: .8rem 0; border-left: 5px solid #f0b54a; }
.item.rated, .item.neutral { border-left-color: var(--line); }
.item-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem .8rem; margin-bottom: .6rem; }
.item-head .muted { font-weight: 400; font-size: .9rem; }
.tag { font-size: .72rem; background: var(--wash); color: var(--muted); padding: .1rem .45rem; border-radius: 4px; font-weight: 400; vertical-align: middle; }
.src { font-size: .78rem; color: var(--muted); font-style: italic; }
.ratings { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.rate { font: inherit; min-height: 64px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 0;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; color: var(--ink); }
.rate b { font-size: 1.35rem; line-height: 1.1; }
.rate small { font-size: .72rem; color: var(--muted); }
.rate.r-E b { color: var(--rE); } .rate.r-G b { color: var(--rG); } .rate.r-F b { color: var(--rF); } .rate.r-D b { color: var(--rD); } .rate.r-NA b { color: var(--rNA); }
.rate.on { color: #fff; border-color: transparent; box-shadow: 0 2px 0 rgba(0,0,0,.15) inset; }
.rate.on b, .rate.on small { color: #fff; }
.rate.on.r-E { background: var(--rE); } .rate.on.r-G { background: var(--rG); } .rate.on.r-F { background: var(--rF); } .rate.on.r-D { background: var(--rD); } .rate.on.r-NA { background: var(--rNA); }
b.r-E { color: var(--rE); } b.r-G { color: var(--rG); } b.r-F { color: var(--rF); } b.r-D { color: var(--rD); } b.r-NA { color: var(--rNA); }
.item-actions { display: flex; gap: .5rem; margin-top: .7rem; flex-wrap: wrap; }
.item-remarks { display: grid; gap: .5rem; margin-top: .6rem; }
.item-remarks:empty { display: none; }
.remark { font: inherit; text-align: left; display: grid; grid-template-columns: auto auto 1fr; gap: .2rem .6rem; align-items: baseline; background: #f6f9f9; border: 1px solid var(--line);
  border-radius: 8px; padding: .6rem .75rem; cursor: pointer; color: var(--ink); }
.remark .ref { font-weight: 700; font-size: .8rem; color: var(--deep); }
.remark .cls { font-size: .8rem; color: var(--teal); font-weight: 500; }
.remark .cls.missing { color: var(--rD); }
.remark .txt { font-size: .9rem; }
.remark .thumbs { grid-column: 1 / -1; }
.thumbs { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; width: 84px; height: 64px; cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs.was .thumb { width: 64px; height: 48px; opacity: .9; }
.was-block { background: #f3f1f9; border-radius: 8px; padding: .45rem .7rem; margin-bottom: .6rem; font-size: .86rem; display: grid; gap: .3rem; }
.was-block .was, .was { color: #4b3f7d; }
.was-block .chip { justify-self: start; }
.was-remark { font-size: .82rem; color: #4b3f7d; }
.was-remark .ref { font-weight: 700; }
.yn { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0; }
.yn > span { min-width: 9rem; color: var(--muted); font-size: .9rem; }
.yn.dim { opacity: .5; }
.stack { display: grid; gap: .5rem; }
.stack .btn { justify-content: flex-start; }

/* Keys */
.keys { display: grid; gap: .7rem; margin: 1rem 0; }
.key-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stepper { display: flex; align-items: center; gap: .6rem; }
.stepper output { min-width: 2.2rem; text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--deep); }
.stepper output.empty { color: #d08a1b; }
.was { font-size: .85rem; }

/* Sheet */
.overlay { position: fixed; inset: 0; background: rgba(10, 40, 46, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); width: min(760px, 100%); max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.2); }
@media (min-height: 700px) and (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 16px; } }
.sheet-head { position: sticky; top: 0; background: var(--panel); display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-body { padding: .6rem 1.2rem 1.4rem; }
.sheet-foot { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.photo-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem; }
.pe { display: grid; gap: .35rem; }
.pe img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(5, 20, 24, .92); display: grid; place-items: center; align-content: center; gap: .8rem; padding: 1rem; color: #fff; }
.lightbox img { max-width: 96vw; max-height: 80vh; border-radius: 6px; }

/* Review */
.report { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1.3rem 1rem; margin: 1rem 0; }
.report h2 { font-size: 1.1rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.report section p { max-width: 50rem; }
table.rv { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.rv th { text-align: left; font-weight: 500; color: var(--muted); font-size: .8rem; border-bottom: 2px solid var(--line); padding: .35rem .4rem; }
table.rv td { border-bottom: 1px solid var(--line); padding: .45rem .4rem; vertical-align: top; }
table.rv tr.grp td { background: var(--wash); font-weight: 700; color: var(--deep); }
table.rv tr.changed td { background: #fdf1ef; }
.rv-remark { border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; margin: .7rem 0; }
.rv-remark-head { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.rv-remark-head .cls { margin-left: auto; color: var(--teal); font-weight: 500; font-size: .88rem; }
.rv-photos { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: .5rem 0; }
.rv-photos figure { margin: 0; }
.rv-photos img { width: 100%; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.rv-photos figcaption { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.tc { border-left: 4px solid var(--line); padding: .3rem .8rem; margin: .5rem 0; }
.tc.disagree { border-left-color: var(--rD); }
.tc-form { background: #f6f9f9; border-radius: 8px; padding: .4rem .9rem .8rem; margin: .8rem 0; }
.tc-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.tc-row select { width: auto; flex: 1; min-width: 14rem; }
.changes li { margin: .2rem 0; }
.review-end { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem 0 .3rem; border-top: 2px dashed var(--line); margin-top: 1rem; }
.signing { background: var(--panel); border: 2px solid var(--teal); border-radius: var(--radius); padding: .4rem 1.3rem 1.2rem; }
.missing { background: #fff4de; border-radius: 8px; padding: .6rem 1rem; }
.missing li { margin: .25rem 0; }
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.sig-panel { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; display: grid; gap: .4rem; align-content: start; }
.sig-panel.signed { background: #f1f7f5; border-color: #9ccab8; }
.sig-panel img { width: 100%; max-height: 120px; object-fit: contain; background: #fff; border-radius: 6px; }
.signer { font-weight: 700; }
.pad-wrap { position: relative; border: 2px dashed #9fb6b9; border-radius: 8px; background: #fff; height: 170px; }
.pad-wrap.locked { opacity: .45; }
.pad-wrap.inked .pad-hint { display: none; }
.pad { width: 100%; height: 100%; display: block; touch-action: none; }
.pad-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); pointer-events: none; font-size: .9rem; }
.final-banner { background: var(--deep); color: #fff; border-radius: var(--radius); padding: 1rem 1.3rem; }
.final-banner h1 { color: #fff; }
.final-banner .muted { color: #b9d2d6; word-break: break-all; }
.final-banner .btn { border-color: transparent; }
.sig-final { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sig-final img { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; max-height: 130px; object-fit: contain; }
.addenda { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1.2rem 1rem; margin-top: 1rem; }
.addendum { border-left: 4px solid #6d5bb5; padding: .3rem .8rem; margin: .6rem 0; }
.cfg-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1rem .8rem; margin: .7rem 0; }
.present { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; align-items: center; }
.present > span { color: var(--muted); font-size: .88rem; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom, 0)); transform: translate(-50%, 150%); background: var(--deep); color: #fff; padding: .75rem 1.1rem; border-radius: 10px;
  display: flex; gap: 1rem; align-items: center; z-index: 90; max-width: 92vw; transition: transform .25s; font-size: .95rem; }
#toast.show { transform: translate(-50%, 0); }
#toast.err { background: var(--rD); }
#toast.warn { background: #8a5a0b; }
.toast-act { font: inherit; background: none; border: 1px solid #fff; color: #fff; border-radius: 6px; padding: .35rem .8rem; min-height: 40px; }

/* Portrait tablets and phones */
@media (max-width: 900px) {
  .insp { grid-template-columns: 1fr; }
  .steps { position: sticky; top: 60px; z-index: 10; display: flex; overflow-x: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: .4rem; gap: .2rem; height: auto; }
  .steps a { grid-template-columns: 26px auto auto; white-space: nowrap; min-height: 44px; }
  .pane { padding: 1rem 1rem 5rem; }
  .progress .bar { width: 70px; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid.three, .facts, .sig-grid, .sig-final, .rv-photos { grid-template-columns: 1fr; }
  .key-row { grid-template-columns: 1fr; }
  .rate small { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===================== v0.3 additions ===================== */
:root { --amber: #b0731a; --purple: #4b3f7d; }
.save-state { display: inline-flex; align-items: center; gap: .35rem; }
.save-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--rG); display: inline-block; flex: none; }
.save-state.busy i { background: var(--amber); animation: pulse 1s infinite; }
.save-state.err { color: var(--rD); }
@keyframes pulse { 50% { opacity: .3; } }
.span2 { grid-column: 1 / -1; }
.notice { background: #fff4de; border: 1px solid #f0d49c; border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0; }
.warn-line { background: #fff4de; border-radius: 8px; padding: .5rem .8rem; font-size: .9rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.storage-line { margin-top: 1.5rem; }
.origin { font-size: 1.1rem; word-break: break-all; }
.search { margin: .6rem 0; }
.resume-box { background: var(--panel); border: 2px solid var(--teal); border-radius: var(--radius); padding: .3rem 1rem .8rem; margin-bottom: 1rem; }
.resume-box h2 { margin: .6rem 0 .4rem; font-size: 1rem; }
.resume { display: grid; gap: .1rem; padding: .7rem .2rem; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 52px; }
.resume:first-of-type { border-top: 0; }

/* New file: floor and room pickers */
.seg-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.room-grid, .room-reg { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.room-btn { font: inherit; min-height: 64px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; align-content: center; gap: .1rem; cursor: pointer; color: var(--ink); -webkit-tap-highlight-color: transparent; touch-action: manipulation; padding: .3rem; }
.room-btn b { font-size: 1.2rem; color: var(--deep); }
.room-btn small { font-size: .7rem; color: var(--muted); text-align: center; line-height: 1.2; }
.room-btn.on { background: var(--teal); border-color: var(--teal); }
.room-btn.on b, .room-btn.on small { color: #fff; }
.room-btn.wide { grid-column: span 2; }
.room-btn.wide b { font-size: .95rem; }
.room-btn.small { min-height: 58px; }
.room-btn.small b { font-size: 1.05rem; }

/* Parties */
.party { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem .2rem; margin: .6rem 0; }
.party-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; min-height: 40px; }
.party .form-grid { margin: .2rem 0; }

/* Items */
.item.open { border-left-color: #f0b54a; }
.item.done { border-left-color: #9ccab8; }
.item-head h3 { font-weight: 700; color: var(--deep); }
.tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.tag.add { background: #e6e2f3; color: var(--purple); }
.note { color: var(--muted); font-size: .88rem; margin: -.3rem 0 .5rem; }
h2.group { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.6rem 0 .2rem; }
.row { display: grid; grid-template-columns: 8.5rem 1fr; gap: .6rem; align-items: center; margin: .55rem 0; }
.row .lbl, .key-grid .lbl { color: var(--muted); font-size: .86rem; font-weight: 500; display: grid; }
.row .lbl small { font-weight: 400; font-size: .76rem; line-height: 1.25; }
.btn.seg { min-height: 48px; padding: .4rem .85rem; }
.btn.seg.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.seg.on.bad { background: var(--rD); border-color: var(--rD); }
.cond-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
.cond { font: inherit; font-size: .8rem; font-weight: 500; line-height: 1.15; min-height: 52px; padding: .25rem .2rem; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.cond.on { color: #fff; border-color: transparent; }
.cond.on.c-very-poor { background: #8f2a1c; } .cond.on.c-poor { background: var(--rD); } .cond.on.c-fair { background: var(--amber); }
.cond.on.c-good { background: var(--rG); } .cond.on.c-very-good { background: #1f6b56; } .cond.on.c-excellent { background: var(--teal); } .cond.on.c-not-assessed { background: var(--rNA); }
.qty { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.qty output, .stepper output { min-width: 2.2rem; text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--deep); }
.qty output.empty { color: #d08a1b; }
.flag { background: #fff4de; color: #7a4d06; border-radius: 8px; padding: .45rem .7rem; font-size: .88rem; }
.flag-inline { color: #7a4d06; font-size: .82rem; }
.diff-box { background: #efecf8; border-radius: 8px; padding: .5rem .8rem; margin: .6rem 0; color: var(--purple); font-size: .9rem; }
.diff-box .field { margin-bottom: 0; }
.open-line { color: #7a4d06; font-size: .82rem; margin: .4rem 0 0; }
.field.remarks { margin-top: .5rem; }
.bulk { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 .2rem; }
.add-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 1.2rem 0; }
.add-row input { flex: 1; min-width: 12rem; }
.add-row select { width: auto; }
.add-row .check { flex: none; }

/* Photos */
.photo-zone { margin-top: .5rem; }
.photo-acts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.thumb { position: relative; width: 104px; height: 78px; }
.thumb.just { outline: 3px solid var(--rG); }
.saved-badge { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(29, 90, 69, .9); color: #fff; font-size: .62rem; padding: .15rem .25rem; text-align: center; }
.thumb.pending { display: grid; place-items: center; align-content: center; gap: .2rem; font-size: .72rem; text-align: center; padding: .2rem; background: #f6f9f9; cursor: default; }
.thumb.pending.saving { animation: pulse 1.2s infinite; }
.thumb.pending.failed { background: #fbe3df; color: #8f2a1c; width: 220px; height: auto; min-height: 78px; }
.pend-acts { display: flex; gap: .3rem; }
.photo-edit .pe b { font-size: .8rem; color: var(--deep); }
.btn-row.tight { margin: .2rem 0; gap: .3rem; }
.photo-index li { margin: .2rem 0; }
h3.ph-group { margin: 1rem 0 .3rem; font-weight: 700; color: var(--deep); font-size: .95rem; }

/* Keys */
.key-grid { display: flex; flex-wrap: wrap; gap: 1.6rem; align-items: center; margin: .4rem 0 .6rem; }
.big-num { font-size: 1.5rem; color: var(--deep); }
.big-num.was { color: var(--purple); }

/* Review */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.unans { color: var(--rD); }
.wear { border: 2px solid var(--teal); border-radius: 10px; padding: .3rem 1rem; background: #fff; }
table.rv tr.changed td { background: #f3f0fb; }
.copies { background: var(--panel); border: 2px solid var(--teal); border-radius: var(--radius); padding: .3rem 1.2rem 1rem; margin: 1rem 0; }
.emails { padding-left: 1.2rem; }
.emails .email { font-family: ui-monospace, Menlo, monospace; font-size: .92rem; }
.final-banner .muted { color: #b9d2d6; }
.signing .missing { margin: .6rem 0; }

/* iPad mini portrait (744 px) and narrower */
@media (max-width: 900px) {
  .save-state span { font-size: .72rem; }
  .tb-right { gap: .5rem; }
}
@media (max-width: 820px) {
  .row { grid-template-columns: 1fr; gap: .3rem; }
  .cond-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .progress .bar { width: 50px; }
  .tb-title { font-size: .92rem; }
}
@media (max-width: 640px) {
  .cond-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .save-state span { display: none; }
  .room-grid, .room-reg { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}
.ipad-box { background: #e4f1ec; border: 1px solid #9ccab8; border-radius: 10px; padding: .7rem 1rem; margin: 0 0 1rem; }
.ipad-url { font-size: 1.35rem; font-weight: 700; color: var(--deep); margin: .3rem 0; word-break: break-all; font-family: ui-monospace, Menlo, monospace; }
