:root {
  --navy-950: #06162e;
  --navy-900: #071f41;
  --navy-800: #0a315f;
  --blue-600: #0b5ed7;
  --blue-100: #eaf3ff;
  --ink: #142033;
  --muted: #667085;
  --line: #d6deea;
  --line-strong: #c3cedd;
  --surface: #ffffff;
  --background: #eef2f7;
  --danger: #a21e1e;
  --focus: #9fc5ff;
  --shadow-soft: 0 10px 30px rgba(16, 24, 40, 0.08);
  --shadow-paper: 0 14px 36px rgba(16, 24, 40, 0.15);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.dark-mode {
  --ink: #e7eef8;
  --muted: #a9b8cc;
  --line: #263a55;
  --line-strong: #38506f;
  --surface: #122138;
  --background: #091424;
  --blue-100: #12345a;
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.28);
  --shadow-paper: 0 14px 36px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 10px 16px;
  color: #fff;
  font-weight: 700;
  background: var(--navy-900);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

button:hover {
  background: var(--navy-800);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
.handle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button:disabled {
  color: var(--muted);
  background: #edf1f6;
  border-color: var(--line);
  cursor: not-allowed;
}

body.dark-mode button:disabled {
  background: #17263d;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 82px;
  color: var(--navy-900);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 6px 18px rgba(7, 31, 65, 0.08);
}

.theme-toggle:hover {
  color: #fff;
}

.theme-toggle span[aria-hidden] {
  font-size: 14px;
  line-height: 1;
}

.mobile-theme-toggle {
  display: none;
  min-width: 38px;
  padding: 7px;
}

body.dark-mode .theme-toggle {
  color: #eef6ff;
  background: #1a2d47;
  border-color: #38506f;
  box-shadow: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 276px;
  padding: 28px 22px 22px;
  color: #fff;
  background: linear-gradient(180deg, var(--navy-950), #082b5c);
  transition: transform 0.24s ease;
}

.sidebar {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.saved-briefs {
  margin-top: 4px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  color: #eaf3ff;
  box-shadow: 0 14px 34px rgba(1, 18, 42, 0.18);
}

.saved-briefs h3 {
  margin: 0 0 12px;
  color: #dff0ff;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.current-profile {
  margin: 8px 0 6px 0;
  padding: 9px 11px;
  background: #173d6e;
  border: 1px solid rgba(159, 197, 255, 0.3);
  border-radius: 8px;
  color: #eef6ff;
  font-weight: 700;
}

.current-profile:empty {
  display: none;
}

.saved-brief-row.is-current {
  background: #1a467d;
  border-color: #78b5ff;
  box-shadow: inset 3px 0 0 #78b5ff, 0 6px 18px rgba(3, 38, 77, 0.25);
}

.saved-briefs label {
  margin-bottom: 8px;
  color: #dceaff;
}

.saved-briefs input[type="text"],
.saved-briefs input[type="email"],
.saved-briefs input[type="date"],
.saved-briefs input:not([type]) {
  background: rgba(255,255,255,0.96);
  color: var(--navy-900);
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 10px 12px;
}

.saved-briefs input#saveName {
  border-radius: 999px;
  padding-left: 16px;
  padding-right: 16px;
  font-weight: 700;
}

#savedBriefsList {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

#savedBriefsList li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #153865;
  border: 1px solid rgba(190, 218, 255, 0.22);
  border-radius: 11px;
}

.brief-row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.brief-row-actions button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 5px;
  border-radius: 9px;
  font-weight: 800;
}

.brief-row-actions button:first-child {
  background: var(--blue-600);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.06);
}

.brief-row-actions button.secondary {
  background: rgba(255,255,255,0.02);
  color: #ffdede;
  border: 1px solid rgba(255,255,255,0.04);
}

.saved-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 10px;
  margin-top: 8px;
}

.saved-actions button {
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  border-radius: 10px;
}

.saved-actions button#saveBrief {
  background: #0b5ed7;
  color: #fff;
  font-weight: 800;
}

.saved-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.saved-tools button {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 6px;
  font-size: 11px;
  line-height: 1.2;
}

.save-progress {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  color: #cfe6ff;
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
}

.save-progress input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  background: #fff;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  border: 2px solid rgba(0,0,0,0.06);
}

.save-progress input[type="checkbox"]:checked {
  background: var(--blue-600);
  color: #fff;
}

.save-progress input[type="checkbox"]:checked::after {
  content: "✓";
  color: #fff;
  font-weight: 900;
}

.saved-brief-row strong {
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.saved-brief-row .muted {
  color: #d5e6fb;
  font-size: 10px;
}

.saved-brief-row button {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 11px;
  background: rgba(0,0,0,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.04);
}

.saved-brief-row button.secondary {
  background: transparent;
  color: #ffdede;
}

.action-load,
.action-edit,
.action-delete {
  min-width: 0;
  padding: 8px 5px;
  border-radius: 10px;
  font-size: 13px;
}

.action-load {
  background: #0b5ed7;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
}

.action-edit {
  background: #254d7e;
  color: #f2f7ff;
  border: 1px solid rgba(207, 226, 255, 0.22);
}

.action-delete {
  background: #4b2f4a;
  color: #ffe7e7;
  border: 1px solid rgba(255, 177, 177, 0.28);
}

.action-load:hover,
.action-edit:hover,
.action-delete:hover,
.saved-brief-row button.secondary:hover {
  filter: brightness(1.08);
}

.sidebar-toggle {
  display: inline-flex;
  align-self: flex-end;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  margin-top: -10px;
  padding: 7px 12px 7px 10px;
  color: #eaf3ff;
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(190, 218, 255, 0.24);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(7, 31, 65, 0.2);
}

.sidebar-toggle:hover {
  color: #fff;
  background: rgba(22, 115, 235, 0.72);
  border-color: rgba(255, 255, 255, 0.42);
}

.sidebar-toggle span:first-child {
  font-size: 22px;
  line-height: 0.7;
}

.case-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 16px;
  background: #f7f9fc;
  border: 1px solid #d8e1ec;
  border-radius: 12px;
}

.contents-document-page {
  height: 1123px;
  min-height: 1123px;
}

.contents-fit {
  width: 100%;
  transform-origin: top left;
}

.witness-document-page {
  height: 1123px;
  min-height: 1123px;
}

.witness-fit {
  width: 100%;
  transform-origin: top left;
}

.witness-summary-table th:first-child,
.witness-summary-table td:first-child {
  width: 54px;
}

.witness-summary-table th:nth-child(2),
.witness-summary-table td:nth-child(2) {
  width: 42%;
}

.witness-document-page.is-compact .doc-heading {
  gap: 13px;
  margin-bottom: 18px;
  padding-bottom: 10px;
}

.witness-document-page.is-compact .doc-heading img {
  width: 48px;
}

.witness-document-page.is-compact .witness-case-card,
.witness-document-page.is-compact .witness-signature-card {
  margin: 16px 0;
  padding: 13px;
}

.witness-document-page.is-compact .off-list li {
  margin-bottom: 7px;
}

.witness-document-page.is-compact .simple-table th,
.witness-document-page.is-compact .simple-table td {
  padding: 7px 8px;
}

.witness-document-page.is-ultra-compact .doc-heading {
  margin-bottom: 12px;
}

.witness-document-page.is-ultra-compact .witness-case-card,
.witness-document-page.is-ultra-compact .witness-signature-card {
  margin: 10px 0;
  padding: 10px 12px;
}

.witness-document-page.is-ultra-compact .off-list {
  font-size: 11px;
}

.witness-document-page.is-ultra-compact .off-list li {
  margin-bottom: 4px;
}

.witness-document-page.is-ultra-compact .off-list em {
  margin-top: 1px;
  font-size: 10px;
}

.witness-document-page.is-ultra-compact .simple-table {
  font-size: 11px;
}

.witness-document-page.is-ultra-compact .simple-table th,
.witness-document-page.is-ultra-compact .simple-table td {
  padding: 5px 7px;
}

.witness-document-page.is-ultra-compact .kv {
  gap: 4px 7px;
  font-size: 11px;
}

.cover-main-fit {
  width: 100%;
  transform-origin: top left;
}

.cover-reference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin: 18px 0;
}

.cover-reference-row .brief-no {
  margin: 0;
}

.cover-copy-label {
  display: flex;
  align-items: center;
  width: min(420px, 100%);
  min-height: 60px;
  overflow: hidden;
  border: 2px solid var(--navy-900);
  border-radius: 3px;
}

.cover-copy-label span {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 13px;
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--navy-900);
}

.cover-copy-label strong {
  padding: 10px 18px;
  color: var(--navy-900);
  font-size: 21px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cover-document-page .officer-grid {
  position: absolute;
  right: 62px;
  bottom: 54px;
  left: 62px;
  margin: 0;
}

.cover-document-page.is-compact .doc-logo {
  width: 72px;
  margin-bottom: 11px;
}

.cover-document-page.is-compact .rule {
  margin: 15px 0;
}

.cover-document-page.is-compact .title strong {
  font-size: 24px;
}

.cover-document-page.is-compact .title span {
  font-size: 20px;
}

.cover-document-page.is-compact .brief-no {
  margin: 0;
}

.cover-document-page.is-compact .cover-reference-row {
  margin: 12px 0;
}

.cover-document-page.is-compact .cover-copy-label {
  min-height: 50px;
}

.cover-document-page.is-compact .cover-copy-label strong {
  font-size: 18px;
}

.cover-document-page.is-compact .info-table th,
.cover-document-page.is-compact .info-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

.cover-document-page.is-compact .card {
  margin: 16px 0 0;
  padding: 13px 15px;
}

.cover-document-page.is-compact .card h4 {
  margin-bottom: 9px;
}

.cover-document-page.is-compact .off-list li {
  margin-bottom: 7px;
}

.cover-document-page.is-compact .off-list em {
  margin-top: 2px;
  font-size: 11px;
}

.cover-document-page.is-ultra-compact .doc-logo {
  width: 60px;
  margin-bottom: 7px;
}

.cover-document-page.is-ultra-compact .force {
  font-size: 10px;
}

.cover-document-page.is-ultra-compact .rule {
  margin: 10px 0;
}

.cover-document-page.is-ultra-compact .title strong {
  font-size: 21px;
}

.cover-document-page.is-ultra-compact .title span {
  font-size: 17px;
}

.cover-document-page.is-ultra-compact .brief-no {
  margin: 0;
}

.cover-document-page.is-ultra-compact .cover-reference-row {
  margin: 8px 0;
}

.cover-document-page.is-ultra-compact .cover-copy-label {
  min-height: 42px;
}

.cover-document-page.is-ultra-compact .cover-copy-label strong {
  font-size: 15px;
}

.cover-document-page.is-ultra-compact .brief-no b {
  margin-top: 2px;
  font-size: 18px;
}

.cover-document-page.is-ultra-compact .info-table {
  font-size: 11px;
}

.cover-document-page.is-ultra-compact .info-table th,
.cover-document-page.is-ultra-compact .info-table td {
  padding: 4px 7px;
}

.cover-document-page.is-ultra-compact .card {
  margin-top: 10px;
  padding: 10px 12px;
}

.cover-document-page.is-ultra-compact .card h4 {
  margin-bottom: 6px;
}

.cover-document-page.is-ultra-compact .split {
  grid-template-columns: 0.75fr 2.5fr;
  gap: 16px;
}

.cover-document-page.is-ultra-compact .off-list {
  padding-left: 18px;
  font-size: 11px;
}

.cover-document-page.is-ultra-compact .off-list li {
  margin-bottom: 4px;
}

.cover-document-page.is-ultra-compact .off-list em {
  margin-top: 1px;
  font-size: 9px;
}

.contents-document-page.is-compact .doc-heading {
  gap: 13px;
  margin-bottom: 18px;
  padding-bottom: 10px;
}

.contents-document-page.is-compact .doc-heading img {
  width: 47px;
}

.contents-document-page.is-compact .case-summary {
  gap: 6px;
  margin-bottom: 12px;
  padding: 11px 14px;
}

.contents-document-page.is-compact .simple-table th,
.contents-document-page.is-compact .simple-table td {
  padding: 6px 8px;
}

.contents-document-page.is-compact .contents-table .check {
  height: 36px;
}

.contents-document-page.is-compact .section-label {
  margin-top: 17px;
  margin-bottom: 9px;
}

.contents-document-page.is-compact .acknowledgement {
  margin-top: 15px;
  padding-top: 14px;
  padding-bottom: 15px;
}

.contents-document-page.is-ultra-compact .doc-heading {
  margin-bottom: 13px;
}

.contents-document-page.is-ultra-compact .case-summary {
  margin-bottom: 9px;
  padding: 8px 12px;
}

.contents-document-page.is-ultra-compact .simple-table {
  font-size: 11px;
}

.contents-document-page.is-ultra-compact .simple-table th,
.contents-document-page.is-ultra-compact .simple-table td {
  padding: 4px 7px;
}

.contents-document-page.is-ultra-compact .contents-table .check {
  height: 29px;
}

.contents-document-page.is-ultra-compact .empty-checkbox {
  width: 15px;
  height: 15px;
}

.contents-document-page.is-ultra-compact .section-label {
  margin-top: 12px;
  margin-bottom: 7px;
}

.contents-document-page.is-ultra-compact .acknowledgement {
  margin-top: 10px;
}

.case-summary div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #12263f;
}

.case-label {
  color: #6c7b97;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.acknowledgement {
  margin-top: 24px;
  padding: 19px 20px 21px;
  background: linear-gradient(145deg, #fbfcfe, #f6f8fb);
  border: 1px solid #d6dee8;
  border-radius: 10px;
}

.ack-heading {
  margin: 0 0 17px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dce3eb;
  color: #738195;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
}

.ack-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 146px;
  gap: 25px;
  align-items: stretch;
}

.ack-without-stamp .ack-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 42px;
}

.ack-party {
  display: grid;
  grid-template-rows: auto repeat(4, 1fr);
  gap: 13px;
  min-width: 0;
}

.ack-party-title {
  min-height: 28px;
  color: #192a40;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 800;
}

.ack-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: end;
  color: #27364a;
  font-size: 10px;
  white-space: nowrap;
}

.ack-write-line,
.ack-date-line {
  display: block;
  min-width: 0;
  height: 12px;
  border-bottom: 1px solid #7d8998;
}

.ack-date-field {
  grid-template-columns: auto minmax(20px, 0.65fr) auto minmax(20px, 0.65fr) auto minmax(28px, 1fr);
  gap: 6px;
}

.ack-date-field b {
  color: #455468;
  font-weight: 600;
}

.ack-stamp {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px;
  border: 1.5px dashed #526174;
  border-radius: 5px;
  color: #26364a;
  opacity: 0.14;
  text-align: center;
  text-transform: uppercase;
}

.ack-stamp span,
.ack-stamp strong {
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: 0.035em;
}

.ack-stamp strong {
  font-weight: 800;
}

.acknowledgement-settings {
  overflow: hidden;
}

.setting-row,
.setting-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 14px 2px;
  border-bottom: 1px solid #e4eaf2;
}

.setting-select {
  color: inherit;
}

.setting-row:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.setting-copy,
.setting-select > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.setting-copy strong,
.setting-select strong {
  color: #24364f;
  font-size: 12px;
  font-weight: 750;
}

.setting-copy span,
.setting-select small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.setting-select select {
  width: 176px;
  min-height: 38px;
  flex: 0 0 176px;
  margin: 0;
  padding: 8px 30px 8px 10px;
  font-size: 11px;
}

.setting-select:has(select:disabled),
.setting-row:has(.switch input:disabled) {
  opacity: 0.48;
}

.setting-select select:disabled,
.switch input:disabled + span {
  cursor: not-allowed;
}

.copy-designation-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.copy-designation-picker legend {
  margin-bottom: 8px;
  color: #34445a;
  font-size: 11px;
  font-weight: 800;
}

.copy-designation-picker label {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

.copy-designation-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.copy-designation-picker span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 9px 10px;
  color: #40546c;
  font-size: 11px;
  font-weight: 800;
  background: #f5f8fc;
  border: 1px solid #cbd7e5;
  border-radius: 9px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.copy-designation-picker input:checked + span {
  color: #0757b2;
  background: #eaf3ff;
  border-color: #78adea;
  box-shadow: inset 0 0 0 1px #78adea;
}

.copy-designation-picker input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.copy-designation-section.is-disabled .copy-designation-picker {
  opacity: 0.45;
}

.copy-designation-picker input:disabled + span {
  cursor: not-allowed;
}

.embedded-option {
  margin-top: 22px;
  padding-top: 2px;
}

.nested-option {
  margin-top: 14px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #d8e2ee;
  border-radius: 12px;
}

.nested-option > summary {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  color: #24364f;
  cursor: pointer;
  list-style: none;
}

.nested-option > summary::-webkit-details-marker {
  display: none;
}

.nested-option > summary > span:first-child {
  display: grid;
  gap: 4px;
}

.nested-option > summary strong {
  font-size: 13px;
  font-weight: 800;
}

.nested-option > summary small {
  color: #697b92;
  font-size: 10px;
  line-height: 1.4;
}

.nested-option-chevron {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  color: #526982;
  background: #fff;
  border: 1px solid #cbd7e5;
  border-radius: 9px;
  transition: transform 0.18s ease;
}

.nested-option[open] > summary {
  background: #f1f6fc;
  border-bottom: 1px solid #d8e2ee;
}

.nested-option[open] .nested-option-chevron {
  transform: rotate(180deg);
}

.nested-option-content {
  padding: 16px;
}

.additional-items-section > .nested-option:first-of-type {
  margin-top: 0;
}

body.dark-mode .nested-option {
  background: #152238;
  border-color: #2d425f;
}

body.dark-mode .nested-option > summary,
body.dark-mode .nested-option > summary strong {
  color: #e5edf7;
}

body.dark-mode .nested-option > summary small {
  color: #94a3b8;
}

body.dark-mode .nested-option[open] > summary {
  background: #1b2c45;
  border-bottom-color: #2d425f;
}

body.dark-mode .nested-option-chevron {
  color: #cbd5e1;
  background: #20324d;
  border-color: #3b526f;
}

.switch {
  position: relative;
  display: block;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  margin: 0;
  cursor: pointer;
}

.form-section .switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #c8d2df;
  border-radius: 999px;
  transition: background 0.16s ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(16, 39, 70, 0.22);
  transition: transform 0.16s ease;
}

.switch input:checked + span {
  background: var(--blue-600);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.switch input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media print {
  .acknowledgement {
    background: #fff;
  }
}

/* ==========================================================================
   2026 workspace overhaul — calmer shell, balanced editor and form journey
   ========================================================================== */
:root {
  --workspace-navy: #14263e;
  --workspace-navy-soft: #203754;
  --workspace-blue: #2563eb;
  --workspace-blue-soft: #eff6ff;
  --workspace-canvas: #f3f6fb;
  --workspace-preview: #e8f0fd;
  --workspace-border: #d8e1ee;
  --workspace-text: #172033;
}

@media screen and (min-width: 901px) {
  main {
    grid-template-columns: minmax(650px, 760px) minmax(520px, 1fr);
  }
}

.builder {
  padding: 28px clamp(24px, 2.2vw, 38px) 72px;
  background: var(--workspace-canvas);
  border-right: 1px solid #d9e2ef;
  box-shadow: 12px 0 32px rgba(24, 45, 75, 0.06);
}

.panel-head {
  align-items: center;
  margin-bottom: 18px;
  padding: 0;
}

.panel-head h2 {
  max-width: none;
  font-size: clamp(28px, 2.1vw, 36px);
  letter-spacing: -0.035em;
}

.panel-head-actions {
  gap: 8px;
}

.panel-head-actions .theme-toggle,
.panel-head-actions .save-brief-button,
.panel-head-actions .print-button {
  min-width: auto;
  min-height: 42px;
  padding: 9px 14px;
  font-size: 12px;
  border-radius: 9px;
}

.brief-progress {
  margin-bottom: 14px;
  padding: 23px 24px 18px;
  border: 1px solid var(--workspace-border);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(24, 45, 75, 0.07);
}

.brief-progress::before {
  height: 4px;
}

.brief-progress::after {
  display: none;
}

.brief-progress-copy {
  align-items: center;
  margin-bottom: 12px;
}

.brief-progress-copy strong {
  padding-left: 40px;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.brief-progress-copy strong::before {
  top: -5px;
  width: 30px;
  height: 30px;
  font-size: 14px;
}

#progressValue {
  font-size: 24px;
}

#progressValue::after {
  font-size: 8px;
}

.progress-track {
  height: 11px;
  margin: 10px 0 7px;
  padding: 3px;
}

#progressHint {
  max-width: none;
  margin-top: 10px;
  font-size: 11px;
}

.phase-summary {
  margin-top: 11px;
  padding-top: 11px;
}

.section-jumpbar {
  position: sticky;
  z-index: 9;
  top: -1px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  margin: 0 0 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--workspace-border);
  border-radius: 13px;
  box-shadow: 0 9px 24px rgba(24, 45, 75, 0.1);
  backdrop-filter: blur(12px);
}

.section-jump-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 96px;
  padding: 12px 15px;
  color: #30435e;
  font-size: 15px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--workspace-border);
  border-radius: 0;
}

.section-jump-button.next {
  border-right: 0;
  border-left: 1px solid var(--workspace-border);
}

.section-jump-button small {
  font-size: 10px;
  font-weight: 800;
}

.section-jump-button:hover {
  color: var(--workspace-blue);
  background: var(--workspace-blue-soft);
}

.section-jump-button:disabled {
  opacity: 0.38;
  background: transparent;
}

.section-jump-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 2px 14px;
  min-width: 0;
  padding: 9px 16px;
}

.section-jump-current small {
  color: var(--workspace-blue);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section-jump-current strong {
  overflow: hidden;
  color: var(--workspace-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-jump-current span {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: #718096;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.builder .form-section {
  margin-top: 18px;
  padding: 0 24px 24px;
  border: 1px solid var(--workspace-border);
  border-radius: 14px;
  box-shadow: 0 5px 16px rgba(24, 45, 75, 0.055);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.builder .form-section.is-current-card {
  border-color: #9ebcf7;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.11);
}

.builder .form-section::before {
  display: none;
}

.builder .form-section .section-heading,
.builder .form-section:nth-of-type(even) .section-heading {
  min-height: 82px;
  margin-bottom: 22px;
  padding: 16px 24px;
  background: var(--workspace-navy);
}

.builder .form-section.is-current-card .section-heading {
  background: linear-gradient(110deg, var(--workspace-navy), var(--workspace-navy-soft));
  box-shadow: inset 4px 0 0 #60a5fa;
}

.builder .form-section .section-heading h3 {
  font-size: 16px;
}

.builder .form-section .section-heading p:not(.section-kicker) {
  max-width: 520px;
  font-size: 10px;
  line-height: 1.35;
}

.builder .form-section .section-status {
  min-width: 92px;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 999px;
}

.builder .form-section label {
  color: #526782;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.045em;
}

.builder .form-section input,
.builder .form-section select,
.builder .form-section textarea {
  min-height: 46px;
  padding: 10px 13px;
  color: var(--workspace-text);
  font-size: 14px;
  background: #fbfdff;
  border: 1px solid #cfdae8;
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(24, 45, 75, 0.025);
}

.builder .form-section input:hover,
.builder .form-section select:hover,
.builder .form-section textarea:hover {
  border-color: #aabbd0;
}

.builder .form-section input:focus,
.builder .form-section select:focus,
.builder .form-section textarea:focus {
  border-color: var(--workspace-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11);
}

.row,
.listing-statement-row {
  background: #f8fafc;
  border-color: #dbe4ef;
  border-radius: 11px;
}

.preview {
  padding: 26px clamp(20px, 2vw, 34px) 64px;
  background: var(--workspace-preview);
}

.toolbar {
  max-width: 620px;
  border-radius: 13px;
  box-shadow: 0 7px 20px rgba(24, 45, 75, 0.1);
}

body.dark-mode .section-jumpbar {
  background: rgba(15, 30, 50, 0.96);
  border-color: #2b425f;
}

body.dark-mode .section-jump-current strong,
body.dark-mode .section-jump-button {
  color: #e6eef9;
}

body.dark-mode .section-jump-button,
body.dark-mode .section-jump-button.next {
  border-color: #2b425f;
}

@media screen and (max-width: 900px) {
  .section-jumpbar {
    top: 58px;
  }

  .section-jump-button {
    min-width: 56px;
    padding-inline: 10px;
  }

  .section-jump-button small,
  .section-jump-current span {
    display: none;
  }

  .section-jump-current {
    grid-template-columns: 1fr;
    padding-inline: 12px;
  }

  .builder .form-section .section-heading,
  .builder .form-section:nth-of-type(even) .section-heading {
    min-height: 80px;
    padding: 15px 16px;
  }
}

@media print {
  .section-jumpbar {
    display: none !important;
  }
}

.combined-card-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 30px 0 22px;
  color: #174fc7;
}

.combined-card-divider::before,
.combined-card-divider::after {
  height: 2px;
  flex: 1;
  content: "";
  background: linear-gradient(90deg, #d7e2f1, #8fb4ef);
  border-radius: 999px;
}

.combined-card-divider::after {
  background: linear-gradient(90deg, #8fb4ef, #d7e2f1);
}

.combined-card-divider span {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
  background: #edf4ff;
  border: 1px solid #c5d9f8;
  border-radius: 999px;
}

.combined-card-note {
  margin: -6px 0 16px;
  color: #697b92;
  font-size: 12px;
  line-height: 1.55;
}

.builder .form-section.is-collapsed {
  padding-bottom: 0;
}

.builder .form-section.is-collapsed .section-heading,
.builder .form-section.is-collapsed:nth-of-type(even) .section-heading {
  min-height: 66px;
  margin-bottom: 0;
  padding-block: 13px;
}

.builder .form-section.is-collapsed .section-heading h3 {
  margin-top: 2px;
}

.builder .form-section.is-collapsed .section-toggle {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .combined-card-divider::before,
body.dark-mode .combined-card-divider::after {
  background: linear-gradient(90deg, #2d425f, #4674b7);
}

body.dark-mode .combined-card-divider::after {
  background: linear-gradient(90deg, #4674b7, #2d425f);
}

body.dark-mode .combined-card-divider span {
  color: #93c5fd;
  background: #172a46;
  border-color: #31598d;
}

@media (max-width: 620px) {
  .combined-card-divider {
    gap: 9px;
    margin: 24px 0 18px;
  }

  .combined-card-divider span {
    padding-inline: 9px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }
}

/* ==========================================================================
   Operational workspace refresh
   Editor navigation, section cards, responsive layout and accessibility
   ========================================================================== */

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --control-height: 44px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --success: #167445;
  --success-soft: #eaf7f0;
  --warning-soft: #fff8e7;
  --danger-soft: #fff4f4;
  --workspace-line: #d9e2ee;
  --workspace-shadow: 0 8px 24px rgba(12, 35, 66, 0.07);
}

body {
  background: #e9eef5;
}

.mobile-header {
  display: none;
}

/* Sidebar workflow navigation */
.sidebar {
  gap: 16px;
  padding: 22px 18px 18px;
}

.sidebar .brand {
  padding: 0 4px 4px;
}

.sidebar .brand img {
  width: 56px;
  height: 56px;
  background: #fff;
  border-radius: 10px;
}

.sidebar .brand h1 {
  font-size: 17px;
}

.sidebar .brand p {
  margin-top: 3px;
  font-size: 11px;
}

.workflow-nav {
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 3px;
}

.nav-group-title {
  margin: 0 0 4px;
  padding: 0 10px;
  color: #91a8c6;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.workflow-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 9px 7px 11px;
  color: #dce8f7;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 8px;
}

.workflow-nav a::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  content: "";
  background: #66809f;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}

.workflow-nav a > span {
  min-width: 0;
  flex: 1;
}

.workflow-nav .tool-nav-link {
  gap: 10px;
  min-height: 40px;
}

.workflow-nav .tool-nav-link::before {
  display: none;
}

.tool-nav-icon {
  box-sizing: border-box;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 5px;
  color: #91a8c6;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  border: 1px solid rgba(177, 197, 255, 0.2);
  border-radius: 8px;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.workflow-nav .tool-nav-link:hover .tool-nav-icon {
  color: #dcecff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(177, 197, 255, 0.38);
  transform: translateY(-1px);
}

.workflow-nav .tool-nav-link.active .tool-nav-icon {
  color: #9bdcff;
  background: rgba(45, 188, 254, 0.09);
  border-color: rgba(45, 188, 254, 0.48);
}

.workflow-nav a > i {
  display: grid;
  flex: 0 0 17px;
  place-items: center;
  width: 17px;
  height: 17px;
  color: transparent;
  font-size: 10px;
  font-style: normal;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.workflow-nav a.is-complete > i {
  color: #083b25;
  background: #8ee0b3;
  border-color: #8ee0b3;
}

.workflow-nav a.is-complete > i::before {
  content: "✓";
}

.workflow-nav a.is-complete::before {
  background: #75d29f;
  border-color: #b7f0d0;
}

.workflow-nav a.active {
  color: #fff;
  background: rgba(34, 119, 230, 0.88);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 3px 0 0 #a9d1ff, 0 5px 16px rgba(2, 34, 79, 0.25);
  transform: none;
}

.workflow-nav a.active::after {
  display: none;
}

.document-nav {
  gap: 7px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.document-nav-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.document-nav a {
  min-height: 30px;
  padding: 6px 3px;
  font-size: 9px;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
  border-radius: 7px;
}

.document-nav a.active {
  background: #176ed8;
  transform: none;
}

.document-nav a.active::after {
  display: none;
}

/* Saved briefs remain nearby without dominating the primary workflow. */
.saved-briefs {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.saved-briefs summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 11px 13px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

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

.saved-briefs summary::after {
  content: "⌄";
  color: #abc2df;
  font-size: 16px;
  transition: transform 0.16s ease;
}

.saved-briefs[open] summary::after {
  transform: rotate(180deg);
}

.saved-briefs summary small {
  margin-left: auto;
  color: #aac0dc;
  font-size: 9px;
  font-weight: 600;
}

.saved-briefs-content {
  padding: 0 13px 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Workspace layout */
main {
  grid-template-columns: minmax(520px, 610px) minmax(0, 1fr);
}

.builder {
  padding: 24px 30px 52px;
  box-shadow: 10px 0 28px rgba(11, 31, 60, 0.08);
}

.panel-head {
  top: -24px;
  margin: 0 -6px;
  padding: 16px 6px 14px;
}

.panel-head .print-button,
.toolbar .print-button,
.mobile-print-button {
  background: linear-gradient(135deg, #0b62d3, #084ea9);
  box-shadow: 0 5px 14px rgba(8, 78, 169, 0.22);
}

.panel-head .print-button:hover,
.toolbar .print-button:hover,
.mobile-print-button:hover {
  background: linear-gradient(135deg, #0956bb, #073f8a);
}

.start-options {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 18px 20px;
  background: #f5f8fc;
  border-color: var(--workspace-line);
  box-shadow: none;
}

.start-option-actions {
  grid-template-columns: auto auto;
}

.start-option-actions .danger-outline {
  color: #9d2828;
  background: var(--danger-soft);
  border-color: #e6b8b8;
}

/* Form sections and headings */
.form-section {
  scroll-margin-top: 86px;
  margin-top: 16px;
  padding: 0 20px 20px;
  border-color: var(--workspace-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--workspace-shadow);
}

.form-section-first {
  padding-top: 0;
  background: #fff;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  width: calc(100% + 40px);
  margin: 0 -20px 20px;
  padding: 17px 20px 15px;
  background: linear-gradient(180deg, #fbfcfe, #f6f8fb);
  border-bottom: 1px solid var(--workspace-line);
  border-radius: 15px 15px 0 0;
}

.section-heading > div:first-child {
  min-width: 0;
}

.section-heading h3 {
  display: block;
  margin: 1px 0 0;
  color: var(--navy-900);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
}

.section-heading p:not(.section-kicker) {
  max-width: 440px;
  margin: 5px 0 0;
  color: #627086;
  font-size: 11px;
  line-height: 1.45;
}

.section-kicker {
  margin: 0;
  color: #356cae;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-heading-compact {
  margin-bottom: 18px;
}

.section-status {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 5px 8px;
  color: #6b4f16;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--warning-soft);
  border: 1px solid #ead8a7;
  border-radius: 999px;
}

.workflow-section.is-complete .section-status,
#matter-details.is-complete .section-status {
  color: #17633d;
  background: var(--success-soft);
  border-color: #b8dfca;
}

.workflow-section.is-complete .section-status::before,
#matter-details.is-complete .section-status::before {
  margin-right: 4px;
  content: "✓";
}

.section-heading-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-toggle {
  display: grid;
  place-items: center;
  width: 31px;
  min-height: 31px;
  padding: 0;
  color: #415a79;
  background: #fff;
  border-color: #cfdae7;
  border-radius: 8px;
}

.section-toggle:hover {
  color: var(--navy-900);
  background: #eef4fb;
}

.section-toggle span {
  transition: transform 0.16s ease;
}

.is-collapsed .section-toggle span {
  transform: rotate(180deg);
}

.is-collapsed .section-heading {
  margin-bottom: 0;
  border-bottom: 0;
}

.form-section > h3 {
  display: none;
}

.form-section label {
  gap: 7px;
  color: #26384f;
  font-size: 11px;
  font-weight: 750;
}

input,
select,
textarea {
  min-height: var(--control-height);
  padding: 10px 12px;
  border-color: #bdcad9;
  border-radius: var(--radius-sm);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8a98aa;
}

.required-field::after {
  color: #a52a2a;
  content: "Required";
  position: absolute;
  top: 0;
  right: 0;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.required-field:has(.is-missing)::before {
  display: none;
}

.required-field:not(:has(.is-missing))::after {
  display: none;
}

input.is-missing,
select.is-missing,
textarea.is-missing {
  background: #fffafa;
  border-color: #c84d4d;
  box-shadow: 0 0 0 3px rgba(200, 77, 77, 0.09);
}

.acknowledgement-guide {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
  padding: 11px 12px;
  color: #4f6076;
  background: #f3f7fc;
  border: 1px solid #d7e2ee;
  border-radius: 10px;
}

.acknowledgement-guide > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  background: #3d6faa;
  border-radius: 50%;
}

.acknowledgement-guide p {
  margin: 1px 0 0;
  font-size: 10px;
  line-height: 1.45;
}

/* Repeatable and sortable cards */
.drag-list,
#witnesses,
.listing-statement-inputs {
  display: grid;
  gap: 9px;
}

.row {
  margin: 0;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #dce4ee;
  border-radius: 11px;
}

.row input,
.row textarea {
  background: #fff;
}

.drag-list .row {
  grid-template-columns: 36px minmax(0, 1fr) 36px;
}

.handle {
  color: #51657d;
  background: #edf2f7;
  border-color: #cfdae6;
}

.handle::after {
  content: "";
}

.row > button,
.listing-statement-row button {
  border-radius: 8px;
}

.listing-statement-row {
  padding: 8px;
  background: #f8fafc;
  border: 1px solid #dce4ee;
  border-radius: 11px;
}

.form-section > .secondary {
  width: auto;
  min-width: 140px;
  margin-top: 12px;
}

/* Optional productivity tools */
.bonus-features-heading {
  margin-top: 34px;
}

.autofill-wizard,
.can-scanner {
  scroll-margin-top: 86px;
  box-shadow: none;
}

.can-scanner {
  border-style: solid;
  border-color: #c9d5e3;
  box-shadow: inset 4px 0 0 #526982;
}

.can-upload-placeholder {
  min-height: 150px;
}

.can-coming-soon {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid #dce4ee;
}

/* Persistent live preview */
.preview {
  position: relative;
  padding: 22px 24px 48px;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.65), transparent 38%),
    #e9eef5;
}

.toolbar {
  min-height: 62px;
  border-radius: 12px;
}

.toolbar > div {
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: center;
}

.toolbar strong,
.toolbar .preview-page-count {
  grid-column: 2;
}

.live-preview-label {
  display: inline-flex;
  grid-row: 1 / 3;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  color: #17633d !important;
  font-size: 8px !important;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--success-soft);
  border: 1px solid #b8dfca;
  border-radius: 999px;
}

.live-preview-label i {
  width: 6px;
  height: 6px;
  background: #2a9b60;
  border-radius: 50%;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(7, 31, 65, 0.25);
  transform: translateY(8px);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Tablet layout */
@media (max-width: 1180px) {
  .sidebar {
    width: 232px;
  }

  main {
    grid-template-columns: minmax(470px, 54vw) minmax(0, 1fr);
    margin-left: 232px;
  }

  .builder {
    padding-right: 22px;
    padding-left: 22px;
  }

  .start-options {
    grid-template-columns: 1fr;
  }

  .page {
    transform-origin: top center;
  }
}

/* Mobile and compact tablet workspace */
@media screen and (max-width: 900px) {
  body {
    padding-top: 58px;
    overflow: auto;
  }

  .mobile-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    height: 58px;
    padding: 8px 12px;
    color: #fff;
    background: var(--navy-950);
    box-shadow: 0 3px 14px rgba(5, 22, 46, 0.24);
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 7px 9px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
  }

  .mobile-brand {
    display: grid;
    min-width: 0;
    color: inherit;
    text-decoration: none;
  }

  .mobile-brand strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-brand span {
    color: #aebfd5;
    font-size: 9px;
  }

  .mobile-print-button {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 10px;
  }

  .mobile-theme-toggle {
    display: inline-flex;
  }

  .panel-head-actions > .theme-toggle {
    display: none;
  }

  .sidebar {
    top: 58px;
    z-index: 45;
    width: min(320px, 88vw);
    transform: translateX(calc(-100% - 20px));
  }

  .sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 20px));
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 45px rgba(0, 0, 0, 0.28);
  }

  body.mobile-sidebar-open::after {
    position: fixed;
    inset: 58px 0 0;
    z-index: 40;
    content: "";
    background: rgba(5, 17, 34, 0.48);
  }

  .sidebar-toggle,
  .sidebar-reveal {
    display: none;
  }

  main,
  .sidebar-collapsed main {
    display: block;
    height: auto;
    min-height: calc(100vh - 58px);
    margin-left: 0;
    overflow: visible;
  }

  .builder {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 18px clamp(14px, 4vw, 28px) 42px;
    overflow: visible;
    box-shadow: none;
  }

  .panel-head {
    position: static;
    margin: 0;
    padding: 6px 0 14px;
  }

  .panel-head .print-button {
    display: none;
  }

  .preview {
    height: auto;
    max-height: 72vh;
    padding: 18px;
    overflow: auto;
    border-top: 1px solid #ccd7e3;
  }

  .preview .toolbar {
    position: sticky;
    left: 0;
    width: 100%;
  }

  .preview .page {
    transform: scale(0.72);
    transform-origin: top left;
    margin-right: -222px;
    margin-bottom: -290px;
  }
}

@media screen and (max-width: 620px) {
  .builder {
    padding-right: 12px;
    padding-left: 12px;
  }

  .panel-head h2 {
    font-size: 22px;
  }

  .start-option-actions,
  .grid.two,
  .form-section .grid.two,
  .signature-actions,
  .wizard-actions,
  .wizard-question-actions {
    grid-template-columns: 1fr;
  }

  .start-option-actions button {
    white-space: normal;
  }

  .form-section {
    padding-right: 15px;
    padding-left: 15px;
  }

  .section-heading {
    width: calc(100% + 30px);
    margin-right: -15px;
    margin-left: -15px;
    padding-right: 15px;
    padding-left: 15px;
  }

  .section-heading p:not(.section-kicker) {
    font-size: 10px;
  }

  .section-status {
    display: none;
  }

  #witnesses .row .grid.two {
    grid-template-columns: 1fr;
  }

  .setting-row,
  .setting-select {
    align-items: flex-start;
  }

  .setting-select {
    flex-direction: column;
  }

  .setting-select select {
    width: 100%;
    flex-basis: auto;
  }

  .preview {
    max-height: 58vh;
  }

  .preview .page {
    transform: scale(0.48);
    margin-right: -413px;
    margin-bottom: -570px;
  }

  .toolbar .print-button {
    display: none;
  }

  .back-to-top {
    right: 12px;
    bottom: 12px;
  }
}

/* Strong card headers inspired by the supplied Brief Builder reference. */
.builder .form-section {
  padding: 0 24px 24px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d5deea;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(16, 35, 62, 0.08);
}

.builder .form-section-first {
  padding-top: 0;
}

.builder .form-section .section-heading {
  align-items: center;
  width: calc(100% + 48px);
  min-height: 104px;
  margin: 0 -24px 24px;
  padding: 20px 24px;
  color: #fff;
  background: #1d2b41;
  border: 0;
  border-radius: 14px 14px 0 0;
}

.builder .form-section:nth-of-type(even) .section-heading {
  background: #263a56;
}

.builder .form-section .section-heading h3 {
  margin-top: 4px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.builder .form-section .section-kicker {
  color: #78b7ff;
  font-size: 9px;
  letter-spacing: 0.16em;
}

.builder .form-section .section-heading p:not(.section-kicker) {
  max-width: 460px;
  margin-top: 7px;
  color: #c6d2e1;
  font-size: 10px;
}

.builder .form-section .section-status {
  margin: 0;
  padding: 7px 11px;
  color: #ffda91;
  background: rgba(145, 91, 0, 0.25);
  border-color: rgba(255, 210, 119, 0.36);
}

.builder .workflow-section.is-complete .section-status,
.builder #matter-details.is-complete .section-status {
  color: #5ce59a;
  background: rgba(18, 137, 76, 0.26);
  border-color: rgba(73, 222, 143, 0.4);
}

.builder .form-section .section-toggle {
  color: #dfeaff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.builder .form-section .section-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.builder .form-section.is-collapsed .section-heading {
  margin-bottom: 0;
  border-radius: 14px;
}

.builder .form-section label {
  color: #536985;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.builder .form-section input,
.builder .form-section select,
.builder .form-section textarea {
  min-height: 48px;
  color: #17243a;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  background: #fbfcfe;
  border-color: #d5dfeb;
}

body.dark-mode .builder .form-section {
  background: #122138;
  border-color: #2d425f;
}

body.dark-mode .builder .form-section .section-heading,
body.dark-mode .builder .form-section:nth-of-type(even) .section-heading {
  background: #07182e;
}

body.dark-mode .builder .form-section label {
  color: #b5c6da;
}

body.dark-mode .builder .form-section input,
body.dark-mode .builder .form-section select,
body.dark-mode .builder .form-section textarea {
  color: #eef5ff;
  background: #172941;
  border-color: #38506f;
}

@media screen and (max-width: 620px) {
  .builder .form-section {
    padding: 0 16px 18px;
  }

  .builder .form-section .section-heading {
    align-items: flex-start;
    width: calc(100% + 32px);
    min-height: 88px;
    margin-right: -16px;
    margin-left: -16px;
    padding: 17px 16px;
  }

  .builder .form-section .section-heading h3 {
    font-size: 15px;
  }

  .builder .form-section .section-heading-actions {
    align-self: center;
  }
}

@media print {
  .mobile-header,
  .back-to-top {
    display: none !important;
  }

  html,
  body,
  main,
  .preview,
  #pages {
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
  }

  .preview .page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    margin: 0 !important;
    padding: 14mm 16mm !important;
    transform: none !important;
    transform-origin: initial !important;
    box-shadow: none !important;
  }

  .preview .listing-form {
    padding: 7.4mm 10.6mm 6.4mm !important;
  }

  #cover .officer-grid {
    right: 16mm;
    bottom: 14mm;
    left: 16mm;
  }
}

.sidebar-reveal {
  position: fixed;
  top: 50%;
  left: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 52px;
  min-height: 40px;
  overflow: hidden;
  padding: 9px 11px;
  background: var(--navy-900);
  border-radius: 0 9px 9px 0;
  box-shadow: 0 3px 12px rgba(7, 31, 65, 0.24);
  transform: translate(-110%, -50%);
  transition: transform 0.24s ease, width 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-reveal span:first-child {
  flex: 0 0 28px;
  text-align: center;
  font-size: 18px;
}

.sidebar-reveal span:last-child {
  width: 0;
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.12s ease, width 0.18s ease;
}

.sidebar-reveal:hover,
.sidebar-reveal:focus-visible {
  width: 132px;
  box-shadow: 0 8px 22px rgba(7, 31, 65, 0.28);
}

.sidebar-reveal:hover span:last-child,
.sidebar-reveal:focus-visible span:last-child {
  width: 48px;
  opacity: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin: 6px 0 0;
  color: #cbd8ec;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 5px;
}

nav a {
  position: relative;
  isolation: isolate;
  padding: 12px 14px 12px 17px;
  overflow: hidden;
  color: #e9f1ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 12px;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}

nav a.active {
  color: #fff;
  background: linear-gradient(135deg, #1673eb, #0b5ed7);
  border-color: rgba(255,255,255,0.16);
  box-shadow: 0 8px 20px rgba(4, 61, 151, 0.32);
  transform: translateX(3px);
}

nav a.active::after {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 6px;
  height: 6px;
  content: "";
  background: #9ed0ff;
  border: 2px solid rgba(255,255,255,0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.1);
}

.privacy {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 14px;
  color: #d9e5f5;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 11px;
}

.privacy strong {
  color: #fff;
  font-size: 12px;
}

main {
  display: grid;
  grid-template-columns: minmax(440px, 500px) minmax(0, 1fr);
  min-height: 100vh;
  margin-left: 276px;
  transition: margin-left 0.24s ease;
}

.sidebar-collapsed .sidebar {
  transform: translateX(calc(-100% - 20px));
}

.sidebar-collapsed .sidebar-reveal {
  transform: translate(0, -50%);
}

.sidebar-collapsed main {
  margin-left: 0;
}

.builder {
  position: relative;
  z-index: 2;
  padding: 26px 28px 40px;
  overflow: auto;
  background: var(--surface);
  box-shadow: 8px 0 25px rgba(16, 24, 40, 0.07);
}

.panel-head {
  position: sticky;
  top: -26px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -2px -4px 0;
  padding: 18px 4px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.02em;
}

.start-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
  padding: 16px 18px;
  background: linear-gradient(145deg, #f8fbff, #eef5ff);
  border: 1px solid #c7d9f0;
  border-radius: 14px;
}

.start-options h3,
.bonus-features-heading h3 {
  margin: 0;
  color: var(--navy-900);
  font-size: 16px;
}

.start-options p,
.bonus-features-heading p {
  margin: 5px 0 0;
  color: #60738d;
  font-size: 11px;
  line-height: 1.45;
}

.start-options .eyebrow,
.bonus-features-heading .eyebrow {
  margin: 0 0 3px;
  color: var(--blue-600);
}

.start-option-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.start-option-actions button {
  width: 100%;
  margin: 0;
  white-space: nowrap;
}

.danger-outline {
  color: #9a2929;
  background: #fff;
  border-color: #e4b8b8;
}

.danger-outline:hover {
  color: #fff;
  background: #a83232;
  border-color: #a83232;
}

.required-field {
  position: relative;
}

.required-field:has(.is-missing)::before {
  position: absolute;
  top: 0;
  right: 0;
  color: #c62828;
  content: "*";
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.required-field:has(.is-missing) {
  color: #a92323;
}

input.is-missing,
select.is-missing,
textarea.is-missing {
  background: #fff7f7;
  border-color: #d94141;
  box-shadow: 0 0 0 2px rgba(217, 65, 65, 0.1);
}

.bonus-features-heading {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.autofill-wizard {
  position: relative;
  margin-top: 14px;
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(86, 156, 255, 0.22), transparent 42%),
    linear-gradient(145deg, #f5f9ff, #edf5ff);
  border: 1px solid #b9d4f7;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(11, 94, 215, 0.08);
}

.wizard-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.wizard-toggle {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  color: var(--navy-900);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.wizard-toggle:hover {
  background: transparent;
}

.wizard-title {
  display: grid;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.wizard-title .eyebrow {
  margin-bottom: 2px;
  font-size: 9px;
}

.wizard-chevron {
  margin-left: auto;
  color: #536a87;
  font-size: 23px;
  line-height: 1;
  transition: transform 0.18s ease;
}

.autofill-wizard.is-open .wizard-chevron {
  transform: rotate(180deg);
}

.wizard-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  font-size: 20px;
  background: linear-gradient(145deg, var(--blue-600), #7047eb);
  border-radius: 11px;
  box-shadow: 0 5px 14px rgba(70, 77, 210, 0.23);
}

.local-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: #17663b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #e8f8ef;
  border: 1px solid #bce5cb;
  border-radius: 999px;
}

#wizardContent[hidden] {
  display: none;
}

.local-badge.is-connected {
  color: #174b7e;
  background: #e6f3ff;
  border-color: #a9d3f5;
}

.wizard-copy {
  margin: 13px 0;
  color: #52647c;
  font-size: 12px;
  line-height: 1.5;
}

.wizard-prompt {
  margin-bottom: 10px;
}

.wizard-prompt textarea {
  min-height: 104px;
  background: rgba(255, 255, 255, 0.9);
  border-color: #adc9ed;
}

.wizard-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.wizard-actions button {
  margin: 0;
}

.wizard-actions #runAutofill {
  background: linear-gradient(110deg, var(--blue-600), #5747d7);
}

.wizard-actions #runAutofill:hover {
  background: linear-gradient(110deg, #0953bd, #4837c2);
}

.wizard-example {
  color: #244a7c;
  background: #fff;
  border-color: #b8cce6;
}

.wizard-example:hover {
  color: var(--navy-900);
  background: #f7faff;
  border-color: #94b3da;
}

.wizard-questions {
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #b8cfee;
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(24, 74, 137, 0.08);
}

.wizard-questions[hidden] {
  display: none;
}

.wizard-question-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wizard-question-heading strong {
  color: var(--navy-900);
  font-size: 14px;
}

.wizard-question-count {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: #174b7e;
  font-size: 9px;
  font-weight: 800;
  background: #e6f3ff;
  border-radius: 999px;
}

.wizard-questions > p {
  margin: 8px 0 12px;
  color: #52647c;
  font-size: 11px;
  line-height: 1.45;
}

.wizard-question-fields {
  display: grid;
  gap: 10px;
}

.wizard-question-fields label {
  margin: 0;
  color: #263c58;
}

.wizard-question-fields small {
  color: #667b96;
  font-weight: 500;
  line-height: 1.35;
}

.wizard-question-fields textarea {
  min-height: 76px;
}

.wizard-question-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin-top: 12px;
}

.wizard-question-actions button {
  margin: 0;
}

.wizard-status {
  margin-top: 11px;
  padding: 9px 10px;
  color: #52647c;
  font-size: 11px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 7px;
}

.wizard-status span {
  color: var(--navy-900);
  font-weight: 800;
}

.wizard-status.is-success {
  color: #245e3d;
  background: #ecf9f1;
}

.wizard-status.is-warning {
  color: #815a17;
  background: #fff8e7;
}

.can-scanner {
  margin-top: 14px;
  padding: 18px;
  background: linear-gradient(145deg, #fbfcfe, #f4f7fb);
  border: 1px dashed #aebed2;
  border-radius: 14px;
}

.can-scanner-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.can-scanner-heading h3 {
  display: block;
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.03em;
  text-transform: none;
}

.can-scanner-heading .eyebrow {
  margin-bottom: 2px;
  color: #596d87;
  font-size: 9px;
}

.can-scanner-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  font-size: 20px;
  background: linear-gradient(145deg, #526982, #273f5b);
  border-radius: 11px;
}

.prototype-badge {
  margin-left: auto;
  padding: 5px 8px;
  color: #765516;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #fff7df;
  border: 1px solid #ead49a;
  border-radius: 999px;
}

.prototype-badge.is-local {
  color: #17663b;
  background: #e8f8ef;
  border-color: #bce5cb;
}

.can-scanner > p {
  margin: 13px 0;
  color: #52647c;
  font-size: 12px;
  line-height: 1.5;
}

.can-upload-placeholder {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 20px 14px;
  color: #34465d;
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  border: 1px dashed #9eb0c5;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.can-upload-placeholder:hover,
.can-upload-placeholder.is-dragging {
  background: #f4f9ff;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.1);
}

.can-upload-placeholder strong {
  font-size: 12px;
}

.can-upload-placeholder > span:not(.can-upload-icon) {
  color: var(--muted);
  font-size: 10px;
}

.can-upload-placeholder button {
  min-height: 36px;
  margin-top: 8px;
  padding: 8px 13px;
  font-size: 11px;
}

.can-upload-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 3px;
  color: #526982;
  font-size: 22px;
  background: #e8edf4;
  border-radius: 50%;
}

.can-scanner .can-coming-soon {
  margin-bottom: 0;
  color: #687991;
  font-size: 10px;
}

.can-coming-soon span {
  margin-right: 5px;
  color: #d09a27;
}

.can-progress {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #d4dfed;
  border-radius: 10px;
}

.can-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #34465d;
  font-size: 11px;
}

.can-progress progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  accent-color: var(--blue-600);
  border: 0;
  border-radius: 999px;
}

.can-review {
  margin-top: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #cbd9ea;
  border-radius: 11px;
}

.can-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.can-review-heading strong {
  display: block;
  max-width: 280px;
  overflow: hidden;
  color: var(--navy-900);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.can-review-heading button {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 6px 9px;
  font-size: 10px;
}

.can-warnings {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 9px 10px;
  color: #7b5010;
  font-size: 10px;
  line-height: 1.4;
  background: #fff7df;
  border: 1px solid #ead49a;
  border-radius: 8px;
}

.can-warning::before {
  margin-right: 6px;
  color: #c17800;
  content: "⚠";
}

.can-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.can-review-grid label {
  margin: 0;
}

.can-review-grid small {
  color: #667b96;
  font-weight: 500;
  line-height: 1.35;
}

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

.can-review-grid textarea {
  min-height: 96px;
}

.can-raw-ocr {
  margin-top: 10px;
  color: #465c77;
  font-size: 10px;
}

.can-raw-ocr summary {
  width: max-content;
  color: var(--blue-600);
  font-weight: 800;
  cursor: pointer;
}

.can-raw-ocr pre {
  max-height: 240px;
  margin: 9px 0 0;
  padding: 10px;
  overflow: auto;
  color: #26384f;
  font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f5f7fa;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
}

.can-review-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.can-review-actions button {
  width: 100%;
  background: linear-gradient(110deg, var(--blue-600), #245fae);
}

.form-section {
  position: relative;
  margin-top: 18px;
  padding: 0 18px 18px;
  background: #fff;
  border: 1px solid #d8e1ed;
  border-radius: 14px;
  box-shadow: 0 5px 16px rgba(16, 39, 70, 0.045);
}

.form-section-first {
  margin-top: 18px;
  padding-top: 18px;
  background: linear-gradient(145deg, #f8fafc, #f3f6fa);
  border-color: #ced9e7;
  box-shadow: none;
}

.form-section > h3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: calc(100% + 36px);
  margin: 0 -18px 18px;
  padding: 13px 18px 12px;
  color: var(--navy-900);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(180deg, #f9fbfe, #f2f6fb);
  border-bottom: 1px solid #d8e1ed;
  border-radius: 13px 13px 0 0;
}

.form-section > h3::after {
  width: 34px;
  height: 3px;
  margin-top: 3px;
  content: "";
  background: var(--blue-600);
  border-radius: 999px;
}

.form-section > h3 span {
  color: #6a778a;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
}

.form-section > h3 span + * {
  margin-top: 0;
}

.form-section > label:last-child,
.form-section > .grid:last-child > label {
  margin-bottom: 0;
}

.form-section .grid.two {
  column-gap: 12px;
}

.form-section label {
  color: #34445a;
}

.form-section input,
.form-section select,
.form-section textarea {
  background: #fbfcfe;
  border-color: #cbd7e5;
  box-shadow: 0 1px 2px rgba(16, 39, 70, 0.025);
}

.form-section input:focus,
.form-section select:focus,
.form-section textarea:focus {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.08);
}

h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  color: var(--navy-900);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h3 span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

h3 span a {
  color: var(--blue-600);
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  color: #152238;
  background: #fff;
  border: 1px solid #cbd5e3;
  border-radius: 8px;
}

textarea {
  min-height: 96px;
  line-height: 1.45;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aebdd0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.secondary {
  width: 100%;
  margin-top: 4px;
  color: #095bbb;
  background: var(--blue-100);
  border-color: #c8ddfa;
}

.secondary:hover {
  color: #074a99;
  background: #dcecff;
  border-color: #a9caf5;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  margin-bottom: 8px;
}

.row .grid.two {
  gap: 8px;
}

.row input {
  min-height: 40px;
}

#witnesses .row {
  align-items: start;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

#witnesses .row .grid.two {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

#witnesses .row textarea {
  min-height: 108px;
  resize: vertical;
}

#witnesses .row > .handle {
  align-self: start;
  width: 38px;
  min-height: 44px;
}

.row > button,
.listing-statement-row button {
  align-self: stretch;
  min-height: 40px;
  padding: 0;
  color: var(--danger);
  font-size: 20px;
  font-weight: 500;
  background: #fff;
  border-color: var(--line);
}

.row > button:hover,
.listing-statement-row button:hover {
  background: #fff5f5;
  border-color: #e6b8b8;
}

.drag-list .row {
  grid-template-columns: 38px minmax(0, 1fr) 38px;
}

.handle {
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.handle-grip {
  font-size: 14px;
  line-height: 1;
}

.handle-sequence {
  min-width: 22px;
  padding-top: 3px;
  color: #315f97;
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  border-top: 1px solid #ccd8e6;
}

.handle:active {
  cursor: grabbing;
}

.witness-row-actions {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.witness-row-actions button {
  width: auto;
  min-height: 38px;
  margin: 0;
}

.witness-row-actions .add-witness-to-listing {
  min-width: 132px;
  padding: 8px 14px;
  color: #0a589f;
  font-size: 10px;
  line-height: 1.25;
  background: #eaf3ff;
  border-color: #bad3f1;
}

.witness-row-actions .add-witness-to-listing:hover {
  color: #073f78;
  background: #dcecff;
}

.witness-row-actions .add-witness-to-listing:disabled {
  color: #65758a;
  background: #f0f3f7;
  border-color: #d8e0e9;
}

.witness-row-actions button:last-child {
  flex: 0 0 42px;
  width: 42px;
  color: var(--danger);
  font-size: 20px;
  font-weight: 500;
  background: #fff;
  border-color: var(--line);
}

.witness-row-actions button:last-child:hover {
  background: #fff5f5;
  border-color: #e6b8b8;
}

.drag-list .is-dragging {
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  opacity: 0.97;
  box-shadow: 0 14px 32px rgba(16, 24, 40, 0.2);
  transform: scale(1.012);
}

.drag-list .is-dragging input,
.drag-list .is-dragging .handle,
.drag-list .is-dragging button {
  background: #f8fbff;
  border-color: #8ebcff;
}

.row-placeholder {
  margin-bottom: 8px;
  background: #eef5ff;
  border: 2px dashed #8ebcff;
  border-radius: 9px;
  transition: height 0.16s ease;
}

.is-reordering {
  cursor: grabbing;
  user-select: none;
}

.signature-pad {
  height: 132px;
  overflow: hidden;
  background:
    linear-gradient(to bottom, transparent calc(100% - 31px), #e3e9f1 calc(100% - 30px), transparent calc(100% - 29px)),
    #fff;
  border: 1px solid #cbd5e3;
  border-radius: var(--radius);
  box-shadow: inset 0 -1px 0 #dce3ed;
}

.signature-pad canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.signature-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.signature-actions .secondary {
  margin: 0;
}

.signature-date {
  margin-top: 14px;
  margin-bottom: 0;
}

.signature-upload {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 42px;
  margin: 0;
  padding: 10px 14px;
  overflow: hidden;
  color: #095bbb;
  font-size: 12px;
  font-weight: 700;
  background: var(--blue-100);
  border: 1px solid #c8ddfa;
  border-radius: 9px;
  cursor: pointer;
}

.signature-upload:hover {
  background: #dcecff;
}

.signature-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.listing-statement-inputs {
  display: grid;
  gap: 8px;
}

.photograph-exhibit-list {
  display: grid;
  gap: 10px;
}

.photograph-exhibit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.photograph-exhibit-toolbar button {
  width: auto;
  min-height: 38px;
  margin: 0;
}

.page-info-list {
  display: grid;
  gap: 10px;
}

.page-info-row {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  overflow: hidden;
  box-shadow: inset 0 4px 0 var(--briefdesk-blue);
}

.photograph-exhibit-empty {
  margin: 0;
  padding: 22px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  background: #f8fafc;
  border: 1px dashed #c8d4e2;
  border-radius: 10px;
}

.photograph-exhibit-row {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #f4f7fb;
  border: 1px solid #c9d7e8;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(32, 65, 110, 0.08);
}

.photograph-exhibit-row > .handle {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: #31577f;
  background: #fff;
  border: 1px solid #bfd0e4;
  border-radius: 10px;
  box-shadow: 0 3px 9px rgba(38, 67, 104, 0.08);
}

.photograph-exhibit-body {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
}

.photograph-editor-group {
  overflow: hidden;
  background: #fff;
  border: 1px solid #d2deeb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(26, 54, 93, 0.04);
}

.photograph-editor-group-heading {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 11px 58px 11px 14px;
  background: #edf4fc;
  border-bottom: 1px solid #d2deeb;
}

.photograph-editor-step {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  background: #2563eb;
  border-radius: 50%;
}

.photograph-editor-group-heading > span:last-child {
  display: grid;
  gap: 2px;
}

.photograph-editor-group-heading strong {
  color: #203752;
  font-size: 13px;
  font-weight: 850;
}

.photograph-editor-group-heading small {
  color: #667b94;
  font-size: 10px;
  line-height: 1.4;
}

.photograph-editor-group > .photograph-exhibit-grid,
.photograph-editor-group > .photograph-image-dropzone,
.photograph-editor-group > .photograph-image-thumbnails,
.photograph-editor-group > .photograph-upload-button,
.photograph-editor-group > .photograph-exhibit-actions {
  margin: 14px;
}

.photograph-editor-group > .photograph-image-thumbnails:empty {
  margin: 0;
}

.photograph-optional-fields .photograph-editor-group-heading {
  background: #f7f3ff;
  border-bottom-color: #e4d8f4;
}

.photograph-optional-fields .photograph-editor-step {
  background: #7c3aed;
}

.photograph-image-fields .photograph-editor-group-heading {
  background: #eef9f5;
  border-bottom-color: #cde9de;
}

.photograph-image-fields .photograph-editor-step {
  background: #07835c;
}

.photograph-page-settings .photograph-editor-group-heading {
  background: #fff7e8;
  border-bottom-color: #f2dfb7;
}

.photograph-page-settings .photograph-editor-step {
  color: #4d3400;
  background: #fbbf24;
}

.photograph-exhibit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.photograph-exhibit-grid label {
  gap: 5px;
  margin: 0;
  color: #3f5875;
  font-size: 11px;
  font-weight: 800;
}

.photograph-required-field {
  position: relative;
}

.photograph-required-field::before {
  position: absolute;
  top: -2px;
  right: 0;
  padding: 2px 5px;
  content: "Required";
  color: #1d4ed8;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #dbeafe;
  border-radius: 999px;
}

.photograph-exhibit-grid input,
.photograph-exhibit-grid select,
.photograph-exhibit-grid textarea {
  min-height: 44px;
  font-size: 12px;
  background: #fbfdff;
  border-color: #bfcfe2;
}

.photograph-exhibit-grid textarea {
  min-height: 72px;
}

.photograph-exhibit-wide {
  grid-column: 1 / -1;
  min-width: 0;
}

.photograph-exhibit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: stretch;
  gap: 10px;
}

.photograph-page-number {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  color: #3f5875;
  font-size: 11px;
  font-weight: 800;
  background: #f8fafc;
  border: 1px solid #d3deeb;
  border-radius: 9px;
}

.photograph-page-number input {
  width: 17px;
  min-height: 17px;
  margin: 0;
}

.photograph-exhibit-actions > button:last-child {
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--danger);
  font-size: 20px;
  background: #fff5f5;
  border-color: #efc0c0;
}

.image-comparison-row {
  border-color: #a9c5f5;
  box-shadow: inset 0 4px 0 var(--briefdesk-blue);
}

.image-comparison-builder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.image-comparison-side {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  background: #f8fbff;
  border: 1px solid #c6d6ef;
  border-radius: 8px;
}

.image-comparison-side > strong {
  color: var(--briefdesk-blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.image-comparison-side label {
  gap: 5px;
  margin: 0;
  font-size: 10px;
}

.image-comparison-side input {
  min-height: 38px;
  font-size: 11px;
}

.image-comparison-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 150px;
  overflow: hidden;
  color: #53657c;
  text-align: center;
  background: #fff;
  border: 1.5px dashed #9db4cf;
  border-radius: 8px;
  cursor: pointer;
}

.image-comparison-dropzone:hover,
.image-comparison-dropzone.is-dragging {
  background: #eaf3ff;
  border-color: var(--briefdesk-blue);
}

.image-comparison-dropzone img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #f4f7fb;
}

.image-comparison-dropzone button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  min-height: 28px;
  padding: 0;
  color: #fff;
  font-size: 17px;
  background: rgba(125, 24, 24, 0.88);
  border: 0;
  border-radius: 50%;
}

.image-comparison-dropzone span {
  color: #244a76;
  font-size: 11px;
  font-weight: 850;
}

.image-comparison-dropzone small {
  font-size: 9px;
}

.pdf-upload-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 164px;
  padding: 24px;
  color: #52647c;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(11, 94, 215, 0.055) 25%, transparent 25%) 0 0 / 18px 18px,
    #f8fbff;
  border: 2px dashed #b8c8dc;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.pdf-upload-dropzone:hover,
.pdf-upload-dropzone.is-dragging {
  background-color: #eaf3ff;
  border-color: var(--blue-600);
  box-shadow: 0 10px 28px rgba(11, 94, 215, 0.12);
}

.pdf-upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.pdf-upload-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  background: var(--blue-600);
  border-radius: 8px;
}

.pdf-upload-dropzone strong {
  color: var(--navy-900);
  font-size: 14px;
}

.pdf-upload-dropzone > span:not(.pdf-upload-icon) {
  color: var(--muted);
  font-size: 11px;
}

.pdf-upload-status {
  margin-top: 10px;
  color: #277e5b;
  font-size: 11px;
  font-weight: 750;
}

.pdf-upload-status:empty {
  display: none;
}

.pdf-upload-status.is-warning {
  color: var(--danger);
}

.pdf-attachment-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pdf-attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pdf-attachment-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pdf-attachment-row strong,
.pdf-attachment-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-attachment-row strong {
  color: var(--navy-900);
  font-size: 12px;
}

.pdf-attachment-row span {
  color: var(--muted);
  font-size: 10px;
}

.map-exhibit-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.map-exhibit-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #d4dfeb;
  border-radius: 10px;
}

.map-exhibit-row img {
  display: block;
  width: 130px;
  height: 78px;
  object-fit: cover;
  background: #e8edf3;
  border: 1px solid #c9d5e2;
  border-radius: 7px;
}

.map-exhibit-row > div:nth-child(2) {
  display: grid;
  gap: 5px;
}

.map-exhibit-row strong {
  color: #162f4d;
  font-size: 13px;
}

.map-exhibit-row span {
  color: #697a8e;
  font-size: 10px;
}

.map-exhibit-row > div:last-child {
  display: flex;
  gap: 7px;
}

.map-editor-dialog {
  width: min(1380px, calc(100% - 24px));
  height: min(94vh, 940px);
  max-height: 94vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid #c6d3e0;
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(0, 27, 62, .35);
}

.map-editor-dialog::backdrop {
  background: rgba(0, 22, 50, .65);
  backdrop-filter: blur(3px);
}

.map-editor-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  background: #f4f7fa;
}

.map-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
  padding: 13px 18px;
  color: #fff;
  background: #001b3e;
}

.map-editor-header .eyebrow { color: #82cfff; }
.map-editor-header h2 { margin: 0; font-size: 21px; }
.map-editor-header p:last-child { margin: 4px 0 0; color: #bed0e1; font-size: 10px; }
.map-editor-header > button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: #fff;
  font-size: 25px;
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.2);
}

.map-editor-body {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  min-height: 0;
}

.map-editor-controls {
  padding: 12px;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid #d8e1eb;
}

.map-editor-controls details {
  margin-bottom: 9px;
  overflow: hidden;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
}

.map-editor-controls summary {
  padding: 12px;
  color: #173757;
  font-size: 11px;
  font-weight: 850;
  background: #f1f5f9;
  cursor: pointer;
}

.map-control-group {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.map-control-group label {
  gap: 5px;
  font-size: 10px;
}

.map-control-group input,
.map-control-group select,
.map-control-group textarea {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 12px;
}

.map-search-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.map-search-row span {
  color: #617389;
  font-size: 9px;
}

.map-file-button {
  min-height: 44px;
  padding: 10px;
  color: #075e8e;
  text-align: center;
  background: #eaf5fb;
  border: 1px dashed #7ebbd8;
  border-radius: 6px;
  cursor: pointer;
}

.map-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

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

.map-toggle-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px;
  background: #f8fafc;
  border-radius: 5px;
}

.map-toggle-grid input {
  width: 18px;
  min-height: 18px;
}

.map-tool-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.map-tool-buttons button {
  min-height: 39px;
  padding: 7px;
  font-size: 10px;
}

.map-tool-buttons button.active {
  color: #fff;
  background: #002664;
  border-color: #002664;
}

.map-tool-buttons button:disabled,
.map-toggle-grid label.disabled {
  opacity: .58;
  cursor: not-allowed;
}

.map-accuracy-options {
  margin-top: 8px;
}

.map-selected-editor {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: #f4f8fc;
  border: 1px solid #c9d8e8;
  border-radius: 8px;
}

.map-selected-editor strong {
  color: #002664;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-selected-editor input {
  min-height: 36px;
  padding: 7px;
  font-size: 11px;
}

.map-selected-editor button {
  min-height: 36px;
  color: #b42318;
  background: #fff;
  border-color: #f3b6af;
}

.map-hint {
  color: #667085;
  font-size: 10px;
  line-height: 1.4;
}

.map-topdown-icons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.map-topdown-icons button {
  position: relative;
  min-height: 44px;
  padding: 7px 7px 7px 32px;
  color: #183b63;
  font-size: 10px;
  text-align: left;
  background: #f8fbff;
  border: 1px solid #c7d7ea;
  border-radius: 8px;
  cursor: grab;
}

.map-topdown-icons button:active {
  cursor: grabbing;
}

.map-topdown-icons button::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 16px;
  height: 16px;
  background: #002664;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
  transform: translateY(-50%);
}

.map-topdown-icons button[data-map-icon-type="Motorbike"]::before {
  width: 18px;
  height: 10px;
  border-radius: 999px;
}

.map-topdown-icons button[data-map-icon-type="Pedestrian"]::before {
  width: 13px;
  height: 18px;
  border-radius: 999px 999px 5px 5px;
}

.map-topdown-icons button[data-map-icon-type="House"]::before {
  clip-path: polygon(50% 0, 100% 42%, 86% 42%, 86% 100%, 14% 100%, 14% 42%, 0 42%);
  border-radius: 0;
}

.map-topdown-icons button[data-map-icon-type="CCTV camera"]::before {
  width: 19px;
  height: 12px;
  border-radius: 3px;
  clip-path: polygon(0 0, 72% 0, 100% 32%, 72% 64%, 72% 100%, 0 100%);
}

.map-annotation-list {
  display: grid;
  gap: 6px;
}

.map-annotation-list > div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  gap: 5px;
}

.map-annotation-list > div:not(:has(input[type="number"])) {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.map-annotation-list input {
  min-width: 0;
  min-height: 35px;
  padding: 6px;
  font-size: 10px;
}

.map-annotation-list button {
  min-height: 35px;
  padding: 0;
}

.map-canvas-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  padding: 12px;
}

.map-canvas-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.map-canvas-toolbar > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-canvas-toolbar button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 10px;
}

.map-canvas-toolbar span {
  color: #52647b;
  font-size: 10px;
}

.map-canvas-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: #dfe5eb;
  border: 1px solid #bcc9d6;
  border-radius: 8px;
}

#mapEditorCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: contain;
  background: #eef2f5;
  cursor: default;
  touch-action: none;
}

.map-privacy-note {
  margin: 8px 0 0;
  color: #748399;
  font-size: 9px;
  text-align: center;
}

.map-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid #d8e1eb;
}

.map-exhibit-page {
  break-inside: avoid;
}

.map-exhibit-details {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.map-exhibit-image {
  display: grid;
  flex: 1;
  min-height: 0;
  margin: 0;
  place-items: center;
  overflow: hidden;
  background: #f3f5f7;
  border: 1px solid #cbd6e3;
  border-radius: 8px;
}

.map-exhibit-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: contain;
}

.map-exhibit-caption {
  margin-top: 12px;
  padding: 10px 12px;
  color: #34465c;
  font-size: 10px;
  line-height: 1.45;
  background: #f6f8fb;
  border: 1px solid #d9e1eb;
  border-radius: 7px;
}

.map-exhibit-caption strong {
  display: block;
  margin-bottom: 4px;
  color: #173757;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-exhibit-caption p { margin: 0; }

.photograph-upload-button {
  width: auto;
  min-height: 38px;
  margin: 0;
  padding: 8px 12px;
  font-size: 10px;
}

.photograph-image-dropzone {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 138px;
  padding: 22px;
  color: #47627f;
  text-align: center;
  background: linear-gradient(145deg, #f7fbff, #edf6ff);
  border: 2px dashed #84a9d6;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.photograph-image-dropzone.is-dragging,
.photograph-image-dropzone:hover {
  background: #eaf3ff;
  border-color: #4f8dd8;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.11);
  transform: translateY(-1px);
}

.photograph-image-dropzone strong {
  color: #173f70;
  font-size: 14px;
}

.photograph-image-dropzone span {
  font-size: 10px;
}

.photograph-image-dropzone .photograph-drop-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  font-size: 20px;
  background: #2563eb;
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.2);
}

.photograph-image-thumbnails {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 7px;
}

.photograph-image-thumbnails:empty {
  display: none;
}

.photograph-image-thumbnail {
  position: relative;
  height: 78px;
  overflow: hidden;
  background: #eef2f7;
  border: 1px solid #ccd7e4;
  border-radius: 8px;
}

.photograph-image-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photograph-image-thumbnail button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 25px;
  min-height: 25px;
  padding: 0;
  color: #fff;
  font-size: 16px;
  background: rgba(125, 24, 24, 0.88);
  border: 0;
  border-radius: 50%;
}

.optional-tools-section > .autofill-wizard,
.optional-tools-section > .can-scanner {
  margin-top: 12px;
}

.listing-statement-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
}

.listing-statement-row > span:not(.handle) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.preview {
  padding: 24px 28px 48px;
  overflow: auto;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(794px, 100%);
  min-height: 54px;
  margin: 0 auto 18px;
  padding: 8px 10px 8px 16px;
  color: #344054;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.toolbar > div {
  display: grid;
  gap: 2px;
}

.toolbar strong {
  color: var(--navy-900);
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.toolbar span {
  color: var(--muted);
  font-size: 11px;
}

.toolbar button {
  min-height: 36px;
  padding: 8px 13px;
}

.page {
  position: relative;
  width: 794px;
  min-height: 1123px;
  margin: 0 auto 24px;
  padding: 54px 62px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-paper);
  scroll-margin-top: 90px;
}

.doc-logo {
  display: block;
  width: 88px;
  margin: 0 auto 18px;
}

.force {
  color: var(--navy-900);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

.rule {
  margin: 22px 0;
  border-top: 1px solid #aeb9c8;
}

.title {
  margin: 0;
  text-align: center;
}

.title strong {
  display: block;
  color: var(--navy-900);
  font-size: 28px;
  letter-spacing: 0.07em;
}

.title span {
  display: block;
  color: #707b8b;
  font-size: 23px;
  font-weight: 300;
  letter-spacing: 0.08em;
}

.brief-no {
  margin: 18px 0;
  color: var(--navy-900);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
}

.brief-no b {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 22px;
}

.info-table {
  width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  border-collapse: collapse;
}

.info-table th {
  width: 27%;
  color: var(--navy-900);
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.info-table th,
.info-table td {
  padding: 9px 11px;
  border-bottom: 1px solid #d4dbe7;
}

.card {
  margin: 26px 0;
  padding: 17px;
  border: 1px solid #c7d1df;
  border-radius: 6px;
}

.card h4,
.section-label {
  margin: 0 0 13px;
  color: var(--navy-900);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-label {
  margin-top: 28px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 2.2fr;
  gap: 26px;
}

.off-list {
  margin: 0;
  padding-left: 20px;
}

.off-list li {
  margin-bottom: 12px;
}

.off-list em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.officer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 24px;
}

.mini h4 {
  margin: 0 0 15px;
  color: var(--navy-900);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kv {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 7px;
  font-size: 12px;
}

.kv b {
  color: var(--navy-900);
  text-transform: uppercase;
}

.document-signature {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  border-bottom: 1px solid #9aa7b8;
}

.document-signature img {
  display: block;
  width: 100%;
  height: 44px;
  object-fit: contain;
  object-position: left center;
}

.doc-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  text-align: center;
  border-bottom: 1px solid #aeb9c8;
}

.doc-heading img {
  width: 56px;
}

.doc-heading h2 {
  margin: 3px 0 0;
  color: var(--navy-900);
  font-size: 19px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.simple-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.simple-table th,
.simple-table td {
  padding: 9px;
  text-align: left;
  vertical-align: top;
  border: 1px solid #c9d2df;
}

.simple-table th {
  color: var(--navy-900);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f6f8fb;
}

.photograph-exhibit-page {
  display: flex;
  flex-direction: column;
  height: 1123px;
  min-height: 1123px;
}

.photograph-exhibit-page .case-summary {
  margin-bottom: 30px;
}

.photograph-exhibit-identification {
  display: grid;
  gap: 11px;
  justify-items: center;
  margin: 4px 0 24px;
  text-align: center;
}

.page-info-document-page {
  display: flex;
  flex-direction: column;
  height: 1123px;
  min-height: 1123px;
  padding: 54px 64px 48px;
}

.page-info-document-page .case-summary {
  margin-bottom: 44px;
}

.page-info-hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: auto 0 54px;
  padding: 58px 36px;
  text-align: center;
  border-top: 3px solid #0b1f3d;
  border-bottom: 3px solid #0b1f3d;
}

.page-info-hero span {
  color: var(--briefdesk-blue);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.page-info-hero h1 {
  max-width: 610px;
  margin: 0;
  color: #10213a;
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-info-hero strong {
  max-width: 560px;
  color: #53647a;
  font-size: 16px;
  line-height: 1.45;
}

.page-info-intro {
  display: grid;
  gap: 10px;
  margin: 0 auto auto;
  max-width: 620px;
  padding: 18px 20px;
  color: #344054;
  background: #f7f9fc;
  border: 1px solid #d4deeb;
  border-radius: 8px;
}

.page-info-intro span,
.page-info-footer span {
  color: #64748b;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.page-info-intro p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.page-info-footer {
  display: grid;
  justify-items: end;
  gap: 4px;
  margin-top: 36px;
}

.page-info-footer strong {
  color: #0b1f3d;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.photograph-exhibit-identification span {
  color: var(--navy-900);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photograph-exhibit-identification strong {
  max-width: 580px;
  color: #22344d;
  font-size: 17px;
  line-height: 1.4;
}

.photograph-exhibit-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #d3dce8;
  border-radius: 9px;
}

.photograph-exhibit-details > div {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
}

.photograph-exhibit-details > div + div {
  border-left: 1px solid #d3dce8;
}

.photograph-exhibit-details span {
  color: #617188;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photograph-exhibit-details strong {
  color: #263b55;
  font-size: 11px;
}

.photograph-exhibit-caption {
  margin: 0 0 16px;
  padding: 11px 13px;
  color: #52647c;
  font-size: 10px;
  line-height: 1.5;
  background: #f6f8fb;
  border: 1px solid #d9e1eb;
  border-radius: 8px;
}

.photograph-image-placeholder {
  display: grid;
  flex: 1;
  place-items: center;
  align-content: center;
  min-height: 430px;
  padding: 30px;
  color: #7b8797;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(226, 232, 240, 0.23) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(315deg, rgba(226, 232, 240, 0.23) 25%, transparent 25%) 0 0 / 18px 18px,
    #fbfcfd;
  border: 2px dashed #bdc9d8;
  border-radius: 12px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.photograph-image-placeholder.is-dragging {
  background-color: #eaf3ff;
  border-color: #3d7fcf;
}

.photograph-image-placeholder strong {
  color: #53647a;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photograph-image-placeholder span {
  margin-top: 8px;
  font-size: 10px;
}

.photograph-exhibit-page-number {
  margin-top: 12px;
  color: #718095;
  font-size: 9px;
  text-align: center;
}

.photograph-image-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
  background: #f7f9fc;
  border: 1px solid #cbd6e3;
  border-radius: 11px;
}

.photograph-image-grid.photograph-image-count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.photograph-image-grid figure {
  display: grid;
  min-width: 0;
  min-height: 0;
  margin: 0;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d7e0ea;
  border-radius: 7px;
}

.photograph-image-grid img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 560px;
  object-fit: contain;
}

.image-comparison-page {
  gap: 0;
}

.image-comparison-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 0;
}

.image-comparison-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #cbd6e3;
  border-radius: 10px;
}

.image-comparison-panel figcaption {
  padding: 10px 12px;
  color: var(--navy-900);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  background: #f2f6fd;
  border-bottom: 1px solid #d7e0ea;
}

.image-comparison-frame {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 10px;
  background: #fbfcff;
}

.image-comparison-frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 500px;
  object-fit: contain;
}

.image-comparison-frame span {
  color: #7b8797;
  font-size: 11px;
  font-weight: 750;
}

.image-comparison-meta {
  display: grid;
  border-top: 1px solid #d7e0ea;
}

.image-comparison-meta > div {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
}

.image-comparison-meta > div + div {
  border-top: 1px solid #e4eaf2;
}

.image-comparison-meta span,
.image-comparison-notes strong {
  color: #617188;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-comparison-meta strong {
  color: #263b55;
  font-size: 10px;
}

.image-comparison-notes {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 12px 14px;
  color: #52647c;
  background: #f6f8fb;
  border: 1px solid #d9e1eb;
  border-radius: 8px;
}

.image-comparison-notes p {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

.pdf-attachment-page {
  display: grid;
  place-items: center;
  padding: 0;
  background: #fff;
}

.pdf-attachment-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.dark-mode .builder,
body.dark-mode .panel-head,
body.dark-mode .form-section,
body.dark-mode .brief-progress,
body.dark-mode .start-options,
body.dark-mode .row,
body.dark-mode .saved-briefs-modal,
body.dark-mode .toolbar {
  color: var(--ink);
  background: #122138;
  border-color: var(--line);
}

body.dark-mode .builder {
  box-shadow: inset -1px 0 0 var(--line);
}

body.dark-mode .panel-head,
body.dark-mode .section-heading,
body.dark-mode .start-options,
body.dark-mode .brief-progress,
body.dark-mode .toolbar {
  background: rgba(18, 33, 56, 0.96);
}

body.dark-mode .form-section,
body.dark-mode .start-options,
body.dark-mode .brief-progress,
body.dark-mode .map-exhibit-row,
body.dark-mode .pdf-attachment-row,
body.dark-mode .photograph-exhibit-empty,
body.dark-mode .can-review,
body.dark-mode .wizard-status {
  background: #142640;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  color: #e7eef8;
  background: #0d1b30;
  border-color: #314866;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #8192aa;
}

body.dark-mode .section-heading h3,
body.dark-mode .panel-head h2,
body.dark-mode .brief-progress-copy strong,
body.dark-mode .start-options h3,
body.dark-mode .toolbar strong,
body.dark-mode .pdf-upload-dropzone strong,
body.dark-mode .pdf-attachment-row strong,
body.dark-mode .map-exhibit-row strong {
  color: #f2f7ff;
}

body.dark-mode .preview {
  background:
    radial-gradient(circle at 50% 0, rgba(62, 88, 122, 0.35), transparent 38%),
    #08111f;
}

body.dark-mode .pdf-upload-dropzone {
  color: #c2d0e3;
  background:
    linear-gradient(135deg, rgba(101, 163, 255, 0.08) 25%, transparent 25%) 0 0 / 18px 18px,
    #0d1b30;
  border-color: #3b5575;
}

body.dark-mode .pdf-upload-dropzone:hover,
body.dark-mode .pdf-upload-dropzone.is-dragging {
  background-color: #102948;
  border-color: #78b5ff;
}

body.dark-mode .photograph-exhibit-actions > button:last-child,
body.dark-mode .pdf-attachment-row button,
body.dark-mode .row button.secondary,
body.dark-mode button.secondary {
  color: #dcecff;
  background: #19304d;
  border-color: #365170;
}

body.dark-mode .photograph-exhibit-row {
  background: #0f1d31;
  border-color: #304966;
}

body.dark-mode .photograph-editor-group {
  background: #13243b;
  border-color: #304966;
}

body.dark-mode .photograph-editor-group-heading {
  background: #1a3150;
  border-bottom-color: #304966;
}

body.dark-mode .photograph-optional-fields .photograph-editor-group-heading {
  background: #2a2140;
  border-bottom-color: #4b3a68;
}

body.dark-mode .photograph-image-fields .photograph-editor-group-heading {
  background: #15382f;
  border-bottom-color: #28584b;
}

body.dark-mode .photograph-page-settings .photograph-editor-group-heading {
  background: #3b3019;
  border-bottom-color: #66532a;
}

body.dark-mode .photograph-editor-group-heading strong,
body.dark-mode .photograph-exhibit-grid label {
  color: #e7eef8;
}

body.dark-mode .photograph-editor-group-heading small {
  color: #a7b7cb;
}

body.dark-mode .photograph-image-dropzone {
  color: #b8c8dc;
  background: linear-gradient(145deg, #10223a, #132b48);
  border-color: #4d739f;
}

body.dark-mode .photograph-image-dropzone strong {
  color: #dbeafe;
}

body.dark-mode .photograph-page-number {
  color: #d5dfeb;
  background: #0e1c30;
  border-color: #304966;
}

body.dark-mode .page,
body.dark-mode .pdf-attachment-page {
  color: #142033;
  background: #fff;
}

.contents-table th:first-child,
.contents-table td:first-child {
  width: 54px;
  text-align: center;
}

.contents-table th:last-child,
.contents-table td:last-child {
  width: 92px;
  text-align: center;
}

.contents-table .check {
  height: 46px;
  vertical-align: middle;
}

.empty-checkbox {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  background: #fff;
  border: 1.7px solid #68778e;
  border-radius: 3px;
}

.empty-state {
  color: var(--muted);
  text-align: center !important;
}

.listing-form {
  padding: 28px 40px 24px;
  color: #111;
  font-family: Arial, sans-serif;
  font-size: 10.5px;
}

.listing-attachment {
  margin: 0 0 8px;
  font-size: 12px;
}

.listing-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.listing-warning {
  max-width: 620px;
  margin: 7px auto 16px;
  font-size: 10.5px;
  line-height: 1.35;
  text-align: center;
}

.official-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.official-table th,
.official-table td {
  height: 25px;
  padding: 4px 7px;
  vertical-align: middle;
  border: 1px solid #222;
}

.official-table th {
  color: #111;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-transform: none;
  background: #fff;
}

.official-table .label {
  font-weight: 800;
  text-transform: uppercase;
}

.official-table .center,
.official-table .choice {
  text-align: center;
}

.official-table .choice {
  font-weight: 800;
}

.listing-case-table {
  margin-bottom: 0;
}

.listing-witness-table,
.listing-details-table {
  margin-top: -1px;
}

.listing-witness-table tbody td {
  height: 23px;
  padding-top: 3px;
  padding-bottom: 3px;
}

.listing-details-table td {
  height: 24px;
}

.listing-form .document-signature {
  min-height: 30px;
  border: 0;
}

.listing-form .document-signature img {
  height: 30px;
}

.listing-footnotes {
  margin-top: 9px;
  font-size: 9px;
  line-height: 1.35;
}

.listing-footnotes p {
  margin: 4px 0;
  padding-left: 13px;
  text-indent: -13px;
}

@page {
  size: A4;
  margin: 0;
}

@media screen {
  body {
    overflow: hidden;
  }

  main {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .builder,
  .preview {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}

@media (max-width: 1350px) {
  .sidebar {
    width: 240px;
  }

  main {
    grid-template-columns: minmax(420px, 470px) minmax(0, 1fr);
    margin-left: 240px;
  }

  .brand img {
    width: 56px;
    height: 56px;
  }

  .brand h1 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .sidebar,
  .sidebar-reveal,
  main,
  .row-placeholder {
    transition: none;
  }
}

@media print {
  html,
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  .sidebar,
  .sidebar-reveal,
  .builder,
  .toolbar {
    display: none !important;
  }

  main {
    display: block;
    height: auto;
    margin: 0;
    overflow: visible;
  }

  .preview {
    height: auto;
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  .page {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    box-shadow: none;
    break-after: page;
    break-inside: avoid;
    page-break-after: always;
    page-break-inside: avoid;
  }

  .page:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  #cover .officer-grid {
    position: absolute;
    right: 62px;
    bottom: 54px;
    left: 62px;
    margin: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* Final responsive cascade: must follow legacy screen layout rules. */
@media screen and (max-width: 900px) {
  html,
  body {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body {
    padding-top: 58px;
    overflow-y: auto;
  }

  .mobile-header {
    display: grid;
  }

  .sidebar {
    top: 58px;
    width: min(320px, 88vw);
    transform: translateX(calc(-100% - 20px));
  }

  .sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 20px));
  }

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

  .sidebar-toggle,
  .sidebar-reveal {
    display: none;
  }

  main,
  .sidebar-collapsed main {
    display: block;
    width: 100%;
    height: auto;
    min-height: calc(100vh - 58px);
    margin-left: 0;
    overflow: visible;
  }

  .builder,
  .preview {
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .builder {
    padding: 18px clamp(14px, 4vw, 28px) 42px;
    overflow: visible;
  }

  .panel-head {
    position: static;
    top: auto;
  }

  .preview {
    max-height: 72vh;
    overflow: auto;
  }
}

@media screen and (max-width: 620px) {
  .builder {
    padding-right: 12px;
    padding-left: 12px;
  }

  .start-option-actions,
  .grid.two,
  .form-section .grid.two,
  .signature-actions,
  .wizard-actions,
  .wizard-question-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  #witnesses .row .grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  #witnesses .row {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .witness-row-actions {
    grid-column: 2;
  }

  .witness-row-actions .add-witness-to-listing {
    flex: 1 1 auto;
  }

  .copy-designation-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .photograph-exhibit-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .photograph-exhibit-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .photograph-exhibit-body {
    padding: 10px;
  }

  .photograph-editor-group-heading {
    padding-right: 52px;
  }

  .photograph-exhibit-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .photograph-exhibit-actions > button:last-child {
    width: 100%;
  }

  .map-exhibit-row {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .map-exhibit-row img {
    width: 90px;
    height: 62px;
  }

  .map-exhibit-row > div:last-child {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .preview {
    max-height: 58vh;
  }
}

@media screen and (max-width: 900px) {
  .map-editor-dialog {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .map-editor-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .map-editor-controls {
    max-height: none;
    overflow: visible;
    border-right: 0;
  }

  .map-canvas-panel {
    min-height: 620px;
  }

  .map-canvas-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .map-canvas-toolbar > div {
    justify-content: space-between;
  }

  #mapEditorCanvas {
    min-height: 500px;
  }
}

@media print {
  .mobile-header,
  .back-to-top,
  .map-editor-dialog {
    display: none !important;
  }
}
/* Production workspace controls */
.new-brief-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  background: #1673eb;
  box-shadow: 0 8px 22px rgba(0, 91, 211, 0.28);
}

.panel-head-actions,
.preview-toolbar-actions,
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-head {
  align-items: stretch;
  flex-direction: column;
  gap: 12px;
}

.panel-head-actions {
  justify-content: flex-start;
}

.panel-head-actions .preview-toggle-button {
  display: none;
}

.panel-head-actions .icon-button {
  display: none;
}

@media screen and (min-width: 1600px) {
  .panel-head-actions .icon-button {
    display: inline-flex;
  }
}

.icon-button,
.preview-toggle-button,
.mobile-preview-button,
.saved-briefs-button {
  color: #24364f;
  background: #fff;
  border-color: #d7e0eb;
}

.icon-button {
  width: 40px;
  padding: 7px;
  font-size: 20px;
}

.icon-button:hover,
.preview-toggle-button:hover,
.mobile-preview-button:hover,
.saved-briefs-button:hover {
  color: #071f41;
  background: #edf4fd;
}

.saved-briefs-button,
.save-brief-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.saved-count {
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  color: #43546b;
  font-size: 10px;
  font-weight: 850;
  background: #edf2f8;
  border-radius: 999px;
}

.save-brief-button {
  color: #fff;
  background: #0b5ed7;
  border-color: #0b5ed7;
  box-shadow: 0 5px 14px rgba(11, 94, 215, 0.2);
}

.save-brief-button:hover {
  background: #084daF;
  border-color: #084daf;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
}

.save-state > span:first-child {
  width: 7px;
  height: 7px;
  background: #1c8b58;
  border-radius: 50%;
}

.save-state.is-saving > span:first-child {
  background: #b67908;
}

.brief-progress {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid #d9e2ee;
  border-radius: 13px;
  box-shadow: 0 5px 18px rgba(12, 35, 66, 0.05);
}

.brief-progress-copy {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.brief-progress-copy .eyebrow {
  margin-bottom: 3px;
}

.brief-progress-copy strong {
  color: #1d3049;
  font-size: 13px;
}

#progressValue {
  color: #0b5ed7;
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  height: 7px;
  margin: 12px 0 8px;
  overflow: hidden;
  background: #e7edf5;
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #0b5ed7;
  border-radius: inherit;
  transition: width 180ms ease;
}

#progressHint {
  margin: 0;
  color: #667085;
  font-size: 10px;
}

.zoom-controls {
  min-height: 38px;
  padding: 3px;
  background: #eef3f9;
  border: 1px solid #d6e0eb;
  border-radius: 9px;
}

.zoom-controls button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  color: #24364f;
  background: transparent;
}

.zoom-controls span {
  min-width: 44px;
  color: #43546b;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.preview-close-button {
  display: none;
  color: #24364f;
  background: #fff;
  border-color: #d6e0eb;
}

#pages {
  transform-origin: top center;
}

.toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  pointer-events: none;
}

.app-toast {
  max-width: 340px;
  padding: 12px 15px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: #102b50;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(6, 22, 46, .28);
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media screen and (max-width: 900px) {
  .mobile-preview-button {
    display: inline-flex;
    min-height: 38px;
    padding: 8px 12px;
  }

  .panel-head-actions .print-button,
  .panel-head-actions .preview-toggle-button,
  .panel-head-actions .saved-briefs-button {
    display: none;
  }

  body.preview-open {
    overflow: hidden;
  }

  body.preview-open .preview {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    width: 100%;
    height: 100dvh;
    overflow: auto;
    background: #dfe6ef;
  }

  body.preview-open .preview .toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  body.preview-open .preview-close-button {
    display: inline-flex;
  }

  body:not(.preview-open) .preview {
    display: none;
  }
}

@media screen and (min-width: 901px) and (max-width: 1350px) {
  .panel-head-actions .icon-button,
  .panel-head-actions .preview-toggle-button {
    display: none;
  }

  .panel-head {
    gap: 12px;
  }

  .saved-briefs-button,
  .save-brief-button,
  .panel-head-actions .print-button {
    padding-inline: 10px;
    font-size: 11px;
  }
}

@media screen and (max-width: 620px) {
  .panel-head-actions {
    gap: 5px;
  }

  .icon-button {
    width: 36px;
    min-height: 36px;
  }

  .save-brief-button {
    min-height: 36px;
    padding: 7px 10px;
  }

  .brief-progress {
    padding: 14px;
  }

  .preview-toolbar-actions .print-button {
    padding-inline: 10px;
  }

  .zoom-controls {
    display: none;
  }

  .toast-region {
    right: 14px;
    bottom: 76px;
    left: 14px;
  }

  .app-toast {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-track span,
  .app-toast {
    transition: none;
    animation: none;
  }
}

@media print {
  .brief-progress,
  .toast-region {
    display: none !important;
  }

  #pages {
    transform: none !important;
  }
}

/* Guided five-phase workflow */
.guided-stepper {
  position: relative;
  gap: 0;
}

.guided-stepper::before {
  position: absolute;
  top: 45px;
  bottom: 29px;
  left: 23px;
  width: 2px;
  content: "";
  background: rgba(177, 197, 255, 0.2);
}

.workflow-nav .guided-step {
  position: relative;
  z-index: 1;
  min-height: 58px;
  padding: 8px 7px;
  gap: 10px;
}

.workflow-nav .guided-step::before {
  display: none;
}

.guided-step-number {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #afc2da;
  font-size: 11px;
  background: #102d52;
  border: 2px solid #496888;
  border-radius: 50%;
}

.guided-step span {
  display: grid;
  gap: 2px;
}

.guided-step span strong {
  font-size: 11px;
}

.guided-step span small {
  overflow: hidden;
  color: #91a8c6;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-nav .guided-step > i {
  flex-basis: 18px;
  width: 18px;
  height: 18px;
}

.workflow-nav .guided-step.active {
  background: rgba(34, 119, 230, 0.3);
  box-shadow: inset 3px 0 0 #7fbbff;
}

.guided-step.active .guided-step-number {
  color: #071f41;
  background: #fff;
  border-color: #9ed0ff;
  box-shadow: 0 0 0 4px rgba(91, 169, 255, 0.18);
}

.guided-step.is-complete .guided-step-number {
  color: #083b25;
  background: #8ee0b3;
  border-color: #8ee0b3;
}

.phase-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #e2e8f0;
}

.phase-summary > span {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #68788d;
}

.phase-summary b {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  font-size: 9px;
  background: #edf2f8;
  border-radius: 50%;
}

.phase-summary small {
  overflow: hidden;
  font-size: 9px;
  font-weight: 750;
  text-overflow: ellipsis;
}

.phase-summary .is-active {
  color: #0b5ed7;
}

.phase-summary .is-active b {
  color: #fff;
  background: #0b5ed7;
  box-shadow: 0 0 0 3px #dceaff;
}

.phase-summary .is-complete b {
  color: #075733;
  background: #b8ebcf;
}

body.dark-mode .phase-summary {
  border-color: #2b405c;
}

body.dark-mode .phase-summary b {
  background: #203550;
}

@media screen and (max-width: 620px) {
  .phase-summary {
    grid-template-columns: repeat(5, 1fr);
  }

  .phase-summary > span {
    justify-items: center;
    grid-template-columns: 1fr;
  }

  .phase-summary small {
    display: none;
  }
}

/* Saved briefs library */
.saved-briefs-modal {
  width: min(720px, calc(100vw - 32px));
  max-height: min(780px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd9e6;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(5, 24, 52, 0.32);
}

.saved-briefs-modal::backdrop {
  background: rgba(5, 19, 40, 0.6);
  backdrop-filter: blur(3px);
}

.saved-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid #dce4ee;
}

.saved-modal-header h2 {
  margin: 2px 0 5px;
  color: var(--navy-900);
  font-size: 24px;
}

.saved-modal-header p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.saved-modal-close {
  width: 38px;
  min-height: 38px;
  padding: 0;
  color: #40536b;
  font-size: 24px;
  font-weight: 500;
  background: #f3f6fa;
  border-color: #dce4ee;
}

.saved-modal-save {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 20px 26px;
  background: #f6f9fd;
  border-bottom: 1px solid #dce4ee;
}

.saved-modal-save label {
  margin: 0;
}

.saved-modal-save button {
  min-height: 44px;
}

.saved-modal-list-heading,
.saved-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 26px;
}

.saved-modal-list-heading > div {
  display: grid;
  gap: 3px;
}

.saved-modal-list-heading strong {
  color: #21344d;
  font-size: 13px;
}

.saved-modal-list-heading span {
  color: var(--muted);
  font-size: 10px;
}

.saved-modal-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  margin: 0;
  padding: 0 26px 20px;
  overflow-y: auto;
  list-style: none;
}

.saved-modal-list .saved-brief-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  align-items: center;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #d8e2ee;
  border-radius: 11px;
}

.saved-modal-list .saved-brief-row.is-current {
  background: #f1f7ff;
  border-color: #82b5f4;
  box-shadow: inset 3px 0 0 #1673eb;
}

.saved-modal-list .saved-brief-row strong {
  display: block;
  color: #172a43;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.saved-modal-list .saved-brief-row .muted {
  margin-top: 4px;
  color: #718095;
  font-size: 10px;
}

.saved-modal-list .brief-row-actions {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  gap: 6px;
  margin: 0;
}

.saved-modal-list .brief-row-actions button {
  width: auto;
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.saved-modal-list .brief-row-actions .action-edit {
  color: #0b57b7;
  background: #eef5ff;
  border: 1px solid #9fc4f3;
}

.saved-modal-list .brief-row-actions .action-edit:hover {
  color: #073f88;
  background: #dcecff;
  border-color: #6da8ed;
  filter: none;
}

.saved-modal-list .brief-row-actions .action-delete {
  color: #a42828;
  background: #fff4f4;
  border: 1px solid #e3a4a4;
}

.saved-modal-list .brief-row-actions .action-delete:hover {
  color: #7f1717;
  background: #ffe5e5;
  border-color: #cf7373;
  filter: none;
}

.saved-modal-list .empty-state {
  padding: 34px 20px;
  color: #667085;
  text-align: center;
  background: #f8fafc;
  border: 1px dashed #cbd7e5;
  border-radius: 11px;
}

.saved-modal-footer {
  border-top: 1px solid #dce4ee;
}

.saved-modal-footer .danger-outline {
  margin-left: auto;
}

@media screen and (max-width: 620px) {
  .saved-briefs-modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .saved-modal-header,
  .saved-modal-list-heading,
  .saved-modal-footer {
    padding-inline: 18px;
  }

  .saved-modal-save {
    grid-template-columns: 1fr;
    padding-inline: 18px;
  }

  .saved-modal-list {
    padding-inline: 18px;
  }

  .saved-modal-list .saved-brief-row {
    grid-template-columns: 1fr;
  }

  .saved-modal-list .brief-row-actions {
    grid-column: 1;
    grid-row: auto;
  }
}

@media print {
  .saved-briefs-modal {
    display: none !important;
  }
}

/* Local common-offence autocomplete */
.offence-field-grid {
  position: relative;
  align-items: start;
}

.offence-combobox {
  position: relative;
  min-width: 0;
}

.offence-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  width: calc(200% + 8px);
  left: 0;
  z-index: 40;
  max-height: 344px;
  padding: 6px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #c8d6e7;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(11, 37, 70, 0.18);
}

.offence-suggestions[hidden] {
  display: none;
}

.offence-suggestion {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  width: 100%;
  min-height: 0;
  padding: 10px 11px;
  color: #24364f;
  text-align: left;
  background: #fff;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
}

.offence-suggestion:hover,
.offence-suggestion.is-active {
  color: #102a4d;
  background: #edf5ff;
}

.offence-suggestion:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.offence-suggestion strong {
  min-width: 0;
  color: inherit;
  font-size: 11px;
  line-height: 1.35;
}

.offence-suggestion > span {
  grid-column: 1;
  color: #61728a;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.35;
}

.offence-suggestion small {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 3px 6px;
  color: #315f97;
  font-size: 8px;
  font-weight: 800;
  background: #e7f1fc;
  border-radius: 999px;
  white-space: nowrap;
}

.offence-no-results {
  padding: 12px;
  color: #667085;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.offence-verify-link {
  grid-column: 1 / -1;
  width: max-content;
  margin: -1px 0 0 2px;
  color: #1767bd;
  font-size: 9px;
  font-weight: 750;
  text-decoration: none;
}

.offence-verify-link:hover {
  text-decoration: underline;
}

.offence-safety-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  color: #52647c;
  font-size: 9px;
  line-height: 1.45;
  background: #f5f8fc;
  border: 1px solid #d8e2ee;
  border-radius: 8px;
}

.offence-safety-note a {
  color: #0b5ed7;
  font-weight: 800;
}

@media screen and (max-width: 620px) {
  #offences .offence-field-grid {
    grid-template-columns: 1fr;
  }

  .offence-suggestions {
    width: 100%;
    max-height: 300px;
  }

  .offence-suggestion {
    grid-template-columns: 1fr;
  }

  .offence-suggestion small {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

@media print {
  .offence-suggestions,
  .offence-verify-link,
  .offence-safety-note {
    display: none !important;
  }
}

/* Google Stitch "Justice Protocol" workspace refresh
   Applied to the existing controls so all Brief Builder behaviour stays intact. */
@media screen {
  :root {
    --stitch-navy: #001b3e;
    --stitch-primary: #002664;
    --stitch-accent: #2dbcfe;
    --stitch-surface: #f7fafd;
    --stitch-surface-low: #f1f4f7;
    --stitch-border: #dfe1e6;
    --stitch-text: #172b4d;
    --stitch-muted: #44546f;
    --stitch-success: #36b37e;
  }

  body {
    color: var(--stitch-text);
    background: var(--stitch-surface);
  }

  button {
    border-radius: 5px;
    box-shadow: none;
  }

  input,
  select,
  textarea {
    border-radius: 5px;
  }

  .builder {
    background: var(--stitch-surface);
    box-shadow: none;
  }

  .panel-head {
    background: rgba(247, 250, 253, 0.97);
    border-color: var(--stitch-border);
    box-shadow: 0 1px 0 rgba(0, 38, 100, 0.04);
  }

  .panel-head .eyebrow {
    color: #39708f;
  }

  .panel-head h2 {
    color: var(--stitch-navy);
    font-size: 24px;
  }

  .save-state {
    color: #607086;
  }

  .save-state > span:first-child {
    background: var(--stitch-success);
  }

  .saved-briefs-button,
  .preview-toggle-button,
  .icon-button {
    color: var(--stitch-primary);
    background: #fff;
    border-color: #cbd5e1;
  }

  .save-brief-button,
  .panel-head .print-button,
  .toolbar .print-button,
  .mobile-print-button {
    color: #fff;
    background: var(--stitch-primary);
    border-color: var(--stitch-primary);
    box-shadow: none;
  }

  .save-brief-button:hover,
  .panel-head .print-button:hover,
  .toolbar .print-button:hover,
  .mobile-print-button:hover {
    background: #001947;
    border-color: #001947;
  }

  .brief-progress {
    padding: 14px 16px;
    background: #fff;
    border-color: var(--stitch-border);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  }

  .brief-progress-copy strong {
    color: var(--stitch-text);
  }

  #progressValue {
    color: var(--stitch-primary);
  }

  .progress-track {
    height: 6px;
    background: #e4e9ee;
    border-radius: 2px;
  }

  .progress-track span {
    background: var(--stitch-success);
    border-radius: 2px;
  }

  .start-options {
    padding: 14px 16px;
    background: #fff;
    border-color: var(--stitch-border);
    border-radius: 8px;
  }

  .start-options .eyebrow {
    color: #39708f;
  }

  .start-option-actions .secondary,
  .form-section > .secondary {
    color: #005f84;
    background: #f5fbff;
    border-color: #82cfff;
  }

  .start-option-actions .secondary:hover,
  .form-section > .secondary:hover {
    color: #003f59;
    background: #e3f5ff;
  }

  .form-section {
    margin-top: 14px;
    padding: 0 16px 16px;
    background: #fff;
    border-color: var(--stitch-border);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.045);
  }

  .section-heading {
    width: calc(100% + 32px);
    margin: 0 -16px 16px;
    padding: 13px 16px 12px;
    background: #f8f9fa;
    border-color: var(--stitch-border);
    border-radius: 8px 8px 0 0;
  }

  .section-heading h3 {
    color: var(--stitch-navy);
    font-size: 16px;
    font-weight: 700;
  }

  .section-heading p:not(.section-kicker) {
    color: var(--stitch-muted);
  }

  .section-kicker {
    color: #39708f;
    letter-spacing: 0.14em;
  }

  .section-status {
    color: #006b48;
    background: #e8f7f0;
    border-color: #b8e7d2;
    border-radius: 999px;
  }

  .section-status.is-complete,
  .workflow-section.is-complete .section-status {
    color: #006644;
    background: #e3fcef;
    border-color: #abdfca;
  }

  .section-toggle {
    border-radius: 5px;
  }

  .form-section label {
    color: #344563;
  }

  .form-section input,
  .form-section select,
  .form-section textarea {
    color: var(--stitch-text);
    background: #fff;
    border-color: #c7d0dc;
    box-shadow: none;
  }

  .form-section input:focus,
  .form-section select:focus,
  .form-section textarea:focus {
    border-color: var(--stitch-primary);
    box-shadow: 0 0 0 3px rgba(0, 38, 100, 0.1);
  }

  .row,
  .photograph-exhibit-row,
  .setting-row,
  .setting-select {
    border-radius: 7px;
    box-shadow: none;
  }

  .row {
    background: #fff;
    border-color: var(--stitch-border);
  }

  .handle {
    color: #5d6b7f;
    background: var(--stitch-surface-low);
    border-radius: 5px;
  }

  .preview {
    background: #e5e8eb;
  }

  .toolbar {
    color: var(--stitch-muted);
    background: rgba(247, 250, 253, 0.97);
    border-color: var(--stitch-border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 38, 100, 0.08);
  }

  .toolbar strong {
    color: var(--stitch-navy);
  }

  .live-preview-label {
    color: #006b48;
  }

  .live-preview-label i {
    background: var(--stitch-success);
  }

  .zoom-controls {
    background: #fff;
    border-color: var(--stitch-border);
    border-radius: 5px;
  }

  .page {
    box-shadow: 0 8px 24px rgba(0, 38, 100, 0.12);
  }

  .saved-briefs-modal {
    border-radius: 8px;
  }
}

@media screen and (min-width: 901px) {
  .sidebar {
    gap: 14px;
    width: 240px;
    padding: 18px 14px 16px;
    background: var(--stitch-navy);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar .brand {
    gap: 10px;
    padding: 0 7px 2px;
  }

  .sidebar .brand img {
    width: 40px;
    height: 40px;
    padding: 2px;
    background: #fff;
    border-radius: 5px;
  }

  .sidebar .brand h1 {
    font-size: 14px;
    line-height: 1.2;
  }

  .sidebar .brand p {
    margin-top: 2px;
    color: #aebed2;
    font-size: 9px;
  }

  .new-brief-button {
    min-height: 42px;
    color: #00344a;
    font-size: 11px;
    background: var(--stitch-accent);
    border-color: var(--stitch-accent);
    border-radius: 6px;
    box-shadow: none;
  }

  .new-brief-button:hover {
    color: #001e2d;
    background: #82cfff;
    border-color: #82cfff;
  }

  .sidebar-toggle {
    min-height: 30px;
    margin: -5px 4px 0 0;
    padding: 5px 9px;
    font-size: 9px;
    border-radius: 5px;
    box-shadow: none;
  }

  .sidebar-toggle span:first-child {
    font-size: 17px;
  }

  .workflow-nav {
    gap: 18px;
  }

  .nav-group {
    gap: 2px;
  }

  .nav-group-title {
    margin-bottom: 5px;
    padding: 0 9px;
    color: #7590ae;
    font-size: 8px;
    letter-spacing: 0.17em;
  }

  .workflow-nav a {
    gap: 9px;
    min-height: 35px;
    padding: 7px 8px;
    color: #aebed2;
    font-size: 10px;
    border-radius: 0 5px 5px 0;
  }

  .workflow-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: transparent;
  }

  .workflow-nav a::before {
    display: grid;
    flex: 0 0 22px;
    place-items: center;
    width: 22px;
    height: 22px;
    color: #91a8c6;
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    background: transparent;
    border: 1px solid rgba(177, 197, 255, 0.18);
    border-radius: 5px;
  }

  .workflow-nav a[href="#accused-section"]::before { content: "A"; }
  .workflow-nav a[href="#representation-section"]::before { content: "R"; }
  .workflow-nav a[href="#oic-section"]::before { content: "O"; }
  .workflow-nav a[href="#signature-section"]::before { content: "S"; }
  .workflow-nav a[href="#offences-section"]::before { content: "C"; }
  .workflow-nav a[href="#contents-section"]::before { content: "B"; }
  .workflow-nav a[href="#page-info-section"]::before { content: "I"; }
  .workflow-nav a[href="#photograph-exhibits-section"]::before { content: "P"; }
  .workflow-nav a[href="#map-exhibits-section"]::before { content: "M"; }
  .workflow-nav a[href="#pdf-attachments-section"]::before { content: "D"; }
  .workflow-nav a[href="#witnesses-section"]::before { content: "W"; }
  .workflow-nav a[href="#listing-section"]::before { content: "L"; }
  .workflow-nav a[href="#acknowledgement-section"]::before { content: "K"; }

  .workflow-nav .tool-nav-link {
    min-height: 40px;
    padding-block: 6px;
  }

  .tool-nav-icon {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }

  .workflow-nav a > i {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.12);
  }

  .workflow-nav a.is-complete > i {
    color: #003b27;
    background: var(--stitch-success);
    border-color: var(--stitch-success);
  }

  .workflow-nav a.is-complete::before {
    color: #b9f6d8;
    background: rgba(54, 179, 126, 0.08);
    border-color: rgba(54, 179, 126, 0.35);
  }

  .workflow-nav a.active {
    color: var(--stitch-accent);
    background: rgba(0, 38, 100, 0.7);
    border-color: transparent;
    box-shadow: inset 3px 0 0 var(--stitch-accent);
  }

  .workflow-nav a.active::before {
    color: var(--stitch-accent);
    border-color: rgba(45, 188, 254, 0.45);
  }

  .document-nav {
    padding-top: 10px;
  }

  .document-nav-links {
    gap: 3px;
  }

  .document-nav a {
    min-height: 27px;
    color: #aebed2;
    font-size: 8px;
    border-radius: 4px;
  }

  .document-nav a.active {
    color: #001e2d;
    background: var(--stitch-accent);
  }

  .saved-briefs {
    border-radius: 6px;
    box-shadow: none;
  }

  .saved-briefs summary {
    min-height: 38px;
    padding: 8px 10px;
  }

  .privacy {
    padding: 10px;
    color: #9eb0c6;
    font-size: 9px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
  }

  .privacy strong {
    font-size: 10px;
  }

  main,
  .sidebar-collapsed main {
    grid-template-columns: minmax(460px, 540px) minmax(0, 1fr);
    margin-left: 240px;
  }

  .sidebar-collapsed main {
    margin-left: 0;
  }

  .builder {
    padding: 18px 22px 44px;
    border-right: 1px solid var(--stitch-border);
  }

  .panel-head {
    top: -18px;
    margin: 0 -3px;
    padding: 12px 3px 11px;
  }

  .panel-head-actions {
    gap: 6px;
  }

  .panel-head-actions button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 10px;
  }

  .preview {
    padding: 18px 22px 44px;
  }

  .toolbar {
    min-height: 48px;
    margin-bottom: 14px;
    padding: 6px 7px 6px 12px;
  }
}

@media screen and (min-width: 1500px) {
  main,
  .sidebar-collapsed main {
    grid-template-columns: minmax(520px, 610px) minmax(0, 1fr);
  }
}

@media screen and (max-width: 900px) {
  .mobile-header {
    color: #fff;
    background: var(--stitch-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-menu-button,
  .mobile-preview-button {
    border-radius: 5px;
  }

  .mobile-preview-button {
    color: #001e2d;
    background: var(--stitch-accent);
    border-color: var(--stitch-accent);
  }

  .sidebar {
    background: var(--stitch-navy);
  }

  .builder {
    padding-inline: 14px;
  }

  .panel-head {
    background: var(--stitch-surface);
  }

  .form-section {
    border-radius: 7px;
  }

  .section-heading {
    border-radius: 7px 7px 0 0;
  }
}

/* ==========================================================================
   Procedural Precision Light
   Design direction imported from stitch UI optimization markdown.
   ========================================================================== */

:root {
  --precision-bg: #f8fafc;
  --precision-surface: #ffffff;
  --precision-surface-soft: #f1f5f9;
  --precision-surface-blue: #eef4ff;
  --precision-text: #111c2d;
  --precision-muted: #64748b;
  --precision-border: #e2e8f0;
  --precision-border-strong: #cbd5e1;
  --precision-primary: #2563eb;
  --precision-primary-dark: #1d4ed8;
  --precision-primary-soft: #dbeafe;
  --precision-success: #15803d;
  --precision-success-soft: #dcfce7;
  --precision-warning: #a16207;
  --precision-warning-soft: #fef3c7;
  --precision-danger: #b91c1c;
  --precision-danger-soft: #fee2e2;
  --precision-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --precision-shadow-lg: 0 18px 38px rgba(15, 23, 42, 0.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

body {
  color: var(--precision-text);
  background: var(--precision-bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button {
  border-radius: var(--radius-sm);
}

.sidebar {
  gap: 14px;
  width: 280px;
  padding: 20px 18px;
  color: #e2e8f0;
  background: #0f172a;
  border-right: 1px solid #1e293b;
  box-shadow: none;
}

.brand {
  align-items: center;
  gap: 11px;
  padding: 6px 6px 10px;
}

.brand img {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-lg);
}

.brand h1 {
  color: #fff;
  font-size: 18px;
  letter-spacing: 0;
}

.brand p,
.nav-group-title,
.eyebrow,
.section-kicker {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.brand p {
  color: #94a3b8;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.new-brief-button {
  min-height: 44px;
  color: #fff;
  background: var(--precision-primary);
  border-color: var(--precision-primary);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.new-brief-button:hover {
  background: var(--precision-primary-dark);
}

.sidebar-toggle,
.workflow-nav a,
.document-nav a,
.saved-briefs,
.privacy {
  border-radius: var(--radius-md);
}

.workflow-nav a {
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
}

.workflow-nav a:hover {
  color: #fff;
  background: #1e293b;
  border-color: #334155;
}

.workflow-nav a.active {
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.13);
  border-color: rgba(96, 165, 250, 0.36);
  box-shadow: inset 3px 0 0 #60a5fa;
}

.workflow-nav a::before {
  background: #475569;
  border-color: #64748b;
}

.workflow-nav a.is-complete::before {
  background: #22c55e;
  border-color: #86efac;
}

.workflow-nav a > i {
  background: #111827;
  border-color: #334155;
}

.workflow-nav a.is-complete > i {
  color: #052e16;
  background: #86efac;
  border-color: #86efac;
}

.nav-group-title {
  color: #94a3b8;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.tool-nav-icon {
  border-radius: var(--radius-md);
}

.document-nav {
  border-top-color: #1e293b;
}

.document-nav a {
  color: #cbd5e1;
  background: #111827;
  border: 1px solid #1e293b;
}

.document-nav a.active {
  color: #fff;
  background: var(--precision-primary);
}

.saved-briefs,
.privacy {
  color: #dbeafe;
  background: #111827;
  border-color: #334155;
  box-shadow: none;
}

main {
  margin-left: 280px;
  grid-template-columns: minmax(520px, 610px) minmax(0, 1fr);
  background: var(--precision-bg);
}

.builder {
  padding: 24px 28px 56px;
  background: var(--precision-bg);
  border-right: 1px solid var(--precision-border);
  box-shadow: none;
}

.panel-head {
  top: -24px;
  margin: 0 -4px 16px;
  padding: 14px 4px 12px;
  background: rgba(248, 250, 252, 0.96);
  border-bottom: 1px solid var(--precision-border);
  backdrop-filter: blur(10px);
}

.panel-head h2 {
  color: var(--precision-text);
  font-family: "Hanken Grotesk", Inter, "Segoe UI", Arial, sans-serif;
  font-size: 31px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.eyebrow {
  color: var(--precision-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.save-state {
  color: var(--precision-muted);
  font-size: 12px;
}

.panel-head-actions button,
.preview-toolbar-actions button,
.start-option-actions button,
.form-section > .secondary {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 750;
  border-radius: var(--radius-sm);
}

.theme-toggle,
.icon-button,
.preview-toggle-button,
.mobile-preview-button,
.saved-briefs-button,
.secondary {
  color: #334155;
  background: var(--precision-surface);
  border-color: var(--precision-border-strong);
  box-shadow: none;
}

.theme-toggle:hover,
.icon-button:hover,
.preview-toggle-button:hover,
.mobile-preview-button:hover,
.saved-briefs-button:hover,
.secondary:hover {
  color: var(--precision-primary-dark);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.save-brief-button,
.panel-head .print-button,
.toolbar .print-button,
.mobile-print-button {
  color: #fff;
  background: var(--precision-primary);
  border-color: var(--precision-primary);
  box-shadow: var(--precision-shadow);
}

.save-brief-button:hover,
.panel-head .print-button:hover,
.toolbar .print-button:hover,
.mobile-print-button:hover {
  background: var(--precision-primary-dark);
  border-color: var(--precision-primary-dark);
}

.brief-progress {
  position: relative;
  margin: 0 0 20px;
  padding: 22px 22px 20px;
  overflow: hidden;
  background: var(--precision-surface);
  border: 1px solid #bfdbfe;
  border-left: 5px solid var(--precision-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--precision-shadow-lg);
}

.brief-progress::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--precision-primary), #0ea5e9);
}

.brief-progress-copy {
  align-items: center;
}

.brief-progress-copy strong {
  color: var(--precision-text);
  font-family: "Hanken Grotesk", Inter, "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
}

#progressValue {
  color: var(--precision-primary);
  font-family: "Hanken Grotesk", Inter, "Segoe UI", Arial, sans-serif;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.progress-track {
  height: 18px;
  margin: 16px 0 11px;
  padding: 3px;
  background: #e2e8f0;
  border: 1px solid var(--precision-border);
  border-radius: 999px;
}

.progress-track span {
  background: linear-gradient(90deg, var(--precision-primary), #0ea5e9);
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.16);
}

#progressHint {
  color: var(--precision-muted);
  font-size: 12px;
  line-height: 1.45;
}

.start-options,
.form-section,
.autofill-wizard,
.can-scanner,
.toolbar,
.saved-briefs-modal,
.map-editor-dialog {
  background: var(--precision-surface);
  border: 1px solid var(--precision-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--precision-shadow);
}

.start-options {
  padding: 16px 18px;
}

.start-options h3,
.section-heading h3,
.form-section > h3,
.saved-modal-header h2,
.map-editor-header h2 {
  color: var(--precision-text);
  font-family: "Hanken Grotesk", Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: -0.005em;
}

.start-options p,
.section-heading p:not(.section-kicker) {
  color: var(--precision-muted);
}

.form-section {
  margin-top: 16px;
  padding: 0 18px 18px;
  scroll-margin-top: 92px;
}

.section-heading {
  width: calc(100% + 36px);
  margin: 0 -18px 18px;
  padding: 16px 18px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--precision-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.section-kicker {
  color: var(--precision-primary);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.section-heading h3 {
  font-size: 17px;
  font-weight: 800;
}

.section-status {
  min-height: 24px;
  padding: 5px 8px;
  color: var(--precision-warning);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  background: var(--precision-warning-soft);
  border: 1px solid #fde68a;
  border-radius: 999px;
}

.section-status.is-complete,
.workflow-section.is-complete .section-status,
#matter-details.is-complete .section-status {
  color: var(--precision-success);
  background: var(--precision-success-soft);
  border-color: #86efac;
}

.section-toggle {
  color: #334155;
  background: #fff;
  border-color: var(--precision-border);
  border-radius: var(--radius-sm);
}

.form-section label,
.setting-copy strong,
.setting-select strong {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  color: var(--precision-text);
  background: #fff;
  border: 1px solid var(--precision-border-strong);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--precision-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

.required-field::after {
  color: var(--precision-danger);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

input.is-missing,
select.is-missing,
textarea.is-missing {
  background: #fffafa;
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.row,
.listing-statement-row,
.case-summary,
.acknowledgement-guide,
.uploaded-signature-preview,
.numbered-preview,
.pdf-attachment-row {
  background: #f8fafc;
  border: 1px solid var(--precision-border);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.handle,
.zoom-controls {
  background: var(--precision-surface-soft);
  border-color: var(--precision-border);
  border-radius: var(--radius-sm);
}

.preview {
  padding: 24px 26px 56px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(248, 250, 252, 0)),
    #e2e8f0;
}

.toolbar {
  margin-bottom: 18px;
  padding: 10px 12px;
}

.toolbar strong {
  color: var(--precision-text);
}

.live-preview-label {
  color: var(--precision-success) !important;
  background: var(--precision-success-soft);
  border-color: #86efac;
}

#pages .page,
.page {
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

body.dark-mode {
  --precision-bg: #020617;
  --precision-surface: #0f172a;
  --precision-surface-soft: #111827;
  --precision-surface-blue: #172554;
  --precision-text: #e2e8f0;
  --precision-muted: #94a3b8;
  --precision-border: #1e293b;
  --precision-border-strong: #334155;
  --precision-primary: #60a5fa;
  --precision-primary-dark: #3b82f6;
  --precision-primary-soft: #172554;
}

body.dark-mode .builder,
body.dark-mode .panel-head {
  background: var(--precision-bg);
}

body.dark-mode .start-options,
body.dark-mode .form-section,
body.dark-mode .brief-progress,
body.dark-mode .toolbar,
body.dark-mode .autofill-wizard,
body.dark-mode .can-scanner {
  color: var(--precision-text);
  background: var(--precision-surface);
  border-color: var(--precision-border);
}

body.dark-mode .section-heading {
  background: #111827;
  border-color: var(--precision-border);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  color: var(--precision-text);
  background: #020617;
  border-color: var(--precision-border-strong);
}

body.dark-mode .row,
body.dark-mode .listing-statement-row,
body.dark-mode .case-summary,
body.dark-mode .acknowledgement-guide {
  background: #111827;
  border-color: var(--precision-border);
}

body.dark-mode .preview {
  background: #020617;
}

@media screen and (max-width: 1180px) {
  .sidebar {
    width: 248px;
  }

  main {
    margin-left: 248px;
    grid-template-columns: minmax(470px, 54vw) minmax(0, 1fr);
  }
}

@media screen and (min-width: 1500px) {
  main,
  .sidebar-collapsed main {
    grid-template-columns: minmax(540px, 640px) minmax(0, 1fr);
  }
}

@media screen and (max-width: 900px) {
  html,
  body {
    overflow-x: hidden;
  }

  .mobile-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    color: #e2e8f0;
    background: #0f172a;
    border-bottom-color: #1e293b;
  }

  .mobile-brand {
    min-width: 0;
  }

  .mobile-brand strong,
  .mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-menu-button,
  .mobile-theme-toggle,
  .mobile-preview-button {
    min-width: 0;
  }

  .mobile-theme-toggle {
    display: none;
  }

  .sidebar {
    width: min(86vw, 310px);
  }

  main {
    margin-left: 0;
    background: var(--precision-bg);
  }

  .builder {
    min-width: 0;
    padding-inline: 16px;
    overflow-x: hidden;
  }

  .panel-head {
    top: -18px;
  }

  .panel-head-actions {
    width: 100%;
  }

  .panel-head-actions button {
    flex: 1 1 auto;
  }

  .brief-progress {
    padding: 18px 16px 16px;
  }

  .brief-progress-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .brief-progress-copy strong {
    font-size: 15px;
  }

  #progressValue {
    align-self: flex-start;
    font-size: 24px;
  }

  #progressHint,
  .start-options p,
  .section-heading p:not(.section-kicker) {
    overflow-wrap: anywhere;
  }

  .start-options {
    grid-template-columns: 1fr;
  }

  .start-option-actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .start-option-actions button {
    width: 100%;
  }

  .form-section,
  .start-options,
  .toolbar {
    border-radius: var(--radius-lg);
  }

  .section-heading {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

/* ==========================================================================
   BriefDesk mockup alignment
   Stronger shell, blue card caps and review-focused preview rail.
   ========================================================================== */

:root {
  --briefdesk-sidebar: #263346;
  --briefdesk-sidebar-2: #1f2b3d;
  --briefdesk-editor: #eef1f7;
  --briefdesk-preview: #dfeaff;
  --briefdesk-blue: #004ac6;
  --briefdesk-blue-2: #0b5ed7;
  --briefdesk-blue-soft: #e9efff;
}

.app-topbar {
  position: fixed;
  z-index: 18;
  top: 0;
  right: 0;
  left: 280px;
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 64px;
  padding: 0 26px 0 28px;
  color: #111c2d;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid #c3c6d7;
}

.app-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-family: "Hanken Grotesk", Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  border-radius: 8px;
  transition: opacity 0.14s ease;
}

.app-topbar-brand:hover,
.app-topbar-brand:focus-visible {
  opacity: 0.78;
}

.app-topbar-brand strong {
  color: var(--briefdesk-blue);
  font-weight: 900;
}

.app-topbar-brand span {
  width: 1px;
  height: 18px;
  background: #c3c6d7;
}

.app-topbar-brand b {
  color: #0f172a;
  font-weight: 850;
}

.stage-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #eef1f6;
  border: 1px solid #e2e6ee;
  border-radius: 10px;
}

.stage-tabs a {
  position: relative;
  display: inline-flex;
  height: 30px;
  align-items: center;
  padding: 0 14px;
  color: #5b6576;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  transform: none;
  transition: background 0.14s ease, color 0.14s ease;
}

.stage-tabs a:hover,
.stage-tabs a:focus-visible {
  color: var(--briefdesk-blue);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
  transform: none;
}

.stage-tabs a::before,
.stage-tabs a.active::before {
  display: none;
  content: none;
}

.stage-tabs a.active {
  color: var(--briefdesk-blue);
  background: #fff;
  border: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
  transform: none;
}

.stage-tabs a.active:hover {
  background: #fff;
}

.stage-tabs a.active::after {
  display: none;
  content: none;
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
}

.autosave-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 14px;
  color: #111827;
  font-size: 13px;
  font-weight: 750;
  background: #edf3ff;
  border: 1px solid #bac7df;
  border-radius: 12px;
}

.autosave-pill span {
  color: var(--briefdesk-blue);
}

.topbar-icon {
  display: grid;
  width: 38px;
  min-height: 38px;
  padding: 0;
  place-items: center;
  color: #111827;
  font-size: 20px;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.topbar-icon:hover {
  color: var(--briefdesk-blue);
  background: #eff6ff;
}

.sidebar {
  width: 280px;
  padding: 0 14px 18px;
  background: var(--briefdesk-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 188px;
  margin: 0 -14px 16px;
  padding: 28px 18px 24px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar .brand img {
  width: 72px;
  height: 72px;
  padding: 7px;
  background: #fff;
  border-radius: 0;
}

.sidebar .brand h1 {
  margin-top: 4px;
  color: #fff;
  font-size: 25px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar .brand p {
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.new-brief-button {
  margin-bottom: 10px;
}

.workflow-nav a {
  min-height: 48px;
  padding: 11px 13px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
}

.workflow-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  box-shadow: none;
}

.workflow-nav a::before {
  display: none;
}

.workflow-nav a > i {
  margin-left: auto;
}

.tool-nav-icon {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
  color: #dbeafe;
  border-color: rgba(255, 255, 255, 0.16);
}

main {
  height: calc(100vh - 64px);
  margin-top: 64px;
  margin-left: 280px;
  grid-template-columns: minmax(530px, 640px) minmax(0, 1fr);
  background: var(--briefdesk-preview);
}

.builder {
  padding: 34px 30px 64px;
  background: var(--briefdesk-editor);
}

.panel-head {
  position: relative;
  top: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin: 0 0 24px;
  padding: 0 0 24px;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
}

.panel-head h2 {
  max-width: 420px;
  color: #0f172a;
  font-size: 40px;
  line-height: 1.12;
}

.panel-head .save-state {
  margin-top: 16px;
  color: #0f172a;
  font-size: 14px;
  font-style: italic;
  font-weight: 500;
}

.panel-head .save-state > span:first-child {
  width: 7px;
  height: 7px;
  background: var(--briefdesk-blue);
}

.panel-head-actions {
  align-items: stretch;
  gap: 14px;
  justify-content: flex-end;
}

.panel-head-actions .theme-toggle,
.panel-head-actions .print-button {
  min-width: 138px;
  min-height: 68px;
  padding: 13px 22px;
  font-size: 16px;
  border-radius: 4px;
}

.panel-head-actions .theme-toggle {
  color: #0f172a;
  background: #fff;
  border-color: #bac7df;
}

.panel-head-actions .print-button {
  font-size: 16px;
  line-height: 1.2;
}

.panel-head-actions .saved-briefs-button,
.panel-head-actions .save-brief-button,
.panel-head-actions .icon-button,
.panel-head-actions .preview-toggle-button {
  display: none;
}

.brief-progress,
.form-section,
.start-options,
.autofill-wizard,
.can-scanner {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid #bac7df;
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.brief-progress::before,
.form-section::before,
.start-options::before,
.autofill-wizard::before,
.can-scanner::before {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  left: 0;
  height: 6px;
  content: "";
  background: var(--briefdesk-blue);
}

.brief-progress {
  padding: 40px 38px 34px;
  border-left: 1px solid #bac7df;
  border-color: #b7c7e8;
  box-shadow: 0 8px 22px rgba(0, 74, 198, 0.12);
}

.brief-progress::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 7px;
  content: "";
  background: var(--briefdesk-blue);
}

.brief-progress-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin-bottom: 24px;
}

.brief-progress-copy .eyebrow {
  display: none;
}

.brief-progress-copy strong {
  display: block;
  position: relative;
  max-width: 470px;
  padding-left: 52px;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.22;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: normal;
}

.brief-progress-copy strong::before {
  position: absolute;
  top: -6px;
  left: 0;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--briefdesk-blue);
  font-size: 20px;
  content: "▣";
  background: var(--briefdesk-blue-soft);
  border-radius: 8px;
}

#progressValue {
  font-size: 32px;
}

#progressValue::after {
  display: block;
  margin-top: 5px;
  color: #0f172a;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  content: "COMPLETION SCORE";
}

.progress-track {
  height: 20px;
  padding: 4px;
  background: #dfe8fa;
  border-color: #b7c7e8;
}

.progress-track span {
  background: var(--briefdesk-blue);
}

#progressHint {
  max-width: 430px;
  margin-top: 20px;
  color: #1f2937;
  font-size: 18px;
  line-height: 1.45;
}

.start-options {
  display: none;
}

.form-section {
  margin-top: 34px;
  padding: 0 28px 28px;
}

.section-heading {
  width: calc(100% + 56px);
  margin: 0 -28px 28px;
  padding: 32px 28px 20px;
  background: #fff;
  border-bottom: 0;
}

.section-kicker {
  color: var(--briefdesk-blue);
  font-size: 11px;
  letter-spacing: 0.22em;
}

.section-heading h3 {
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.2;
}

.section-heading p:not(.section-kicker) {
  font-size: 12px;
}

.section-status {
  min-width: 128px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.brief-type-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.brief-type-card {
  position: relative;
  display: block;
  min-width: 0;
  margin: 0;
  cursor: pointer;
}

.brief-type-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  opacity: 0;
}

.brief-type-card span {
  display: grid;
  min-height: 86px;
  align-content: start;
  gap: 6px;
  padding: 15px 15px 14px 42px;
  color: #111827;
  background: #fff;
  border: 1px solid #bac7df;
  border-radius: 6px;
  box-shadow: inset 0 5px 0 #c7d7f5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.brief-type-card span::before {
  position: absolute;
  top: 18px;
  left: 15px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  content: "";
  background: #fff;
  border: 2px solid #94a3b8;
  border-radius: 4px;
}

.brief-type-card strong {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: 0;
}

.brief-type-card small {
  color: #64748b;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
}

.brief-type-card input:checked + span {
  background: #f8fbff;
  border-color: var(--briefdesk-blue);
  box-shadow: inset 0 5px 0 var(--briefdesk-blue), 0 0 0 3px rgba(0, 74, 198, 0.08);
}

.brief-type-card input:checked + span::before {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  background: var(--briefdesk-blue);
  border-color: var(--briefdesk-blue);
}

.brief-type-card input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.brief-title-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.brief-title-field span {
  color: #1f2a44;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brief-title-field input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  color: #08182f;
  font-size: 15px;
  font-weight: 750;
  text-transform: uppercase;
  background: #f8fbff;
  border: 1px solid #bac7df;
  border-radius: 6px;
  box-shadow: inset 0 3px 0 #c7d7f5;
}

.grid.two {
  gap: 22px 28px;
}

.form-section label {
  color: #111827;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select,
textarea {
  min-height: 54px;
  padding: 13px 15px;
  color: #0f172a;
  font-size: 18px;
  font-weight: 650;
  background: #f0f3ff;
  border-color: #bac7df;
  border-radius: 4px;
}

.preview {
  padding: 32px 32px 64px;
  background: var(--briefdesk-preview);
}

.toolbar {
  max-width: 520px;
  min-height: 56px;
  margin: 0 auto 20px;
  padding: 10px 14px 10px 18px;
  background: #fff;
  border-color: #bac7df;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.toolbar strong {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.preview-page-count {
  color: #111827;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.live-preview-label {
  color: #111827 !important;
  font-size: 11px !important;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.live-preview-label i {
  width: 7px;
  height: 7px;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

.zoom-controls {
  min-height: 36px;
  padding: 0 6px;
  background: #edf3ff;
  border-color: #bac7df;
  border-radius: 4px;
}

.zoom-controls button {
  width: 28px;
  min-height: 28px;
  font-size: 14px;
}

.zoom-controls span {
  min-width: 42px;
  color: #111827;
  font-size: 11px;
}

.toolbar .print-button {
  min-height: 36px;
  padding-inline: 16px;
  font-size: 12px;
  border-radius: 4px;
}

#pages {
  display: grid;
  justify-items: center;
}

.page {
  border: 1px solid #bac7df;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.sidebar-collapsed .app-topbar {
  left: 0;
}

.sidebar-collapsed main {
  margin-left: 0;
}

@media screen and (max-width: 1180px) {
  .app-topbar {
    left: 248px;
  }

  .panel-head {
    grid-template-columns: 1fr;
  }

  .panel-head-actions {
    justify-content: flex-start;
  }
}

@media screen and (max-width: 900px) {
  .app-topbar {
    display: none;
  }

  main {
    height: auto;
    margin-top: 0;
  }

  .sidebar {
    width: min(86vw, 310px);
  }

  .builder {
    padding: 30px 16px 52px;
  }

  .panel-head {
    grid-template-columns: 1fr;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .panel-head h2 {
    font-size: 30px;
  }

  .panel-head-actions .theme-toggle,
  .panel-head-actions .print-button {
    min-width: 0;
    min-height: 48px;
    flex: 1 1 150px;
  }

  .panel-head-actions .print-button {
    display: inline-flex;
  }

  .brief-progress,
  .form-section {
    border-radius: 12px;
  }

  .brief-progress {
    padding: 34px 20px 24px;
  }

  .brief-progress-copy strong {
    padding-left: 0;
    font-size: 15px;
  }

  .brief-progress-copy strong::before {
    display: none;
  }

  #progressHint {
    font-size: 13px;
  }

  .form-section {
    padding: 0 18px 22px;
  }

  .section-heading {
    width: calc(100% + 36px);
    margin: 0 -18px 20px;
    padding: 28px 18px 18px;
  }

  .section-status {
    min-width: 0;
  }
}

/* ==========================================================================
   Workflow access correction
   Persistent desktop navigation, restored start controls and denser cards.
   ========================================================================== */

@media screen and (min-width: 901px) {
  body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 20px));
  }

  body.sidebar-collapsed .app-topbar {
    left: 0;
  }

  body.sidebar-collapsed main {
    margin-left: 0;
  }

  .sidebar-reveal {
    display: none;
  }

  body.sidebar-collapsed .sidebar-reveal {
    display: flex;
  }

  .sidebar-toggle {
    display: inline-flex;
  }
}

.panel-head-actions .save-brief-button {
  display: inline-flex;
  min-width: 112px;
  min-height: 46px;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: 4px;
}

.panel-head-actions .theme-toggle,
.panel-head-actions .print-button {
  min-width: 120px;
  min-height: 52px;
  padding: 10px 16px;
  font-size: 14px;
}

.start-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.72fr);
  gap: 18px;
  align-items: center;
  margin: 0 0 22px;
  padding: 28px 24px 22px;
}

.start-option-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.start-option-actions button {
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 4px;
}

.brief-progress {
  margin-bottom: 22px;
  padding: 32px 32px 26px;
}

.brief-progress-copy {
  margin-bottom: 18px;
}

.brief-progress-copy strong {
  font-size: 16px;
}

.brief-progress-copy strong::before {
  top: -4px;
  width: 34px;
  height: 34px;
  font-size: 17px;
}

#progressValue {
  font-size: 28px;
}

.progress-track {
  height: 16px;
  margin-block: 12px 8px;
}

#progressHint {
  margin-top: 14px;
  font-size: 14px;
}

.form-section {
  margin-top: 24px;
  padding: 0 24px 24px;
  border-radius: 12px;
}

.form-section::before,
.start-options::before,
.brief-progress::before,
.autofill-wizard::before,
.can-scanner::before {
  height: 5px;
}

.section-heading {
  width: calc(100% + 48px);
  margin: 0 -24px 20px;
  padding: 26px 24px 16px;
}

.section-kicker {
  font-size: 10px;
}

.section-heading h3 {
  margin-top: 5px;
  font-size: 17px;
}

.section-heading p:not(.section-kicker) {
  margin-top: 4px;
  font-size: 11px;
}

.section-status {
  min-width: 108px;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 9px;
}

.grid.two {
  gap: 16px 18px;
}

.form-section label {
  gap: 8px;
  font-size: 11px;
}

input,
select,
textarea {
  min-height: 46px;
  padding: 10px 13px;
  font-size: 15px;
}

.row,
.listing-statement-row {
  padding: 8px;
}

.builder {
  padding-top: 28px;
}

.panel-head {
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.panel-head h2 {
  font-size: 35px;
}

.panel-head .save-state {
  margin-top: 10px;
}

@media screen and (max-width: 900px) {
  .start-options {
    grid-template-columns: 1fr;
    padding: 26px 18px 18px;
  }

  main,
  body.sidebar-collapsed main {
    width: 100%;
    margin-left: 0;
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .builder {
    max-width: 100vw;
  }

  .start-option-actions {
    grid-template-columns: 1fr;
  }

  .panel-head-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .panel-head-actions .save-brief-button {
    display: inline-flex;
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .panel-head-actions .theme-toggle,
  .panel-head-actions .print-button {
    min-height: 44px;
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .brief-progress {
    padding: 30px 18px 20px;
  }

  .brief-progress-copy {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .form-section {
    padding: 0 16px 20px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    width: calc(100% + 32px);
    margin: 0 -16px 18px;
    padding: 24px 16px 15px;
  }

  .section-heading-actions,
  .section-status {
    align-self: flex-start;
    min-width: 0;
  }

  input,
  select,
  textarea {
    max-width: 100%;
  }

  .brief-type-options {
    grid-template-columns: 1fr;
  }

  .brief-type-card span {
    min-height: 76px;
  }

  .image-comparison-builder,
  .image-comparison-grid {
    grid-template-columns: 1fr;
  }

  .photograph-exhibit-toolbar {
    display: grid;
  }
}

/* Card contrast + status-aware accent.
   Mandatory sections (required fields / brief type) carry an amber top accent
   and amber badge until filled, then switch to green — so scanning down the
   column shows at a glance what still needs attention. */
.form-section,
.brief-progress,
.start-options,
.autofill-wizard,
.can-scanner {
  border-color: #d7deea;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.form-section:focus-within {
  border-color: var(--briefdesk-blue);
  box-shadow: 0 0 0 3px var(--briefdesk-blue-soft);
}

.workflow-section:not(.is-complete)::before,
#matter-details:not(.is-complete)::before,
#brief-type-section:not(.is-complete)::before {
  background: #d97706;
}

.workflow-section.is-complete::before,
#matter-details.is-complete::before,
#brief-type-section.is-complete::before {
  background: #16a34a;
}

[data-required-fields] .section-status,
#matter-details .section-status,
#brief-type-section .section-status {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

[data-required-fields]:not(.is-complete) .section-status::before,
#matter-details:not(.is-complete) .section-status::before,
#brief-type-section:not(.is-complete) .section-status::before {
  margin-right: 4px;
  content: "●";
  font-size: 7px;
  vertical-align: 1px;
}

[data-required-fields].is-complete .section-status,
#matter-details.is-complete .section-status,
#brief-type-section.is-complete .section-status {
  color: #15803d;
  background: #dcfce7;
  border-color: #86efac;
}

#brief-type-section.is-complete .section-status::before {
  margin-right: 4px;
  content: "✓";
}

/* Genuinely optional sections read as neutral, never as an unresolved warning. */
#copy-designation-section .section-status {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

body.dark-mode .form-section:focus-within {
  border-color: var(--precision-primary);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

body.dark-mode .workflow-section:not(.is-complete)::before,
body.dark-mode #matter-details:not(.is-complete)::before,
body.dark-mode #brief-type-section:not(.is-complete)::before {
  background: #f59e0b;
}

body.dark-mode .workflow-section.is-complete::before,
body.dark-mode #matter-details.is-complete::before,
body.dark-mode #brief-type-section.is-complete::before {
  background: #22c55e;
}

body.dark-mode [data-required-fields] .section-status,
body.dark-mode #matter-details .section-status,
body.dark-mode #brief-type-section .section-status {
  color: #fbbf24;
  background: rgba(217, 119, 6, 0.15);
  border-color: rgba(217, 119, 6, 0.35);
}

body.dark-mode [data-required-fields].is-complete .section-status,
body.dark-mode #matter-details.is-complete .section-status,
body.dark-mode #brief-type-section.is-complete .section-status {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
}

body.dark-mode #copy-designation-section .section-status {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.24);
}

/* .live-preview-label forces a dark navy text color with !important, which
   otherwise stays stuck (unreadable) against the dark-mode toolbar surface. */
body.dark-mode .live-preview-label {
  color: var(--precision-text) !important;
}

/* Several body elements (.drag-list and friends) declare their own
   unconditional `display`, which otherwise beats the browser's built-in
   [hidden] rule and leaves "collapsed" section content visibly rendered. */
[hidden] {
  display: none !important;
}

/* Collapsed sections shrink to a compact single row instead of leaving the
   full kicker/title/description block on screen. */
.is-collapsed .section-heading {
  padding-block: 14px;
}

.is-collapsed .section-heading p:not(.section-kicker) {
  display: none;
}

/* Hide/show the live preview column on desktop. Mobile keeps its existing
   overlay (preview-open) behaviour untouched. */
.preview-reveal {
  display: none;
}

.hide-preview-button {
  display: none;
}

@media screen and (min-width: 901px) {
  .toolbar .hide-preview-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    color: #24364f;
    font-size: 11px;
    font-weight: 700;
    background: #fff;
    border: 1px solid #d6e0eb;
    border-radius: 8px;
    cursor: pointer;
  }

  .hide-preview-button:hover {
    color: #071f41;
    background: #edf4fd;
  }

  body.preview-collapsed main {
    grid-template-columns: minmax(0, 1fr);
  }

  body.preview-collapsed .preview {
    display: none;
  }

  body.preview-collapsed .preview-reveal {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: var(--briefdesk-blue);
    border: none;
    border-radius: 10px 0 0 10px;
    box-shadow: 0 8px 22px rgba(0, 74, 198, 0.28);
    transform: translateY(-50%);
    cursor: pointer;
  }

  body.preview-collapsed .preview-reveal:hover {
    background: var(--briefdesk-blue-2);
  }
}

body.dark-mode .hide-preview-button {
  color: #e2e8f0;
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-mode .hide-preview-button:hover {
  background: #172554;
}

/* Final print contract for Generate PDF.
   Keep this at the end so app-shell/UI refresh rules cannot leak into print. */
@page {
  size: A4;
  margin: 0;
}

@media print {
  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .mobile-header,
  .sidebar,
  .sidebar-reveal,
  .app-topbar,
  .builder,
  .toolbar,
  .preview .toolbar,
  .preview-toolbar-actions,
  .preview-close-button,
  .back-to-top,
  .map-editor-dialog,
  .saved-briefs-modal,
  .toast-region,
  .app-toast {
    display: none !important;
  }

  main,
  .preview,
  #pages {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  #pages {
    gap: 0 !important;
    justify-items: stretch !important;
  }

  .page {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    break-after: page !important;
    break-inside: avoid !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    transform: none !important;
  }

  .page:last-child {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  .cover-document-page .officer-grid,
  #cover .officer-grid {
    right: 16mm !important;
    bottom: 14mm !important;
    left: 16mm !important;
  }
}
