:root {
  --navy-950: #06162e;
  --navy-900: #071f41;
  --blue-700: #0953bd;
  --blue-600: #0b5ed7;
  --blue-100: #eaf3ff;
  --ink: #17243a;
  --muted: #66758d;
  --line: #d4dfed;
  --soft: #f5f8fc;
  --background: #e9eef5;
  --focus: #9fc5ff;
  --danger: #a52a2a;
  --progress-done: #16a34a;
  --progress-done-soft: rgba(22, 163, 74, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

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

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

button {
  min-height: 44px;
  padding: 10px 16px;
  color: #26405f;
  font-weight: 800;
  background: #fff;
  border: 1px solid #bfd0e4;
  border-radius: 10px;
  cursor: pointer;
}

button:hover {
  background: #f2f6fb;
}

button.primary {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
}

button.primary:hover {
  background: var(--blue-700);
}

button.secondary {
  color: #31506f;
  background: #f3f7fc;
}

.statement-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 12px clamp(18px, 4vw, 60px);
  color: #fff;
  background: linear-gradient(135deg, var(--navy-950), #0a376f);
  box-shadow: 0 8px 24px rgba(5, 25, 52, 0.18);
}

.statement-brand,
.header-actions a {
  color: inherit;
  text-decoration: none;
}

.statement-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.statement-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border-radius: 9px;
}

.statement-brand span {
  display: grid;
  gap: 2px;
}

.statement-brand small {
  color: #b9cae0;
  font-size: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.header-actions button,
.header-actions a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 13px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 10px;
}

.header-actions button:hover,
.header-actions a:hover {
  background: rgba(255, 255, 255, 0.17);
}

.header-actions button span {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  color: var(--navy-900);
  background: #fff;
  border-radius: 99px;
}

.statement-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 0.95fr) minmax(560px, 1.05fr);
  min-height: calc(100vh - 78px);
}

.statement-editor {
  min-width: 0;
  padding: clamp(24px, 4vw, 50px);
  background: #fff;
  border-right: 1px solid #cbd7e5;
}

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

.statement-progress {
  margin: 0 0 18px;
  padding: 8px 2px 0;
  background: #fff;
}

.statement-progress-track {
  display: flex;
  align-items: center;
  padding: 2px 2px 8px;
}

.statement-progress-dot {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  padding: 0;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.15s;
}

.statement-progress-dot.is-current {
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 4px var(--progress-done-soft);
}

.statement-progress-dot.is-current,
.statement-progress-dot.is-done {
  background: var(--progress-done);
  border-color: var(--progress-done);
}

.statement-progress-line {
  flex: 1;
  height: 2px;
  margin: 0 3px;
  background: #e2e6ec;
  border-radius: 2px;
  transition: background 0.2s;
}

.statement-progress-line.is-done {
  background: var(--progress-done);
}

.statement-progress-label {
  color: var(--progress-done);
  font-size: 11.5px;
  font-weight: 700;
}

@media (max-width: 860px) {
  .statement-progress {
    position: sticky;
    top: 0;
    z-index: 29;
    margin: 0 -14px 14px;
    padding: 10px 14px 8px;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.06);
  }
}

.eyebrow {
  margin: 0 0 7px;
  color: #2167b7;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.editor-heading h1,
.saved-dialog-shell h2 {
  margin: 0;
  color: var(--navy-900);
  letter-spacing: -0.025em;
}

.editor-heading h1 {
  font-size: clamp(30px, 4vw, 46px);
}

.editor-heading p:not(.eyebrow) {
  max-width: 600px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.desktop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 20px;
  color: #52708f;
  font-size: 11px;
  font-weight: 750;
}

.save-status > span:first-child {
  width: 7px;
  height: 7px;
  background: #35a36b;
  border-radius: 50%;
}

.template-picker {
  margin: 0 0 18px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(24, 50, 82, 0.055);
}

.template-picker > label {
  max-width: 620px;
}

.template-picker > label > span {
  color: var(--navy-900);
  font-size: 15px;
}

.template-description {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f4f8fd;
  border: 1px solid #d1deec;
  border-radius: 10px;
}

.template-description strong {
  color: #23466d;
  font-size: 13px;
}

.template-description p {
  margin: 4px 0 0;
  color: #61748b;
  font-size: 12px;
  line-height: 1.45;
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.template-actions button:last-child {
  flex: 1 1 260px;
}

.template-confirmation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 13px;
  background: #fff8e8;
  border: 1px solid #e4c67b;
  border-radius: 11px;
}

.template-confirmation[hidden] {
  display: none;
}

.template-confirmation strong {
  color: #684b08;
  font-size: 13px;
}

.template-confirmation p {
  margin: 3px 0 0;
  color: #79683d;
  font-size: 11px;
  line-height: 1.45;
}

.template-confirmation > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.fill-prompt-help {
  margin-top: 11px;
  color: #4e6681;
  font-size: 11px;
}

.fill-prompt-help summary {
  width: fit-content;
  color: #295d96;
  font-weight: 850;
  cursor: pointer;
}

.fill-prompt-help ul {
  margin: 8px 0 0;
  padding: 10px 12px 10px 29px;
  line-height: 1.55;
  background: #f7f9fc;
  border-radius: 9px;
}

.template-drafting-notice {
  margin: 10px 0 0;
  color: #6b788b;
  font-size: 10px;
  line-height: 1.45;
}

.statement-form-section {
  margin: 0 0 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(24, 50, 82, 0.055);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 76px;
  padding: 15px 20px;
  text-align: left;
  background: linear-gradient(180deg, #fbfcfe, #f5f8fc);
  border: 0;
  border-radius: 0;
}

.section-heading:hover {
  background: #f1f6fc;
}

.section-heading {
  gap: 14px;
}

.section-number {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 800;
  background: rgba(9, 83, 189, 0.1);
  border-radius: 9px;
}

.section-titles {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}

.section-heading small {
  color: #2d6bb4;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.section-heading strong {
  color: var(--navy-900);
  font-size: 19px;
}

.section-chevron {
  flex-shrink: 0;
  color: #46637f;
  font-size: 22px;
  transition: color 0.15s;
}

.section-heading:hover .section-chevron {
  color: var(--blue-700);
}

.section-body {
  padding: 22px;
  border-top: 1px solid var(--line);
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

label {
  display: grid;
  align-content: start;
  gap: 7px;
  color: #34445a;
  font-size: 12px;
  font-weight: 800;
}

label > small {
  color: #7b899d;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  background: #fbfcfe;
  border: 1.5px solid #bdcde0;
  border-radius: 10px;
  outline: 0;
}

input,
select {
  min-height: 50px;
  padding: 10px 13px;
}

textarea {
  padding: 13px;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 4px rgba(11, 94, 215, 0.1);
}

.conditional-fields {
  margin-top: 20px;
  padding: 18px;
  background: var(--blue-100);
  border: 1px solid #c6dcf6;
  border-radius: 12px;
}

.conditional-fields > p {
  margin: 0 0 14px;
  color: #24598f;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.locked-opening {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.locked-opening > div,
.locked-opening > label {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px 12px;
  padding: 15px;
  background: #f5f8fc;
  border: 1px solid #d8e2ef;
  border-radius: 11px;
}

.locked-opening b {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  align-self: start;
  width: 30px;
  height: 30px;
  color: #fff;
  background: #315d91;
  border-radius: 8px;
}

.locked-opening p {
  margin: 0;
  color: #3a4960;
  font-size: 13px;
  line-height: 1.55;
}

.locked-opening div > span {
  color: #76869a;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.locked-opening label > span {
  color: #40536b;
  font-size: 12px;
}

.locked-opening textarea {
  grid-column: 2;
}

.locked-opening .derived-opening p {
  grid-column: 2;
  min-height: 48px;
  padding: 12px 13px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  background: #eef3f8;
  border: 1px solid #d1dce8;
  border-radius: 8px;
}

.statement-body-label {
  margin-bottom: 8px;
}

.statement-body-label > span {
  font-size: 14px;
}

.writing-toolbar {
  margin-bottom: 10px;
  padding: 10px;
  background: #f4f8fd;
  border: 1px solid #ccdbea;
  border-radius: 12px;
}

.writing-toolbar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.writing-toolbar-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.writing-toolbar-heading strong {
  color: #203b5a;
  font-size: 13px;
}

.writing-toolbar-heading span {
  color: #718197;
  font-size: 10px;
}

.writing-toolbar-scroll {
  display: flex;
  gap: 7px;
  padding: 1px 1px 7px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scroll-snap-type: inline proximity;
  -webkit-overflow-scrolling: touch;
}

.writing-tool-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 12px;
  color: #244a73;
  font-size: 12px;
  white-space: nowrap;
  background: #fff;
  border-color: #b8cce1;
  border-radius: 9px;
  scroll-snap-align: start;
}

.writing-tool-button:hover {
  color: #0a54aa;
  background: #eaf3ff;
  border-color: #8eb7e5;
}

.writing-tool-button.new-paragraph {
  color: #fff;
  background: #315d91;
  border-color: #315d91;
}

.writing-helpers {
  position: relative;
  flex: 0 0 auto;
}

.writing-helpers summary {
  min-height: 40px;
  padding: 10px 12px;
  color: #285a91;
  font-size: 11px;
  font-weight: 850;
  list-style: none;
  background: #e5f0fc;
  border: 1px solid #b9d2ed;
  border-radius: 9px;
  cursor: pointer;
}

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

.writing-helpers-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(145px, 1fr));
  gap: 6px;
  width: min(360px, calc(100vw - 64px));
  padding: 9px;
  background: #fff;
  border: 1px solid #c7d6e6;
  border-radius: 11px;
  box-shadow: 0 16px 36px rgba(18, 46, 78, 0.2);
}

.writing-helpers:not([open]) .writing-helpers-menu {
  display: none;
}

.writing-helpers-menu .writing-tool-button {
  width: 100%;
  text-align: left;
  white-space: normal;
}

.writing-toolbar-note {
  margin: 2px 2px 0;
  color: #6c7b8f;
  font-size: 10px;
  line-height: 1.35;
}

.statement-body-input {
  min-height: 330px;
  font-size: 17px;
}

.numbered-preview {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #cbd8e7;
  border-radius: 12px;
}

.numbered-preview header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  color: #30465f;
  font-size: 12px;
  background: #edf4fc;
  border-bottom: 1px solid #d3dfec;
}

.numbered-preview header span {
  color: #60748d;
}

.numbered-preview ol {
  max-height: 360px;
  margin: 0;
  padding: 16px 20px 16px 48px;
  overflow: auto;
}

.numbered-preview li {
  padding: 0 0 12px 6px;
  color: #33445a;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.numbered-preview li:last-child {
  padding-bottom: 0;
}

.signature-builders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.signature-builder {
  min-width: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.06);
}

.signature-builder h2 {
  margin: 0 0 15px;
  color: #203650;
  font-size: 16px;
}

.signature-method-panel {
  margin-top: 14px;
}

.signature-method-panel canvas {
  display: block;
  width: 100%;
  height: 130px;
  margin-bottom: 9px;
  background: #f3f5f8;
  border: 1.5px dashed #c7cdd7;
  border-radius: 12px;
  touch-action: none;
}

button.clear-signature {
  min-height: auto;
  padding: 4px 2px;
  color: var(--blue-700);
  font-size: 12.5px;
  font-weight: 600;
  background: transparent;
  border: 0;
  box-shadow: none;
}

button.clear-signature:hover {
  color: #063f8c;
  background: transparent;
  text-decoration: underline;
}

.signature-upload {
  place-items: center;
  min-height: 92px;
  padding: 15px;
  color: #155bb2;
  text-align: center;
  background: var(--blue-100);
  border: 1.5px dashed #8eb9ec;
  border-radius: 10px;
  cursor: pointer;
}

.signature-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.uploaded-signature-preview {
  display: grid;
  place-items: center;
  min-height: 90px;
  margin-top: 9px;
  color: #75859a;
  font-size: 12px;
  background: #fff;
  border: 1px solid #d6e0eb;
  border-radius: 9px;
}

.uploaded-signature-preview img {
  max-width: 100%;
  max-height: 95px;
  object-fit: contain;
}

.no-signature-note {
  padding: 18px;
  color: #6d3b3b;
  font-weight: 800;
  text-align: center;
  background: #fff5f5;
  border: 1px solid #efcccc;
  border-radius: 9px;
}

.narrative-fullscreen {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.narrative-fullscreen[hidden] {
  display: none;
}

.narrative-fullscreen-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eceff3;
}

.narrative-fullscreen-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.narrative-fullscreen-title strong {
  color: var(--navy-900);
  font-size: 17px;
}

.narrative-fullscreen-header button,
.narrative-fullscreen-footer button {
  padding: 8px 4px;
  color: var(--blue-700);
  font-weight: 700;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.narrative-fullscreen-toolbar {
  flex-shrink: 0;
  padding: 14px 20px 0;
}

.narrative-fullscreen-input {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 10px 20px 20px;
  border: 0;
  border-radius: 0;
  font-size: 16.5px;
  line-height: 1.75;
  resize: none;
}

.narrative-fullscreen-input:focus {
  box-shadow: none;
}

.narrative-fullscreen-footer {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid #eceff3;
}

.narrative-fullscreen-footer span {
  color: var(--muted);
  font-size: 12.5px;
}

.narrative-fullscreen-footer button {
  padding: 10px 22px;
  color: #fff;
  font-size: 13.5px;
  background: var(--blue-700);
  border-radius: 10px;
}

@media (min-width: 861px) {
  .narrative-fullscreen {
    display: none !important;
  }
}

.drafting-note {
  margin: 24px 0 12px;
  color: #6c7d91;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.statement-export {
  margin-top: 28px;
}

.statement-export h2 {
  margin: 0 0 16px;
  color: #363b46;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

.statement-export-options {
  display: grid;
  gap: 14px;
}

.statement-export-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) minmax(24px, auto);
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 106px;
  padding: 18px 24px 18px 20px;
  color: #10233b;
  text-align: left;
  background: #fff;
  border: 1px solid #d9e6f6;
  border-radius: 26px;
  box-shadow: 0 2px 5px rgba(20, 54, 90, 0.08);
}

.statement-export-card:hover {
  background: #fbfdff;
  border-color: #b9d2f1;
  box-shadow: 0 5px 16px rgba(20, 54, 90, 0.11);
  transform: translateY(-1px);
}

.statement-export-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  color: #e32834;
  background: #fff0f1;
  border-radius: 20px;
}

.statement-export-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.statement-export-icon text {
  fill: currentColor;
  stroke: none;
  font-size: 5px;
  font-weight: 900;
}

.export-word .statement-export-icon {
  color: #246be8;
  background: #edf5ff;
}

.export-images .statement-export-icon {
  color: #e57d00;
  background: #fff7e5;
}

.export-mobipol .statement-export-icon {
  color: #14705e;
  background: #eaf8f3;
}

.statement-export-copy {
  display: grid;
  gap: 4px;
}

.statement-export-copy strong {
  font-size: 22px;
  line-height: 1.1;
}

.statement-export-copy small {
  color: #535b68;
  font-size: 16px;
  font-weight: 500;
}

.statement-export-status {
  justify-self: end;
  color: #767b84;
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
  transition: color 0.15s;
}

.statement-export-status.is-pending,
.statement-export-status.is-done {
  font-size: 13px;
  font-weight: 700;
}

.statement-export-status.is-pending {
  color: var(--blue-700);
}

.statement-export-status.is-done {
  color: var(--progress-done);
}

.writing-tool-button.person-description-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: #176c62;
  border-color: #176c62;
}

.writing-tool-button.person-description-tool svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.writing-tool-button.person-description-tool:hover {
  color: #fff;
  background: #10584f;
  border-color: #10584f;
}

.person-description-dialog {
  width: min(920px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  background: #f4f7fb;
  border: 1px solid #c7d4e3;
  border-radius: 18px;
  box-shadow: 0 32px 90px rgba(5, 24, 48, 0.35);
}

.person-description-dialog::backdrop {
  background: rgba(5, 18, 37, 0.62);
  backdrop-filter: blur(3px);
}

.person-description-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: inherit;
  overflow: hidden;
}

.person-description-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  color: #fff;
  background: linear-gradient(135deg, #092747, #0c4d73);
}

.person-description-header .eyebrow {
  margin-bottom: 3px;
  color: #acd2ee;
}

.person-description-header h2 {
  margin: 0;
  font-size: 22px;
}

.person-description-header p:last-child {
  margin: 5px 0 0;
  color: #d2e3f1;
  font-size: 11px;
}

.dialog-close {
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  padding: 0;
  color: #fff;
  font-size: 25px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.person-description-content {
  display: grid;
  gap: 12px;
  padding: 16px 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.description-basics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 13px;
  background: #fff;
  border: 1px solid #d2deeb;
  border-radius: 12px;
}

.description-basics input,
.description-basics select {
  min-height: 44px;
}

.description-intro-toggle {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 11px;
  background: #eef5fc;
  border-radius: 9px;
}

.description-intro-toggle input {
  width: 20px;
  min-height: 20px;
}

.description-feature-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 9px;
}

.description-feature-section {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d1ddea;
  border-radius: 11px;
}

.description-feature-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 11px 13px;
  color: #264664;
  font-size: 12px;
  font-weight: 850;
  background: #f8fafc;
  cursor: pointer;
}

.description-feature-section[open] summary {
  background: #eaf3fc;
  border-bottom: 1px solid #d4e0ed;
}

.description-selection-count {
  display: grid;
  flex: 0 0 auto;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  place-items: center;
  color: #fff;
  font-size: 10px;
  background: #176c62;
  border-radius: 999px;
}

.description-selection-count[hidden] {
  display: none;
}

.description-feature-body {
  display: grid;
  gap: 10px;
  padding: 11px;
}

.description-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.description-chip {
  min-height: 44px;
  padding: 8px 11px;
  color: #35536f;
  font-size: 11px;
  background: #f8fafc;
  border-color: #bdcee0;
  border-radius: 999px;
}

.description-chip[aria-pressed="true"] {
  color: #fff;
  background: #176c62;
  border-color: #176c62;
  box-shadow: 0 0 0 2px rgba(23, 108, 98, 0.14);
}

.description-custom-option,
.description-detail-field {
  padding: 10px;
  background: #f2f7fc;
  border-radius: 9px;
}

.description-feature-note {
  margin: 0;
  color: #68798c;
  font-size: 10px;
  line-height: 1.45;
}

.description-section-clear {
  justify-self: start;
  min-height: 38px;
  padding: 7px 10px;
  color: #6a7788;
  font-size: 10px;
  background: transparent;
  border-color: #ccd6e2;
}

.description-text-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 11px;
}

.generated-description {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px;
  background: #eaf2fb;
  border: 1px solid #b9cee4;
  border-radius: 12px;
  box-shadow: 0 -8px 24px rgba(20, 48, 78, 0.08);
}

.generated-description textarea {
  min-height: 130px;
  background: #fff;
}

.person-description-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid #cbd7e4;
}

.person-description-actions button:first-child {
  flex: 1 1 190px;
}

/* Stitch export: Justice Protocol person-description surface */
.person-description-dialog {
  width: min(1120px, calc(100% - 48px));
  height: min(90vh, 920px);
  max-height: 920px;
  color: #172b4d;
  background: #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 38, 100, 0.12);
}

.person-description-dialog::backdrop {
  background: rgba(0, 27, 62, 0.6);
  backdrop-filter: blur(5px);
}

.person-description-shell {
  height: 100%;
  background: #fff;
}

.person-description-header {
  align-items: center;
  min-height: 70px;
  padding: 16px 30px;
  color: #00133a;
  background: #f1f4f7;
  border-bottom: 1px solid #dfe1e6;
}

.person-description-title,
.person-description-header-actions {
  display: flex;
  align-items: center;
}

.person-description-title {
  gap: 13px;
}

.person-description-title svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.person-description-header h2 {
  color: #00133a;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.person-description-header-actions {
  gap: 24px;
}

.description-reset-all {
  min-height: 36px;
  padding: 6px 0;
  color: #00658d;
  font-size: 13px;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.description-reset-all:hover {
  color: #00133a;
  text-decoration: underline;
  background: transparent;
}

.dialog-close {
  width: 38px;
  min-height: 38px;
  color: #747781;
  font-size: 28px;
  font-weight: 400;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.dialog-close:hover {
  color: #00133a;
  background: #e5e8eb;
}

.person-description-content {
  gap: 28px;
  padding: 36px 30px 28px;
  background: #fff;
}

.description-basics {
  grid-template-columns: minmax(0, 1fr) minmax(220px, .65fr);
  gap: 16px 32px;
  padding: 0 0 22px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #dfe1e6;
  border-radius: 0;
}

.description-basic-group {
  display: grid;
  align-content: start;
  gap: 14px;
}

.description-group-label,
.description-feature-section summary > span:first-child {
  color: #00658d;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.description-native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.description-person-pills button {
  min-height: 42px;
  padding: 8px 14px;
  color: #44546f;
  font-size: 14px;
  font-weight: 400;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.description-person-pills button[aria-pressed="true"] {
  color: #fff;
  font-weight: 700;
  background: #002664;
}

.description-person-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.description-person-pills button {
  min-width: 76px;
  background: #ebeef1;
  border-radius: 999px;
}

.description-custom-field {
  max-width: none;
}

.description-first-person-note {
  align-self: end;
  margin: 0;
  padding: 12px;
  color: #44546f;
  font-size: 11px;
  line-height: 1.45;
  background: #f1f4f7;
  border: 1px solid #dfe1e6;
  border-radius: 6px;
}

.description-feature-sections {
  gap: 18px 36px;
}

.description-feature-section {
  border-color: #dfe1e6;
  border-radius: 8px;
  box-shadow: none;
}

.description-feature-section summary {
  min-height: 50px;
  padding: 13px 16px;
  color: #00133a;
  background: #f7fafd;
}

.description-feature-section[open] summary {
  background: #f1f4f7;
  border-color: #dfe1e6;
}

.description-feature-body {
  padding: 15px;
}

.description-chip {
  min-height: 40px;
  padding: 8px 16px;
  color: #44546f;
  font-size: 13px;
  background: #ebeef1;
  border: 0;
  border-radius: 999px;
}

.description-chip:hover {
  color: #00133a;
  background: #e0e3e6;
}

.description-chip[aria-pressed="true"] {
  color: #fff;
  font-weight: 700;
  background: #002664;
  box-shadow: none;
}

.description-custom-option,
.description-detail-field {
  background: #f1f4f7;
  border-radius: 6px;
}

.person-description-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px 30px 18px;
  background: #fff;
  border-top: 1px solid #dfe1e6;
}

.generated-description {
  position: static;
  padding: 12px 16px;
  background: #f7fafd;
  border: 1px solid #dfe1e6;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.generated-description label {
  gap: 4px;
}

.generated-description label > span {
  color: #00133a;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.generated-description label > small {
  display: inline;
  margin-left: 8px;
  color: #66758a;
}

.generated-description textarea {
  min-height: 52px;
  max-height: 100px;
  margin-top: 5px;
  padding: 7px 9px;
  color: #172b4d;
  font-size: 15px;
  line-height: 1.55;
  background: #fff;
  border: 1px solid #dfe1e6;
  border-radius: 4px;
  box-shadow: none;
}

.generated-description textarea:focus {
  box-shadow: none;
}

.person-description-action-row,
.person-description-action-row > div {
  display: flex;
  align-items: center;
}

.person-description-action-row {
  justify-content: space-between;
  gap: 18px;
}

.person-description-action-row > div {
  gap: 12px;
}

.person-description-action-row button {
  min-height: 48px;
  padding: 10px 20px;
  color: #00133a;
  font-size: 13px;
  background: #fff;
  border: 1px solid #00133a;
  border-radius: 4px;
}

.person-description-action-row button.secondary {
  color: #44546f;
  border-color: #dfe1e6;
}

.person-description-action-row button.primary {
  min-width: 255px;
  color: #fff;
  background: #00133a;
  border-color: #00133a;
  box-shadow: 0 3px 7px rgba(0, 19, 58, 0.18);
}

#clearPersonDescription {
  color: #00658d;
  background: transparent;
  border-color: transparent;
}

.statement-preview {
  position: sticky;
  top: 78px;
  height: calc(100vh - 78px);
  min-width: 0;
  overflow: auto;
  background: #dce2ea;
}

.preview-toolbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 12px 20px;
  color: #fff;
  background: rgba(6, 22, 46, 0.96);
  backdrop-filter: blur(8px);
}

.preview-toolbar > div:first-child {
  display: grid;
  gap: 3px;
}

.preview-toolbar span {
  color: #aec1d9;
  font-size: 10px;
}

.preview-toolbar > div:last-child {
  display: flex;
  gap: 8px;
}

.statement-pages {
  display: grid;
  justify-items: center;
  gap: 20px;
  padding: 30px;
}

.statement-page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 794px;
  height: 1123px;
  min-height: 1123px;
  padding: 55px 68px 42px;
  overflow: hidden;
  color: #111;
  background: #fff;
  box-shadow: 0 8px 24px rgba(8, 23, 43, 0.2);
  font-family: Arial, Helvetica, sans-serif;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.statement-document-header {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr 90px;
  align-items: start;
  min-height: 132px;
  padding-bottom: 18px;
  border-bottom: 4px solid #111;
}

.statement-document-header img {
  display: block;
  width: 94px;
  height: 94px;
  object-fit: contain;
  object-position: center;
}

.statement-document-heading {
  padding-top: 4px;
  text-align: center;
}

.statement-document-heading strong {
  display: block;
  color: #4d4d4d;
  font-size: 16px;
  letter-spacing: 0.08em;
}

.statement-document-heading h2 {
  margin: 38px 0 0;
  color: #555;
  font-size: 25px;
  letter-spacing: 0.015em;
}

.statement-form-reference {
  padding-top: 7px;
  color: #555;
  font-size: 16px;
  font-weight: 800;
  text-align: right;
}

.statement-form-reference small {
  display: block;
  margin-top: 5px;
  font-size: 7px;
  font-weight: 500;
}

.matter-box {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 8px 10px;
  min-height: 88px;
  margin-top: 28px;
  padding: 8px 10px;
  font-size: 15px;
  border: 1.5px solid #111;
}

.matter-box b,
.name-box b {
  font-weight: 800;
}

.matter-box span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.name-box {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 10px;
  min-height: 28px;
  margin-top: 26px;
  padding: 5px 10px;
  font-size: 15px;
  border: 1.5px solid #111;
}

.continuation-header {
  display: grid;
  gap: 4px;
  padding-bottom: 11px;
  color: #333;
  font-size: 11px;
  border-bottom: 2px solid #111;
}

.continuation-header strong {
  color: #111;
  font-size: 16px;
}

.statement-content-region {
  flex: 1;
  min-height: 0;
  padding-top: 27px;
  overflow: hidden;
}

.statement-content-region h3 {
  margin: 0 0 13px;
  font-size: 15px;
}

.document-paragraph {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0 8px;
  margin: 0 0 13px;
  font-size: 14px;
  line-height: 1.55;
  break-inside: avoid;
}

.document-paragraph span:first-child {
  text-align: right;
}

.document-paragraph p {
  margin: 0;
  white-space: pre-wrap;
}

.document-paragraph strong,
.numbered-preview li strong {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.statement-document-footer {
  flex: 0 0 205px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 8px 40px;
  padding: 24px 4px 24px;
  color: #111;
  font-size: 14px;
}

.statement-signature-block {
  min-width: 0;
}

.statement-signature-line {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  font-size: 18px;
}

.signature-render {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-width: 0;
  height: 62px;
  padding: 0 8px 3px;
  border-bottom: 1.5px solid #111;
}

.signature-render img {
  display: block;
  width: 100%;
  height: 58px;
  object-fit: contain;
  object-position: center bottom;
}

.signature-render .none {
  color: #333;
  font-size: 12px;
  font-style: italic;
}

.signature-person-details {
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 5px 0 0 102px;
  color: #111;
  font-size: 16px;
  line-height: 1.28;
}

.signature-person-details span {
  display: block;
  overflow-wrap: anywhere;
}

.mobile-only,
.mobile-action-bar {
  display: none;
}

.saved-statements-dialog {
  width: min(850px, calc(100% - 30px));
  max-height: min(760px, calc(100vh - 30px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #c7d4e3;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(5, 24, 48, 0.3);
}

.saved-statements-dialog::backdrop {
  background: rgba(5, 18, 37, 0.65);
  backdrop-filter: blur(3px);
}

.saved-dialog-shell {
  max-height: inherit;
  overflow: auto;
}

.saved-dialog-shell > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.saved-dialog-shell > header button {
  width: 44px;
  padding: 0;
  font-size: 25px;
}

.save-current-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  padding: 20px 24px;
  background: #f3f7fc;
  border-bottom: 1px solid var(--line);
}

.saved-statement-tools {
  display: flex;
  gap: 9px;
  padding: 15px 24px 0;
}

.saved-statement-list {
  display: grid;
  gap: 10px;
  padding: 15px 24px 24px;
}

.saved-statement-empty {
  padding: 38px 20px;
  color: #718197;
  text-align: center;
  border: 1px dashed #c9d5e3;
  border-radius: 12px;
}

.saved-statement-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border: 1px solid #d5dfeb;
  border-radius: 12px;
}

.saved-statement-item strong,
.saved-statement-item small {
  display: block;
}

.saved-statement-item small {
  margin-top: 4px;
  color: #75869a;
}

.saved-statement-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.saved-statement-item-actions .danger {
  color: var(--danger);
  border-color: #e4b6b6;
}

.statement-toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100% - 30px));
  padding: 12px 16px;
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  background: #173d68;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(6, 30, 57, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.statement-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .statement-workspace {
    grid-template-columns: minmax(480px, 0.9fr) minmax(430px, 1.1fr);
  }

  .statement-pages {
    justify-items: start;
    overflow-x: auto;
  }

  .signature-builders {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body {
    padding-bottom: 70px;
  }

  .statement-header {
    position: relative;
    min-height: 68px;
    padding: 9px 14px;
  }

  .statement-brand img {
    width: 42px;
    height: 42px;
  }

  .statement-brand strong {
    font-size: 13px;
  }

  .header-actions button {
    display: none;
  }

  .header-actions a {
    width: 44px;
    padding: 8px;
    overflow: hidden;
    font-size: 0;
    white-space: nowrap;
  }

  .header-actions a span {
    margin: auto;
    font-size: 17px;
  }

  .statement-workspace {
    display: block;
  }

  .statement-editor {
    padding: 23px 14px 40px;
    border: 0;
  }

  .editor-heading {
    display: block;
  }

  .desktop-actions {
    display: none;
  }

  .template-picker {
    padding: 14px;
  }

  .template-picker > label {
    max-width: none;
  }

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

  .template-actions button {
    min-width: 0;
    min-height: 48px;
    padding: 9px;
  }

  .template-actions button:last-child {
    grid-column: 1 / -1;
  }

  .template-confirmation {
    grid-template-columns: 1fr;
  }

  .template-confirmation > div:last-child {
    display: grid;
    grid-template-columns: 1fr;
  }

  .template-confirmation button {
    width: 100%;
    min-height: 48px;
  }

  .fill-prompt-help ul {
    padding-right: 9px;
  }

  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .section-body {
    padding: 16px;
  }

  .section-heading {
    min-height: 68px;
    padding: 13px 16px;
  }

  .statement-body-input {
    min-height: 390px;
  }

  .writing-toolbar {
    margin-right: -4px;
    margin-left: -4px;
    padding: 8px;
  }

  .writing-toolbar-heading {
    margin-bottom: 6px;
  }

  .writing-toolbar-heading > div {
    display: grid;
    gap: 0;
  }

  .writing-toolbar-scroll {
    margin-right: -8px;
    margin-left: -8px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .writing-tool-button {
    min-height: 44px;
    padding: 8px 11px;
    font-size: 11px;
  }

  .writing-helpers summary {
    min-height: 44px;
  }

  .writing-helpers-menu {
    position: fixed;
    z-index: 45;
    top: auto;
    right: 10px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    max-height: min(50vh, 360px);
    overflow-y: auto;
  }

  .writing-toolbar-note {
    max-width: 52ch;
    font-size: 9px;
  }

  .person-description-dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    height: min(94dvh, 900px);
    max-height: 94dvh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .person-description-header {
    padding: 13px 14px;
  }

  .person-description-header h2 {
    font-size: 18px;
  }

  .person-description-title {
    gap: 9px;
  }

  .person-description-title svg {
    width: 22px;
    height: 22px;
  }

  .description-reset-all {
    display: none;
  }

  .person-description-content {
    gap: 12px;
    padding: 14px 10px 18px;
    overflow-x: hidden;
  }

  .description-basics,
  .description-feature-sections,
  .description-text-fields {
    grid-template-columns: 1fr;
  }

  .description-basics {
    gap: 14px;
    padding: 0 0 16px;
  }

  .description-custom-field {
    max-width: none;
  }

  .description-feature-section summary {
    min-height: 50px;
  }

  .description-chip {
    min-height: 46px;
  }

  .generated-description {
    position: static;
    padding: 14px;
  }

  .generated-description textarea {
    min-height: 58px;
    max-height: 90px;
  }

  .person-description-actions {
    position: sticky;
    z-index: 4;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  }

  .person-description-actions button {
    min-height: 48px;
  }

  .person-description-actions button:not(#insertDescriptionParagraph):not(#cancelPersonDescription) {
    display: none;
  }

  .person-description-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.65fr);
    gap: 8px;
  }

  .person-description-action-row > div {
    display: contents;
  }

  #insertDescriptionParagraph {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  #cancelPersonDescription {
    grid-column: 2;
    grid-row: 1;
  }

  .locked-opening > div,
  .locked-opening > label {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 12px;
  }

  .statement-preview {
    position: fixed;
    z-index: 60;
    inset: 0;
    display: none;
    height: 100vh;
    padding: 0;
    background: #d8dfe8;
  }

  body.preview-measuring .statement-preview {
    display: block;
    visibility: hidden;
    pointer-events: none;
  }

  body.preview-open {
    overflow: hidden;
  }

  body.preview-open .statement-preview {
    display: block;
  }

  .preview-toolbar {
    min-height: 64px;
    padding: 9px 12px;
  }

  .mobile-only {
    display: inline-flex;
  }

  .statement-pages {
    display: block;
    padding: 14px;
    overflow: hidden;
  }

  .statement-page {
    width: 794px;
    margin: 0 auto 14px;
    transform: scale(calc((100vw - 28px) / 794));
    transform-origin: top left;
  }

  .statement-page + .statement-page {
    margin-top: calc((1123px * ((100vw - 28px) / 794)) - 1123px + 14px);
  }

  .statement-pages::after {
    display: block;
    height: calc(1123px * ((100vw - 28px) / 794));
    content: "";
  }

  .mobile-action-bar {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px max(9px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(9px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #cbd6e3;
    box-shadow: 0 -8px 24px rgba(10, 35, 64, 0.12);
    backdrop-filter: blur(8px);
  }

  body[data-statement-kind="police"] .mobile-action-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mobile-action-bar button {
    min-width: 0;
    min-height: 38px;
    padding: 7px 4px;
    font-size: 11px;
    white-space: normal;
  }

  .save-current-row {
    grid-template-columns: 1fr;
  }

  .saved-statement-item {
    grid-template-columns: 1fr;
  }

  .saved-statement-item-actions {
    justify-content: flex-start;
  }

  .saved-statement-tools {
    flex-direction: column;
  }

  .statement-toast {
    right: 15px;
    bottom: 84px;
  }
}

/* Statement workspace refinement */
:root {
  --navy-950: #071425;
  --navy-900: #0a2342;
  --blue-700: #155f9f;
  --blue-600: #1b6ca8;
  --blue-100: #e9f2f8;
  --ink: #172033;
  --muted: #617085;
  --line: #d4dce7;
  --soft: #f4f6f9;
  --background: #eef2f6;
}

body {
  background:
    linear-gradient(180deg, #f8fafc 0, var(--background) 340px),
    var(--background);
}

button,
input,
select,
textarea,
.template-picker,
.statement-form-section,
.numbered-preview,
.signature-builder,
.writing-tool-button {
  border-radius: 8px;
}

.statement-header {
  background: linear-gradient(135deg, var(--navy-950), #123d68);
  box-shadow: 0 8px 28px rgba(7, 20, 37, 0.18);
}

.statement-editor {
  background: #fbfcfe;
}

.template-picker,
.statement-form-section {
  box-shadow: 0 8px 24px rgba(18, 34, 55, 0.06);
}

.statement-kind-picker {
  display: block;
  margin: 0 0 18px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.statement-kind-picker legend {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  color: var(--navy-900);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.statement-kind-picker label {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0;
  box-shadow: 0 4px 14px rgba(18, 34, 55, 0.05);
  cursor: pointer;
}

.statement-kind-picker label:first-of-type {
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}

.statement-kind-picker label:last-of-type {
  border-radius: 0 0 16px 16px;
}

.statement-kind-picker label:has(input:checked) {
  background: rgba(9, 83, 189, 0.05);
}

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

.statement-kind-picker label::after {
  display: grid;
  place-items: center;
  justify-self: end;
  width: 22px;
  height: 22px;
  color: transparent;
  font-size: 12px;
  font-weight: 800;
  content: "";
  background: #fff;
  border: 2px solid #d3d8e0;
  border-radius: 50%;
}

.statement-kind-picker label:has(input:checked)::after {
  color: #fff;
  content: "✓";
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.statement-kind-picker label > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.statement-kind-picker strong {
  color: #152b44;
  font-size: 15px;
}

.statement-kind-picker small {
  color: #66768a;
  font-size: 12.5px;
  line-height: 1.4;
}

.police-format-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -6px 0 18px;
  padding: 11px 14px;
  color: #33465c;
  background: #f7f9fb;
  border: 1px solid #d5dde7;
  border-radius: 8px;
}

.police-format-notice[hidden] {
  display: none;
}

.police-format-notice strong {
  color: #172f4b;
  font-size: 12px;
}

.police-format-notice span {
  font-size: 11px;
}

body[data-statement-kind="police"] .template-picker {
  display: none;
}

body[data-statement-kind="police"] #policeWitnessFields {
  background: #f6f8fa;
  border-color: #d7dfe8;
}

body[data-statement-kind="police"] #policeWitnessFields > p {
  color: #40546a;
}

.statement-page.police-statement {
  padding-top: 55px;
}

.police-statement .statement-document-header {
  border-bottom-color: #111;
}

.police-statement .statement-document-heading h2,
.police-statement .continuation-header strong {
  color: #111;
}

.police-statement .matter-box,
.police-statement .name-box {
  border-color: #111;
}

.police-statement .police-officer-box {
  grid-template-columns: 138px minmax(0, 1fr) 82px minmax(0, .7fr);
  min-height: 82px;
  padding: 8px 10px;
}

.police-statement .police-officer-box b:not(:nth-of-type(4)) {
  grid-column: 1;
}

.police-statement .police-officer-box span:not(:nth-of-type(4)) {
  grid-column: 2;
}

.police-statement .police-officer-box b:nth-of-type(1),
.police-statement .police-officer-box span:nth-of-type(1) { grid-row: 1; }
.police-statement .police-officer-box b:nth-of-type(2),
.police-statement .police-officer-box span:nth-of-type(2) { grid-row: 2; }
.police-statement .police-officer-box b:nth-of-type(3),
.police-statement .police-officer-box span:nth-of-type(3) { grid-row: 3; }

.police-statement .police-officer-box b:nth-of-type(4),
.police-statement .police-officer-box span:nth-of-type(4) {
  grid-row: 1;
}

.police-statement .police-officer-box b:nth-of-type(4) {
  grid-column: 3;
}

.police-statement .police-officer-box span:nth-of-type(4) {
  grid-column: 4;
}

.police-statement .statement-signature-line {
  grid-template-columns: 78px minmax(0, 1fr);
  font-size: 16px;
}

.police-statement .signature-person-details {
  padding-left: 88px;
  font-size: 14px;
  line-height: 1.2;
}


.police-statement .statement-document-footer {
  flex-basis: 174px;
  gap: 8px 32px;
  padding-top: 18px;
}

.editor-heading h1 {
  letter-spacing: 0;
}

.template-description,
.locked-opening > div,
.locked-opening > label,
.signature-builder,
.numbered-preview header {
  background: var(--soft);
}

.template-confirmation {
  color: #39475a;
  background: #f7f3e8;
  border-color: #ddd0a9;
}

.template-confirmation strong {
  color: #4d4126;
}

.template-confirmation p {
  color: #655d49;
}

.section-heading {
  min-height: 68px;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
}

.section-heading small,
.eyebrow {
  color: var(--blue-700);
  letter-spacing: 0.12em;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #b9c7d8;
  border-radius: 8px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(21, 95, 159, 0.1);
}

.writing-toolbar {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.writing-toolbar-scroll {
  gap: 8px;
  padding-bottom: 8px;
}

.writing-tool-button {
  min-height: 40px;
  color: #263d56;
  background: #fff;
  border: 1px solid #c5d2e0;
}

.writing-tool-button:hover {
  color: var(--blue-700);
  background: #edf4fb;
  border-color: #a9c4dc;
}

.writing-tool-button.exhibit-tool {
  color: #fff;
  background: #263f5c;
  border-color: #263f5c;
}

.writing-tool-button.exhibit-tool:hover {
  color: #fff;
  background: #1b314d;
  border-color: #1b314d;
}

.writing-tool-button.person-description-tool {
  color: #fff;
  background: #18704f;
  border-color: #18704f;
}

.writing-tool-button.new-paragraph {
  color: #fff;
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.statement-body-input {
  min-height: 380px;
  font-family: "Segoe UI", Arial, sans-serif;
}

.numbered-preview {
  border-color: var(--line);
}

.numbered-preview header {
  color: #2f4157;
}

.numbered-preview li {
  color: #26384f;
}

.preview-toolbar {
  background: rgba(7, 20, 37, 0.96);
}

.statement-preview {
  background: #d9e0e8;
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .statement-editor {
    padding: 16px 10px 32px;
  }

  .statement-progress {
    margin: 0 -10px 14px;
    padding: 10px 10px 8px;
  }

  .statement-export {
    margin: 24px 2px 0;
  }

  .statement-export h2 {
    margin-left: 10px;
    font-size: 19px;
  }

  .statement-export-options {
    gap: 12px;
  }

  .statement-export-card {
    grid-template-columns: 58px minmax(0, 1fr) minmax(18px, auto);
    gap: 16px;
    min-height: 112px;
    padding: 17px 18px 17px 16px;
    border-radius: 25px;
  }

  .statement-export-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .statement-export-copy strong {
    font-size: 20px;
  }

  .statement-export-copy small {
    font-size: 15px;
  }

  .statement-export-status {
    font-size: 36px;
  }

  .statement-export-status.is-pending,
  .statement-export-status.is-done {
    font-size: 12px;
  }

  .editor-heading {
    margin-bottom: 14px;
  }

  .editor-heading h1 {
    font-size: clamp(25px, 8vw, 34px);
  }

  .template-picker,
  .statement-form-section {
    margin-bottom: 12px;
  }

  .statement-kind-picker {
    margin-bottom: 12px;
  }

  .police-format-notice {
    display: grid;
    margin-bottom: 12px;
  }

  .statement-kind-picker label {
    min-height: 62px;
    padding: 14px 16px;
  }

  .section-body {
    padding: 13px 10px;
  }

  .statement-body-section .section-body {
    padding-right: 8px;
    padding-left: 8px;
  }

  .locked-opening {
    gap: 8px;
    margin-bottom: 14px;
  }

  .locked-opening > div,
  .locked-opening > label {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 5px 9px;
    padding: 10px;
  }

  .locked-opening b {
    width: 28px;
    height: 28px;
  }

  .locked-opening > div:first-child p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .locked-opening .derived-opening p {
    min-height: 44px;
    padding: 10px 11px;
  }

  .writing-toolbar {
    margin: 0 0 8px;
    padding: 9px 8px;
  }

  .writing-toolbar-scroll {
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .writing-toolbar-scroll::-webkit-scrollbar {
    display: none;
  }

  .writing-tool-button {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .statement-body-input {
    min-height: max(440px, 58dvh);
    padding: 15px 13px 30vh;
    font-size: 17px;
    line-height: 1.65;
    resize: none;
    scroll-margin-block: 92px 110px;
    overscroll-behavior: contain;
  }

  .statement-body-input:focus {
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(21, 95, 159, 0.14);
  }

  body:has(.statement-body-input:focus) .mobile-action-bar {
    display: none;
  }

  .mobile-action-bar {
    gap: 6px;
    padding-top: 7px;
  }

  .mobile-action-bar button {
    min-height: 42px;
    font-size: 12px;
  }
}

@page {
  size: A4;
  margin: 0;
}

@media print {
  html,
  body {
    width: auto;
    height: auto;
  }

  body {
    padding: 0;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .statement-header,
  .statement-editor,
  .preview-toolbar,
  .mobile-action-bar,
  .statement-toast,
  .person-description-dialog,
  .saved-statements-dialog,
  .narrative-fullscreen {
    display: none !important;
  }

  .statement-workspace,
  .statement-preview,
  .statement-pages {
    display: block !important;
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  .statement-page {
    width: 209mm;
    height: 295mm;
    min-height: 295mm;
    padding: 12.5mm 17mm 8.5mm;
    margin: 0;
    overflow: hidden;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    break-inside: avoid;
    page-break-inside: avoid;
    transform: none !important;
    zoom: 1 !important;
  }

  .statement-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
