:root { --bg: #080b0f; --surface: #10151c; --surface-2: #18202a; --line: #263241; --text: #e8edf3; --muted: #93a1b2; --blue: #4e739f; --blue-hi: #8fb3dc; --leaf: #a7ef8b; --warn: #f5c26b; --bad: #f87171; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--blue-hi); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 8px 14px; min-height: 40px; }
button:hover:not(:disabled) { border-color: var(--blue-hi); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
button.icon { display: inline-grid; place-items: center; padding: 0; width: 40px; flex: none; }
button.link { background: none; border: 0; color: var(--blue-hi); padding: 4px 8px; }
:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bar { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.bar img { width: 150px; }
.bar-title { color: var(--muted); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; margin-right: auto; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 80px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.narrow { max-width: 560px; margin: 40px auto; }
.card h1 { margin: 0 0 8px; font-size: 24px; }
details { margin: 12px 0 20px; background: var(--surface-2); border-radius: 10px; padding: 10px 14px; }
summary { cursor: pointer; font-weight: 600; }
form { display: grid; gap: 8px; }
input[type=password], input[type=search], select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-height: 40px; width: 100%; }
.error { color: var(--bad); min-height: 1.5em; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; position: sticky; top: 64px; background: var(--bg); padding: 10px 0; z-index: 4; }
.search { flex: 1 1 240px; } .search.small { flex: 0 1 240px; } .filter { flex: 0 0 190px; }
.summary { color: var(--muted); font-size: 14px; }
.spacer { flex: 1; }
.save-status { min-height: 1.5em; margin: 0 0 8px; color: var(--leaf); }
.save-status.bad { color: var(--bad); }
.loading { color: var(--muted); text-align: center; margin-top: 60px; }
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.project { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.project.changed { border-color: var(--warn); }
.row { display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center; padding: 10px; }
/* Projects added by the JarArch sync, waiting for review */
.project.review:not(.changed) { border-color: var(--blue); }
.info .new { display: inline-block; margin-left: 8px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; border-radius: 6px; padding: 1px 7px; vertical-align: middle; }
.review-box { border-top: 1px solid var(--line); padding: 12px 14px 14px; display: grid; gap: 10px; }
.review-box p { margin: 0; }
.review-box > button { justify-self: start; }
.review-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.review-fields label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 220px; }
.review-fields label.check { display: flex; align-items: center; gap: 8px; width: auto; height: auto; min-height: 40px; color: var(--text); flex: 0 1 auto; }
.review-fields input[type=text] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; min-height: 40px; width: 100%; color: var(--text); }
.review-fields input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
.sync-note { background: var(--surface); border: 1px solid var(--blue); border-radius: 12px; padding: 12px 16px; margin: 0 0 10px; }
.sync-note p { margin: 0; }
.sync-note details { margin: 8px 0 0; }
.sync-note ul { margin: 8px 0; padding-left: 20px; }
.cover { width: 120px; aspect-ratio: 8/5; border-radius: 6px; background: var(--surface-2); object-fit: cover; }
.cover.empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.info strong { display: block; font-size: 16px; }
.info small { display: block; color: var(--muted); }
.info .note { color: var(--warn); }
.actions { display: flex; gap: 10px; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; min-height: 40px; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 13px; background: var(--line); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--leaf); }
.switch input:checked::after { transform: translateX(20px); }
.switch.locked { cursor: default; color: var(--muted); } .switch.locked input { cursor: default; opacity: .45; }
.panel { border-top: 1px solid var(--line); padding: 14px; }
.panel p { margin: 0; color: var(--muted); font-size: 14px; }
.panel.drop { outline: 2px dashed var(--blue-hi); outline-offset: -6px; background: var(--surface-2); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.panel-head p { flex: 1 1 260px; }
.tag { position: absolute; top: 6px; right: 6px; background: var(--warn); color: #241703; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 8px; pointer-events: none; }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { background: var(--surface-2); border: 2px solid transparent; border-radius: 10px; overflow: hidden; }
.tile.on { border-color: var(--leaf); }
.tile .pic { position: relative; aspect-ratio: 8/5; background: #000; }
.tile .pic button { position: absolute; inset: 0; padding: 0; border: 0; border-radius: 0; background: none; width: 100%; height: 100%; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 6px; left: 6px; background: var(--leaf); color: #0b1a06; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 8px; pointer-events: none; }
.tile .meta { padding: 8px; display: grid; gap: 6px; }
.tile .label { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.tile .controls { display: flex; gap: 6px; flex-wrap: wrap; }
.tile .controls button { min-height: 34px; padding: 4px 10px; font-size: 13px; }
dialog { border: 0; padding: 0; background: #000; max-width: 96vw; max-height: 94vh; }
dialog::backdrop { background: rgb(0 0 0 / 80%); }
dialog img { max-height: 94vh; width: auto; }
dialog .close { position: absolute; top: 8px; right: 8px; font-size: 22px; background: rgb(0 0 0 / 60%); }
@media (max-width: 700px) {
  /* Phones: the header scrolls away and Save sits in a bar at the bottom, so the projects get the screen. */
  .bar { padding: 12px 16px; transition: transform .2s; }
  .bar.hide { transform: translateY(-100%); }
  .bar img { width: 120px; }
  main { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }
  input[type=password], input[type=search], input[type=text], select { font-size: 16px; min-height: 44px; }
  button { min-height: 44px; }
  .toolbar { position: static; padding: 4px 0 8px; }
  .search, .search.small, .filter { flex: 1 1 100%; }
  .spacer { display: none; }
  .toolbar #discard, .toolbar #save { position: fixed; z-index: 7; bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(50% - 18px); min-height: 48px; }
  .toolbar #discard { left: 12px; } .toolbar #save { right: 12px; }
  .toolbar::after { content: ""; position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; height: calc(68px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
  .row { grid-template-columns: 84px 1fr; gap: 10px 12px; padding: 12px; }
  .cover { width: 84px; }
  .info strong { font-size: 17px; }
  .actions { grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; }
  .actions > button { flex: 1 1 calc(100% - 60px); }
  .actions > button.icon { flex: 0 0 48px; min-height: 48px; }
  .actions .switch { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); white-space: normal; line-height: 1.2; }
  .actions .switch input { flex: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile .controls button { min-height: 40px; padding: 4px 8px; flex: 1 1 auto; }
  .panel { padding: 12px; }
  .panel-head button { flex: 1 1 100%; }
}

/* Page links in the header */
.bar-nav { display: flex; gap: 4px; margin-right: auto; }
.bar-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.bar-nav a:hover { color: var(--text); }
.bar-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.bar-title { margin-right: 0; }
.admin-version { color: var(--muted); font: 12px ui-monospace, Menlo, monospace; }
@media (max-width: 640px) { .bar { flex-wrap: wrap; } .bar-title { display: none; } .bar-nav { order: 3; width: 100%; overflow-x: auto; } .bar-nav a { white-space: nowrap; padding: 10px 12px; } }

/* Square footage page */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 6px; }
.totals div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; }
.totals b { font-size: 26px; font-weight: 600; }
.totals span { color: var(--text); font-size: 14px; }
.totals small { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 12px; max-width: 90ch; }
.table-wrap { overflow-x: auto; contain: paint; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; }
table.areas { width: 100%; border-collapse: collapse; min-width: 760px; }
.areas th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--surface); position: sticky; top: 0; }
.areas td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.areas th.num, .areas td.num { text-align: right; }
.areas td strong { display: block; font-weight: 600; }
.areas td small { display: block; color: var(--muted); font-size: 13px; }
.areas details { margin: 6px 0 0; padding: 6px 10px; font-size: 13px; }
.areas details p { margin: 6px 0 0; }
.areas .muted { color: var(--muted); }
.areas tr.changed td { background: color-mix(in srgb, var(--warn) 8%, transparent); }
.areas tr.changed td:first-child { box-shadow: inset 3px 0 var(--warn); }
.areas tr.out strong, .areas tr.out td.num input { opacity: .5; }
.areas input[type=number], .areas input[type=text] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-height: 38px; }
.areas input[type=number] { width: 120px; text-align: right; }
.areas input[type=text] { width: 100%; min-width: 220px; }
.check { display: inline-grid; place-items: center; width: 40px; height: 38px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue-hi); }

/* Map pins */
.pins { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 14px; height: calc(100vh - 230px); min-height: 460px; }
.pin-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 6px; align-content: start; }
.pin-list button { width: 100%; text-align: left; display: grid; gap: 2px; background: var(--surface); }
.pin-list button[aria-pressed="true"] { border-color: var(--blue-hi); background: var(--surface-2); }
.pin-list button.changed { border-color: var(--warn); }
.pin-list small { color: var(--muted); font-size: 12px; }
.pin-list .tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); }
.pin-list .tag.ok { color: var(--leaf); }
.pin-map { border-radius: 12px; border: 1px solid var(--line); min-height: 360px; }
@media (max-width: 760px) { .pins { grid-template-columns: 1fr; height: auto; } .pin-list { max-height: 34vh; } .pin-map { height: 56vh; } }
