/* Apartment Tours — iOS-flavoured, system fonts, grouped lists, motion tuned per Emil Kowalski's rules. */

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --grouped: #ffffff;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.62);
  --label-3: rgba(60, 60, 67, 0.34);
  --label-4: rgba(60, 60, 67, 0.2);
  --sep: rgba(60, 60, 67, 0.2);
  --fill: rgba(120, 120, 128, 0.2);
  --fill-3: rgba(118, 118, 128, 0.12);
  --seg-on: #ffffff;
  --blue: #007aff;
  --green: #34c759;
  --green-ink: #1f8f3d;
  --orange: #ff9500;
  --orange-ink: #b86a00;
  --red: #ff3b30;
  --teal: #30b0c7;
  --indigo: #5856d6;
  --gray: #8e8e93;
  --accent: var(--blue);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: calc(50px + var(--safe-b));
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro', system-ui, 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --grouped: #1c1c1e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.62);
    --label-3: rgba(235, 235, 245, 0.32);
    --label-4: rgba(235, 235, 245, 0.18);
    --sep: rgba(84, 84, 88, 0.65);
    --fill: rgba(120, 120, 128, 0.36);
    --fill-3: rgba(118, 118, 128, 0.24);
    --seg-on: #636366;
    --blue: #0a84ff;
    --green: #30d158;
    --green-ink: #4ade80;
    --orange: #ff9f0a;
    --orange-ink: #ffb340;
    --red: #ff453a;
    --teal: #40c8e0;
    --indigo: #7d7aff;
    --gray: #98989d;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 17px/1.3 var(--font);
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
}
button,
input,
textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
h1,
h2,
h3,
p {
  margin: 0;
}
.ico {
  display: inline-grid;
  place-items: center;
  flex: none;
}

#app {
  position: fixed;
  inset: 0;
}
#views {
  position: absolute;
  inset: 0;
}

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tab-h);
  padding-bottom: var(--safe-b);
  display: flex;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  box-shadow: 0 -0.5px 0 var(--sep);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--label-2);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0;
  transition: color 140ms ease;
}
.tab .ico {
  transition: transform 160ms var(--ease-out);
}
.tab:active .ico {
  transform: scale(0.9);
}
.tab.on {
  color: var(--accent);
}
.tab.on svg {
  fill: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* ---------- views, nav bar, large title ---------- */
.view {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.view.active {
  display: block;
}
.view .body {
  padding-bottom: calc(var(--tab-h) + 28px);
}
.navbar {
  position: sticky;
  top: 0;
  z-index: 6;
  height: calc(44px + var(--safe-t));
  padding: var(--safe-t) 12px 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}
.navbar.collapsed {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  box-shadow: 0 0.5px 0 var(--sep);
}
.nav-title {
  font-weight: 600;
  opacity: 0;
  transition: opacity 160ms ease;
}
.navbar.collapsed .nav-title {
  opacity: 1;
}
.nav-side::after {
  font-size: 12px;
  font-weight: 500;
  color: var(--orange-ink);
}
body[data-sync='offline'] .nav-side::after {
  content: 'Offline · saved on this device';
}
.nav-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}
.nav-btn {
  border: 0;
  background: none;
  color: var(--accent);
  min-width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0 4px;
  transition: transform 140ms var(--ease-out), opacity 140ms ease;
}
.nav-btn:active {
  transform: scale(0.92);
  opacity: 0.6;
}
.nav-btn.bold {
  font-weight: 600;
}
.lt h1 {
  padding: 0 16px 10px;
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: 0.37px;
}

/* ---------- grouped lists ---------- */
.group {
  margin: 0 16px 22px;
  background: var(--grouped);
  border-radius: 12px;
  overflow: hidden;
}
.group > * {
  position: relative;
}
.group > * + *::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 0.5px;
  background: var(--sep);
}
.group-title {
  margin: 0 32px 7px;
  font-size: 12.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--label-2);
}
.group-title span {
  font-weight: 500;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
}
.row-l {
  flex: none;
  max-width: 46%;
}
.row-l small,
.crit-top small {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  color: var(--label-2);
}
.row-c {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  text-align: right;
}
.inp {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: right;
  padding: 12px 0;
  outline: none;
  color: var(--label);
}
.inp::placeholder,
.ta::placeholder,
.card-name::placeholder,
.card-addr::placeholder {
  color: var(--label-3);
}
input[type='date'].inp,
input[type='time'].inp {
  width: auto;
  padding: 6px 0;
}
.money-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.money-wrap i {
  font-style: normal;
  color: var(--label-2);
}
.money-wrap .inp {
  width: 7.5ch;
}
.link-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.icon-btn {
  border: 0;
  background: none;
  color: var(--accent);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
}
.ta-row {
  padding: 4px 16px 8px;
  display: block;
}
.ta {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  min-height: 44px;
  padding: 10px 0;
  line-height: 1.38;
  overflow: hidden;
}
.row-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  height: 44px;
  padding: 0 16px;
}
.row-btn.danger,
.btn.danger {
  color: var(--red);
}
.row-btn:active {
  background: var(--fill-3);
}

.lede {
  margin: 0 32px 14px;
  font-size: 15px;
  color: var(--label-2);
}
.footnote {
  margin: -8px 32px 20px;
  font-size: 13px;
  color: var(--label-2);
}
.center {
  display: flex;
  justify-content: center;
  margin: 0 16px 22px;
}
.center.tight {
  margin-top: -10px;
}
.danger-zone {
  margin: 8px 16px 0;
}
.danger-zone .btn {
  width: 100%;
  background: var(--grouped);
}

/* ---------- buttons, chips ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--fill-3);
  color: var(--accent);
  font-weight: 500;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.small {
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  font-size: 15px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 0;
}
.chip.big {
  font-size: 13px;
  padding: 7px 8px 7px 11px;
  transition: transform 140ms var(--ease-out);
}
.chip.big:active {
  transform: scale(0.96);
}
.chip.big .ico {
  opacity: 0.7;
}

/* ---------- segmented control ---------- */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--fill-3);
  border-radius: 9px;
  padding: 2px;
}
.seg-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  border-radius: 7px;
  background: var(--seg-on);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  transition: transform 260ms var(--ease-drawer);
}
.seg-btn {
  position: relative;
  z-index: 1;
  height: 32px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}
.seg-btn.on {
  font-weight: 600;
}
.seg.mini {
  width: 190px;
}
.seg.mini .seg-btn {
  height: 28px;
  font-size: 13px;
}
.mode-switch {
  padding: 0 16px 14px;
}

/* ---------- day strip ---------- */
.days {
  display: flex;
  gap: 6px;
  padding: 2px 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.days::-webkit-scrollbar {
  display: none;
}
.day {
  flex: none;
  width: 54px;
  padding: 8px 0 7px;
  border: 0;
  border-radius: 14px;
  background: none;
  display: grid;
  justify-items: center;
  gap: 1px;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.day:active {
  transform: scale(0.95);
}
.day small {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-2);
}
.day b {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.day.on {
  background: var(--accent);
  color: #fff;
}
.day.on small {
  color: rgba(255, 255, 255, 0.8);
}
.day-head {
  padding: 0 16px 12px;
}
.day-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.35px;
}
.day-head p {
  font-size: 15px;
  color: var(--label-2);
  margin-top: 1px;
}

/* ---------- agenda ---------- */
.agenda {
  padding: 0 0 8px;
}
.ev-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 0 16px;
}
.ev-time {
  text-align: right;
  padding-top: 11px;
  font-variant-numeric: tabular-nums;
}
.ev-time b {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.ev-time small {
  font-size: 11px;
  font-weight: 500;
  color: var(--label-2);
}
.event {
  width: 100%;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px 12px 16px;
  background: color-mix(in srgb, var(--c) 12%, var(--grouped));
  box-shadow: inset 4px 0 0 var(--c);
  transition: transform 160ms var(--ease-out);
}
.event:active {
  transform: scale(0.985);
}
.num {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ev-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ev-body b {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ev-loc {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--label-2);
}
.ev-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.hop {
  margin: 0;
}
.hop-body {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 11px;
  padding: 7px 0 7px 22px;
  border-left: 2px dotted var(--label-3);
  font-size: 13px;
  color: var(--label-2);
}
.hop-body em {
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--orange-ink);
  background: color-mix(in srgb, var(--orange) 18%, transparent);
}

/* ---------- wishlist ---------- */
.wrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 120ms ease;
}
.wrow:active {
  background: var(--fill-3);
}
.wmain {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}
.wmain b {
  font-weight: 600;
}
.sub {
  display: block;
  min-width: 0;
  font-size: 14px;
  color: var(--label-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.has-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.empty {
  padding: 18vh 40px 0;
  text-align: center;
}
.empty h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.empty p {
  color: var(--label-2);
  margin-bottom: 20px;
  text-wrap: balance;
}

/* ---------- scores: pipeline + compare ---------- */
.pipeline {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 16px 12px;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: none;
  align-items: flex-start;
}
.pipeline::-webkit-scrollbar {
  display: none;
}
.col {
  flex: 0 0 min(82vw, 330px);
  min-width: 0;
  scroll-snap-align: start;
  padding: 10px 10px 4px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--label) 5%, var(--bg));
}
.col header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 10px;
}
.col header i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}
.col h3 {
  font-size: 15px;
  font-weight: 600;
}
.col header span {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.col-empty {
  padding: 18px 8px 22px;
  text-align: center;
  font-size: 14px;
  color: var(--label-3);
}
.pcard {
  display: flex;
  gap: 10px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--grouped);
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.pcard:active {
  transform: scale(0.985);
}
.pthumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: var(--fill-3);
}
.pc-main {
  flex: 1;
  min-width: 0;
}
.pc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.pc-top b {
  font-weight: 600;
  line-height: 1.25;
}
.pc-move {
  flex: none;
  margin: -6px -8px -6px 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--label-3);
}
.pc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.pc-foot .sub {
  font-variant-numeric: tabular-nums;
}
.score {
  flex: none;
  min-width: 36px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--fill-3);
  color: var(--label-2);
}
.score.tone-good {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green-ink);
}
.score.tone-ok {
  background: color-mix(in srgb, var(--orange) 18%, transparent);
  color: var(--orange-ink);
}
.score.tone-low {
  background: color-mix(in srgb, var(--red) 15%, transparent);
  color: var(--red);
}

.cmp-wrap {
  margin: 0 16px 14px;
  overflow-x: auto;
  border-radius: 12px;
  background: var(--grouped);
}
.cmp {
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.cmp th,
.cmp td {
  padding: 11px 12px;
  white-space: nowrap;
  font-size: 15px;
  text-align: center;
  box-shadow: inset 0 -0.5px 0 var(--sep);
}
.cmp thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--label-2);
}
.cmp tbody tr:last-child > * {
  box-shadow: none;
}
.cmp .sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--grouped);
  min-width: 150px;
  box-shadow: inset -0.5px 0 0 var(--sep), inset 0 -0.5px 0 var(--sep);
}
.cmp .sticky button {
  display: grid;
  gap: 2px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-weight: 600;
}
.cmp .sticky small {
  font-size: 11px;
  font-weight: 600;
  color: var(--c);
}
.cmp td.best {
  font-weight: 700;
  color: var(--green-ink);
}

/* ---------- map ---------- */
.map-view {
  overflow: hidden;
}
.map-view .navbar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}
.map-canvas {
  position: absolute;
  inset: 0;
}
.map-overlay {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(var(--safe-t) + 52px);
  pointer-events: none;
}
.map-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  pointer-events: auto;
}
.map-bar .days {
  padding: 3px;
  gap: 2px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}
.map-bar .day {
  width: 46px;
  padding: 5px 0 4px;
  border-radius: 15px;
}
.map-bar .day b {
  font-size: 18px;
}
.chip-toggle {
  margin-left: auto;
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--label-2);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
  transition: transform 160ms var(--ease-out), color 160ms ease;
}
.chip-toggle:active {
  transform: scale(0.96);
}
.chip-toggle.on {
  color: var(--accent);
}
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  bottom: var(--tab-h);
}
.pin {
  position: relative;
  border: 0;
  padding: 0;
  background: none;
  transition: transform 160ms var(--ease-out);
}
.pin:active {
  transform: scale(0.92);
}
.num-pin span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font: 700 15px/1 var(--font);
  box-shadow: 0 0 0 3px #fff, 0 3px 10px rgba(0, 0, 0, 0.28);
}
.num-pin em {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 600 12px/1.1 var(--font);
  color: #111;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff, 0 0 6px #fff;
  pointer-events: none;
}
.wish-pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3.5px solid var(--blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.wish-pin em {
  display: none;
}

/* ---------- sheets ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  transition: opacity 220ms ease-out;
}
.backdrop.in {
  opacity: 1;
}
.sheet {
  position: fixed;
  z-index: 51;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: min(100%, 680px);
  max-height: calc(100dvh - var(--safe-t) - 10px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.2);
  transform: translateY(104%);
  transition: transform 240ms var(--ease-out);
  will-change: transform;
}
.sheet.in {
  transform: none;
  transition: transform 440ms var(--ease-drawer);
}
.sheet.card {
  height: calc(100dvh - var(--safe-t) - 10px);
}
.sheet.compact {
  padding-bottom: var(--safe-b);
}
.sheet.compact.tall {
  height: 82dvh;
}
.sheet-head {
  padding: 8px 16px 14px;
  text-align: center;
  touch-action: none;
}
.sheet-head h2 {
  font-size: 17px;
  font-weight: 600;
}
.sheet-head p {
  font-size: 14px;
  color: var(--label-2);
  margin-top: 2px;
}
.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  padding-top: 4px;
}
.sheet-foot {
  padding: 8px 16px 14px;
}
.sheet-foot .btn {
  width: 100%;
}
.grabber {
  display: block;
  width: 36px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 3px;
  background: var(--label-4);
}

.card-head {
  flex: none;
  padding: 8px 16px 0;
  touch-action: none;
  background: var(--bg);
}
.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-name {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  padding: 2px 0;
  font-size: 28px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: 0.35px;
}
.card-addr {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  padding: 2px 0;
  font-size: 15px;
  color: var(--label-2);
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 12px;
  min-height: 28px;
}
.card-sub {
  display: contents;
}
.card-sub .when {
  font-size: 14px;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.dir {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  padding: 4px 0 4px 8px;
}
.pin-status {
  font-size: 12px;
  color: var(--label-3);
  order: 3;
}
.card-head .seg {
  margin-bottom: 10px;
}
.card-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 14px;
  box-shadow: inset 0 0.5px 0 var(--sep);
}
.card-end {
  height: calc(var(--safe-b) + 48px);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 16px 22px;
}
.tile {
  background: var(--grouped);
  border-radius: 14px;
  padding: 11px 12px 12px;
  min-width: 0;
}
.tile small {
  display: block;
  font-size: 12px;
  color: var(--label-2);
}
.tile b {
  display: block;
  margin-top: 2px;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tone-good {
  color: var(--green-ink);
}
.tone-ok {
  color: var(--orange-ink);
}
.tone-low {
  color: var(--red);
}
.tone-none {
  color: var(--label-3);
}

/* scoring */
.score-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 16px 22px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--grouped);
}
.score-summary .big {
  min-width: 70px;
  text-align: center;
  font-size: 46px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.sum-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.sum-text b {
  font-weight: 600;
}
.sum-text span {
  font-size: 13px;
  line-height: 1.3;
  color: var(--label-2);
}
.unit-pick {
  margin: 0 16px 12px;
}
.unit-pick .seg {
  overflow-x: auto;
}
.crit {
  padding: 12px 16px 14px;
}
.crit-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.sv {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 1.5ch;
  text-align: right;
}
.scale {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.scale button {
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--fill-3);
  color: var(--label-2);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms var(--ease-out);
}
.scale button:active {
  transform: scale(0.9);
}
.scale button.lit {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent);
}
.scale button.on {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.stepper button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--fill-3);
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  transition: transform 140ms var(--ease-out), opacity 140ms ease;
}
.stepper button:active {
  transform: scale(0.9);
}
.stepper button:disabled {
  opacity: 0.35;
}
.stepper b {
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.totals .row {
  padding-top: 9px;
  padding-bottom: 9px;
}
.totals b.row-c {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* photos */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 16px 22px;
}
.ph {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--fill-3);
  transition: transform 160ms var(--ease-out);
}
.ph:active {
  transform: scale(0.96);
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ph.add {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  background: none;
  border: 1.5px dashed var(--label-4);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}
.up {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}
.viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #000;
  color: #fff;
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.viewer.in {
  opacity: 1;
}
.v-bar {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(rgba(0, 0, 0, 0.5), transparent);
}
.v-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  transition: transform 140ms var(--ease-out);
}
.v-btn:active {
  transform: scale(0.92);
}
.v-strip {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.v-strip::-webkit-scrollbar {
  display: none;
}
.v-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
}
.v-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* action sheet */
.sheet.action {
  background: transparent;
  box-shadow: none;
  gap: 8px;
  width: min(100%, 430px);
  padding: 0 8px calc(8px + var(--safe-b));
  max-height: 90dvh;
  overflow-y: auto;
  z-index: 60;
}
.sheet.action ~ .backdrop {
  z-index: 59;
}
.as-group {
  border-radius: 14px;
  overflow: hidden;
  background: color-mix(in srgb, var(--grouped) 94%, transparent);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.as-head {
  display: grid;
  gap: 2px;
  padding: 14px 16px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--label-2);
}
.as-head b {
  font-weight: 600;
}
.as-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 44px;
  border: 0;
  border-top: 0.5px solid var(--sep);
  background: none;
  color: var(--accent);
  font-size: 20px;
  letter-spacing: -0.02em;
  transition: background-color 100ms ease;
}
.as-btn:first-child {
  border-top: 0;
}
.as-btn:active {
  background: var(--fill-3);
}
.as-btn.destructive {
  color: var(--red);
}
.as-btn.bold {
  font-weight: 600;
}
.as-btn .ico {
  position: absolute;
  right: 16px;
}

/* toast + lock */
.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(var(--tab-h) + 14px);
  max-width: min(88vw, 420px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(44, 44, 46, 0.94);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.96);
  transition: opacity 200ms ease-out, transform 240ms var(--ease-out);
  pointer-events: none;
}
.toast.in {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.lock {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.lock-card {
  width: min(100%, 360px);
  display: grid;
  gap: 12px;
  text-align: center;
}
.lock-skyline {
  width: 100%;
  aspect-ratio: 1438 / 611;
  margin-bottom: 8px;
  background: #075e6c;
  -webkit-mask: url(/img/chicago-skyline.svg) center / contain no-repeat;
  mask: url(/img/chicago-skyline.svg) center / contain no-repeat;
  animation: skyline-rise 900ms var(--ease-out) backwards;
}
@keyframes skyline-rise {
  from {
    clip-path: inset(100% 0 0 0);
    opacity: 0.4;
  }
  to {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}
@media (prefers-color-scheme: dark) {
  .lock-skyline {
    background: #2fb8aa;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lock-skyline {
    animation: none;
  }
}
.lock-card h1 {
  font-size: 28px;
  font-weight: 700;
}
.lock-card p {
  color: var(--label-2);
}
.lock-input {
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--grouped);
  padding: 0 16px;
  text-align: center;
  outline: none;
}
.lock-msg {
  min-height: 1.3em;
  font-size: 14px;
  color: var(--red) !important;
}

/* ---------- first-load rise (only once, only a few rows) ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.boot .ev-row,
.boot .wrow,
.boot .pcard {
  animation: rise 320ms var(--ease-out) backwards;
  animation-delay: calc(min(var(--i, 0), 6) * 40ms);
}

@media (hover: hover) and (pointer: fine) {
  .event:hover {
    background: color-mix(in srgb, var(--c) 17%, var(--grouped));
  }
  .scale button:hover:not(.on):not(.lit) {
    background: var(--fill);
  }
  .btn:hover {
    background: var(--fill);
  }
  .btn.primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, #000);
  }
}

@media (min-width: 760px) {
  .view .body,
  .lt,
  .mode-switch {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
  }
  .navbar {
    padding-left: max(16px, calc((100vw - 820px) / 2 + 16px));
    padding-right: max(12px, calc((100vw - 820px) / 2 + 12px));
  }
  .map-view .navbar {
    padding-left: 16px;
    padding-right: 12px;
  }
}

@media (prefers-color-scheme: dark) {
  .maplibregl-canvas {
    filter: invert(1) hue-rotate(180deg) brightness(0.86) contrast(0.92) saturate(0.8);
  }
  .toast {
    background: rgba(99, 99, 102, 0.95);
  }
  .num-pin em {
    color: #fff;
    text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 4px #000, 0 0 6px #000;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet.in {
    transform: none;
    opacity: 0;
    transition: opacity 160ms ease-out;
  }
  .sheet.in {
    opacity: 1;
  }
  .seg-thumb {
    transition-duration: 1ms;
  }
  .boot .ev-row,
  .boot .wrow,
  .boot .pcard {
    animation: none;
  }
}

/* ---------- report + camera ---------- */
.report-row {
  display: flex;
  margin: -6px 16px 22px;
}
.report-row .btn {
  flex: 1;
  background: var(--grouped);
}
.sheet-body {
  padding: 0 16px 8px;
}
.sheet-foot.stack {
  display: grid;
  gap: 8px;
}
.btn.plain {
  background: none;
}
.progress {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--fill-3);
}
.progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 220ms var(--ease-out);
}

.cam {
  position: fixed;
  inset: 0;
  z-index: 56;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
  opacity: 0;
  transition: opacity 200ms ease-out;
  user-select: none;
  -webkit-user-select: none;
}
.cam.in {
  opacity: 1;
}
.cam-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
}
.cam-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  max-width: 52vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 140ms var(--ease-out);
}
.cam-pill:active {
  transform: scale(0.95);
}
.cam-count {
  min-width: 74px;
  text-align: right;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.8);
}
.cam-view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #111;
}
.cam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  transition: transform 260ms var(--ease-out);
}
.cam-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.cam-flash.go {
  animation: camflash 180ms ease-out;
}
@keyframes camflash {
  from {
    opacity: 0.8;
  }
  to {
    opacity: 0;
  }
}
.cam-bottom {
  display: grid;
  gap: 16px;
  padding: 14px 24px calc(var(--safe-b) + 22px);
}
.cam-zoom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}
.zb {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(60, 60, 60, 0.7);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: width 200ms var(--ease-out), height 200ms var(--ease-out), color 160ms ease, transform 140ms var(--ease-out);
}
.zb:active {
  transform: scale(0.92);
}
.zb.on {
  width: 46px;
  height: 46px;
  color: #ffd60a;
  background: rgba(40, 40, 40, 0.85);
}
.cam-ctrl {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.shutter {
  width: 76px;
  height: 76px;
  padding: 4px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: none;
}
.shutter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transition: transform 100ms var(--ease-out);
}
.shutter:active i {
  transform: scale(0.86);
}
.cam-thumbwrap {
  justify-self: start;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}
.cam-last {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
