:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1d232b; --muted: #5d6673; --line: #dcd8cf;
  --accent: #0f766e; --accent-ink: #ffffff; --field: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d; --card: #1d232b; --ink: #eef0f3; --muted: #a3acb8; --line: #333c47;
    --accent: #2dd4bf; --accent-ink: #14181d; --field: #14181d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-wrap: anywhere; }
h1, h2, p { margin: 0 0 .6em; }
small { color: var(--muted); font-weight: 400; font-size: .8em; }

.bar, main, footer { width: min(100% - 32px, 760px); margin-inline: auto; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 0 12px; margin-bottom: 8px; }
.brand { font-weight: 600; letter-spacing: .02em; color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.brand b { color: var(--accent); }
.back { color: var(--muted); font-size: .9rem; min-height: 44px; display: inline-flex; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font: 600 1rem/1 inherit; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.full { width: 100%; }
.link { background: none; border: 0; color: var(--accent); font: 600 .95rem inherit; padding: 12px 0; min-height: 44px; cursor: pointer; }
.icon { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; border-radius: 8px; }
@media (hover: hover) { .btn:hover { filter: brightness(1.08); } .icon:hover { color: var(--ink); background: var(--bg); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
h2 { font-size: 1.1rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.grid .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid { grid-template-columns: minmax(0, 1fr); } }
label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--field); color: var(--ink); font: inherit; font-size: 1rem; }
textarea { resize: vertical; }
select { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
#job-form label { margin-bottom: 12px; }
.status { margin: 10px 0 0; min-height: 1.5em; color: var(--muted); }

.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* rooms */
.room { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.room-top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.room-name { font-weight: 600; }
.room-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.tool { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: 600 .95rem inherit; cursor: pointer; }
.tool.mic::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.tool.mic.on { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.tool.mic.on::before { background: #fff; }
.tool.photo:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.room-msg { color: var(--muted); font-size: .9rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 8px; }
.thumbs:empty { display: none; }
.thumbs figure { position: relative; margin: 0; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.thumbs .icon { position: absolute; top: 2px; right: 2px; background: rgba(0, 0, 0, .55); color: #fff; }
.icon.del { margin-left: auto; }

/* the report looks like paper in both themes, since it is what gets printed and signed */
.report { background: #fff; color: #1d232b; border-radius: 6px; padding: 28px 24px; margin-bottom: 16px; box-shadow: 0 2px 16px rgba(0, 0, 0, .12); }
.r-head { border-bottom: 2px solid #0f766e; padding-bottom: 12px; margin-bottom: 8px; }
.r-title { font-weight: 800; letter-spacing: .1em; color: #0f766e; margin: 0 0 4px; }
.r-addr { font-weight: 700; font-size: 1.15rem; margin: 0 0 8px; }
.r-meta, .r-meters { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 16px; margin: 0; font-size: .9rem; }
.r-meta dt, .r-meters dt { color: #5d6673; }
.r-meta dd, .r-meters dd { margin: 0; }
.r-room { margin-top: 18px; break-inside: avoid-page; }
.r-room h3 { font-size: 1rem; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid #dcd8cf; }
.report table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.report th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #5d6673; padding: 4px 6px; }
.report td { border-top: 1px solid #eeebe4; padding: 6px; vertical-align: top; }
.report td[contenteditable]:focus { outline: 2px solid #99d5cc; background: #f3faf8; }
.report th:nth-child(1) { width: 30%; } .report th:nth-child(2) { width: 30%; }
.report select { min-height: 36px; padding: 4px 28px 4px 6px; border-color: transparent; background-color: transparent; color: inherit; background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; }
.r-none { color: #5d6673; font-size: .9rem; margin: 0; }
.r-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 8px; }
.r-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; display: block; }
.r-legal { font-size: .82rem; color: #5d6673; margin: 18px 0 8px; }
.signs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; break-inside: avoid; }
.sign { border: 1px dashed #c9c4b9; border-radius: 6px; min-height: 120px; padding: 10px; font-size: .85rem; }
.sign small { color: #5d6673; }
.ptext { display: none; }
@media (max-width: 560px) {
  .report { padding: 20px 14px; } .signs { grid-template-columns: 1fr; }
  .report thead { display: none; }
  .report tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); border-top: 1px solid #eeebe4; padding: 4px 0; }
  .report td { border: 0; padding: 4px 6px; }
  .report td:nth-child(1) { font-weight: 600; align-self: center; }
  .report td:nth-child(3) { grid-column: 1 / -1; color: #4b5563; }
  .report select { width: 100%; }
}
.report td select { margin: -6px 0; }

.actions { margin-bottom: 24px; }
.hint { color: var(--muted); font-size: .9rem; }
footer { color: var(--muted); font-size: .8rem; padding: 12px 0 max(24px, env(safe-area-inset-bottom)); }

@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .no-print, footer { display: none !important; }
  main { width: 100%; }
  .report { box-shadow: none; padding: 0; }
  .report select { display: none; }
  .ptext { display: inline; }
  .r-photos { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 760px), (pointer: coarse) { input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px !important; } }
