/* Fixasset SOS — brand tokens from SOS Children's Villages palette */
:root {
  --sos: #009ee0;
  --sos-deep: #0079ad;
  --sos-tint: #e6f5fc;
  --navy: #1f3864;
  --ink: #1d2b3a;
  --muted: #5b6f84;
  --line: #dbe6ef;
  --paper: #ffffff;
  --page: #f3f8fb;
  --ok: #5fd47c;
  --ok-ink: #1f8a41;
  --ok-bg: #e8f8ec;
  --bad: #e74361;
  --bad-ink: #b4203d;
  --bad-bg: #fde9ed;
  --wait: #efb828;
  --wait-ink: #8a6200;
  --wait-bg: #fdf4dc;
  --stale: #9aa7b4;
  --stale-bg: #eef1f4;
  --melon: #f75322;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 18px;
  --shadow: 0 1px 2px rgba(31, 56, 100, 0.08), 0 4px 16px rgba(31, 56, 100, 0.06);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
  --step-4: 2.25rem;
  --nav-w: 248px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  color: var(--navy);
  line-height: 1.25;
  margin: 0;
}
h1 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.01em;
}
h2 {
  font-size: var(--step-1);
  font-weight: 600;
}
h3 {
  font-size: var(--step-0);
  font-weight: 600;
}
p {
  margin: 0 0 0.75em;
  max-width: 72ch;
}
a {
  color: var(--sos-deep);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--sos);
  outline-offset: 2px;
  border-radius: 4px;
}
[hidden] {
  display: none !important;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}
.nav {
  background: var(--navy);
  color: #dce7f3;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 22px;
  color: #fff;
  text-decoration: none;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sos);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg {
  width: 20px;
  height: 20px;
}
.brand b {
  display: block;
  font-size: var(--step-1);
  line-height: 1.1;
}
.brand small {
  color: #9fb6cf;
  font-size: var(--step--1);
}
.nav a.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-s);
  color: inherit;
  text-decoration: none;
  font-weight: 500;
}
.nav a.item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.nav a.item[aria-current='page'] {
  background: var(--sos);
  color: #fff;
}
.nav a.item svg {
  width: 20px;
  height: 20px;
  flex: none;
  opacity: 0.9;
}
.nav .badge {
  margin-inline-start: auto;
  background: var(--wait);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 8px;
}
.nav-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 10px 6px;
}
.nav-foot {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: var(--step--1);
  color: #9fb6cf;
}
.nav-foot strong {
  color: #fff;
  display: block;
  font-size: var(--step-0);
}
.nav-foot .row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.nav-foot button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: var(--radius-s);
  padding: 4px 10px;
  cursor: pointer;
}

.main {
  min-width: 0;
  padding: 28px clamp(16px, 3vw, 40px) 96px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  margin-bottom: 22px;
}
.page-head .sub {
  color: var(--muted);
  margin: 4px 0 0;
}
.page-head .actions {
  margin-inline-start: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.crumbs {
  font-size: var(--step--1);
  color: var(--muted);
  margin-bottom: 6px;
}
.crumbs a {
  color: var(--muted);
}

/* Mobile bottom bar */
.tabbar {
  display: none;
}
@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .nav {
    display: none;
  }
  .main {
    padding: 18px 14px 104px;
  }
  h1 {
    font-size: var(--step-2);
  }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
    padding: 4px 0;
  }
  .tabbar a svg {
    width: 22px;
    height: 22px;
  }
  .tabbar a[aria-current='page'] {
    color: var(--sos-deep);
  }
  .tabbar .more-tab {
    min-width: 0;
    display: grid;
    place-items: center;
  }
  .tabbar .more-wrap {
    display: contents;
  }
  .tabbar .more-toggle {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    line-height: 1.25;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    width: 100%;
    padding: 4px 0;
    cursor: pointer;
  }
  .tabbar .more-toggle svg {
    width: 22px;
    height: 22px;
  }
  .tabbar .more-toggle[aria-current='page'],
  .tabbar .more-toggle[aria-expanded='true'] {
    color: var(--sos-deep);
  }
  .more-menu {
    position: absolute;
    inset-inline: 8px;
    bottom: calc(100% + 8px);
    z-index: 41;
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 8px;
    text-align: start;
  }
  .more-destinations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 2px;
  }
  .tabbar .more-link {
    min-width: 0;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    font-size: var(--step--1);
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-s);
    color: var(--ink);
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  .tabbar .more-link svg {
    width: 19px;
    height: 19px;
    flex: none;
    color: var(--muted);
  }
  .tabbar .more-link:hover,
  .tabbar .more-link[aria-current='page'] {
    background: var(--sos-tint);
    color: var(--sos-deep);
  }
  .more-link[aria-current='page'] {
    font-weight: 600;
  }
  .more-link[aria-current='page'] svg {
    color: var(--sos-deep);
  }
  .more-tools {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--line);
    margin-top: 6px;
    padding: 8px 2px 2px;
  }
  .more-action {
    flex: 1 1 0;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    background: var(--page);
    color: var(--navy);
    padding: 9px 10px;
    cursor: pointer;
    overflow-wrap: anywhere;
  }
  .more-action:hover {
    border-color: var(--sos);
    background: var(--sos-tint);
  }
  .tabbar a.scan {
    color: #fff;
  }
  .tabbar a.scan span.dot {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--sos);
    display: grid;
    place-items: center;
    margin-top: -22px;
    box-shadow: 0 4px 14px rgba(0, 158, 224, 0.4);
    border: 4px solid var(--page);
  }
  .tabbar a.scan small {
    color: var(--sos-deep);
    font-weight: 600;
  }
}

/* ---------- Surfaces ---------- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel + .panel {
  margin-top: 16px;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head .actions {
  margin-inline-start: auto;
  display: flex;
  gap: 8px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.muted {
  color: var(--muted);
}
.small {
  font-size: var(--step--1);
}
.stack > * + * {
  margin-top: 12px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}

/* Figures strip: a single line of plain facts, not a card wall */
.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.figure {
  flex: 1 1 160px;
  padding: 16px 20px;
  border-inline-end: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.figure:last-child {
  border-inline-end: 0;
}
.figure b {
  display: block;
  font-size: var(--step-3);
  color: var(--navy);
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.figure span {
  color: var(--muted);
  font-size: var(--step--1);
}
.figure.bad b {
  color: var(--bad-ink);
}
.figure.wait b {
  color: var(--wait-ink);
}
a.figure:hover {
  background: var(--sos-tint);
}

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}
.btn svg {
  width: 18px;
  height: 18px;
}
.btn.primary {
  background: var(--sos);
  color: #fff;
}
.btn.primary:hover {
  background: var(--sos-deep);
}
.btn.ghost {
  background: var(--paper);
  border-color: var(--line);
  color: var(--navy);
}
.btn.ghost:hover {
  border-color: var(--sos);
}
.btn.danger {
  background: var(--bad);
  color: #fff;
}
.btn.ok {
  background: var(--ok-ink);
  color: #fff;
}
.btn.link {
  background: none;
  border: 0;
  color: var(--sos-deep);
  padding: 4px 6px;
}
.btn.big {
  padding: 14px 22px;
  font-size: var(--step-1);
  border-radius: var(--radius);
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-weight: 500;
  font-size: var(--step--1);
  color: var(--navy);
}
.field .hint {
  font-size: var(--step--1);
  color: var(--muted);
}
.input,
select.input,
textarea.input {
  width: 100%;
  border: 1px solid #c9d7e3;
  border-radius: var(--radius-s);
  padding: 9px 12px;
  background: #fff;
  min-height: 42px;
}
.input:focus {
  border-color: var(--sos);
  outline: 3px solid rgba(0, 158, 224, 0.2);
  outline-offset: 0;
}
textarea.input {
  min-height: 80px;
  resize: vertical;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 16px;
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--sos);
}
.searchbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.searchbar .input {
  flex: 1 1 200px;
  width: auto;
}
.searchbar select.input {
  flex: 0 1 200px;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step-0);
}
table.data th {
  text-align: start;
  font-weight: 600;
  color: var(--muted);
  font-size: var(--step--1);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfd;
  white-space: nowrap;
}
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}
table.data tr:last-child td {
  border-bottom: 0;
}
table.data tr.clickable {
  cursor: pointer;
}
table.data tr.clickable:hover td {
  background: var(--sos-tint);
}
.tag {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 0;
  color: var(--muted);
  font-size: var(--step--1);
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.pill.ok {
  color: var(--ok-ink);
  background: var(--ok-bg);
}
.pill.bad {
  color: var(--bad-ink);
  background: var(--bad-bg);
}
.pill.wait {
  color: var(--wait-ink);
  background: var(--wait-bg);
}
.pill.stale {
  color: #56626e;
  background: var(--stale-bg);
}
.pill.info {
  color: var(--sos-deep);
  background: var(--sos-tint);
}

/* ---------- Floor plan: the centrepiece ---------- */
.plan {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: manipulation;
}
.plan img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.plan svg.zones {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.zone {
  cursor: pointer;
  transition: fill-opacity 0.15s;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}
.zone.ok {
  fill: var(--ok);
  stroke: var(--ok-ink);
  fill-opacity: 0.32;
}
.zone.missing {
  fill: var(--bad);
  stroke: var(--bad-ink);
  fill-opacity: 0.34;
}
.zone.stale {
  fill: var(--wait);
  stroke: var(--wait-ink);
  fill-opacity: 0.3;
}
.zone.never {
  fill: var(--stale);
  stroke: #6d7a87;
  fill-opacity: 0.22;
}
.zone.counting {
  fill: var(--sos);
  stroke: var(--sos-deep);
  fill-opacity: 0.35;
  animation: pulse 1.6s ease-in-out infinite;
}
.zone.pending_review,
.zone.discrepancies {
  fill: var(--wait);
  stroke: var(--wait-ink);
  fill-opacity: 0.34;
}
.zone.rejected_review {
  fill: var(--bad);
  stroke: var(--bad-ink);
  fill-opacity: 0.34;
}
.zone:hover,
.zone.sel {
  fill-opacity: 0.55;
}
.zone-label {
  font-family: var(--font);
  font-weight: 600;
  fill: var(--navy);
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 4px;
  pointer-events: none;
}
.plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: var(--step--1);
  color: var(--muted);
  margin-top: 10px;
}
.plan-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-inline-end: 6px;
  vertical-align: -1px;
}
.plan-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.plan-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.plan-tabs button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
  color: var(--navy);
}
.plan-tabs button[aria-pressed='true'] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.drop {
  border: 2px dashed #b9cfe0;
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  background: #fafdff;
  cursor: pointer;
}
.drop.over {
  border-color: var(--sos);
  background: var(--sos-tint);
}
.drop b {
  color: var(--navy);
  display: block;
  font-size: var(--step-1);
  margin-bottom: 4px;
}
@keyframes pulse {
  50% {
    fill-opacity: 0.15;
  }
}

/* Room list beside the plan */
.room-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.room-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #edf2f7;
  cursor: pointer;
}
.room-list li:hover {
  background: var(--sos-tint);
}
.room-list li:last-child {
  border-bottom: 0;
}
.room-list .name {
  font-weight: 500;
}
.room-list .meta {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: var(--step--1);
  white-space: nowrap;
}
.room-verification-summary {
  display: grid;
  min-width: 0;
  overflow-wrap: anywhere;
  gap: 5px;
  margin: 0 0 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f6fafc;
  color: var(--ink);
  font-size: var(--step--1);
}
.room-verification-line { display: block; }
.approved-verification { color: var(--navy); font-weight: 700; }
.approved-observations { color: var(--muted); }
.followup-indicators { color: var(--wait-ink); }
.latest-observation { border-top: 1px solid var(--line); padding-top: 5px; }
.current-missing { font-weight: 600; color: var(--bad-ink); }
.room-verification-summary.compact {
  gap: 2px;
  margin: 3px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1.45;
}
.room-verification-summary.compact .latest-observation { border-top: 0; padding-top: 0; }
.room-list-copy { display: grid; min-width: 0; gap: 1px; }
.room-list-copy .meta { margin-inline-start: 0; white-space: normal; }
@media (max-width: 640px) {
  .room-list .meta {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* ---------- Scanner ---------- */
.scan-wrap {
  max-width: 720px;
  margin: 0 auto;
}
.camera {
  position: relative;
  background: #0d1b2a;
  border-radius: var(--radius-l);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.camera .frame {
  position: absolute;
  inset: 18% 22%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(13, 27, 42, 0.35);
}
.camera .msg {
  position: absolute;
  inset-inline: 0;
  bottom: 14px;
  text-align: center;
  color: #fff;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.camera.flash-ok .frame {
  border-color: var(--ok);
}
.camera.flash-bad .frame {
  border-color: var(--bad);
}
.camera.flash-wait .frame {
  border-color: var(--wait);
}
.camera .off {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #c9d7e3;
  text-align: center;
  padding: 20px;
}
.result {
  display: flex;
  gap: 14px;
  align-items: center;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 12px;
  border-inline-start: 6px solid;
  background: var(--paper);
}
.result.found {
  border-color: var(--ok);
  background: var(--ok-bg);
}
.result.misplaced {
  border-color: var(--wait);
  background: var(--wait-bg);
}
.result.extra,
.result.forged {
  border-color: var(--bad);
  background: var(--bad-bg);
}
.result.duplicate,
.result.room_ok,
.result.room_other {
  border-color: var(--stale);
  background: var(--stale-bg);
}
.result b {
  display: block;
  color: var(--navy);
}
.result-pop {
  animation: pop 0.28s ease-out;
}
@keyframes pop {
  from {
    transform: scale(0.97);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.tally {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.tally div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.tally b {
  display: block;
  font-size: var(--step-2);
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.tally span {
  font-size: 12px;
  color: var(--muted);
}
.tally .t-ok b {
  color: var(--ok-ink);
}
.tally .t-bad b {
  color: var(--bad-ink);
}
.tally .t-wait b {
  color: var(--wait-ink);
}
.manual {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.manual .input {
  flex: 1;
}
.progress {
  height: 8px;
  border-radius: 99px;
  background: #e3edf5;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--ok);
  transition: width 0.3s;
}

/* Report sections */
.report-group {
  margin-top: 18px;
}
.report-group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.report-group h2 .count {
  font-weight: 700;
  border-radius: 999px;
  padding: 0 10px;
  font-size: var(--step--1);
}
.g-found .count {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
.g-missing .count,
.g-extra .count {
  background: var(--bad-bg);
  color: var(--bad-ink);
}
.g-misplaced .count {
  background: var(--wait-bg);
  color: var(--wait-ink);
}

/* Workflow timeline (a real sequence, so it is numbered by position) */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  position: relative;
  padding: 0 0 18px;
  padding-inline-start: 30px;
}
.timeline li::before {
  content: '';
  position: absolute;
  inset-inline-start: 7px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.timeline li:last-child::before {
  display: none;
}
.timeline li .dot {
  position: absolute;
  inset-inline-start: 0;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--line);
}
.timeline li.done .dot {
  border-color: var(--ok-ink);
  background: var(--ok);
}
.timeline li.now .dot {
  border-color: var(--wait-ink);
  background: var(--wait);
}
.timeline li.stop .dot {
  border-color: var(--bad-ink);
  background: var(--bad);
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr);
}
.login-art {
  background: var(--sos);
  color: #fff;
  padding: clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-art h1 {
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 700;
  max-width: 14ch;
  line-height: 1.1;
}
.login-art p {
  font-size: var(--step-1);
  color: #e4f5fd;
  max-width: 34ch;
}
.login-art .houses {
  position: absolute;
  inset-inline-end: -40px;
  bottom: -10px;
  width: min(520px, 70%);
  opacity: 0.95;
}
.login-form {
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: var(--paper);
}
.login-form form {
  width: min(380px, 100%);
}
.login-form h2 {
  font-size: var(--step-2);
  margin-bottom: 4px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: var(--step--1);
  margin: 18px 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.ms-btn {
  width: 100%;
  background: #fff;
  border: 1px solid #c9d7e3;
  color: var(--ink);
}
.ms-btn:hover {
  border-color: var(--navy);
}
.alert {
  border-radius: var(--radius-s);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: var(--step--1);
}
.alert.bad {
  background: var(--bad-bg);
  color: var(--bad-ink);
}
.alert.ok {
  background: var(--ok-bg);
  color: var(--ok-ink);
}
.alert.info {
  background: var(--sos-tint);
  color: var(--navy);
}
.lang-switch {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
}
@media (max-width: 860px) {
  .login {
    grid-template-columns: 1fr;
  }
  .login-art {
    min-height: 220px;
  }
  .login-art .houses {
    width: 260px;
  }
}

/* ---------- Modal & toast ---------- */
dialog.modal {
  border: 0;
  border-radius: var(--radius-l);
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  box-shadow: 0 20px 60px rgba(13, 27, 42, 0.3);
}
dialog.modal::backdrop {
  background: rgba(13, 27, 42, 0.45);
}
.modal-body {
  padding: 22px 24px;
  max-height: calc(100vh - 160px);
  overflow: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: #f8fbfd;
}
.toasts {
  position: fixed;
  inset-inline-end: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  box-shadow: var(--shadow);
  max-width: 360px;
  animation: pop 0.2s ease-out;
}
.toast.bad {
  background: var(--bad-ink);
}
@media (max-width: 860px) {
  .toasts {
    bottom: 90px;
    inset-inline: 12px;
  }
}

/* ---------- Labels print ---------- */
.labels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.label {
  border: 1px dashed #b9cfe0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  background: #fff;
  break-inside: avoid;
}
.label img {
  width: 120px;
  height: 120px;
}
.label b {
  display: block;
  color: var(--navy);
}
.label small {
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.label .org {
  font-size: 10px;
  color: var(--sos-deep);
}
.labels-page .labels-controls {
  margin-bottom: 12px;
}
.labels-page .labels-actions {
  align-items: flex-start;
}
.labels-page .labels-custom-size:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.labels-page .labels-custom-size[hidden] {
  display: none;
}
.labels-page .labels-output.asset-labels.size-custom {
  grid-template-columns: repeat(auto-fill, var(--custom-label-width));
  align-items: start;
  gap: 5mm;
  overflow-x: auto;
}
.labels-page .asset-label.size-custom {
  --label-width: var(--custom-label-width);
  --label-height: var(--custom-label-height);
}
.labels-print-guidance {
  color: var(--muted);
  font-size: var(--step--1);
  margin: 8px 2px 14px;
}
.labels-output.asset-labels.size-standard {
  grid-template-columns: repeat(auto-fill, 55mm);
  align-items: start;
  gap: 5mm;
}
.labels-output.asset-labels.size-large {
  grid-template-columns: repeat(auto-fill, 75mm);
  align-items: start;
  gap: 5mm;
}
.asset-label {
  --label-width: 55mm;
  --label-height: 25mm;
  position: relative;
  direction: ltr;
  text-align: left;
  width: var(--label-width);
  height: var(--label-height);
  min-height: 0;
  max-height: var(--label-height);
  padding: 1.15mm 1mm 1.1mm 1.5mm;
  border: 1px solid #bbc6cc;
  border-radius: 1.4mm;
  background: #fff;
  color: #171b1e;
  break-inside: avoid;
  overflow: visible;
  font-family: Arial, sans-serif;
  line-height: 1.12;
}
.asset-label.size-large {
  --label-width: 75mm;
  --label-height: 35mm;
  padding: 1.7mm 1.4mm 1.5mm 2mm;
}
.asset-label-main {
  position: absolute;
  top: 1.15mm;
  right: 18mm;
  bottom: 1.1mm;
  left: 1.5mm;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
}
.asset-label-property {
  margin: 0 0 0.5mm;
  text-align: center;
  font-size: 6.4pt;
  line-height: 1.05;
  font-weight: 700;
}
.asset-label-name {
  max-width: 100%;
  margin: 0 0 0.5mm;
  font-size: 5.45pt;
  line-height: 1.05;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.asset-label .asset-label-barcode {
  display: block;
  width: 100%;
  height: 4.3mm;
  margin: 0 0 0.2mm;
  object-fit: fill;
  image-rendering: pixelated;
  flex: 0 0 4.3mm;
}
.asset-label-number {
  width: 100%;
  margin: 0 0 0.4mm;
  text-align: center;
  font-size: 6.1pt;
  line-height: 1.02;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.asset-label-serial {
  max-width: 100%;
  margin: 0.25mm 0;
  font-size: 5.2pt;
  line-height: 1.08;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.labels-output.asset-labels .asset-label-fixed-number {
  max-width: 100%;
  margin: 0.15mm 0;
  font-size: 5.2pt;
  line-height: 1.08;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.labels-output.asset-labels .asset-label-property {
  line-height: 1.2;
}
.labels-output.asset-labels .asset-label.size-standard.has-fixed-number .asset-label-property,
.labels-output.asset-labels .asset-label.size-standard.has-fixed-number .asset-label-name {
  margin-bottom: 0.25mm;
}
.labels-output.asset-labels .asset-label.size-standard.has-fixed-number .asset-label-number {
  margin-bottom: 0.2mm;
}
.labels-output.asset-labels .asset-label.size-standard.has-fixed-number .asset-label-fixed-number {
  margin: 0;
}
.labels-output.asset-labels .asset-label.size-standard.has-fixed-number .asset-label-serial {
  margin: 0.15mm 0;
}
.asset-label-key {
  font-weight: 700;
  white-space: nowrap;
}
.asset-label b {
  display: inline;
  color: inherit;
}
.asset-label-report {
  max-width: 100%;
  margin-top: 0.25mm;
  font-size: 4.65pt;
  line-height: 1.04;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.asset-label .asset-label-qr {
  position: absolute;
  right: 4mm;
  bottom: 1mm;
  display: block;
  width: 13mm;
  height: 13mm;
  object-fit: contain;
  image-rendering: pixelated;
}
.asset-label-side-tag {
  position: absolute;
  top: 0.7mm;
  right: 0.55mm;
  bottom: 0.7mm;
  width: 2.8mm;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: sideways;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: 5pt;
  line-height: 1;
  font-weight: 700;
}
.labels-notice {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
@media print {
  .nav,
  .tabbar,
  .page-head .actions,
  .no-print,
  .toasts {
    display: none !important;
  }
  .shell {
    display: block;
  }
  .main {
    padding: 0;
  }
  body {
    background: #fff;
  }
  .labels {
    grid-template-columns: repeat(4, 1fr);
    gap: 4mm;
  }
  .label {
    border: 1px solid #999;
  }
  .labels-page .page-head,
  .labels-page .labels-controls,
  .labels-page .labels-print-guidance {
    display: none !important;
  }
  .labels-page {
    margin: 0;
    padding: 0;
  }
  .labels-output.asset-labels.size-standard {
    display: grid;
    grid-template-columns: repeat(auto-fill, 55mm);
    gap: 2mm;
    margin: 0 !important;
  }
  .labels-output.asset-labels.size-large {
    display: grid;
    grid-template-columns: repeat(auto-fill, 75mm);
    gap: 2mm;
    margin: 0 !important;
  }
  .labels-page .labels-output.asset-labels.size-custom {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--custom-label-width));
    gap: 2mm;
    margin: 0 !important;
    overflow: visible;
  }
  .labels-output.asset-labels .asset-label {
    width: var(--label-width);
    height: var(--label-height);
    min-height: 0;
    max-height: var(--label-height);
    margin: 0;
    border: 0.2mm solid #222;
    border-radius: 0;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .labels-output.asset-labels .asset-label.size-large {
    width: 75mm;
    height: 35mm;
    min-height: 0;
    max-height: 35mm;
  }
  .labels-output.asset-labels .asset-label-qr,
  .labels-output.asset-labels .asset-label-barcode {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty b {
  display: block;
  color: var(--navy);
  font-size: var(--step-1);
  margin-bottom: 4px;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
  margin: 0;
}
.kv dt {
  color: var(--muted);
  font-size: var(--step--1);
  padding-top: 2px;
}
.kv dd {
  margin: 0;
}
.photo {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.skeleton {
  color: var(--muted);
  padding: 30px 0;
}
.qr-img {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
}
code.hash {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Room-type markers and the one-tap placement workflow */
.grid.site-detail-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
}
@media (max-width: 800px) {
  .grid.site-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.room-type-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.room-marker-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.room-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.97);
  color: var(--navy);
  box-shadow: 0 2px 7px rgba(31, 56, 100, 0.3);
  cursor: pointer;
  outline: none;
  pointer-events: auto;
  z-index: 1;
}
.room-marker.ok {
  border-color: var(--ok-ink);
}
.room-marker.missing {
  border-color: var(--bad-ink);
}
.room-marker.rejected_review {
  border-color: var(--bad-ink);
  background: var(--bad-bg);
}
.room-marker.pending_review,
.room-marker.discrepancies {
  border-color: var(--wait-ink);
  background: var(--wait-bg);
}
.room-marker.stale,
.room-marker.never {
  border-color: var(--wait-ink);
}
.room-marker.counting {
  border-color: var(--sos-deep);
}
.room-marker-glyph {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
}
.room-marker-glyph path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.room-marker-label,
.room-marker-detail {
  position: absolute;
  left: 50%;
  display: block;
  width: max-content;
  max-width: min(160px, calc(100vw - 28px));
  padding: 1px 4px;
  transform: translateX(-50%);
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.room-marker-label {
  top: calc(100% + 2px);
}
.room-marker-detail {
  top: calc(100% + 16px);
  color: var(--muted);
  font-weight: 600;
}
.room-marker:hover,
.room-marker.sel,
.room-marker:focus-visible {
  background: var(--sos-tint);
  border-color: var(--sos-deep);
  box-shadow: 0 0 0 3px rgba(0, 158, 224, 0.24), 0 2px 7px rgba(31, 56, 100, 0.3);
}
.plan.placing {
  cursor: crosshair;
  outline: 3px solid var(--sos);
  outline-offset: -3px;
}
.placement-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  flex: 1 1 100%;
  align-items: end;
}
.placement-icon-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 11px;
  color: var(--navy);
  background: var(--sos-tint);
  border: 1px solid #c4e8f7;
  border-radius: var(--radius-s);
  font-weight: 600;
}
.placement-help {
  flex: 1 1 100%;
  margin: 0;
}
.room-list .room-type-icon {
  color: var(--sos-deep);
  width: 22px;
  height: 22px;
}
@media (max-width: 640px) {
  .placement-controls {
    grid-template-columns: 1fr;
  }
  .placement-controls .placement-icon-preview {
    grid-column: auto;
  }
  .plan-tools .placement-controls {
    min-width: 100%;
  }
  .room-marker-label,
  .room-marker-detail {
    max-width: min(150px, calc(100vw - 24px));
  }
}
