:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1a1a1f;
  --muted: #5c6270;
  --accent: #1e6b8a;
  --border: #d8dde6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

.wrap { padding: 0.75rem 1rem 2rem; max-width: 58rem; margin: 0 auto; }

.site-head {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-head .inner {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  max-width: 58rem;
  margin: 0 auto;
}
.brand { font-weight: 700; text-decoration: none; color: var(--accent); }
.site-nav {
  display: none;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.site-nav.open { display: flex; }
.site-nav a {
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: 6px;
  color: var(--text);
}
.site-nav a:hover { background: var(--bg); }

.site-nav .nav-signout {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
}
.site-nav .nav-signout .btn { margin: 0.25rem 0 0 0; }

.stack-form .btn { margin-top: 0.65rem; }
.form-error { color: #9a2b2b; margin: 0 0 0.75rem; font-weight: 600; }

.muted { color: var(--muted); }


@media (min-width: 560px) {
  .site-nav {
    display: flex;
    flex: 1 1 auto;
  }
  .nav-toggle { display: none; }
}
@media (max-width: 559px) {
  .nav-toggle {
    margin-inline-start: auto;
    min-height: 44px;
    padding: 0 0.75rem;
  }
}

h1 { font-size: 1.35rem; margin: 0 0 0.75rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  margin-bottom: 1rem;
}

fieldset { border: none; padding: 0; margin: 0 0 0.85rem; }
label { display: block; font-weight: 600; margin: 0.35rem 0 0.2rem; font-size: 0.92rem; }
input[type=text], input[type=email], input[type=date], input[type=file], input[type=password],
textarea, select {
  width: 100%; max-width: 100%; font-size: 1rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
textarea { min-height: 4.5rem; }

.checkbox-row label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: normal; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 0.9rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  margin: 0.25rem 0.35rem 0.25rem 0;
}
.btn.secondary {
  background: #e9ecf2;
  color: var(--text);
}

table { border-collapse: collapse; width: 100%; overflow-x: auto; display: block; }
@media (min-width: 560px) { table { display: table; } }
th, td { border-bottom: 1px solid var(--border); padding: 0.4rem 0.35rem; text-align: left; }


.batch-nav {
  display: flex; flex-wrap: wrap;
  gap: 0.35rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding-bottom: 0.5rem;
  z-index: 2;
}
.batch-nav a { font-size: 0.92rem; }

.panel { scroll-margin-top: 3rem; }

/* ----- Batch overview: progress strip + expandable steps ----- */
.batch-page-title small {
  font-weight: 600;
  color: var(--muted);
}
.batch-intro {
  margin: -0.25rem 0 1rem;
  font-size: 0.95rem;
}

.batch-progress {
  position: sticky;
  top: 0;
  z-index: 4;
  background: linear-gradient(180deg, var(--bg) 88%, rgba(245, 246, 248, 0));
  padding: 0.5rem 0 0.75rem;
  margin: 0 0 1rem;
}
.batch-progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: stretch;
}
.batch-progress-steps a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  min-height: 44px;
}
.batch-progress-steps a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.batch-progress-li.done a {
  border-color: #9bc4a8;
  background: #f4faf6;
}
.batch-progress-steps .progress-mark {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  line-height: 1;
}
.batch-progress-li.done .progress-mark {
  background: #208040;
}
.batch-progress-steps .progress-label {
  white-space: nowrap;
}
.batch-progress-edit {
  margin: 0.65rem 0 0;
}

.batch-step.card {
  overflow: clip;
}
.batch-step > summary.batch-step-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0.15rem 0 0.25rem;
}
.batch-step > summary.batch-step-summary::-webkit-details-marker {
  display: none;
}
.batch-step > summary.batch-step-summary::marker {
  content: "";
}
.batch-step > summary.batch-step-summary::after {
  content: "";
  display: inline-block;
  margin-inline-start: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-inline-end: 2px solid var(--muted);
  border-block-end: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-0.08rem);
}
.batch-step[open] > summary.batch-step-summary::after {
  transform: rotate(-135deg) translateY(0.12rem);
}
.batch-step-summary .step-status {
  flex-shrink: 0;
  font-weight: 800;
  color: var(--muted);
  min-width: 1.05rem;
  text-align: center;
}
.batch-step-summary .step-badge {
  margin: 0;
}
.batch-step-summary .step-heading-text {
  font-weight: 700;
  font-size: 1.05rem;
}
.batch-step--attention {
  border-color: #c99a59;
  box-shadow: 0 0 0 1px rgba(201, 154, 89, 0.25);
}

.batch-step-body {
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}
.card-inset {
  background: #f8f9fc;
  border: 1px solid #e6e9f0;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
}
.card-inset strong:first-child {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
}
.step-instructions ol {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
}
.step-instructions li {
  margin: 0.3rem 0;
}
.step-flag {
  font-size: 0.93rem;
  padding: 0.55rem 0.65rem;
  margin: 0 0 0.85rem;
  border-radius: 8px;
  background: #fff8f0;
  border: 1px solid #e8cfa3;
}

.issued-doc-details {
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  background: var(--card);
}
.issued-doc-details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.93rem;
}
.issued-html {
  padding-top: 0.65rem;
  font-size: 0.93rem;
  line-height: 1.4;
}

.doc-print-wrap .doc-print-inner {
  scroll-margin-top: 3rem;
}

/* ----- Batch workflow wizard (edit + overview) ----- */
.wizard-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0.55rem 0;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--border);
}
.wizard-track a:not(.btn) {
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
}
.wizard-track a:not(.btn):hover { border-color: var(--accent); color: var(--accent); }

.step-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 1.1rem;
  scroll-margin-top: 3rem;
}
.step-section h2 { margin-top: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.step-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}
.step-lead { margin-top: -0.2rem; margin-bottom: 0.85rem; }
.field-group-label { font-weight: 700; margin: 0.85rem 0 0.35rem; font-size: 0.92rem; }

.checklist-banner { padding: 0.95rem !important; }
.checklist-heading { margin: 0 0 0.35rem; font-size: 1.05rem; }
.checklist { margin: 0; padding-left: 1.2rem; }
.checklist li { margin: 0.25rem 0; font-size: 0.93rem; }
.checklist li.ok { color: #1a6234; }
.checklist li.warn { color: #8a4513; font-weight: 600; }
.checklist li.muted { color: var(--muted); }

.callout {
  font-size: 0.93rem;
  padding: 0.55rem 0.65rem;
  margin: 0.35rem 0 0.75rem;
  border-radius: 8px;
  background: #eef5f9;
  border: 1px solid #cce0eb;
}

.form-actions-sticky {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin-top: 1.25rem;
  padding: 0.85rem 0 0;
  background: linear-gradient(180deg, rgba(245,246,248,0) 0%, var(--bg) 12%);
  border-top: 2px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.compact-dl {
  display: grid;
  grid-template-columns: minmax(9rem, 12rem) 1fr;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.85rem;
}
.compact-dl dt { margin: 0; font-weight: 700; color: var(--muted); font-size: 0.88rem; }
.compact-dl dd { margin: 0; }

.fibre-block { padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.fibre-block:last-of-type { border-bottom: none; }
.fibre-block h3 { font-size: 1rem; margin: 0 0 0.5rem; }

.evidence-inline-form .inline-label { display: block; font-weight: 600; margin-top: 0.35rem; font-size: 0.88rem; }
.evidence-inline-form select, .evidence-inline-form textarea { margin-top: 0.15rem; }

@media print {
  .site-head, .batch-nav, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
  .batch-step.card {
    border: 1px solid #ccc;
    margin-bottom: 1rem;
    page-break-inside: avoid;
  }
  .batch-step--attention {
    box-shadow: none;
  }
  .batch-step-summary::after {
    display: none !important;
  }
  .batch-step-body {
    display: block !important;
    border-top: 1px solid #ddd;
  }
  .step-instructions.card-inset {
    background: #f9f9f9;
    border: 1px solid #ddd;
  }
}
