/* ============================================================
   Contractor app — surface styles on top of zephyr.css tokens
   ============================================================ */

* { box-sizing: border-box; }

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--fg-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  font-size: 15px;
  line-height: 1.4;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- App chrome ---- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--z-white);
  border-bottom: 1px solid var(--border-subtle);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar__logo {
  height: 32px;
  width: auto;
  display: block;
}
.topbar__role {
  background: rgba(27, 154, 170, 0.10);
  color: var(--z-teal);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
.topbar__spacer { flex: 1; }
.topbar__user {
  font-size: 13px;
  color: var(--fg-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--z-steel);
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.topbar__action {
  background: none;
  border: none;
  color: var(--fg-muted);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.topbar__action:hover { color: var(--z-navy); background: var(--bg-subtle); }

.langtoggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  padding: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.langtoggle button {
  background: none;
  border: none;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: var(--fg-muted);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.langtoggle button.is-on {
  background: white;
  color: var(--z-navy);
  box-shadow: var(--shadow-card);
}

/* ---- Containers ---- */
.page {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.page--wide { max-width: 1280px; }
.page--narrow { max-width: 720px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 80ms ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--z-navy);
  color: white;
}
.btn--primary:hover { background: var(--z-navy-dark); }
.btn--primary[disabled],
.btn--primary.is-disabled {
  background: var(--bg-subtle);
  color: var(--fg-muted);
  cursor: not-allowed;
}
.btn--ghost {
  background: white;
  color: var(--z-navy);
  border-color: var(--border-subtle);
}
.btn--ghost:hover { border-color: var(--z-steel); color: var(--z-navy); }
.btn--text {
  background: none;
  color: var(--fg-link);
  padding: 6px 8px;
}
.btn--text:hover { color: var(--z-navy); }
.btn--amber {
  background: var(--z-amber);
  color: white;
}
.btn--amber:hover { background: #b87f29; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--lg { padding: 14px 22px; font-size: 15px; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
}
.card--flat { box-shadow: none; }
.card--accent { position: relative; overflow: hidden; }
.card--accent::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--z-steel);
}

/* Section label inside card */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--z-steel);
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label .count {
  background: var(--bg-subtle);
  color: var(--fg-muted);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ---- Headings ---- */
h1.page-title {
  font-size: 32px;
  font-weight: 400;
  color: var(--z-charcoal);
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.page-subtitle {
  font-size: 14px;
  color: var(--fg-muted);
  margin: 0 0 24px 0;
}

/* ---- Form ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--z-charcoal);
}
.field__hint {
  font-size: 12px;
  color: var(--fg-muted);
}
.input, .select, .textarea {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--z-charcoal);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
  box-sizing: border-box;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--z-steel);
  box-shadow: 0 0 0 3px rgba(59, 107, 138, 0.15);
  outline: none;
}
.input::placeholder { color: #B5B0AA; }

.field-row { display: grid; gap: 16px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}
.checkbox-row input[type=checkbox] {
  margin-top: 3px;
  accent-color: var(--z-steel);
  width: 16px;
  height: 16px;
}
.checkbox-row .label {
  font-size: 14px;
  font-weight: 500;
  color: var(--z-charcoal);
}
.checkbox-row .desc {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ---- Tables ---- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}
.table td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: rgba(59, 107, 138, 0.04); }

/* ---- Pills ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill--active { background: rgba(27, 154, 170, 0.12); color: var(--z-teal); }
.pill--ready  { background: rgba(212, 149, 58, 0.14); color: #A36F1C; }
.pill--review { background: rgba(59, 107, 138, 0.14); color: var(--z-steel); }
.pill--done   { background: rgba(91, 140, 107, 0.18); color: #4D7857; }
.pill--warn   { background: rgba(192, 57, 43, 0.10); color: #A8392E; }

/* Dot indicators */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot--gray  { background: #C9C5BF; }
.dot--steel { background: var(--z-steel); }
.dot--teal  { background: var(--z-teal); }
.dot--amber { background: var(--z-amber); }
.dot--red   { background: #C0392B; }
.dot--sage  { background: #5B8C6B; }

/* ---- Progress ---- */
.progress {
  position: relative;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  width: 100%;
}
.progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--z-teal);
  border-radius: inherit;
  transition: width 240ms ease;
}
.progress--segmented {
  display: flex;
  background: var(--bg-subtle);
  gap: 2px;
  padding: 0;
}
.progress--segmented > span {
  position: relative;
  flex: 1;
  background: transparent;
  border-radius: 0;
}
.progress--segmented > span.is-on { background: var(--z-teal); }
.progress--segmented > span.is-warn { background: var(--z-amber); }
.progress--segmented > span.is-bad { background: #C0392B; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 39, 68, 0.42);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 100;
  animation: fadein 160ms ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}
.modal {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(26, 39, 68, 0.32);
  padding: 28px;
  position: relative;
  animation: pop 200ms cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--fg-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.modal__close:hover { background: var(--bg-subtle); color: var(--z-navy); }

/* ---- Auth ---- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-primary);
}
.auth-shell__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  max-width: 480px;
  margin-left: auto;
  width: 100%;
}
.auth-shell__hero {
  background: linear-gradient(160deg, var(--z-navy) 0%, var(--z-navy-dark) 100%);
  color: white;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-shell__hero::after {
  content: "";
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 80%;
  height: 80%;
  background-image: url(assets/roofer_installing.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom right;
  opacity: 0.18;
  filter: invert(1) brightness(1.2);
}
.auth-shell__hero > * { position: relative; z-index: 1; }
.auth-shell__logo { height: 44px; width: auto; }
.auth-shell__quote {
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  color: white;
  max-width: 400px;
  letter-spacing: -0.005em;
}
.auth-shell__quote span { color: var(--z-amber-warm); }
.auth-shell__caption {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-shell__hero { display: none; }
  .auth-shell__panel { margin: 0 auto; padding: 32px 24px; }
}

/* ---- Photo upload screen specific ---- */
.upload-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 880px) {
  .upload-shell { grid-template-columns: 1fr; }
}

.sidenav {
  position: sticky;
  top: 76px;
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  font-size: 14px;
}
.sidenav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
  cursor: pointer;
  position: relative;
  font-weight: 500;
}
.sidenav__item:hover { background: var(--bg-subtle); }
.sidenav__item.is-active {
  background: rgba(59, 107, 138, 0.08);
  color: var(--z-navy);
  font-weight: 600;
}
.sidenav__item .count {
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
}
.sidenav__item.is-active .count { color: var(--z-steel); font-weight: 600; }

/* Requirement card */
.req {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 20px;
  align-items: start;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.req.is-done { border-color: rgba(91, 140, 107, 0.4); }
.req.has-issue { border-color: rgba(192, 57, 43, 0.4); box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.06); }
@media (max-width: 720px) {
  .req { grid-template-columns: 1fr; }
}

.req__example {
  position: relative;
  width: 120px;
  height: 90px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  border: 1px dashed #C9C5BF;
}
.req__example.has-img {
  border-style: solid;
  border-color: var(--border-subtle);
}
.req__example .badge {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(26, 39, 68, 0.85);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
  font-weight: 600;
  text-transform: none;
}

.req__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.req__code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--z-steel);
}
.req__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--z-charcoal);
  margin: 0 0 4px 0;
  letter-spacing: -0.005em;
}
.req__desc {
  font-size: 13px;
  color: var(--fg-secondary);
  margin: 0;
  line-height: 1.4;
}
.req__thumbs {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.req__thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background-size: cover;
  background-position: center;
  background-color: var(--bg-subtle);
  position: relative;
  border: 1px solid var(--border-subtle);
}
.req__thumb.is-issue { border-color: #C0392B; box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.18); }
.req__thumb.is-ok { border-color: #5B8C6B; }
.req__thumb .badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid white;
  display: grid;
  place-items: center;
  font-size: 9px;
  color: white;
}
.req__thumb .badge.bad { background: #C0392B; }
.req__thumb .badge.ok { background: #5B8C6B; }

.req__upload-btn {
  border: 2px dashed var(--border-subtle);
  background: white;
  color: var(--fg-secondary);
  border-radius: var(--radius-sm);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 20px;
}
.req__upload-btn:hover { border-color: var(--z-steel); color: var(--z-steel); background: rgba(59, 107, 138, 0.04); }

.req__action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.req__complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: rgba(91, 140, 107, 0.12);
  color: #4D7857;
  border: 1px solid rgba(91, 140, 107, 0.35);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.req__complete-badge svg { color: #4D7857; }
.req__status {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-muted);
}
.req__status.is-done { color: #4D7857; }
.req__status.is-progress { color: var(--z-steel); }
.req__status.is-issue { color: #A8392E; }

/* AI feedback inline */
.ai-note {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(212, 149, 58, 0.08);
  border-left: 3px solid var(--z-amber);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--z-charcoal);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ai-note.is-issue {
  background: rgba(192, 57, 43, 0.06);
  border-left-color: #C0392B;
}
.ai-note.is-ok {
  background: rgba(91, 140, 107, 0.08);
  border-left-color: #5B8C6B;
}
.ai-note__icon {
  font-size: 14px;
  margin-top: 1px;
  flex-shrink: 0;
}

/* Group header */
.req-group {
  margin-bottom: 32px;
}
.req-group__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.req-group__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--z-navy);
  margin: 0;
  letter-spacing: -0.005em;
}
.req-group__meta {
  font-size: 12px;
  color: var(--fg-muted);
  font-weight: 500;
}
.req-group__rule {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
.req-group__items { display: flex; flex-direction: column; gap: 10px; }

/* Sticky upload header */
.upload-header {
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 10;
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

/* AI review panel — drawer */
.ai-banner {
  background: linear-gradient(135deg, var(--z-navy) 0%, var(--z-navy-dark) 100%);
  color: white;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.ai-banner__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(212, 149, 58, 0.18);
  color: var(--z-amber);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ai-banner__body { flex: 1; }
.ai-banner__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px 0;
}
.ai-banner__sub {
  font-size: 13px;
  margin: 0;
  color: rgba(255,255,255,0.7);
}

/* ---- Stat strip ---- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 720px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
.stat-strip__cell {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.stat-strip__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  font-weight: 700;
  margin: 0 0 6px 0;
}
.stat-strip__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--z-navy);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1;
  font-feature-settings: 'tnum' 1;
}
.stat-strip__value.amber { color: var(--z-amber); }
.stat-strip__value.teal { color: var(--z-teal); }
.stat-strip__sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin: 4px 0 0 0;
}

/* ---- Project detail ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 720px) { .detail-grid { grid-template-columns: 1fr; } }

.key-value { display: grid; grid-template-columns: 100px 1fr; row-gap: 10px; column-gap: 16px; font-size: 14px; }
.key-value dt { color: var(--fg-muted); font-weight: 500; }
.key-value dd { margin: 0; color: var(--z-charcoal); }

.tag-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  padding: 3px 8px;
  background: rgba(212, 149, 58, 0.15);
  color: #8E6020;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

/* AI review results page */
.review-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: white;
  margin-bottom: 8px;
}
.review-row__thumb {
  width: 88px;
  height: 66px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  background-size: cover;
  background-position: center;
}
.review-row__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 2px 0;
  color: var(--z-charcoal);
}
.review-row__issue { font-size: 13px; color: var(--fg-secondary); margin: 0; }
.review-row__code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--z-steel);
  margin: 0 0 4px 0;
}

/* Tweaks-specific overrides ------------------------------------ */
.theme-navy .topbar { background: var(--z-navy); border-bottom-color: rgba(255,255,255,0.06); }
.theme-navy .topbar__role { background: rgba(255,255,255,0.08); color: var(--z-amber-warm); }
.theme-navy .topbar__user, .theme-navy .topbar__action { color: rgba(255,255,255,0.7); }
.theme-navy .topbar__action:hover { background: rgba(255,255,255,0.06); color: white; }
.theme-navy .langtoggle { background: rgba(255,255,255,0.08); }
.theme-navy .langtoggle button { color: rgba(255,255,255,0.55); }
.theme-navy .langtoggle button.is-on { background: rgba(255,255,255,0.16); color: white; box-shadow: none; }

/* Layout variation: compact (single column dense list) */
.layout-compact .req {
  grid-template-columns: 60px 1fr auto;
  padding: 12px 16px;
}
.layout-compact .req__example {
  width: 60px;
  height: 45px;
  font-size: 9px;
}
.layout-compact .req__title { font-size: 14px; }
.layout-compact .req__desc { font-size: 12px; }

/* Layout variation: cards-grid */
.layout-grid .req-group__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.layout-grid .req {
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
}
.layout-grid .req__example {
  width: 100%;
  height: 140px;
}
.layout-grid .req__action {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

/* Hide examples */
.examples-off .req__example { display: none; }
.examples-off .req { grid-template-columns: 1fr auto; }
.examples-off.layout-compact .req { grid-template-columns: 1fr auto; }

/* Utility */
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.muted { color: var(--fg-muted); }
.small { font-size: 13px; }
.tnum { font-feature-settings: 'tnum' 1; }
.right { text-align: right; }

/* ──────────────────────────────────────────────────────────────────────────
   Mobile (≤ 540px) — most of our roofers use the upload page on a phone.
   Tighten padding, reduce font sizes, prevent horizontal overflow.
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  body { overflow-x: hidden; }

  /* Topbar: compress spacing, ensure user/language toggle fits */
  .topbar {
    height: 52px;
    padding: 0 12px;
    gap: 8px;
  }
  .topbar__logo { height: 26px; }
  .topbar__role { font-size: 10px; padding: 3px 7px; }
  .topbar__user { font-size: 12px; gap: 6px; }
  .topbar__avatar { width: 26px; height: 26px; font-size: 11px; }
  .topbar__action { padding: 4px 6px; }
  .langtoggle { font-size: 10px; }
  .langtoggle button { padding: 3px 7px; }

  /* Page: tighten outer padding so content has breathing room */
  .page,
  .page--wide,
  .page--narrow {
    padding: 16px 12px 100px;
  }

  /* Upload page header: smaller h1, less sticky padding */
  .upload-header {
    padding: 12px 0 14px;
    margin-bottom: 16px;
  }
  .page-title { font-size: 20px !important; }

  /* Requirement cards: less internal whitespace */
  .req-card { padding: 14px; }
  .req-card__thumb-strip img,
  .req-card__example { max-width: 100% !important; }

  /* Detail page two-col grid collapses to single column (already in 720px
     breakpoint, but reinforce for very small screens) */
  .detail-grid { grid-template-columns: 1fr !important; gap: 12px; }
}

/* ── Verify StageTree (ported from prototype) ── */
.stagetree { background: linear-gradient(180deg, var(--z-navy) 0%, var(--z-navy-dark) 100%); display: flex; flex-direction: column; overflow: hidden; }
.tree-top { padding: 18px 18px 12px; flex-shrink: 0; }
.tree-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tree-brandcol { display: flex; flex-direction: column; gap: 7px; }
.tree-brand { font-size: 13px; font-weight: 700; letter-spacing: .07em; color: var(--z-amber-warm); }
.prop-back { display: inline-flex; align-items: center; gap: 8px; color: #aeb8c6; font-size: 15px; font-weight: 600; }
.prop-back:active { color: #fff; }
.tree-top .bldg-chip { margin-top: 14px; }

.bldg-chip { display: inline-flex; align-items: center; gap: 9px; height: 40px; padding: 0 14px; white-space: nowrap; flex-shrink: 0;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; color: #fff; font-size: var(--fs-chip, 15px); font-weight: 700;
  backdrop-filter: blur(2px); }
.bldg-chip.dark { background: rgba(255,255,255,.1); }
.bldg-chip svg { color: var(--z-amber-warm); }
.bldg-chip .caret { font-size: 11px; opacity: .8; font-weight: 400; }
.bldg-chip:active { background: rgba(255,255,255,.22); }

.tiles { flex: 1; overflow-y: auto; padding: 4px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.tile { position: relative; width: 100%; height: 148px; border-radius: 18px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 4px 16px rgba(0,0,0,.35); text-align: left; flex-shrink: 0; }
.tile:active { transform: scale(.985); }
.tile-img { position: absolute; inset: 0; background-size: cover; background-repeat: no-repeat; background-color: #223;
  filter: saturate(1.03) contrast(1.02); }
.tile-grad { position: absolute; inset: 0; background:
  linear-gradient(90deg, rgba(17,28,51,.86) 0%, rgba(17,28,51,.45) 48%, rgba(17,28,51,.15) 100%); }
.tile-foot { position: absolute; left: 18px; bottom: 16px; right: 18px; display: flex; flex-direction: column; gap: 3px; }
.tile-num { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--z-amber-warm); text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.tile-name { font-size: 30px; font-weight: 700; color: #fff; letter-spacing: -.01em; text-shadow: 0 2px 8px rgba(0,0,0,.55); }
.tile-badge { position: absolute; top: 14px; right: 14px; min-width: 50px; height: 36px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px;
  font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; backdrop-filter: blur(2px); }
.tile-badge.none    { color: #cfd6e0; background: rgba(20,28,44,.7);  border: 1px solid rgba(255,255,255,.28); }
.tile-badge.partial { color: #fff;    background: rgba(212,149,58,.32); border: 1px solid var(--z-amber); }
.tile-badge.ok      { color: #fff;    background: var(--z-teal);        border: 1px solid var(--z-teal); min-width: 0; width: 36px; padding: 0; border-radius: 50%; }
.tile-badge.ok svg { font-size: 17px; }
