.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

.phone-frame {
  width: 100%;
  max-width: 420px;
  min-height: 720px;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.progress-bar {
  height: 5px;
  background: var(--gridline);
}

.progress-fill {
  height: 100%;
  background: var(--seq-blue-500);
  border-radius: 0 4px 4px 0;
  transition: width 200ms ease;
}

.error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(208, 59, 59, 0.1);
  color: var(--status-critical);
  border: 1px solid rgba(208, 59, 59, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 16px 20px 0;
  font-size: 13px;
}

.error-banner::before {
  content: '!';
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--status-critical);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-hairline);
}

.screen-header h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 17px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--page-plane);
  color: var(--text-primary);
}

.icon-btn:disabled {
  visibility: hidden;
}

.icon-btn.placeholder {
  cursor: default;
}

.screen-body {
  flex: 1;
  padding: 22px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.screen-footer {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-1);
  border-top: 1px solid var(--border-hairline);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.05);
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.field-row:last-child {
  margin-bottom: 0;
}

.screen-body form > .summary-card {
  margin-bottom: 20px;
}

.field-row.inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--page-plane);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
}

.field-row label {
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.field-row.inline label {
  text-transform: none;
  font-size: 14px;
  letter-spacing: normal;
  color: var(--text-primary);
}

.field-row input[type='text'],
.field-row input[type='email'],
.field-row input[type='date'],
.field-row input[type='datetime-local'],
.field-row input[type='number'],
.field-row input[type='password'],
.field-row select,
.field-row textarea {
  border: 1px solid var(--gridline);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface-1);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field-row input:focus,
.field-row select:focus,
.field-row textarea:focus {
  border-color: var(--seq-blue-500);
  box-shadow: 0 0 0 3px var(--seq-blue-150);
}

.field-row input[type='date'],
.field-row input[type='datetime-local'] {
  min-height: 42px;
  color-scheme: light dark;
}

.field-row input[type='date']::-webkit-datetime-edit,
.field-row input[type='datetime-local']::-webkit-datetime-edit {
  font-size: 15px;
  padding: 2px 0;
}

.field-row input[type='date']::-webkit-calendar-picker-indicator,
.field-row input[type='datetime-local']::-webkit-calendar-picker-indicator {
  width: 20px;
  height: 20px;
  opacity: 0.75;
}

.field-row input:disabled {
  background: var(--gridline);
  color: var(--text-muted);
  border-color: transparent;
  cursor: not-allowed;
}

.field-row select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.field-row textarea {
  min-height: 90px;
  resize: vertical;
}

.rating-scale {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rating-caption {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: 2px;
}

.rating-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--gridline);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.rating-dot:hover {
  border-color: var(--seq-blue-500);
}

.rating-dot:active {
  transform: scale(0.94);
}

.rating-dot.active {
  background: var(--seq-blue-500);
  color: #fff;
  border-color: var(--seq-blue-500);
}

.pill-toggle {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-1);
  border: 1px solid var(--gridline);
  border-radius: 10px;
}

.pill {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.pill:hover:not(.active) {
  color: var(--text-primary);
}

.pill.active {
  background: var(--text-secondary);
  color: #fff;
}

.pill[data-pill-value='Y'].active {
  background: var(--status-good);
}

.pill[data-pill-value='A'].active {
  background: var(--status-warning);
}

.pill[data-pill-value='N'].active {
  background: var(--status-critical);
}

.toggle-with-score {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-input {
  width: 64px;
  border: 1px solid var(--gridline);
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
  text-align: center;
  color: var(--text-primary);
  background: var(--surface-1);
}

.fraction-input {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.fraction-input input {
  width: 56px;
  border: 1px solid var(--gridline);
  border-radius: 8px;
  padding: 7px 8px;
  text-align: center;
  color: var(--text-primary);
  background: var(--surface-1);
}

.inventory-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.photo-uploader {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
}

.photo-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}

.photo-thumb-wrap .photo-thumb {
  width: 100%;
  height: 100%;
}

.photo-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--status-critical);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.photo-thumb-remove:hover {
  filter: brightness(1.1);
}

.photo-uploader-btn {
  display: inline-flex;
  width: auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.photo-uploader-btn.uploading {
  opacity: 0.75;
  pointer-events: none;
}

.photo-uploader-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--gridline);
  border-top-color: var(--seq-blue-500);
  border-radius: 50%;
}

.photo-uploader-btn.uploading .photo-uploader-spinner {
  display: inline-block;
  animation: photo-uploader-spin 700ms linear infinite;
}

@keyframes photo-uploader-spin {
  to {
    transform: rotate(360deg);
  }
}

.category-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.category-preview-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  background: var(--page-plane);
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease;
}

a.category-preview-tile:hover {
  border-color: var(--seq-blue-500);
  background: var(--surface-1);
}

.category-preview-icon {
  font-size: 20px;
}

.category-preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  overflow: hidden;
}

.inventory-table th,
.inventory-table td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--gridline);
}

.inventory-table th {
  background: var(--page-plane);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inventory-table tbody tr:last-child td {
  border-bottom: none;
}

.inventory-table input {
  width: 100%;
  border: 1px solid var(--gridline);
  border-radius: 6px;
  padding: 6px;
  color: var(--text-primary);
  background: var(--surface-1);
}

.action-plan-section-row td {
  background: var(--page-plane);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.btn-primary,
.btn-dark,
.btn-secondary {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 120ms ease, transform 80ms ease, background 120ms ease;
}

.btn-primary {
  background: var(--seq-blue-500);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 106, 191, 0.3);
}

.btn-dark {
  background: var(--text-primary);
  color: var(--surface-1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  width: auto;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--gridline);
  padding: 8px 14px;
  font-size: 13px;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--page-plane);
}

.btn-danger-outline {
  width: auto;
  background: transparent;
  color: var(--status-critical);
  border: 1px solid rgba(208, 59, 59, 0.35);
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 120ms ease, transform 80ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--status-critical);
  border-color: var(--status-critical);
  color: #fff;
}

.btn-primary:hover:not(:disabled),
.btn-dark:hover:not(:disabled) {
  filter: brightness(1.12);
}

.btn-primary:active:not(:disabled),
.btn-dark:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.btn-danger-outline:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-dark:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary:focus-visible,
.btn-dark:focus-visible,
.btn-secondary:focus-visible,
.btn-danger-outline:focus-visible,
.field-row input:focus-visible,
.field-row select:focus-visible,
.field-row textarea:focus-visible {
  outline: 2px solid var(--seq-blue-500, #256abf);
  outline-offset: 1px;
}

.summary-card {
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface-1);
}

.summary-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--text-primary);
}

.summary-card p {
  color: var(--text-secondary);
  font-size: 13px;
}

.summary-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gridline);
  font-size: 13px;
}

.summary-card dt {
  color: var(--text-muted);
}

.summary-card dd {
  margin: 0;
  color: var(--text-primary);
  font-weight: 500;
}

.summary-card.success {
  text-align: center;
  border-color: var(--status-good);
  background: rgba(12, 163, 12, 0.08);
}

.summary-card.success h2::before {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--status-good);
  color: #fff;
  font-size: 20px;
}

.score-line {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
  color: var(--text-primary);
}

/* ---------- App-wide surfaces (dataviz reference palette) ---------- */
:root {
  --surface-1: #fcfcfb;
  --page-plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --border-hairline: rgba(11, 11, 11, 0.1);
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --seq-blue-500: #256abf;
  --seq-blue-150: #b7d3f6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-1: #1a1a19;
    --page-plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --border-hairline: rgba(255, 255, 255, 0.1);
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-critical: #d03b3b;
    --seq-blue-500: #3987e5;
    --seq-blue-150: #184f95;
  }
}

body {
  background: var(--page-plane);
  color: var(--text-primary);
}

/* ---------- Nav + page shell (dashboard/audits/admin) ---------- */
.main-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 232px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface-1);
  border-right: 1px solid var(--border-hairline);
  padding: 20px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 24px;
}

.sidebar-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--seq-blue-500);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--page-plane);
}

.sidebar-link.active {
  color: var(--text-primary);
  background: var(--seq-blue-150);
}

.sidebar-group-toggle {
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.sidebar-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 150ms ease;
}

.sidebar-group-toggle[aria-expanded='true'] .sidebar-chevron {
  transform: rotate(90deg);
}

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 4px;
  padding-left: 30px;
}

.sidebar-sublink {
  padding: 8px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-sublink:hover {
  color: var(--text-primary);
  background: var(--page-plane);
}

.sidebar-sublink.active {
  color: var(--text-primary);
  background: var(--seq-blue-150);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
  font-size: 13px;
  color: var(--text-secondary);
  width: 100%;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: var(--page-plane);
  border: 1px solid var(--border-hairline);
}

.sidebar-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--seq-blue-500);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-account-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sidebar-footer-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.sidebar-footer-link-form {
  width: 100%;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.sidebar-footer-link:hover {
  color: var(--text-primary);
  background: var(--page-plane);
}

.sidebar-footer-link.active {
  color: var(--text-primary);
  background: var(--seq-blue-150);
}

.sidebar-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.sidebar-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
}

.link-btn {
  border: none;
  background: none;
  color: var(--seq-blue-500);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn.danger {
  color: var(--status-critical);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.link-btn:focus-visible,
.sidebar-link:focus-visible,
.sidebar-sublink:focus-visible,
.sidebar-footer-link:focus-visible,
.data-table a:focus-visible {
  outline: 2px solid var(--seq-blue-500);
  outline-offset: 2px;
  border-radius: 2px;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-wide {
  max-width: 1180px;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.page h1 {
  font-size: 24px;
  margin: 0 0 20px;
}

.page h2 {
  font-size: 16px;
  margin: 28px 0 12px;
  color: var(--text-secondary);
}

.page .summary-card {
  margin-bottom: 16px;
}

.page .summary-card:last-child {
  margin-bottom: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-btn {
  text-decoration: none;
  display: inline-block;
  width: auto;
  padding: 10px 18px;
}

.filters-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}

.filters-row select,
.filters-row input[type='date'] {
  border: 1px solid var(--gridline);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-1);
  color: var(--text-primary);
}

.filters-row select:focus-visible,
.filters-row input:focus-visible,
.inline-form input:focus-visible,
.inline-form select:focus-visible {
  outline: 2px solid var(--seq-blue-500);
  outline-offset: 1px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  font-size: 14px;
  border-radius: 10px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gridline);
}

.data-table th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover td {
  background: var(--page-plane);
}

.data-table a {
  color: var(--seq-blue-500);
  text-decoration: none;
}

.data-table a:hover {
  text-decoration: underline;
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
}

.status-pill.submitted {
  background: rgba(12, 163, 12, 0.12);
  color: var(--status-good);
}

.status-pill.in_progress {
  background: rgba(250, 178, 25, 0.15);
  color: #8a5a00;
}

/* ---------- Audit detail page ---------- */
.audit-hero {
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  background: var(--surface-1);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.audit-hero-top {
  margin-bottom: 14px;
}

.audit-hero-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.audit-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.audit-meta-grid dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.audit-meta-grid dd {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--page-plane);
  border: 1px solid var(--border-hairline);
}

.score-badge-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.score-badge-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.score-badge.green .score-badge-value { color: var(--status-good); }
.score-badge.yellow .score-badge-value { color: #8a5a00; }
.score-badge.red .score-badge-value { color: var(--status-critical); }

.score-badge.green { background: rgba(12, 163, 12, 0.08); border-color: rgba(12, 163, 12, 0.25); }
.score-badge.yellow { background: rgba(250, 178, 25, 0.12); border-color: rgba(250, 178, 25, 0.3); }
.score-badge.red { background: rgba(208, 59, 59, 0.08); border-color: rgba(208, 59, 59, 0.25); }

.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.category-card-header h3 {
  margin: 0;
}

.category-score-chip {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--page-plane);
  border: 1px solid var(--border-hairline);
  border-radius: 999px;
  padding: 3px 12px;
}

.eval-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.eval-pill.yes {
  background: rgba(12, 163, 12, 0.12);
  color: var(--status-good);
}

.eval-pill.no {
  background: rgba(208, 59, 59, 0.1);
  color: var(--status-critical);
}

.comment-box {
  margin-top: 14px;
  background: var(--page-plane);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 10px 14px;
}

.comment-box-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comment-box p {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
}

.photo-thumb-lg {
  width: 90px;
  height: 90px;
}

.accent-card {
  border-left-width: 4px;
  border-left-style: solid;
}

.accent-card.accent-warning {
  border-left-color: var(--status-warning);
}

.trend-up {
  color: var(--status-good);
  font-weight: 600;
}

.trend-down {
  color: var(--status-critical);
  font-weight: 600;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, var(--surface-1) 0%, var(--page-plane) 65%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-top: 3px solid var(--seq-blue-500);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--seq-blue-500), #1a4d8f);
  box-shadow: 0 8px 20px rgba(37, 106, 191, 0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 6px;
}

.login-card h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  text-align: center;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin: -10px 0 4px;
  font-size: 13px;
}

.login-card input:focus-visible {
  outline: 2px solid var(--seq-blue-500);
  outline-offset: 1px;
}

.login-card .btn-dark {
  margin-top: 4px;
}

/* ---------- Dashboard ---------- */
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.hero-figure {
  font-size: 48px;
  font-weight: 600;
  line-height: 1.1;
}

.hero-figure.green {
  color: var(--status-good);
}

.hero-figure.yellow {
  color: var(--status-warning);
}

.hero-figure.red {
  color: var(--status-critical);
}

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gauge-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
}

.gauge-track {
  fill: none;
  stroke: var(--gridline);
  stroke-width: 16;
  stroke-linecap: round;
}

.gauge-fill {
  fill: none;
  stroke-width: 16;
  stroke-linecap: round;
  transition: stroke-dashoffset 300ms ease;
}

.gauge-fill-green {
  stroke: var(--status-good);
}

.gauge-fill-yellow {
  stroke: var(--status-warning);
}

.gauge-fill-red {
  stroke: var(--status-critical);
}

.gauge-fill-none {
  stroke: var(--text-muted);
}

.gauge-value {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: -18px;
}

.gauge-value-green {
  color: var(--status-good);
}

.gauge-value-yellow {
  color: var(--status-warning);
}

.gauge-value-red {
  color: var(--status-critical);
}

.gauge-value-none {
  color: var(--text-muted);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.outlet-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.outlet-card {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 16px;
}

.outlet-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.green {
  background: var(--status-good);
}

.status-dot.yellow {
  background: var(--status-warning);
}

.status-dot.red {
  background: var(--status-critical);
}

.outlet-card-name {
  font-weight: 600;
  font-size: 14px;
}

.outlet-card-value {
  font-size: 26px;
  font-weight: 600;
}

.outlet-card-value.none {
  color: var(--text-muted);
  font-weight: 500;
}

.outlet-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.category-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 20px 24px;
}

.category-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 80px;
  align-items: center;
  gap: 12px;
}

.category-bar-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.category-bar-track {
  height: 12px;
  border-radius: 6px;
  background: var(--gridline);
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  background: var(--seq-blue-500);
  border-radius: 6px 0 0 6px;
}

.category-bar-value {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  height: 220px;
  padding: 12px 8px 0;
  overflow-x: auto;
}

.bar-chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 0 56px;
  height: 100%;
  min-width: 56px;
}

.bar-chart-value {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.bar-chart-track {
  flex: 1;
  width: 100%;
  max-width: 40px;
  display: flex;
  align-items: flex-end;
  background: var(--gridline);
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.bar-chart-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: height 300ms ease;
}

.bar-chart-bar.green { background: var(--status-good); }
.bar-chart-bar.yellow { background: var(--status-warning); }
.bar-chart-bar.red { background: var(--status-critical); }
.bar-chart-bar.none { background: var(--text-muted); opacity: 0.4; }

.bar-chart-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

/* ---------- Admin ---------- */
.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--gridline);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  border: none;
  background: none;
  padding: 10px 4px;
  margin-right: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 120ms ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--seq-blue-500);
  font-weight: 600;
}

.tab:focus-visible {
  outline: 2px solid var(--seq-blue-500);
  outline-offset: 2px;
  border-radius: 2px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin: -12px 0 20px;
}

.admin-card {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.admin-card h2 {
  font-size: 15px;
  margin: 0 0 14px;
  color: var(--text-primary);
}

[data-admin-panel] > .admin-card:last-child,
[data-admin-panel] > .summary-card:last-child {
  margin-bottom: 0;
}

.divider-top {
  border-top: 1px solid var(--gridline);
  padding-top: 14px;
  margin-top: 14px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.inline-form input,
.inline-form select {
  border: 1px solid var(--gridline);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-1);
  color: var(--text-primary);
}

.inline-form input[name="question_text"] {
  flex: 1;
  min-width: 260px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.question-list {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gridline);
  font-size: 14px;
}

.muted {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mobile sidebar drawer (hidden on desktop) ---------- */
.mobile-header {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Mobile (dashboard/audits/admin — the wizard's phone-frame is
   already fluid width and needs no breakpoint) ---------- */
@media (max-width: 640px) {
  .main-shell {
    flex-direction: column;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-hairline);
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .mobile-header-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-hairline);
    border-radius: 8px;
    background: var(--surface-1);
    color: var(--text-primary);
    cursor: pointer;
  }

  .mobile-header-toggle svg {
    width: 18px;
    height: 18px;
  }

  .mobile-header-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    max-width: 80vw;
    height: 100vh;
    border-right: 1px solid var(--border-hairline);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    z-index: 50;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
  }

  .page {
    padding: 20px 16px 40px;
  }

  .page-header {
    flex-wrap: wrap;
  }

  .filters-row select {
    flex: 1 1 140px;
  }

  .filters-row input[type='date'],
  .filters-row input[type='datetime-local'] {
    flex: 1 1 100%;
  }

  .inline-form {
    flex-wrap: wrap;
  }

  .inline-form input,
  .inline-form select {
    flex: 1 1 140px;
  }

  .inline-form input[type='date'],
  .inline-form input[type='datetime-local'] {
    flex: 1 1 100%;
  }

  .stat-tile,
  .category-bars {
    padding: 16px;
  }

  .hero-figure {
    font-size: 36px;
  }

  .category-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .category-bar-value {
    text-align: left;
  }
}
