/* Variables */
:root {
  --gray-900: #111;
  --gray-800: #333;
  --gray-700: #555;
  --gray-600: #666;
  --gray-500: #888;
  --gray-400: #aaa;
  --gray-300: #ccc;
  --gray-200: #e5e5e5;
  --gray-100: #f0f0f0;
  --gray-50: #f7f7f7;
  --white: #fff;
  --black: #000;
}

/* Accessibility */
*:focus-visible {
  outline: 2px solid var(--gray-500);
  outline-offset: 2px;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: var(--gray-700);
  background: var(--gray-50);
}

a, button, input, select, textarea, [role="button"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--gray-900);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
  background: var(--gray-900);
  color: var(--white);
  position: relative;
  z-index: 101;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* Connection status indicator */
.connection-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--gray-400);
}
.connection-status.clickable {
  cursor: pointer;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-500);
  flex-shrink: 0;
}

.connection-status.online .connection-dot {
  background: #22c55e;
}

.connection-status.offline .connection-dot {
  background: #dc2626;
}

.connection-status.pending .connection-dot {
  background: #f59e0b;
}

.connection-label {
  display: none;
}

@media (min-width: 480px) {
  .connection-label {
    display: inline;
  }
}

/* User info in header */
.header-user {
  display: none;
}

@media (min-width: 480px) {
  .header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--gray-300);
  }
  .connection-status {
    margin-left: 0;
  }
}

.header-user-name {
  color: var(--white);
}

.badge-role-root {
  background: #7c3aed;
  color: var(--white);
}

.badge-role-admin {
  background: #9333ea;
  color: var(--white);
}

.badge-role-editor {
  background: #2563eb;
  color: var(--white);
}

.badge-role-viewer {
  background: var(--gray-500);
  color: var(--white);
}

/* Login page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--gray-100);
}

.login-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  margin: 1rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Sidebar auth */
.nav-spacer {
  flex: 1;
}

.nav-profile {
  font-weight: 500;
  color: var(--gray-800) !important;
}

.nav-logout {
  margin: 0;
  padding: 0;
}

.nav-logout-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  color: var(--gray-600);
  cursor: pointer;
}

.nav-logout-btn:hover {
  color: var(--gray-900);
}

/* Sidebar */
body.sidebar-open {
  overflow: hidden;
}

.sidebar {
  display: none;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 1rem 0;
}

.sidebar.open {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 3.25rem;
  left: 0;
  bottom: 0;
  width: 240px;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-backdrop.visible {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}

.nav-link {
  display: block;
  padding: 0.5rem 1.25rem;
  color: var(--gray-700);
  text-decoration: none;
}

.nav-link:hover {
  background: var(--gray-100);
}

/* Main content */
.main {
  padding: 1rem;
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Search */
.search-form {
  display: inline-flex;
}

.search-input {
  width: 180px;
  padding: 0.4rem 0.6rem !important;
  font-size: 0.9rem !important;
}

@media (max-width: 600px) {
  .search-input {
    width: 140px;
  }
}

@media (max-width: 480px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  .page-header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input {
    width: 100%;
  }
  .search-form {
    display: flex;
  }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 0;
}

.pagination-info {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.btn-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Searchable combobox */
.combobox {
  position: relative;
  display: inline-block;
}

.combobox-input {
  width: 200px;
  padding: 0.4rem 0.6rem !important;
  font-size: 0.9rem !important;
  cursor: text;
}

.combobox-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 250px;
  overflow-y: auto;
  margin-top: 2px;
}

.combobox.open .combobox-dropdown {
  display: block;
}

.combobox-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.combobox-option:hover {
  background: var(--gray-100);
}

.combobox-option-selected {
  background: var(--gray-100);
  font-weight: 600;
}

.combobox-option-hidden {
  display: none;
}

@media (max-width: 600px) {
  .combobox-input {
    width: 160px;
  }
}

@media (max-width: 480px) {
  .combobox {
    display: block;
  }
  .combobox-input {
    width: 100%;
  }
}

.text-muted {
  color: var(--gray-500);
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 1rem;
  height: 100%;
}

.card + .card {
  margin-top: 0.75rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.card-body {
  margin-top: 0.75rem;
}

.card-with-thumb .card-body {
  margin-top: 0;
  min-width: 0;
}

.card-grid {
  display: grid;
  gap: 0.75rem;
}

.card-grid > .card + .card {
  margin-top: 0;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover .card {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.card-with-thumb {
  display: flex;
  gap: 0.75rem;
  align-items: start;
}

.card-thumbnail {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Site image gallery */
.site-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-gallery-item {
  display: block;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.site-gallery-item:hover {
  border-color: var(--gray-400);
}

.site-gallery-img {
  display: block;
  max-height: 180px;
  max-width: 240px;
  object-fit: cover;
}

.site-gallery-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 80px;
  background: var(--gray-50);
  text-decoration: none;
  color: var(--gray-600);
  font-size: 0.75rem;
}

.pdf-icon {
  font-weight: 700;
  font-size: 1rem;
  color: var(--red-500, #e53e3e);
}

.site-gallery-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
  text-align: center;
}

.site-gallery-editable {
  position: relative;
}

.site-gallery-editable .image-delete {
  position: absolute;
  top: 4px;
  right: 4px;
}

.site-gallery-editable .image-rotate {
  position: absolute;
  top: 4px;
  left: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: var(--white);
  color: var(--gray-700);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}

.btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-primary {
  background: var(--gray-900);
  color: var(--white);
  border-color: var(--gray-900);
}

.btn-primary:hover {
  background: var(--gray-800);
}

.btn-danger {
  color: #5a2d2d;
  border-color: #d4a0a0;
}

.btn-danger:hover {
  background: #f0e8e8;
}

.btn-destructive {
  background: #c53030;
  color: var(--white);
  border-color: #c53030;
}

.btn-destructive:hover:not(:disabled) {
  background: #9b2c2c;
  border-color: #9b2c2c;
}

.btn-destructive:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
}

.form-inline-sm {
  display: flex;
  gap: 0.5rem;
  align-items: end;
}

.form-inline-sm .form-input,
.form-inline-sm .form-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

.form-inline-sm .form-select {
  padding-right: 1.75rem;
}

.form-inline-sm .form-label {
  font-size: 0.75rem;
}

@media (max-width: 480px) {
  .form-inline-sm {
    flex-wrap: wrap;
  }
  .form-inline-sm .form-group {
    flex: 1 1 100%;
  }
  .form-inline-sm .btn {
    width: 100%;
  }
}

.btn-block {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: var(--white);
  color: var(--gray-700);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem;
  padding-right: 2rem;
}

input[type="date"].form-input {
  /* iOS Safari collapses date inputs when -webkit-appearance: none is set;
     pin the box to match the standard .form-input height. */
  min-height: calc(1.5em + 1rem + 2px);
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--gray-500);
  box-shadow: 0 0 0 2px var(--gray-200);
}

.form-static {
  padding: 0.5rem 0;
  color: var(--gray-700);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.form-textarea {
  min-height: 5rem;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.form-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 1.5rem;
  max-width: 640px;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.table th {
  font-weight: 600;
  color: var(--gray-800);
  background: var(--gray-50);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.table tbody tr:hover {
  background: var(--gray-50);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-sm {
  font-size: 0.7rem;
}

.badge-ok {
  background: #e8f0e8;
  color: #2d5a2d;
}

.badge-defect {
  background: #f0e8e8;
  color: #5a2d2d;
}

.badge-na {
  background: var(--gray-200);
  color: var(--gray-600);
}

.badge-draft {
  background: #fef3c7;
  color: #92400e;
}

.badge-unsigned {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #dc2626;
  color: #fff;
}

.badge-info {
  background: #3b82f6;
  color: #fff;
}

.badge-muted {
  background: var(--gray-200);
  color: var(--gray-600);
}

.badge-aktiv {
  background: #e8f0e8;
  color: #2d5a2d;
}

.badge-v {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-o {
  background: var(--gray-200);
  color: var(--gray-700);
}

.badge-h {
  background: var(--gray-800);
  color: var(--white);
}

.badge-type {
  background: var(--gray-100);
  color: var(--gray-600);
  text-transform: none;
  font-weight: 500;
}

.badge-doc {
  background: var(--blue-50, #eff6ff);
  color: var(--primary);
  text-decoration: none;
  text-transform: none;
  font-weight: 500;
}

.badge-gesperrt {
  background: #dc2626;
  color: #fff;
}

.badge-stillgelegt {
  background: var(--gray-400);
  color: var(--white);
}

.equipment-inactive {
  opacity: 0.6;
}

.badge-severity-sofort {
  background: #dc2626;
  color: #fff;
}

.badge-severity-kurzfristig {
  background: #f59e0b;
  color: #333;
}

.badge-severity-mittelfristig {
  background: #3b82f6;
  color: #fff;
}

.badge-severity-langfristig {
  background: var(--gray-500);
  color: var(--white);
}

.badge-event {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-event-success {
  background: #e8f0e8;
  color: #2d5a2d;
}

.badge-event-neutral {
  background: var(--gray-200);
  color: var(--gray-600);
}

.badge-event-danger {
  background: #f0e8e8;
  color: #5a2d2d;
}
.badge-compliance-good {
  background: #e8f0e8;
  color: #2d5a2d;
}
.badge-compliance-warn {
  background: #fef3c7;
  color: #92400e;
}
.badge-compliance-bad {
  background: #f0e8e8;
  color: #5a2d2d;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-error {
  background: #f0e8e8;
  color: #5a2d2d;
  border: 1px solid #d4a0a0;
}

.alert-success {
  background: #e8f0e8;
  color: #2d5a2d;
  border: 1px solid #a0c4a0;
}

.alert-warning {
  background: #fef3cd;
  color: #664d03;
  border: 1px solid #e0c36e;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}

.empty-state p {
  margin-bottom: 1rem;
}

/* Actions bar */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  justify-content: flex-end;
}

.actions-between {
  justify-content: space-between;
}

/* Overflow menu */
.overflow-menu {
  position: relative;
}

.overflow-toggle {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  min-width: 2rem;
}

.overflow-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  z-index: 20;
  overflow: hidden;
}

.overflow-dropdown.open {
  display: block;
}

.overflow-item {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--gray-700);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.overflow-item:hover {
  background: var(--gray-50);
}

.overflow-item-danger {
  color: #dc2626;
}

/* Detail header */
.detail-header {
  margin-bottom: 1.5rem;
}

.detail-header-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .detail-header-top {
    flex-direction: column;
  }
  .detail-header-top .actions {
    width: 100%;
  }
  .detail-meta {
    gap: 0.5rem;
  }
}

.detail-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
}

.detail-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Section */
.section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.section-title-inline {
  border-bottom: none;
  margin: 0;
  padding: 0;
}

/* Wizard */
.conduct-bottom-bar {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 0.5rem 0.75rem max(0.5rem, env(safe-area-inset-bottom));
  margin: 0 -1rem;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.conduct-actions {
  display: none;
}

.wizard-progress {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

/* Equipment step card */
.equipment-step {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.equipment-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  scroll-margin-top: 2rem;
}

.equipment-step-title {
  font-weight: 600;
  color: var(--gray-800);
}

.equipment-step-pos {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Status radio group */
.status-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.status-option {
  flex: 1;
}

.status-option input[type="radio"] {
  display: none;
}

.status-option label {
  display: block;
  text-align: center;
  padding: 0.5rem;
  border: 2px solid var(--gray-200);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}

.status-option label:hover {
  border-color: var(--gray-400);
}

.status-option input[type="radio"]:checked + label {
  border-color: var(--gray-900);
  background: var(--gray-100);
}

/* Defect fields */
.defect-fields {
  display: none;
  background: #faf5f5;
  border: 1px solid #d4a0a0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.defect-fields.visible {
  display: block;
}

.defect-fields-heading {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  color: #5a2d2d;
}

.defect-fields-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

/* Checklist group */
.checklist-group {
  margin-bottom: 1.5rem;
}

.checklist-group-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.checklist-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9375rem;
  color: var(--gray-700);
}

.checklist-item:last-child {
  border-bottom: none;
}

.checklist-hint {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.125rem;
  padding-left: 0.25rem;
}

.checklist-scope {
  font-size: 0.7rem;
  color: var(--gray-500);
  font-style: italic;
}

.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Inspection type guidance box */
.type-guide {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--gray-600);
  line-height: 1.6;
}

.type-guide-row {
  margin-bottom: 0.25rem;
}

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

/* Responsive visibility */
.mobile-only {
  display: block;
}
.desktop-only {
  display: none;
}

/* Mobile equipment cards */
.mobile-equipment-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: inherit;
  background: var(--white);
}

.mobile-equipment-card:hover {
  border-color: var(--gray-300);
}

.mobile-equipment-card .equipment-ref-thumb {
  flex-shrink: 0;
}

.mobile-equipment-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.mobile-equipment-name {
  font-weight: 600;
  color: var(--gray-800);
}

.mobile-equipment-meta {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

/* Mobile inspection cards */
.mobile-inspection-card {
  display: block;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: inherit;
  background: var(--white);
}

.mobile-inspection-card[hidden] {
  display: none;
}

.mobile-inspection-card:hover {
  border-color: var(--gray-300);
}

.mobile-inspection-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mobile-inspection-date {
  font-weight: 600;
  color: var(--gray-800);
}

.mobile-inspection-meta {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 0.125rem;
  display: block;
}

/* Mobile result cards */
.mobile-result-card {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--white);
}

.mobile-result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mobile-result-name {
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
  min-width: 0;
}

.mobile-result-details {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-100);
  font-size: 0.875rem;
}

.mobile-result-field {
  margin-top: 0.25rem;
  color: var(--gray-600);
}

/* Desktop layout */
@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
  .desktop-only {
    display: block;
  }

  .form-card {
    padding: 2rem;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .menu-toggle {
    display: none;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 3.25rem;
    left: 0;
    bottom: 0;
    width: 240px;
    overflow-y: auto;
  }

  .main {
    margin-left: 240px;
    padding: 1.5rem 2rem;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .wizard-step {
    display: block;
  }

  .conduct-bottom-bar {
    position: static;
    box-shadow: none;
    border-top: none;
    margin: 1rem 0 0;
    padding: 0;
  }

  .wizard-nav {
    display: none;
  }

  .conduct-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
  }
}

/* Collapsible form sections */
/*.form-details {*/ /* TODO Delete*/
  /*margin-bottom: 1rem;*/
/*}*/

.form-details[open] {
  padding: 0 0 0 1rem;
}

.form-details[open] > .form-summary {
  margin-left: -1rem;
}

.form-summary {
  font-weight: 600;
  padding: 0.75rem 0rem;
  cursor: pointer;
  list-style: none;
}

.form-summary::before {
  content: '\25B8  ';
}

.form-details[open] > .form-summary::before {
  content: '\25BE  ';
}

.form-summary::-webkit-details-marker {
  display: none;
}

/* Checklist config */
.checklist-config-group {
  margin-bottom: 0.75rem;
}

.checklist-config-group strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.checklist-config-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.9rem;
  cursor: pointer;
}

.checklist-config-item input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* Image gallery */
.image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.image-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-thumb.image-pending {
  opacity: 0.6;
  border-style: dashed;
}

.image-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--gray-800);
  color: var(--white);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-rotate {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--gray-800);
  color: var(--white);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-thumb:hover .image-delete,
.image-thumb:hover .image-rotate,
.site-gallery-editable:hover .image-delete,
.site-gallery-editable:hover .image-rotate {
  opacity: 1;
}

@media (hover: none) {
  .image-thumb .image-delete,
  .image-thumb .image-rotate,
  .site-gallery-editable .image-delete,
  .site-gallery-editable .image-rotate {
    opacity: 1;
  }
}

.image-upload-btn {
  cursor: pointer;
}

.upload-status {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-style: italic;
}

/* Document list */
.document-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: var(--gray-50);
}

.document-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.document-link:hover {
  color: var(--primary);
}

.document-icon {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  background: var(--gray-200);
  color: var(--gray-600);
  flex-shrink: 0;
}

.document-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
}

.document-size {
  font-size: 0.75rem;
  color: var(--gray-500);
  flex-shrink: 0;
}

.document-item .image-delete {
  position: static;
  opacity: 0;
  flex-shrink: 0;
}

.document-item:hover .image-delete {
  opacity: 1;
}

@media (hover: none) {
  .document-item .image-delete {
    opacity: 1;
  }
}

.result-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.result-thumb img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--gray-200);
}

.defect-photo-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Equipment reference thumbnails */
.equipment-ref-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
  display: block;
}

.equipment-ref-thumb-lg {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
}

/* Reorder buttons */
.reorder-cell {
  white-space: nowrap;
  width: 50px;
}

.reorder-btn {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 1.6;
  cursor: pointer;
  color: var(--gray-700);
}

.reorder-btn:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-500);
}

.reorder-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Status indicators (sites list) */
.status-indicators {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--white);
}

.status-dot-ok {
  background: #22c55e;
}

.status-dot-due_soon {
  background: #f59e0b;
  color: #333;
}

.status-dot-overdue {
  background: #dc2626;
}

.status-dot-never {
  background: var(--gray-300);
  color: var(--gray-600);
}

/* Schedule grid (site detail) */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.schedule-card {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.75rem;
  background: var(--white);
}

.schedule-card-overdue {
  border-color: #dc2626;
  background: #fef2f2;
}

.schedule-card-due_soon {
  border-color: #f59e0b;
  background: #fffbeb;
}

.schedule-type {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.schedule-status {
  margin-bottom: 0.375rem;
}

.schedule-detail {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
}

.badge-schedule-ok {
  background: #e8f0e8;
  color: #2d5a2d;
}

.badge-schedule-due_soon {
  background: #fef3cd;
  color: #664d03;
}

.badge-schedule-overdue {
  background: #dc2626;
  color: #fff;
}

.badge-schedule-never {
  background: var(--gray-200);
  color: var(--gray-600);
}

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

@media (max-width: 480px) {
  .schedule-card {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .schedule-type {
    font-size: 0.875rem;
    margin-bottom: 0;
  }
  .schedule-status {
    margin-bottom: 0;
  }
  .schedule-detail {
    width: 100%;
    font-size: 0.75rem;
  }
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--white);
  color: var(--gray-800);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 201;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-counter {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 8px;
}

.lightbox-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: lightbox-spin 0.8s linear infinite;
}

.lightbox--loading .lightbox-spinner {
  display: block;
}

.lightbox--loading .lightbox-img {
  filter: blur(2px);
}

@keyframes lightbox-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Checklist in conduct wizard */
.checklist-section {
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 0;
  margin: 0.5rem 0;
}

.checklist-section-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checklist-progress {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.btn-ok-all {
  margin-left: auto;
  background: #e8f0e8;
  color: #2d5a2d;
  border-color: #c5d9c5;
}
.btn-ok-all:hover {
  background: #d4e8d4;
}

.checklist-type-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.75rem 0 0.25rem;
}

.check-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.check-item:last-child {
  border-bottom: none;
}

.check-item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.check-item-text {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--gray-700);
  min-width: 0;
}

.check-item-radios {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.check-radio {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--gray-600);
  cursor: pointer;
  border-radius: 4px;
  -webkit-tap-highlight-color: transparent;
  min-height: 2.25rem;
}

.check-radio:has(input:checked[value="ok"]) {
  background: var(--ok-bg, #e8f5e9);
  color: var(--ok-text, #2e7d32);
}

.check-radio:has(input:checked[value="defect"]) {
  background: var(--defect-bg, #fce4ec);
  color: var(--defect-text, #c62828);
}

.check-radio input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: currentColor;
}

.check-item-hint {
  font-size: 0.8125rem;
  color: var(--gray-500);
  font-style: italic;
  margin-top: 0.125rem;
}

.check-item-measurement {
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.check-item-defect {
  display: none;
  margin-top: 0.5rem;
  padding-left: 0;
}

.check-item-defect.visible {
  display: block;
}

.check-item-defect .form-textarea {
  font-size: 0.875rem;
}

.check-item-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.badge-check {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 0.75rem;
}

@media (max-width: 480px) {
  .check-item-header {
    flex-direction: column;
    align-items: stretch;
  }
  .check-item-radios {
    justify-content: stretch;
  }
  .check-radio {
    flex: 1;
    justify-content: center;
  }
}

/* Offline button */
.btn-offline {
  color: #1e3a5f;
  border-color: #7da8d4;
  background: #e8f0f8;
}

.btn-offline:hover {
  background: #d0e2f0;
}

.btn-offline.cached {
  color: #2d5a2d;
  border-color: #a0c4a0;
  background: #e8f0e8;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.625rem 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--gray-800);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.3s ease;
}

.toast-success {
  background: #2d5a2d;
}

.toast-error {
  background: #5a2d2d;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Open defects page */
.defect-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--white);
}

.defect-card.defect-urgent {
  border-left: 3px solid #dc2626;
}

.defect-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.defect-age {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.defect-card-site {
  font-weight: 600;
}

.defect-card-site a {
  color: inherit;
  text-decoration: none;
}

.defect-card-equipment {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.defect-card-desc {
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

.defect-card-measure {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.defect-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.defect-urgent td:first-child {
  border-left: 3px solid #dc2626;
}
.defect-card.defect-overdue {
  border-left: 3px solid #f59e0b;
}
.defect-overdue td:first-child {
  border-left: 3px solid #f59e0b;
}

/* Material badges & hints */
.badge-material {
  background: #e5e7eb;
  color: #374151;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
}
.material-hint {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: #0369a1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}

/* Bar chart */
.bar-chart {
  margin: 0.75rem 0;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.bar-label {
  width: 100px;
  font-size: 0.8rem;
  text-align: right;
  flex-shrink: 0;
}
.bar-track {
  flex: 1;
  height: 18px;
  background: var(--gray-100, #f3f4f6);
  border-radius: 2px;
}
.bar-fill {
  height: 100%;
  background: #dc2626;
  border-radius: 2px;
  min-width: 2px;
}
.bar-value {
  width: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.dashboard-site-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.dashboard-site-name {
  font-weight: 600;
  color: var(--text);
}

.dashboard-site-organization {
  font-size: 0.85rem;
  color: var(--muted);
}

.dashboard-site-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

/* Dashboard stat cards (used by admin overview) */
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.dashboard-stat-alert {
  border-color: #dc2626;
  background: #fef2f2;
}

.dashboard-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.dashboard-stat-alert .dashboard-stat-value {
  color: #dc2626;
}

.dashboard-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Admin statistics dashboard */
.admin-summary-grid {
  grid-template-columns: repeat(3, 1fr);
}
.admin-activity-grid {
  grid-template-columns: repeat(3, 1fr);
}
.row-muted {
  opacity: 0.5;
}
@media (max-width: 640px) {
  .admin-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-activity-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 480px) {
  .admin-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Signature pad */
.signature-conduct-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.signature-conduct-header h3 {
  margin: 0;
}

.signature-pad-wrapper canvas {
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  width: 100%;
  height: 200px;
  touch-action: none;
  cursor: crosshair;
  background: #fff;
}
.signature-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.signature-image {
  max-width: 300px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: #fff;
}
.signature-display {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

/* ===== Public pages ===== */

.public-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--gray-900);
  color: var(--white);
}

.public-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.public-nav-link {
  color: var(--gray-300);
  text-decoration: none;
  font-size: 0.875rem;
}

.public-nav-link:hover {
  color: var(--white);
}

@media (max-width: 480px) {
  .public-nav-link {
    display: none;
  }
}

/* Hero */
.hero {
  background: var(--gray-900);
  color: var(--white);
  padding: 3rem 1rem 4rem;
  text-align: center;
}

.hero-inner {
  max-width: 640px;
  margin: 0 auto;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--gray-300);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Hero image */
.hero-image {
  background: var(--gray-900);
  padding: 0 1rem 3rem;
  text-align: center;
}

.hero-image-inner {
  max-width: 960px;
  margin: 0 auto;
}

.hero-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* Features */
.features {
  padding: 3rem 1rem;
}

.features-inner {
  max-width: 900px;
  margin: 0 auto;
}

.features-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2rem;
}

.features-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

.feature-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 1.25rem;
}

.feature-icon {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.5;
}

@media (min-width: 600px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-title {
    font-size: 2.5rem;
  }
}

@media (min-width: 900px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Workflow section */
.workflow {
  background: var(--gray-100);
  padding: 3rem 1rem;
}

.workflow-inner {
  max-width: 720px;
  margin: 0 auto;
}

.workflow-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2rem;
}

.workflow-phase {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--gray-800);
  color: var(--white);
}

.phase-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--white);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.phase-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.phase-body {
  padding: 1.25rem;
}

.phase-points {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.phase-point {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.5;
}

.phase-point strong {
  color: var(--gray-800);
}

.phase-arrow {
  text-align: center;
  font-size: 1.5rem;
  color: var(--gray-400);
  padding: 0.5rem 0;
}

.workflow-steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.workflow-step {
  text-align: center;
  padding: 0.5rem;
  width: 100%;
}

.workflow-step strong {
  display: block;
  font-size: 0.875rem;
  color: var(--gray-800);
  margin-bottom: 0.125rem;
}

.workflow-step p {
  font-size: 0.8125rem;
  color: var(--gray-600);
  line-height: 1.4;
  margin: 0;
}

.step-arrow {
  color: var(--gray-400);
  font-size: 1.25rem;
  transform: rotate(90deg);
}

@media (min-width: 600px) {
  .workflow-steps {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .step-arrow {
    transform: none;
    align-self: center;
    margin-top: 0.5rem;
  }
  .workflow-step {
    flex: 1;
  }
}

/* Benefits section */
.benefits {
  padding: 3rem 1rem;
}

.benefits-inner {
  max-width: 900px;
  margin: 0 auto;
}

.benefits-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2rem;
}

.benefits-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

.benefit-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  border-left: 3px solid var(--gray-800);
}

.benefit-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.benefit-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.benefit-card p {
  font-size: 0.875rem;
  color: var(--gray-600);
  line-height: 1.5;
}

@media (min-width: 600px) {
  .benefits-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Trust section */
.trust-section {
  padding: 2rem 1rem;
  text-align: center;
  border-top: 1px solid var(--gray-200);
}

.trust-inner {
  max-width: 600px;
  margin: 0 auto;
}

.trust-text {
  font-size: 0.95rem;
  color: var(--gray-600);
  font-style: italic;
  line-height: 1.6;
}

/* CTA section */
.cta-section {
  background: var(--gray-100);
  padding: 3rem 1rem;
  text-align: center;
}

.cta-inner {
  max-width: 540px;
  margin: 0 auto;
}

.cta-inner h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.cta-inner p {
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

/* Footer */
.public-footer {
  margin-top: auto;
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 1.5rem 1rem;
}

.public-footer-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.public-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.public-footer-links a {
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.875rem;
}

.public-footer-links a:hover {
  color: var(--white);
}

.public-footer-copy {
  font-size: 0.8125rem;
}

/* Legal pages */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.legal-page h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.legal-updated {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 2rem;
}

.legal-page h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.legal-page p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.legal-page ul {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
}

.legal-page li {
  margin-bottom: 0.25rem;
  line-height: 1.6;
}

.legal-note {
  margin-top: 2rem;
  padding: 1rem;
  background: #fef3cd;
  border: 1px solid #e0c36e;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #664d03;
}

/* Docs page */
.docs-page {
  display: flex;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
  gap: 2rem;
}

.docs-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
  align-self: flex-start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.docs-sidebar-toggle {
  display: none;
}

.docs-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.docs-toc-list li {
  margin-bottom: 0.25rem;
}

.docs-toc-list a {
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.875rem;
  display: block;
  padding: 0.2rem 0;
}

.docs-toc-list a:hover {
  color: var(--gray-900);
  text-decoration: underline;
}

.docs-content {
  flex: 1;
  min-width: 0;
}

.docs-content h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 0.25rem;
}

.docs-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
  scroll-margin-top: 1rem;
}

.docs-content h2:first-of-type {
  margin-top: 1.5rem;
}

.docs-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 1.5rem 0 0.5rem;
}

.docs-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 1.25rem 0 0.5rem;
}

.docs-content p {
  line-height: 1.6;
  color: var(--gray-700);
  font-size: 0.9375rem;
  margin: 0.5rem 0;
}

.docs-content ul,
.docs-content ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  color: var(--gray-700);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.docs-content li {
  margin-bottom: 0.25rem;
}

.docs-content hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 2rem 0;
}

.docs-content a {
  color: var(--gray-800);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-content a:hover {
  color: var(--gray-900);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}

.docs-table th {
  background: var(--gray-100);
  text-align: left;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  color: var(--gray-800);
}

.docs-table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  line-height: 1.5;
}

.docs-table tr:nth-child(even) {
  background: var(--gray-50);
}

/* Mobile: stacked layout with collapsible TOC */
@media (max-width: 767px) {
  .docs-page {
    flex-direction: column;
    gap: 0;
    padding: 1rem;
  }

  .docs-sidebar {
    position: static;
    width: 100%;
    max-height: none;
    margin-bottom: 1rem;
  }

  .docs-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
  }

  .docs-sidebar-arrow {
    transition: transform 0.2s;
  }

  .docs-sidebar.open .docs-sidebar-arrow {
    transform: rotate(180deg);
  }

  .docs-toc-list {
    display: none;
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-top: -1px;
  }

  .docs-sidebar.open .docs-toc-list {
    display: block;
  }

  .docs-table {
    font-size: 0.8125rem;
  }

  .docs-table th,
  .docs-table td {
    padding: 0.375rem 0.5rem;
  }
}

/* Help link (? circle) */
.help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.5rem;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
}

.help-link:hover {
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-400);
}

/* Register page */
.register-page {
  padding: 2rem 1rem;
  max-width: 480px;
  margin: 0 auto;
}

.register-hero {
  display: flex;
  gap: 3rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  align-items: flex-start;
}

.register-benefits {
  flex: 1;
  padding-top: 1rem;
}

.register-headline {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.register-subline {
  color: var(--gray-600);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.register-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

.register-features li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--gray-700);
  line-height: 1.4;
}

.register-features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 700;
}

.register-trust {
  font-size: 0.9rem;
  color: var(--gray-500);
  font-style: italic;
}

.register-form-wrapper {
  flex: 0 0 420px;
}

@media (max-width: 768px) {
  .register-hero {
    flex-direction: column;
    padding: 2rem 1rem;
    gap: 1.5rem;
  }

  .register-headline {
    font-size: 1.375rem;
  }

  .register-form-wrapper {
    flex: none;
    width: 100%;
  }
}

/* Defect summary card */
.defect-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.defect-summary-ok {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.defect-summary-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.defect-summary-label {
  font-weight: 600;
  white-space: nowrap;
}

.defect-summary-badges {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.defect-summary-badges .badge {
  text-decoration: none;
  font-size: 0.75rem;
}

/* Tab bar */
.detail-tabs {
  margin-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
  padding-top: 0;
}

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--gray-700);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-panel {
  display: none;
  padding-top: 1rem;
}

.tab-panel.active {
  display: block;
}

/* In-app viewer overlay (PDFs + images) — prevents iOS PWA dead-ends */
.viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
}

.viewer-overlay[hidden] {
  display: none;
}

.viewer-close {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 2;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  background: var(--white);
  color: var(--gray-900);
  border: none;
  border-radius: 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.viewer-body {
  flex: 1;
  min-height: 0;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  padding-left: max(0, env(safe-area-inset-left));
  padding-right: max(0, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.viewer-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Full-screen blocking overlay shown while submitting an inspection so the
   inspector cannot retry or navigate away during a slow request. */
.submit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.submit-overlay-content {
  background: white;
  padding: 24px 32px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 320px;
  text-align: center;
}

.submit-overlay-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--color-primary, #0066cc);
  border-radius: 50%;
  animation: submit-overlay-spin 0.8s linear infinite;
}

@keyframes submit-overlay-spin {
  to { transform: rotate(360deg); }
}
