:root {
  --bg: #f5f5f3;
  --ink: #1f252b;
  --muted: #697079;
  --line: #dadde1;
  --surface: #ffffff;
  --surface-2: #f0f1f2;
  --accent: #4b5563;
  --accent-dark: #374151;
  --warn: #8a6a3b;
  --danger: #8f3f3a;
  --done: #54615a;
  --blue: #5c6670;
  --shadow: 0 18px 46px rgba(31, 37, 43, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(31, 37, 43, 0.1);
  background: rgba(245, 245, 243, 0.94);
  backdrop-filter: blur(14px);
}

.brand-lock {
  display: grid;
  gap: 1px;
  color: var(--ink);
}

.brand-lock strong {
  font-size: 15px;
  line-height: 1;
}

.brand-lock span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.back-link,
.ghost-btn,
.small-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.back-link span {
  font-size: 24px;
  line-height: 0;
}

.ghost-btn:hover,
.small-btn:hover,
.back-link:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 37, 43, 0.38);
  background: #fff;
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-btn:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.primary-btn.wide {
  width: 100%;
}

.small-btn {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.topbar-main strong,
.topbar-main span {
  display: block;
}

.topbar-main strong {
  font-size: 14px;
}

.topbar-main span {
  color: var(--muted);
  font-size: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 18px;
}

.rail,
.output {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.rail {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
}

.workspace {
  min-width: 0;
}

.workspace-head,
.panel,
.rail-card,
.output-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  margin-bottom: 14px;
}

.workspace-head h1 {
  margin: 2px 0 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

.workspace-head p,
.panel-head p,
.rail-card p {
  margin: 0;
  color: var(--muted);
}

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

.form-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 0 0;
  background: transparent;
}

.form-footer .primary-btn {
  min-width: 160px;
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-card,
.output-card {
  padding: 15px;
}

.rail-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.rail-card.compact strong {
  display: inline;
  font-size: 14px;
}

.stepper {
  display: grid;
  gap: 8px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px 10px;
  align-items: start;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  color: var(--ink);
}

.step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 850;
  font-size: 12px;
}

.step strong {
  font-size: 13px;
}

.step small {
  color: var(--muted);
  font-size: 12px;
}

.step.is-active,
.step.is-complete {
  border-color: rgba(75, 85, 99, 0.55);
}

.step.is-active span {
  background: var(--accent);
  color: #fff;
}

.step.is-complete span {
  background: rgba(75, 85, 99, 0.12);
  color: var(--done);
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  margin: 8px 0 10px;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  transition: width 180ms ease;
}

.panel {
  display: none;
  padding: 20px;
}

.panel.is-active {
  display: block;
  animation: softIn 180ms ease-out both;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: 0;
}

.field-grid,
.inline-grid,
.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.inline-grid {
  grid-template-columns: 210px repeat(2, minmax(0, 1fr));
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.signature-grid {
  grid-template-columns: 1fr;
  max-width: 940px;
}

.signature-package-summary,
.signed-record-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(47, 59, 74, 0.18);
  border-radius: var(--radius);
  background: #f8faf9;
  animation: softIn 220ms ease-out both;
}

.signature-package-summary h3,
.signed-record-panel h3 {
  margin: 4px 0 6px;
  font-size: 18px;
  letter-spacing: 0;
}

.signature-package-summary p,
.signed-record-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.package-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.package-pill-grid span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #2f3b4a;
  font-size: 12px;
  font-weight: 850;
}

.signed-record-panel {
  border-color: rgba(62, 107, 83, 0.28);
  background: #f6fbf8;
}

@keyframes softIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.signed-record-grid {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.signed-record-grid dt,
.signed-record-grid dd {
  margin: 0;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.signed-record-grid dt:nth-of-type(1),
.signed-record-grid dd:nth-of-type(1) {
  border-top: 0;
}

.signed-record-grid dt {
  color: #2f3b4a;
  font-weight: 850;
}

.signed-record-grid dd {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.field {
  display: grid;
  gap: 6px;
}

.field.span-2 {
  grid-column: span 2;
}

.field-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-topline > span {
  min-width: 0;
}

.locate-btn {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.input-with-action {
  display: grid;
  gap: 6px;
}

.field span,
.yesno-label {
  color: #2d333a;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.25;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.custom-select {
  position: relative;
  min-width: 0;
}

.select-trigger {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  font-size: 14px;
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.select-trigger:hover {
  border-color: rgba(31, 37, 43, 0.38);
}

.select-trigger:focus {
  border-color: rgba(75, 85, 99, 0.62);
  box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.14);
  outline: none;
}

.select-caret {
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  flex: 0 0 auto;
}

.select-menu {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  z-index: 30;
  display: none;
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(31, 37, 43, 0.18);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 16px 38px rgba(31, 37, 43, 0.13);
  padding: 6px;
}

.custom-select.is-open .select-menu {
  display: grid;
  gap: 2px;
}

.select-option {
  display: block;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 8px 9px;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
}

.select-option:hover,
.select-option.is-selected {
  background: var(--surface-2);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(75, 85, 99, 0.62);
  box-shadow: 0 0 0 3px rgba(75, 85, 99, 0.14);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: rgba(168, 58, 50, 0.7);
}

.field.has-error .select-trigger {
  border-color: rgba(168, 58, 50, 0.7);
}

.field small {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
}

.field-note {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
}

.field-note[data-status="success"] {
  color: var(--done);
}

.field-note[data-status="error"] {
  color: var(--danger);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #30363d;
  font-size: 13px;
  font-weight: 650;
}

.check-row span,
.check-row.risk span {
  color: #30363d;
}

.check-row input {
  width: 17px;
  min-width: 17px;
  height: 17px;
  min-height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.check-row.has-error {
  border-color: rgba(168, 58, 50, 0.5);
}

.section-confirm {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: start;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.section-confirm .check-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.section-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 750;
}

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

.yesno-row {
  display: grid;
  gap: 12px;
  margin: 0;
  min-height: 96px;
  align-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.yesno-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yesno-options label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  min-width: 62px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: #30363d;
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}

.yesno-options label:has(input:checked) {
  border-color: rgba(75, 85, 99, 0.55);
  background: rgba(75, 85, 99, 0.1);
}

.yesno-options input {
  width: 15px;
  min-width: 15px;
  height: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

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

fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

fieldset legend {
  padding: 0 4px;
}

.procedure-picker,
.notice-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.procedure-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 16px;
  align-items: end;
  margin-top: 16px;
  padding: 16px;
}

.procedure-picker h3,
.notice-card h3,
.section-copy h3 {
  margin: 0 0 7px;
  font-size: 16px;
  letter-spacing: 0;
}

.procedure-picker p,
.notice-card p,
.section-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.section-copy {
  max-width: 900px;
}

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

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

.notice-card {
  padding: 16px;
  background: #fff;
}

.procedure-confirm {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.procedure-bundle {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.form-detail-stack {
  display: grid;
  gap: 14px;
}

.procedure-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.procedure-card h3,
.packet-procedure h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.procedure-card p,
.production-note {
  margin: 0 0 8px;
  color: #3e4650;
  font-size: 13px;
}

.procedure-card ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: #3e4650;
  font-size: 13px;
}

.packet-procedure {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ack-list {
  display: grid;
  gap: 12px;
  max-width: 900px;
}

.ack-list.compact-list {
  max-width: none;
}

.ack-list .check-row,
.signature-grid .check-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.review-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 14px;
}

.review-grid .span-2 {
  grid-column: 1 / -1;
}

.review-grid h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

dl {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.document-list {
  display: grid;
  gap: 8px;
}

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

.doc-row strong,
.doc-row span {
  font-size: 12px;
}

.doc-row span {
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.doc-jump-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.doc-link {
  color: var(--accent-dark);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.alert {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.alert.error {
  border-color: rgba(168, 58, 50, 0.24);
  color: #73332d;
  background: #fffafa;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.output {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding-right: 2px;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.output-head .label {
  margin: 0;
}

pre {
  max-height: 210px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #171b20;
  color: #edf0f2;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.badge-list,
.risk-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.empty-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge {
  border: 1px solid rgba(138, 106, 59, 0.3);
  background: rgba(138, 106, 59, 0.1);
  color: #5b4930;
}

.empty-badge {
  border: 1px solid rgba(75, 85, 99, 0.24);
  background: rgba(75, 85, 99, 0.1);
  color: var(--done);
}

.pdf-stub {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  color: #26322e;
  font-size: 13px;
}

.generated-document {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 22px;
  color: #252b31;
  font-size: 13px;
  line-height: 1.55;
  max-height: 640px;
  overflow: auto;
  text-align: left;
  animation: softIn 240ms ease-out both;
}

.pdf-frame-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.pdf-frame-head p {
  max-width: 360px;
  text-align: left;
  line-height: 1.5;
}

.generated-document h3,
.generated-document h4 {
  margin: 0 0 10px;
}

.generated-document h4 {
  margin-top: 18px;
  font-size: 14px;
}

.generated-document p {
  margin: 0 0 8px;
  color: #3e4650;
  line-height: 1.55;
}

.generated-document .source-text {
  max-height: none;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #343b44;
  padding: 0;
  font: inherit;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}

.full-text-section {
  break-inside: avoid;
}

.doc-link {
  color: #2f3b4a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-preview-actions {
  display: flex;
  justify-content: flex-end;
}

.generated-document ul {
  margin: 8px 0 12px 18px;
  padding: 0;
  color: #3e4650;
}

.generated-document li {
  margin: 4px 0;
}

.packet-doc {
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  animation: softIn 220ms ease-out both;
}

.cover-doc {
  padding-top: 4px;
}

.packet-doc:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.generated-document table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
}

.generated-document th,
.generated-document td {
  border-top: 1px solid var(--line);
  padding: 8px 5px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

.signature-pad {
  display: grid;
  gap: 8px;
}

.signature-pad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #2d333a;
  font-size: 13px;
  font-weight: 780;
}

#signatureCanvas {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 38px, rgba(31, 37, 43, 0.06) 39px) border-box;
  touch-action: none;
}

.signature-pad.has-error #signatureCanvas {
  border-color: rgba(143, 63, 58, 0.72);
}

.signature-pad small {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
}

.pdf-stub h3 {
  margin: 0 0 10px;
}

.pdf-stub p {
  margin: 0 0 8px;
  color: var(--muted);
}

.pdf-stub table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.pdf-stub th,
.pdf-stub td {
  border-top: 1px solid var(--line);
  padding: 7px 4px;
  text-align: left;
  font-size: 12px;
}

.signature-preview {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.signature-preview strong {
  display: block;
  margin-bottom: 8px;
}

.signature-preview img {
  display: block;
  width: 100%;
  max-width: 320px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.audit-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #2b3733;
  font-size: 12px;
}

.audit-log li {
  padding-left: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .rail {
    position: static;
    max-height: none;
  }

  .output {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .rail {
    position: static;
    max-height: none;
    width: 100%;
    min-width: 0;
  }

  .rail-card {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .stepper {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
    gap: 8px;
    overflow-x: visible;
    padding-bottom: 0;
    scroll-snap-type: none;
  }

  .step {
    grid-template-columns: auto 1fr;
    gap: 6px;
    padding: 10px;
    min-width: 0;
    scroll-snap-align: none;
  }

  .step span {
    grid-row: auto;
  }

  .step small {
    display: none;
  }

  .workspace-head {
    display: grid;
  }

  .field-grid,
  .inline-grid,
  .procedure-picker,
  .check-grid,
  .check-grid.dense,
  .section-confirm,
  .yesno-grid,
  .risk-board,
  .review-grid,
  .output {
    grid-template-columns: 1fr;
  }

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

  .doc-row span {
    white-space: normal;
  }

  .pdf-frame-head {
    display: grid;
  }

  .pdf-frame-head p {
    max-width: none;
    text-align: left;
  }

  .field.span-2 {
    grid-column: auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .rail,
  .workspace-head,
  .panel-head,
  .form-footer,
  .form-preview-actions,
  .head-actions,
  .ack-list,
  .primary-btn,
  .small-btn,
  .dev-output {
    display: none;
  }

  .layout,
  .workspace,
  .signature-grid {
    display: block;
    padding: 0;
    max-width: none;
  }

  .panel,
  .panel.is-active {
    display: block;
    padding: 0;
  }

  .panel:not([data-step="5"]) {
    display: none;
  }

  .generated-document {
    max-height: none;
    overflow: visible;
    box-shadow: none;
    border: 0;
    padding: 0;
  }

  .signature-pad,
  .field {
    break-inside: avoid;
  }
}
