/* ============================================================
   Grants QA Check Sheet — Styles
   Designed for mobile-first (phone on factory floor / site)
   ============================================================ */

:root {
  --navy: #1a237e;
  --navy-light: #283593;
  --yellow: #ffd600;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --red: #c62828;
  --red-light: #ffebee;
  --orange: #ef6c00;
  --orange-light: #fff3e0;
  --grey-50: #fafafa;
  --grey-100: #f5f5f5;
  --grey-200: #eeeeee;
  --grey-300: #e0e0e0;
  --grey-600: #757575;
  --grey-800: #424242;
  --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--grey-100);
  color: var(--grey-800);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 12px 80px;
}

/* Header */
.form-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px;
  margin: 0 -12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-header h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.header-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}
.header-badge.pass { background: var(--green); color: white; }
.header-badge.fail { background: var(--red); color: white; }

/* Sections */
.form-section {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section-title {
  background: var(--navy);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  margin: -16px -16px 16px;
  border-radius: 8px 8px 0 0;
}

.subsection {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--yellow);
}

/* Fields */
.field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.field {
  flex: 1;
  min-width: 140px;
}
.field-sm { max-width: 120px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--grey-600);
  margin-bottom: 4px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(26,35,126,0.15);
}
textarea { resize: vertical; }

.hint {
  font-size: 11px;
  color: var(--grey-600);
  font-weight: 400;
}

.warning-inline {
  display: inline-block;
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  margin-top: 4px;
}

/* Checkbox fields */
.field-check {
  display: flex;
  align-items: center;
  min-width: 140px;
}
.field-check label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--grey-800);
  cursor: pointer;
  margin-bottom: 0;
}
.field-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--navy);
  cursor: pointer;
}

/* Tolerance guide box */
.tolerance-guide {
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-left: 4px solid var(--navy);
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.6;
  margin-bottom: 16px;
  border-radius: 0 4px 4px 0;
}

/* Dimension table */
.dim-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.dim-table th {
  background: var(--navy-light);
  color: var(--white);
  font-size: 12px;
  padding: 8px;
  text-align: left;
}
.dim-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--grey-200);
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}
.dim-table input {
  padding: 8px;
  font-size: 14px;
}
.tolerance-status {
  font-size: 13px;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
}
.tolerance-status.pass { color: var(--green); }
.tolerance-status.fail { color: var(--red); background: var(--red-light); border-radius: 4px; }

/* Issues grid */
.issues-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
@media (max-width: 500px) {
  .issues-grid { grid-template-columns: 1fr; }
}
.issues-col h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.issue-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  font-weight: 400 !important;
  color: var(--grey-800) !important;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--grey-100);
}
.issue-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--red);
}

/* Photo capture */
.photo-capture {
  margin: 10px 0 16px;
}
.photo-btn {
  display: inline-block;
  background: var(--grey-100);
  border: 2px dashed var(--grey-300);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s;
}
.photo-btn:hover { background: var(--grey-200); }
.photo-btn input[type="file"] { display: none; }

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.photo-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--grey-200);
}

/* Drawing link */
.drawing-link {
  margin-top: 8px;
}
.drawing-link a {
  display: inline-block;
  background: var(--navy);
  color: var(--yellow);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

/* Submit bar */
.submit-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  padding: 12px 16px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 100;
  text-align: center;
}
.btn-submit {
  background: var(--green);
  color: var(--white);
  border: none;
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  min-width: 250px;
  transition: background 0.15s;
}
.btn-submit:hover { background: #1b5e20; }
.btn-submit:disabled { background: var(--grey-300); cursor: not-allowed; }

/* Overlay */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.overlay-content {
  background: var(--white);
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  text-align: center;
}
.overlay-content h2 { margin: 12px 0 8px; font-size: 20px; }

#resultIcon { font-size: 48px; }
#resultDetails { font-size: 14px; color: var(--grey-600); margin-bottom: 20px; line-height: 1.7; }

.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-link, .btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.btn-link { background: var(--navy); color: var(--white); }
.btn-secondary { background: var(--grey-200); color: var(--grey-800); }

/* Register page styles */
.page-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 20px;
  margin: 0 -12px 16px;
}
.page-header h1 { font-size: 18px; font-weight: 700; }
.page-header p { font-size: 13px; opacity: 0.8; margin-top: 4px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--grey-600);
  margin-top: 4px;
}
.stat-card.warning .stat-value { color: var(--orange); }
.stat-card.danger .stat-value { color: var(--red); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: 13px;
}
.data-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--grey-200);
}
.data-table tr:hover { background: var(--grey-50); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pass { background: var(--green-light); color: var(--green); }
.badge-fail { background: var(--red-light); color: var(--red); }
.badge-open { background: var(--orange-light); color: var(--orange); }
.badge-resolved { background: var(--green-light); color: var(--green); }
.badge-critical { background: var(--red); color: var(--white); }
.badge-high { background: var(--orange); color: var(--white); }
.badge-medium { background: var(--yellow); color: var(--grey-800); }
.badge-low { background: var(--grey-200); color: var(--grey-600); }

.nav-links {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.nav-links a {
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--grey-200);
}
.nav-links a:hover { background: var(--grey-300); }

/* QR Generator */
.qr-output {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
}
.qr-card {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.qr-card img { max-width: 200px; }
.qr-card p { font-size: 12px; font-weight: 600; margin-top: 8px; color: var(--navy); }

/* Form tabs — colour-coded by completion status */
.form-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--white);
  background: var(--navy);
  transition: background 0.15s, opacity 0.15s;
}
.form-tab:hover { background: var(--navy-light); }
.form-tab em { font-weight: 400; font-size: 13px; opacity: 0.7; }

.form-tab.tab-disabled {
  background: var(--grey-300);
  color: var(--grey-600);
  pointer-events: none;
}

/* Status indicator dot */
.form-tab-indicator {
  display: inline-block;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border-radius: 50%;
  background: var(--grey-300);
  border: 2px solid rgba(255,255,255,0.3);
}
.form-tab-indicator.status-done {
  background: var(--green);
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 0 6px rgba(46,125,50,0.5);
}
.form-tab-indicator.status-issues {
  background: var(--orange);
  border-color: rgba(255,255,255,0.5);
  box-shadow: 0 0 6px rgba(239,108,0,0.5);
}
.form-tab-indicator.status-none {
  background: var(--grey-300);
  border-color: rgba(255,255,255,0.2);
}
