:root {
  --space: 4px;
  --radius: 8px;
  --shadow: 0 12px 32px rgba(20, 18, 16, 0.08);
  --bg: #f4f2ee;
  --surface: #ffffff;
  --ink: #161412;
  --muted: #5f5a53;
  --line: #ddd8d0;
  --accent: #c81e3a;
  --accent-hover: #a41830;
  --on-accent: #ffffff;
  --sidebar: #ffffff;
  --sidebar-text: #161412;
  --sidebar-muted: #5f5a53;
  --sidebar-line: #ddd8d0;
  --sidebar-active: #f4f2ee;
  --critical: #b42318;
  --major: #b54708;
  --minor: #a15c07;
  --observation: #175cd3;
  --compliant: #067647;
  --focus: #c81e3a;
  --font: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent);
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
}

.skip:focus {
  left: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  z-index: 80;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--sidebar-line);
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius);
  padding: 4px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 650;
  font-size: 14px;
}

.brand-product {
  font-size: 12px;
  color: var(--sidebar-muted);
}

.brand-fallback {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.nav-search {
  padding: 12px 16px 4px;
}

.nav-search input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

.nav {
  padding: 8px 12px 16px;
  overflow: auto;
  flex: 1;
}

.nav-group {
  margin-top: 16px;
}

.nav-group-label {
  margin: 0 8px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  font-weight: 650;
}

.nav-link,
.nav-link-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-link:hover,
.nav-link-btn:hover {
  background: var(--sidebar-active);
}

.nav-link.is-active {
  background: var(--sidebar-active);
  border-color: var(--sidebar-line);
  font-weight: 650;
}

.sidebar-foot {
  border-top: 1px solid var(--sidebar-line);
  padding: 12px;
}

.user-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: #f4f2ee;
  border: 1px solid var(--sidebar-line);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.user-card small {
  color: var(--sidebar-muted);
  display: block;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav-toggle {
  display: none;
  min-height: 36px;
  min-width: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.main {
  padding: 24px;
}

.muted {
  color: var(--muted);
}

.panel,
.empty-state,
.login-panel,
.kpi,
.table-wrap,
.form-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  padding: 14px 16px;
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.kpi-value {
  margin: 6px 0 0;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.kpi-delta {
  margin: 4px 0 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.kpi-delta.up {
  color: var(--compliant);
}

.kpi-delta.down {
  color: var(--critical);
}

.score-up {
  color: var(--compliant);
  font-weight: 600;
}

.score-down {
  color: var(--critical);
  font-weight: 600;
}

.split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.panel {
  padding: 16px;
}

.panel h2,
.empty-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.empty-state {
  padding: 24px;
  max-width: 40rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.icon-lg {
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.btn,
.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-block {
  width: 100%;
}

.btn:focus-visible,
.nav-link:focus-visible,
.nav-link-btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 8px;
  min-height: 22px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.status-chip .chip-dot {
  background: var(--muted);
}

.status-chip.status-open .chip-dot {
  background: var(--compliant);
}

.status-chip.status-temporarily_closed .chip-dot {
  background: var(--major);
}

.status-chip.status-closed .chip-dot {
  background: var(--critical);
}

.store-status-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.status-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.store-toolbar {
  flex-wrap: wrap;
}

.store-summary {
  margin: 0 0 12px;
}

.store-quick-form {
  max-width: 720px;
}

.store-quick-fields {
  margin-top: 16px;
}

.location-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 240px;
  overflow: auto;
}

.location-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.location-result:hover {
  background: #faf8f5;
}

.location-results li:last-child .location-result {
  border-bottom: 0;
}

.location-hint {
  margin: 8px 0 0;
}

.location-preview {
  margin: 16px 0;
}

.location-preview .osm-map {
  margin-top: 8px;
}

.geocode-preview {
  margin-bottom: 16px;
}

.meta-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.form-section {
  grid-column: 1 / -1;
}

.store-form {
  display: grid;
  gap: 16px;
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.store-row-closed {
  opacity: 0.72;
}

.store-row-temporarily_closed {
  opacity: 0.88;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #faf8f5;
  position: sticky;
  top: 0;
}

.data-table tbody tr:hover {
  background: #faf8f5;
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.message {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-panel {
  width: 100%;
  max-width: 380px;
  padding: 28px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 4px;
}

.login-brand .page-title {
  margin: 0 0 6px;
}

.login-brand .muted {
  margin: 0;
}

.login-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  display: block;
  margin: 0 auto 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.login-form .input,
.login-form input {
  width: 100%;
}

.login-form,
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.table-actions.bin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.table-actions.bin-actions form {
  margin: 0;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field-inline select {
  min-width: 180px;
}

.manager-filter-banner {
  margin-bottom: 16px;
}

.field input,
.field select,
.field textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="date"],
select,
textarea {
  font: inherit;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.form-error,
.field-error {
  color: var(--critical);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
  max-width: 56rem;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
}

.progress {
  height: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.section-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.section-nav a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}

.section-nav a.is-active {
  border-color: var(--ink);
  font-weight: 650;
}

.question {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--surface);
}

.question-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.question.is-incomplete {
  border-color: #c81e3a;
  box-shadow: 0 0 0 1px rgba(200, 30, 58, 0.18);
}

.question.is-incomplete .question-text .req {
  color: #c81e3a;
}

.question-text {
  margin: 0;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.choice {
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.choice span {
  display: inline-flex;
  min-height: 36px;
  min-width: 36px;
  padding: 0 14px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf8f5;
  font-weight: 600;
}

.choice input:checked + span {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.choice[data-tone="pass"] input:checked + span {
  background: var(--compliant);
  border-color: var(--compliant);
}

.choice[data-tone="fail"] input:checked + span {
  background: var(--critical);
  border-color: var(--critical);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.evidence {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf8f5;
}

.evidence-label {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 650;
}

.evidence-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn-file {
  position: relative;
  overflow: hidden;
}

.btn-file input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.evidence-empty {
  margin: 12px 0 0;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.photo-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.photo-tile {
  margin: 0;
}

.photo-tile a {
  display: block;
}

.photo-tile img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.photo-tile figcaption {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.photo-status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 1.2em;
}

.camera-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 18, 16, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
}

.camera-sheet[hidden] {
  display: none;
}

.camera-frame {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.camera-frame h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.camera-frame video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #161412;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
  transform-origin: center center;
}

.camera-preview-wrap {
  overflow: hidden;
  border-radius: var(--radius);
  background: #161412;
  border: 1px solid var(--line);
}

.camera-preview-wrap video {
  border: 0;
  border-radius: 0;
}

.camera-zoom-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.camera-zoom-label input[type="range"] {
  flex: 1;
}

.camera-actions {
  margin-top: 12px;
}

.report-lightbox-stage {
  overflow: auto;
  max-width: 96vw;
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-lightbox-toolbar {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.report-lightbox-toolbar .btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(20, 18, 16, 0.55);
}

.report-lightbox img {
  transform-origin: center center;
  transition: transform 0.12s ease;
}

.report-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.report-grade {
  text-align: right;
  min-width: 120px;
}

.report-grade-mark {
  margin: 4px 0;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.rating-label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.star-rating {
  margin: 6px 0 2px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 2px;
}

.star {
  color: var(--line);
}

.star.is-on {
  color: #c9a227;
}

.rating-value {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.kpi .rating-label {
  margin-bottom: 4px;
}

.kpi .star-rating {
  font-size: 18px;
}

.kpi .rating-value {
  font-size: 16px;
}

.osm-map {
  width: 100%;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf8f5;
  z-index: 0;
}

.osm-map-network {
  height: 420px;
}

.osm-attrib {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.leaflet-control-attribution {
  display: none !important;
}

.leaflet-container {
  font: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sync-chip {
  font-size: 12px;
  color: var(--muted);
}

.sync-chip.is-error {
  color: var(--danger, #c81e3a);
}

.sync-chip.is-success {
  color: #1a7f45;
}

.sync-chip.is-pending {
  color: var(--text);
}

.capture-gps-hint {
  margin-top: 8px;
  font-size: 12px;
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.45);
  z-index: 20;
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  margin-top: 8px;
}

.spark i {
  display: block;
  width: 6px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
}

.overlay {
  display: none;
}

.kpi-row-8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chart-grid,
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.chart-svg {
  width: 100%;
  height: 140px;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf8f5;
}

.chart-legend {
  margin: 8px 0 0;
  font-size: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(92px, 130px) 1fr 52px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f2ee;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.welcome-wrap {
  max-width: 1080px;
  margin: 0 auto;
}

.hero-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 28px 32px;
  margin-bottom: 16px;
}

.hero-panel .login-logo {
  margin: 0 auto 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.hero-panel .empty-title {
  margin-bottom: 8px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.feature-grid .panel h2 {
  margin-bottom: 8px;
}

.feature-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media print {
  .sidebar,
  .nav-toggle,
  .topbar-meta,
  .scrim,
  .camera-sheet,
  .evidence-actions {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .osm-map {
    height: 240px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 88vw);
    transform: translateX(-105%);
    z-index: 30;
    min-height: 100%;
  }

  .sidebar.is-open {
    transform: none;
  }

  .scrim.is-on {
    display: block;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .kpi-row,
  .kpi-row-8,
  .split,
  .form-grid,
  .chart-grid,
  .feature-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .evidence-actions .btn {
    flex: 1 1 160px;
  }

  .topbar,
  .main,
  .login-body {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar > div:first-child {
    flex: 1 1 200px;
    min-width: 0;
  }

  .topbar-meta {
    width: 100%;
  }

  .page-title {
    font-size: clamp(1.1rem, 4vw, 1.375rem);
    word-break: break-word;
  }

  .toolbar .field,
  .filter-toolbar .field,
  .store-toolbar .field {
    flex: 1 1 140px;
    min-width: 0;
  }

  .filter-bar .field {
    max-width: none;
    flex: 1 1 160px;
  }

  .field-inline select {
    min-width: 0;
    width: 100%;
  }

  .work-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .work-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .data-table--scroll {
    min-width: 560px;
  }

  .data-table--cards thead {
    display: none;
  }

  .data-table--cards tbody tr {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .data-table--cards tbody tr:hover {
    background: #faf8f5;
  }

  .data-table--cards td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 7px 0;
    border: 0;
    text-align: right;
  }

  .data-table--cards td::before {
    content: attr(data-label);
    font-weight: 650;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-align: left;
    flex: 0 0 42%;
    max-width: 42%;
  }

  .data-table--cards td.table-actions {
    flex-direction: column;
    align-items: stretch;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px dashed var(--line);
  }

  .data-table--cards td.table-actions .btn,
  .data-table--cards .template-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .data-table--cards .template-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .data-table--cards td.table-actions::before {
    display: none;
  }

  .data-table--cards td[colspan] {
    display: block;
    text-align: center;
  }

  .data-table--cards td[colspan]::before {
    display: none;
  }

  .data-table-row {
    cursor: pointer;
  }
}

/* Templates */
.default-picker {
  margin: 0;
}

.default-radio {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.default-radio input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.default-radio-ui {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  position: relative;
}

.default-radio input:checked + .default-radio-ui {
  border-color: var(--accent);
}

.default-radio input:checked + .default-radio-ui::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.chip-default {
  margin-left: 8px;
  border-color: var(--accent);
  color: var(--accent);
}

.template-row-default {
  background: #fff8f9;
}

.template-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-picker {
  border: 0;
  padding: 0;
  margin: 0;
}

.choice-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
}

.choice-card:has(input:checked) {
  border-color: var(--accent);
  background: #fff8f9;
}

.choice-card small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

/* Tops report */
.report-page .report-hero-tops {
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  background: #141210;
  color: #f4f2ee;
}

.report-hero-brand {
  padding: 20px;
}

.report-brand-mark {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c81e3a;
  font-weight: 700;
}

.report-store-title {
  margin: 0 0 8px;
  font-size: 26px;
  color: #fff;
}

.report-hero-tops .muted {
  color: #a39c93;
}

.report-grade-tops {
  background: #1c1917;
  padding: 20px;
  border-left: 4px solid #c81e3a;
  min-width: 160px;
}

.report-grade-tops .kpi-label,
.report-grade-tops .muted {
  color: #a39c93;
}

.report-grade-tops .rating-label {
  color: #a39c93;
}

.report-grade-mark {
  color: #fff;
}

.grade-a .report-grade-mark {
  color: #4ade80;
}

.grade-b .report-grade-mark {
  color: #86efac;
}

.grade-c .report-grade-mark {
  color: #fde047;
}

.grade-d .report-grade-mark {
  color: #fb923c;
}

.grade-e .report-grade-mark {
  color: #f87171;
}

.star-rating-report {
  font-size: 26px;
}

.star-rating-inline {
  font-size: 14px;
  letter-spacing: 1px;
  margin: 2px 0 0;
}

.star {
  color: #3d3a36;
}

.star.is-on {
  color: #c81e3a;
}

.report-page .star.is-on {
  color: #e8b923;
  text-shadow: 0 0 0 #c81e3a;
}

.rating-max {
  font-size: 0.85em;
  color: var(--muted);
}

.report-grade-tops .rating-max {
  color: #a39c93;
}

.bar-track-tops {
  background: #ece8e2;
}

.bar-fill-tops {
  background: linear-gradient(90deg, #c81e3a, #141210);
}

.report-bar-row {
  align-items: center;
}

.report-bar-label {
  min-width: 140px;
}

.report-bar-score {
  min-width: 44px;
  text-align: right;
}

.report-panel h2 {
  border-bottom: 2px solid #141210;
  padding-bottom: 8px;
}

.report-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.report-section-score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip-critical {
  border-color: var(--critical);
  color: var(--critical);
}

.answer-pass {
  border-color: var(--compliant);
}

.answer-fail {
  border-color: var(--critical);
}

@media print {
  .report-sheet-head-light {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .report-hero-tops,
  .report-sheet-head:not(.report-sheet-head-light) {
    background: #141210 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print,
  .report-toolbar {
    display: none !important;
  }

  .report-document {
    background: #fff;
  }

  .report-sheet {
    box-shadow: none;
    border: 0;
  }
}

/* Standalone inspection report document */
.report-document {
  margin: 0;
  min-height: 100vh;
  background: #ece8e2;
  color: var(--ink);
}

.report-document #main {
  max-width: none;
  padding: 0;
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(250, 248, 245, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.report-toolbar-start,
.report-toolbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-form {
  display: inline-flex;
  margin: 0;
}

.table-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.table-actions form {
  display: inline-flex;
}

.report-sheet-wrap {
  padding: 24px 20px 48px;
}

.report-sheet {
  max-width: 980px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 18px 48px rgba(20, 18, 16, 0.08);
  overflow: hidden;
}

.report-sheet-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 28px 32px;
  background: linear-gradient(135deg, #141210 0%, #1f1b18 55%, #2a1218 100%);
  color: #f4f2ee;
  border-bottom: 4px solid #c81e3a;
}

.report-sheet-head-light {
  background: #fff;
  color: var(--ink);
  border-bottom: 3px solid #c81e3a;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand score"
    "meta score";
  gap: 20px 24px;
}

.report-sheet-brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.report-meta-grid-head {
  grid-area: meta;
}

.report-score-card {
  grid-area: score;
  align-self: start;
  min-width: 148px;
  padding: 16px 18px;
  background: #faf8f5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.report-score-card-label {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-score-card-value {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.report-score-card-unit {
  font-size: 20px;
  font-weight: 600;
  color: var(--muted);
}

.report-score-card-stars {
  margin-top: 10px;
}

.report-score-card-stars .star-rating {
  justify-content: center;
}

.report-score-card-caption {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.report-score-card-empty {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.report-import-notice {
  margin: 0;
  padding: 16px 32px;
  background: #fff8eb;
  border-bottom: 1px solid #f0dfc0;
  color: var(--ink);
}

.report-import-notice-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a5a00;
}

.report-import-notice-list {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 14px;
}

.report-import-notice-list li {
  margin: 4px 0;
}

.report-import-notice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.report-location-caption {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink);
}

.data-table tbody tr.data-table-row {
  cursor: pointer;
}

.data-table tbody tr.data-table-row:hover {
  background: rgba(200, 30, 58, 0.04);
}

.data-table tbody tr.data-table-row.is-selected {
  background: rgba(200, 30, 58, 0.08);
  box-shadow: inset 3px 0 0 #c81e3a;
}

.data-table tbody tr.data-table-row.is-selected a {
  font-weight: 600;
  color: var(--ink);
}

.report-sheet-head-light .report-sheet-title {
  color: var(--ink);
}

.report-sheet-head-light .report-sheet-meta {
  color: var(--muted);
}

.report-meta-grid-light dt {
  color: var(--muted);
}

.report-meta-grid-light dd {
  color: var(--ink);
}

.report-meta-wide {
  grid-column: 1 / -1;
}

.report-sheet-score-light {
  background: #faf8f5;
  border: 1px solid var(--line);
}

.report-sheet-score-light .report-score-label,
.report-sheet-score-light .rating-label,
.report-sheet-score-light .rating-max {
  color: var(--muted);
}

.report-sheet-score-light .report-score-grade,
.report-sheet-score-light .rating-value,
.report-sheet-score-light .report-score-percent {
  color: var(--ink);
}

.report-score-percent {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
}

.report-body-grid-light .report-panel {
  background: #fff;
}

.section-score-pill-light {
  background: #c81e3a;
  color: #fff;
}

.answer-note {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink);
}

.report-panel-dark {
  background: #141210;
  color: #f4f2ee;
}

/* Area Manager capture form */
.capture-shell {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.capture-visit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #c81e3a;
  border-radius: var(--radius);
}

.capture-visit-bar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.capture-form-badge {
  background: #141210;
  color: #fff;
  border: none;
}

.capture-visit-bar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.capture-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.capture-stat strong {
  font-size: 15px;
}

.report-score-card-grade {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #c81e3a;
}

.capture-page .workspace {
  padding-bottom: 88px;
}

.capture-progress {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.capture-progress span {
  display: block;
  height: 100%;
  background: #c81e3a;
}

.capture-section-nav {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.capture-section-link {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.capture-section-link.is-active {
  background: #c81e3a;
  border-color: #c81e3a;
  color: #fff;
}

.capture-section-link.is-active .capture-section-pct {
  opacity: 0.92;
}

.capture-section-pct {
  font-weight: 700;
}

.question-num {
  color: #c81e3a;
  font-weight: 700;
  margin-right: 0.15em;
}

.report-row-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 100%;
}

.report-row-photos .photo-tile {
  flex: 0 0 72px;
  width: 72px;
  margin: 0;
}

.report-photo-btn {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.report-row-photos .photo-tile img {
  width: 72px;
  height: 72px;
  max-width: 72px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.report-photo-missing {
  margin: 6px 0 0;
  font-size: 12px;
}

.report-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 18, 16, 0.88);
}

.report-lightbox[hidden] {
  display: none !important;
}

.report-lightbox img {
  max-width: min(920px, 96vw);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.report-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

body.report-lightbox-open {
  overflow: hidden;
}

@media print {
  .report-row-photos {
    break-inside: avoid;
  }

  .report-row-photos .photo-tile img {
    width: 64px;
    height: 64px;
    max-width: 64px;
  }

  .report-photo-missing {
    display: none;
  }
}

.report-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-width: 640px;
}

.report-photo-grid .photo-tile {
  margin: 0;
}

.report-photo-grid .report-photo-btn,
.report-photo-grid .photo-tile a {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.report-photo-grid .photo-tile img {
  width: 100%;
  max-width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.capture-section-banner {
  background: linear-gradient(135deg, #141210 0%, #2a1218 100%);
  color: #fff;
  border-left: 4px solid #c81e3a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.capture-section-banner h2 {
  margin: 0 0 4px;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
}

.capture-section-banner .muted {
  color: rgba(255, 255, 255, 0.82);
}

.capture-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(20, 18, 16, 0.04);
}

.capture-meta-grid {
  display: grid;
  gap: 14px;
}

.capture-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--ink);
}

.capture-label .req {
  color: #c81e3a;
}

.capture-field input,
.capture-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.capture-field input[readonly],
.capture-field textarea[readonly] {
  background: #faf8f5;
  color: var(--ink);
}

.location-toggle {
  display: flex;
  width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf8f5;
  margin-bottom: 10px;
}

.location-toggle-btn {
  flex: 1;
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}

.location-toggle-btn.is-active {
  background: #c81e3a;
  color: #fff;
  font-weight: 600;
}

.location-toggle-btn-test.is-active {
  background: #9a6700;
  color: #fff;
}

.capture-inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  align-items: center;
}

.capture-gps-btn {
  min-height: 44px;
}

.capture-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #c81e3a;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  min-height: 44px;
}

.capture-action-btn {
  padding: 6px 12px;
  border: 1px solid rgba(200, 30, 58, 0.25);
  border-radius: 999px;
  background: #fff5f6;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.capture-action-btn:hover {
  background: #ffe8ec;
  border-color: rgba(200, 30, 58, 0.45);
}

.capture-action-btn .icon {
  width: 18px;
  height: 18px;
}

.btn-icon .icon {
  width: 16px;
  height: 16px;
}

.action-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  margin-top: 12px;
  box-shadow: 0 8px 24px rgba(20, 18, 16, 0.08);
}

.action-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.action-dialog-icon {
  width: 22px;
  height: 22px;
  color: #c81e3a;
  flex-shrink: 0;
  margin-top: 2px;
}

.action-dialog-title {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
}

.action-dialog-sub {
  margin: 2px 0 0;
  font-size: 13px;
}

.action-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.action-dialog[hidden] {
  display: none;
}

.capture-rating-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.capture-rating-row .choice {
  min-height: 44px;
  min-width: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.capture-rating-row .choice-pass:has(input:checked) {
  border-color: var(--compliant);
  background: #f0fdf4;
}

.capture-rating-row .choice-fail:has(input:checked) {
  border-color: var(--critical);
  background: #fff5f5;
}

.capture-star-picker {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
}

.capture-star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
}

.capture-star-glyph {
  font-size: 38px;
  line-height: 1;
  color: #d8d3cb;
  transition: color 0.12s ease, transform 0.12s ease;
}

.capture-star-btn.is-on .capture-star-glyph,
.capture-star-btn:hover .capture-star-glyph {
  color: #c81e3a;
}

.capture-star-btn.is-on .capture-star-glyph {
  transform: scale(1.05);
}

.capture-page-amr .capture-rating-row .choice,
.capture-page-jamil .capture-rating-row .choice {
  min-width: 88px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}

.capture-page-amr .question-num,
.capture-page-jamil .question-num {
  font-size: 1.05em;
}

.capture-page-jamil .question-text {
  font-size: 16px;
  line-height: 1.35;
}

.template-assign-list {
  display: grid;
  gap: 10px;
  max-width: 520px;
}

.template-assign-row {
  padding: 8px 0;
}

.field-note span {
  font-weight: 600;
  color: var(--ink);
}

.capture-nav-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 12px;
}

.capture-page .capture-nav-bar {
  position: sticky;
  bottom: 0;
  z-index: 12;
  background: rgba(250, 248, 245, 0.96);
  border-top: 1px solid var(--line);
  padding: 12px 0;
  margin-top: 24px;
  backdrop-filter: blur(8px);
}

.capture-page .topbar {
  flex-wrap: wrap;
  gap: 12px;
}

.capture-page .topbar-meta,
.capture-page .topbar > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 768px) {
  .capture-meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .capture-meta-grid .capture-field:first-child,
  .capture-meta-grid .capture-field:nth-child(2) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .capture-shell {
    padding: 0 2px;
  }

  .capture-card {
    padding: 16px 14px;
  }

  .capture-section-banner {
    padding: 14px 16px;
  }

  .location-toggle {
    flex-direction: column;
    border-radius: var(--radius);
  }

  .location-toggle-btn {
    border-radius: calc(var(--radius) - 2px);
  }

  .capture-nav-bar .btn {
    flex: 1;
    justify-content: center;
    min-height: 48px;
  }

  .capture-page .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .capture-page .topbar-meta,
  .capture-page .topbar > div:last-child {
    width: 100%;
  }

  .capture-page .topbar-meta .chip,
  .capture-page .topbar-meta .btn {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }

  .capture-section-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .capture-section-link {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .capture-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .capture-link-btn,
  .capture-inline-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .choice-row.capture-rating-row {
    flex-direction: column;
  }

  .choice-row.capture-rating-row .choice {
    width: 100%;
  }

  .capture-star-picker {
    justify-content: space-between;
    gap: 4px;
  }

  .capture-star-btn {
    flex: 1;
    min-width: 0;
  }

  .photo-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }

  .data-table--cards tbody tr {
    padding: 12px;
  }

  .nav-search input {
    width: 100%;
  }
}

@media (max-width: 860px) {
  .report-sheet-head,
  .report-sheet-head-light {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "score"
      "meta";
  }

  .report-sheet-logo {
    display: flex;
    justify-content: center;
  }

  .report-sheet-score {
    width: 100%;
  }

  .report-body-grid {
    grid-template-columns: 1fr;
  }

  .report-body-grid .report-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-checklist-table {
    min-width: 480px;
  }
}

.report-sheet-logo img {
  display: block;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
}

.report-sheet-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c81e3a;
  font-weight: 700;
}

.report-sheet-title {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  line-height: 1.15;
  color: #fff;
}

.report-sheet-meta {
  margin: 0 0 4px;
  color: #a39c93;
  font-size: 14px;
}

.report-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 20px;
  margin: 18px 0 0;
}

.report-meta-grid dt {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a746c;
}

.report-meta-grid dd {
  margin: 4px 0 0;
  font-weight: 600;
  color: #fff;
}

.report-sheet-score {
  min-width: 168px;
  padding: 18px 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(200, 30, 58, 0.45);
  border-radius: var(--radius);
  text-align: center;
}

.report-score-label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a39c93;
}

.report-score-grade {
  margin: 6px 0 10px;
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #fff;
}

.report-sheet-score .rating-label {
  color: #a39c93;
}

.report-sheet-score .rating-value {
  color: #fff;
}

.report-sheet-score .rating-max {
  color: #a39c93;
}

.report-sheet-score .star {
  color: #3d3a36;
}

.report-sheet-score .star.is-on {
  color: #e8b923;
}

.report-sheet-score.grade-a .report-score-grade {
  color: #4ade80;
}

.report-sheet-score.grade-b .report-score-grade {
  color: #86efac;
}

.report-sheet-score.grade-c .report-score-grade {
  color: #fde047;
}

.report-sheet-score.grade-d .report-score-grade {
  color: #fb923c;
}

.report-sheet-score.grade-e .report-score-grade {
  color: #f87171;
}

.report-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.report-stat {
  padding: 16px 20px;
  background: #faf8f5;
  text-align: center;
}

.report-stat-label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.report-stat-value {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 700;
}

.report-body-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.report-body-grid .report-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
}

.report-body-grid .report-panel:last-child {
  border-right: 0;
}

.report-panel-dark {
  background: #141210;
  color: #f4f2ee;
}

.report-panel-dark h2 {
  color: #fff;
  border-bottom-color: #c81e3a;
}

.report-panel-dark .muted {
  color: #a39c93;
}

.report-score-row {
  margin-bottom: 14px;
}

.report-score-row:last-child {
  margin-bottom: 0;
}

.report-score-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

.report-score-row-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.report-panel-dark .bar-track-tops {
  background: #2a2622;
}

.report-panel-dark .num {
  color: #fff;
  min-width: 44px;
  text-align: right;
}

.osm-map-report {
  height: 260px;
}

.report-panel {
  padding: 24px 28px;
}

.report-checklist-table .row-pass {
  background: rgba(34, 197, 94, 0.04);
}

.report-checklist-table .row-fail {
  background: rgba(239, 68, 68, 0.05);
}

.section-score-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #141210;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.report-sheet-foot {
  padding: 20px 28px;
  background: #faf8f5;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
}

.report-sheet-foot p {
  margin: 0 0 4px;
}

/* report-sheet-head mobile rules consolidated above at 860px */

/* Template editor & admin */
.tab-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tab-btn {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  border-radius: calc(var(--radius) - 2px);
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.is-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(20, 18, 16, 0.08);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.template-editor .panel + .panel {
  margin-top: 12px;
}

.panel-intro h2 {
  margin: 0 0 6px;
}

.panel-danger {
  border-color: #fecaca;
  background: #fffafa;
}

.message-info {
  border-left: 3px solid var(--accent);
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.meta-list dt {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 2px;
}

.meta-list dd {
  margin: 0;
  font-weight: 600;
}

.compact-grid {
  gap: 12px;
}

.span-all {
  grid-column: 1 / -1;
}

.field-check .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.section-card-head {
  margin-bottom: 12px;
}

.section-edit,
.question-edit {
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.section-edit summary,
.question-edit summary {
  cursor: pointer;
  font-weight: 600;
}

.question-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.question-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.question-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.question-text {
  margin: 0;
  font-weight: 600;
}

.question-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.chip-photo {
  border-color: #2563eb;
  color: #2563eb;
}

.chip-warn {
  border-color: var(--critical);
  color: var(--critical);
}

.chip-ok {
  border-color: var(--compliant);
  color: var(--compliant);
}

.sortable-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.sortable-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 6px;
  cursor: grab;
}

.sortable-item.is-dragging {
  opacity: 0.55;
}

.sortable-item-ghost {
  font-size: 13px;
  color: var(--muted);
}

.drag-handle {
  color: var(--muted);
  letter-spacing: -2px;
  user-select: none;
}

.reorder-bar {
  margin-bottom: 12px;
}

.add-question-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.inline-danger {
  margin-top: 8px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-danger {
  border-color: #b91c1c;
  color: #b91c1c;
  background: #fff;
}

.btn-danger:hover {
  background: #fef2f2;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-bar .field {
  max-width: 220px;
}

.field-search {
  flex: 1 1 200px;
  min-width: 0;
}

.user-create-form .field small {
  display: block;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .meta-list {
    grid-template-columns: 1fr;
  }

  .question-card-head {
    flex-direction: column;
  }
}

/* Toggle switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d4d0cb;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 18, 16, 0.18);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(20px);
}

.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-label .toggle-on,
.toggle-switch input:checked ~ .toggle-label .toggle-off {
  display: none;
}

.toggle-switch input:checked ~ .toggle-label .toggle-on {
  display: inline;
}

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 52px;
}

.toggle-switch input:checked ~ .toggle-label {
  color: var(--accent);
}

.toggle-form {
  margin: 0;
}

.template-row-inactive {
  opacity: 0.72;
}

.field-toggle .toggle-field {
  padding-top: 4px;
}

/* Work tabs */
.work-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.work-tab {
  display: inline-block;
  padding: 10px 16px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.work-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.filter-toolbar {
  margin-bottom: 12px;
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.link-btn:hover {
  text-decoration: underline;
}

.block {
  display: block;
}

.row-overdue {
  background: #fff8f8;
}

.upcoming-table th,
.upcoming-table td {
  vertical-align: top;
}

/* Store popup */
.store-popup {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 18, 16, 0.45);
}

.store-popup[hidden] {
  display: none;
}

.store-popup-card {
  width: min(520px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(20, 18, 16, 0.18);
  padding: 18px;
}

.store-popup-head,
.store-popup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.store-popup-head {
  margin-bottom: 12px;
}

.store-popup-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.popup-meta {
  display: grid;
  gap: 10px;
  margin: 0;
}

.popup-meta dt {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 2px;
}

.popup-meta dd {
  margin: 0;
  font-weight: 600;
}

/* Light report fixes — override dark score styles that leak white text */
.report-sheet-score.report-sheet-score-light .report-score-grade,
.report-sheet-score.report-sheet-score-light .rating-value {
  color: var(--ink);
}

.report-sheet-score.report-sheet-score-light .report-score-label,
.report-sheet-score.report-sheet-score-light .rating-label,
.report-sheet-score.report-sheet-score-light .rating-max {
  color: var(--muted);
}

.report-sheet-head-light .report-meta-grid dd {
  color: var(--ink);
}

.report-score-grade-small {
  margin: 10px 0 0;
  font-size: 22px;
  font-weight: 700;
}

.report-body-grid-light .report-panel .num,
.report-body-grid-light .report-score-row-head,
.report-body-grid-light .report-panel h2 {
  color: var(--ink);
}

.report-sheet-score-light .star.is-on {
  color: #c81e3a;
}

/* Inspection actions */
.action-panel-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.action-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.action-status {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.action-status-open { color: #c81e3a; }
.action-status-in_progress { color: #d97706; }
.action-status-completed { color: #15803d; }
.action-status-cancelled { color: var(--muted); }

.action-assignee {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff5f6;
  color: #c81e3a;
  font-size: 13px;
  font-weight: 600;
}

/* Responsive — tablet & phone polish */
@media (min-width: 601px) and (max-width: 900px) {
  .kpi-row,
  .kpi-row-4,
  .kpi-row-8 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .osm-map,
  .osm-map-network {
    height: 220px;
  }

  .store-popup {
    padding: 12px;
  }

  .store-popup-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .store-popup-foot .btn {
    width: 100%;
    justify-content: center;
  }

  .bin-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .bin-actions form {
    display: block;
  }

  .bin-actions .btn {
    width: 100%;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .login-panel {
    margin: 0 auto;
    width: 100%;
  }

  .store-toolbar .field-search {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .report-summary-strip {
    grid-template-columns: 1fr;
  }

  .report-sheet-wrap {
    padding: 8px;
  }

  .report-toolbar {
    padding: 10px 12px;
  }

  .report-toolbar-end,
  .report-toolbar-start {
    width: 100%;
  }

  .report-toolbar-end .btn,
  .report-toolbar-start .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .report-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .capture-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .capture-inline-actions .capture-link-btn,
  .capture-inline-actions .capture-action-btn {
    justify-content: center;
    width: 100%;
  }

  .capture-section-nav {
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .report-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .action-panel-head {
    flex-direction: column;
  }
}

.capture-location-line {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #faf8f5;
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
}

.capture-location-help {
  margin: 8px 0 0;
  font-size: 13px;
}

.capture-location-actions {
  margin-top: 10px;
}

.report-answer-stars .star-rating {
  margin: 0;
}

.report-rating-cell .star-rating {
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .work-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .data-table--cards td {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 4px;
  }

  .data-table--cards td::before {
    flex: none;
    max-width: none;
    margin-bottom: 2px;
  }

  .topbar-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .topbar-meta .btn,
  .topbar-meta .chip {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 860px) {
  .report-checklist-table.data-table--scroll {
    min-width: 0;
  }

  .report-checklist-table thead {
    display: none;
  }

  .report-checklist-table tbody tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .report-checklist-table td {
    display: block;
    padding: 4px 0;
    border: 0;
  }

  .report-checklist-table td:first-child {
    font-weight: 650;
    padding-bottom: 8px;
  }

  .report-rating-cell .star-rating {
    justify-content: flex-start;
  }
}

.signature-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signature-help {
  margin: 0;
  font-size: 13px;
}

.signature-pad-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
}

.signature-pad-canvas {
  display: block;
  width: 100%;
  height: 160px;
  cursor: crosshair;
}

.report-signatures {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.report-signatures-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.report-signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.report-signature-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf8f5;
}

.report-signature-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.report-signature-name {
  margin: 0;
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: 22px;
}

.report-signature-image {
  display: block;
  max-width: 100%;
  max-height: 96px;
}

.report-signature-date {
  margin: 8px 0 0;
  font-size: 12px;
}

.mitti-import-panel {
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .row-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch !important;
  }

  .row-actions form {
    display: block;
    width: 100%;
  }

  .row-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .data-table--cards td.row-actions::before {
    content: "Actions";
    font-weight: 650;
    margin-bottom: 4px;
  }

  .report-signature-grid {
    grid-template-columns: 1fr;
  }
}
