:root {
  --ink: #151719;
  --muted: #636b73;
  --line: #d9dee3;
  --paper: #ffffff;
  --page: #f4f6f7;
  --accent: #e5e21d;
  --accent-dark: #a8a500;
  --focus: #0f766e;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(21, 23, 25, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #050505;
}

.brand-mark span {
  position: absolute;
  bottom: 12px;
  width: 7px;
  background: #fff;
}

.brand-mark span:nth-child(1) {
  left: 18px;
  height: 26px;
}

.brand-mark span:nth-child(2) {
  left: 29px;
  height: 35px;
}

.brand-mark span:nth-child(3) {
  left: 40px;
  height: 18px;
}

.brand-kicker,
.section-heading p,
.dialog-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.1;
}

.status-pill {
  min-width: max-content;
  padding: 8px 12px;
  border: 1px solid #c9d7d4;
  border-radius: 999px;
  color: #134e4a;
  background: #e7f4f1;
  font-size: 0.9rem;
  font-weight: 700;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 880px);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
  width: min(1240px, calc(100% - 32px));
  margin: 28px auto 54px;
}

.side-panel {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 18px;
}

.progress-wrap,
.privacy-note {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-track {
  height: 9px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ecef;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #111, var(--accent));
  transition: width 160ms ease;
}

.section-nav {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.section-nav a {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.section-nav a:last-child {
  border-bottom: 0;
}

.section-nav a:hover,
.section-nav a:focus {
  background: #fbfbec;
  outline: 0;
}

.privacy-note p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-panel {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.15;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two,
.upload-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid .wide {
  grid-column: 1 / -1;
}

label,
.upload-box,
.details-box {
  display: grid;
  gap: 7px;
}

label span,
.upload-box span {
  color: #31363b;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #b9c1c8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus,
summary:focus {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
  border-color: var(--focus);
}

input:user-invalid,
textarea:user-invalid {
  border-color: var(--danger);
}

.upload-grid {
  display: grid;
  gap: 16px;
}

.upload-box {
  align-content: start;
  min-height: 136px;
  padding: 18px;
  border: 1px dashed #98a3ad;
  border-radius: 8px;
  background: #fbfcfd;
}

.upload-box small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.camera-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.camera-panel h3 {
  margin-bottom: 4px;
}

.camera-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.camera-actions,
.signature-actions,
.dialog-actions,
.submit-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.camera-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.camera-stage video,
.camera-stage canvas {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.camera-placeholder {
  color: #c8d0d8;
  font-weight: 700;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.choice-group legend {
  width: 100%;
  margin-bottom: 4px;
  color: #31363b;
  font-weight: 700;
}

.choice-group label,
.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.choice-group input,
.check-list input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.details-box {
  margin-bottom: 18px;
}

.check-list {
  display: grid;
  gap: 12px;
}

.signature-pad {
  margin-top: 16px;
}

#signatureCanvas {
  width: 100%;
  height: 220px;
  touch-action: none;
  border: 1px solid #aeb7c0;
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent 0, transparent 42px, rgba(21, 23, 25, 0.08) 43px);
}

.signature-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.office-only {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.office-only summary {
  width: fit-content;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.office-only .grid {
  margin-top: 16px;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 8;
  justify-content: flex-end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -12px 30px rgba(21, 23, 25, 0.08);
  backdrop-filter: blur(14px);
}

.primary,
.secondary,
.ghost,
.icon-button {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 800;
}

.primary {
  border: 1px solid #111;
  background: #111;
  color: #fff;
  padding: 10px 16px;
}

.primary:hover {
  background: #2c2f33;
}

.secondary {
  border: 1px solid #111;
  background: var(--accent);
  color: #111;
  padding: 10px 16px;
}

.secondary:hover {
  background: #f2ef3f;
}

.ghost,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.review-dialog {
  width: min(820px, calc(100% - 28px));
  max-height: min(820px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.review-dialog::backdrop {
  background: rgba(10, 12, 14, 0.58);
}

.review-dialog form {
  display: grid;
  max-height: inherit;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin-bottom: 0;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.review-content {
  display: grid;
  gap: 18px;
  overflow: auto;
  padding: 20px 22px;
}

.review-group {
  display: grid;
  gap: 8px;
}

.review-group h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.review-row {
  display: grid;
  grid-template-columns: minmax(140px, 240px) minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid #edf0f2;
}

.review-row span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.review-row span:last-child {
  overflow-wrap: anywhere;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

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

  .side-panel {
    position: static;
  }

  .section-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .section-nav a {
    text-align: center;
  }
}

@media (max-width: 680px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .page-shell {
    width: min(100% - 22px, 1240px);
    margin-top: 14px;
  }

  .grid.two,
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .section-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .submit-bar {
    justify-content: stretch;
  }

  .submit-bar button,
  .dialog-actions button {
    flex: 1 1 180px;
  }

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

/* Privacy and admin additions use the prototype's existing colours and controls. */
.message { overflow-wrap: anywhere; line-height: 1.5; }
.message:empty { display: none; }
.message.error { color: #9d241d; }
.message.success { color: #176138; }
#reviewStatus { margin: 0; padding: 0 22px 16px; }
#submissionStatus { flex: 1; }
.upload-help { color: var(--muted); line-height: 1.5; }
.signature-upload { margin-top: 16px; }
.admin-shell { width: min(100% - 32px, 1240px); margin: 24px auto; }
.admin-card { padding: 24px; margin: 20px 0; border: 1px solid var(--line); border-radius: 16px; background: white; }
#loginForm { max-width: 560px; display: grid; gap: 20px; }
.admin-toolbar, .attachment-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.attachment-row { padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.attachment-row span { min-width: 0; flex: 1 1 240px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; margin-bottom: 16px; }
th, td { padding: 14px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#detail:empty { display: none; }
#detail p, #detail .review-row { overflow-wrap: anywhere; white-space: pre-wrap; }
button:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 680px) {
  .admin-card { padding: 14px; }
  th, td { padding: 8px 4px; font-size: .88rem; }
  .admin-toolbar h2 { font-size: 1.2rem; }
}
