:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #627084;
  --line: #d8e0ea;
  --panel: #ffffff;
  --page: #eef2f6;
  --navy: #053a66;
  --teal: #0b6f71;
  --amber: #be7d1f;
  --soft-blue: #e9f2fb;
  --soft-teal: #e8f5f3;
  --soft-amber: #fff4df;
  --shadow: 0 10px 30px rgba(20, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, #f8fafc 0, #eef2f6 320px),
    var(--page);
}

.workspace {
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.brand-lockup img {
  width: min(250px, 36vw);
  height: auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.12;
  letter-spacing: 0;
}

.top-actions,
.secondary-actions,
.section-heading {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
  flex-shrink: 0;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(56px, 1fr));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.segment,
.icon-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segment {
  min-height: 36px;
  padding: 0 12px;
  font-weight: 700;
}

.segment.active {
  background: var(--navy);
  color: #fff;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.icon-button svg,
button svg,
.section-heading svg {
  width: 18px;
  height: 18px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(620px, 1.1fr);
  gap: 20px;
  align-items: start;
}

.form-panel,
.output-panel {
  min-width: 0;
}

.section-band,
.actions-card,
.pdf-sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-band {
  position: relative;
  padding: 22px;
  margin-bottom: 16px;
  overflow: hidden;
}

.section-band::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--navy);
}

.section-heading {
  gap: 10px;
  margin-bottom: 16px;
}

.section-heading svg {
  color: var(--teal);
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

.control-box-select {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.control-box-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.control-box-heading span {
  color: var(--ink);
  font-size: 15px;
}

.control-box-heading small {
  color: var(--muted);
  font-weight: 600;
}

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

.control-card {
  position: relative;
  display: grid;
  grid-template-rows: 148px auto;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cbd6e4;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.control-card:hover {
  transform: translateY(-1px);
  border-color: #91a8c0;
  box-shadow: 0 10px 24px rgba(20, 32, 51, 0.1);
}

.control-card input {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  min-height: 20px;
  accent-color: var(--navy);
  z-index: 2;
}

.control-card img {
  display: block;
  width: 100%;
  height: 148px;
  object-fit: cover;
  background: #edf2f7;
}

.control-card-copy {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #fff;
}

.control-card-copy strong {
  font-size: 15px;
  line-height: 1.2;
}

.control-card-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.control-card:has(input:checked) {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(5, 58, 102, 0.14), 0 12px 28px rgba(20, 32, 51, 0.12);
}

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

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd6e4;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 125, 126, 0.14);
}

.full {
  margin-top: 16px;
}

.item-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 110px 70px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}

.item-row:last-child {
  border-bottom: 0;
}

.item-head {
  min-height: 42px;
  color: var(--navy);
  background: var(--soft-blue);
  font-size: 13px;
  font-weight: 800;
}

.item-row input {
  min-height: 38px;
  text-align: left;
}

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

.note-editor {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
}

.note-editor input {
  width: 18px;
  min-height: 18px;
  margin-top: 12px;
  accent-color: var(--teal);
}

.note-editor textarea {
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.note-editor textarea:focus {
  border-color: #cbd6e4;
  background: #fff;
}

.add-note-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: #fff;
  font-weight: 800;
}

.output-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.actions-card {
  padding: 16px;
  border-top: 4px solid var(--navy);
}

.primary-action,
.secondary-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  min-height: 50px;
  color: #fff;
  background: linear-gradient(180deg, #074a83, var(--navy));
}

.secondary-actions {
  grid-template-columns: repeat(3, 1fr);
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.secondary-actions button {
  min-height: 42px;
  color: var(--navy);
  border: 1px solid #cbd6e4;
  background: #fff;
}

.secondary-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status-line {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pdf-sheet {
  min-height: 760px;
  padding: 20px;
  overflow: hidden;
  background: #dfe6ee;
}

.pdf-doc {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 794px;
  margin: 0 auto;
  color: #1d2736;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 12.5px;
}

.pdf-page {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  aspect-ratio: 794 / 1123;
  padding: 44px 48px 38px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(20, 32, 51, 0.14);
}

.pdf-header {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 3px solid #074a83;
}

.pdf-header img {
  width: 250px;
  height: auto;
}

.pdf-title {
  min-width: 0;
  text-align: right;
}

.pdf-title h2 {
  margin: 0 0 6px;
  font-size: 21px;
  line-height: 1.15;
  color: #074a83;
  overflow-wrap: anywhere;
}

.pdf-doc-en .pdf-title h2 {
  font-size: 18px;
  line-height: 1.2;
}

.pdf-title p {
  margin: 0;
  color: #627084;
  font-size: 12px;
}

.pdf-block {
  margin-top: 17px;
}

.pdf-block h3 {
  margin: 0 0 10px;
  padding: 7px 10px;
  border-left: 5px solid #0f7d7e;
  background: #e8f5f3;
  color: #142033;
  font-size: 14px;
}

.pdf-kv {
  border: 1px solid #d8e0ea;
  border-bottom: 0;
}

.pdf-kv-row {
  display: grid;
  grid-template-columns: 21% 29% 21% 29%;
  min-height: 34px;
  border-bottom: 1px solid #d8e0ea;
}

.pdf-kv-row span {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 7px 10px;
  line-height: 1.35;
  text-align: left;
  word-break: break-word;
}

.pdf-kv-row span {
  border-right: 1px solid #d8e0ea;
}

.pdf-kv-row span:last-child {
  border-right: 0;
}

.pdf-kv-label {
  background: #f4f7fb;
  color: #536176;
  font-weight: 700;
}

.pdf-kv-value {
  background: #fff;
}

.pdf-kv-empty {
  color: transparent;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.pdf-table th,
.pdf-table td {
  border: 1px solid #d8e0ea;
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  line-height: 1.35;
  font-size: 12.5px;
  word-break: break-word;
}

.pdf-table th {
  color: #074a83;
  background: #e9f2fb;
  font-weight: 800;
}

.pdf-notes {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pdf-notes li {
  padding: 8px 11px;
  border-left: 4px solid #be7d1f;
  background: #fff4df;
  line-height: 1.42;
  font-size: 12.5px;
}

.pdf-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pdf-images.single {
  grid-template-columns: minmax(0, 1fr);
}

.pdf-images figure {
  margin: 0;
  border: 1px solid #d8e0ea;
  background: #fbfdff;
}

.pdf-images img {
  display: block;
  width: 100%;
  height: 255px;
  object-fit: cover;
}

.pdf-images.single figure {
  max-width: 520px;
}

.pdf-images figcaption {
  padding: 7px 8px;
  color: #536176;
  font-size: 11px;
  font-weight: 700;
}

.pdf-remarks {
  min-height: 54px;
  padding: 9px 12px;
  border: 1px solid #d8e0ea;
  line-height: 1.45;
  font-size: 12.5px;
  white-space: pre-wrap;
}

.pdf-page-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid #d8e0ea;
  color: #627084;
  font-size: 10.5px;
  line-height: 1.45;
}

.pdf-page-footer span {
  max-width: 560px;
}

.pdf-page-footer strong {
  color: #536176;
  white-space: nowrap;
}

@media (max-width: 1220px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .output-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .brand-lockup,
  .pdf-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-header {
    display: flex;
  }

  .brand-lockup img {
    width: min(250px, 76vw);
  }

  .field-grid,
  .control-box-grid,
  .pdf-kv,
  .pdf-images {
    grid-template-columns: 1fr;
  }

  .item-row {
    grid-template-columns: minmax(120px, 1fr) 92px 46px;
  }

  .pdf-sheet {
    padding: 12px;
    min-height: 600px;
  }

  .pdf-title {
    text-align: left;
  }
}
