:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #17231c;
  --muted: #637069;
  --line: #dbe2dc;
  --green: #157a4a;
  --green-dark: #0f5d3a;
  --green-soft: #e5f2ea;
  --blue: #1f5f93;
  --blue-soft: #e8f0f7;
  --amber: #8b5b12;
  --amber-soft: #fff3da;
  --red: #a33b31;
  --shadow: 0 16px 40px rgba(20, 39, 29, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: #b8c5bd;
  background: #f9fbf8;
}

button.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

button.primary:hover {
  background: var(--green-dark);
}

button.danger {
  border-color: #ecc5c1;
  color: var(--red);
}

button.full {
  width: 100%;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 122, 74, 0.12);
}

.input-affix {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 260px;
  max-width: 520px;
  flex-wrap: nowrap;
}

.input-affix span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.input-affix input {
  flex: 1 1 auto;
  min-width: 130px;
}

.pair-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  width: min(100%, 520px);
}

.pair-input label {
  display: grid;
  gap: 5px;
}

.pair-input label span {
  color: var(--muted);
  font-size: 12px;
}

.pair-input strong {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--green-dark);
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(21, 122, 74, 0.08), transparent 42%),
    var(--bg);
}

.login-panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-brand img,
.brand-row img {
  width: 56px;
  height: 42px;
  object-fit: contain;
}

.login-brand p,
.login-brand h1 {
  margin: 0;
}

.login-brand p {
  color: var(--green);
  font-weight: 700;
}

.login-brand h1 {
  font-size: 28px;
  letter-spacing: 0;
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.request-key-button {
  border-color: #bdd9c9;
  background: #f4fbf7;
  color: var(--green-dark);
  font-weight: 700;
}

.request-key-button:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.login-highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.login-highlights div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px;
  min-width: 0;
}

.login-highlights strong,
.login-highlights span {
  display: block;
}

.login-highlights strong {
  color: var(--green-dark);
  font-size: 13px;
}

.login-highlights span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.key-request {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.key-request-qr {
  width: 210px;
  height: 210px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.key-request-eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-weight: 700;
}

.key-request h4 {
  margin: 0;
  font-size: 20px;
}

.key-request p:not(.key-request-eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.key-request .key-request-tip {
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 22px 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.overall-progress {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  margin-bottom: 18px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e5ebe6;
  margin: 12px 0 8px;
  overflow: hidden;
}

.progress-track div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: transform 0.2s ease;
}

.overall-progress small {
  color: var(--muted);
}

.section-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  text-align: left;
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.nav-item.active {
  border-color: rgba(21, 122, 74, 0.35);
  background: var(--green-soft);
}

.nav-item.complete {
  border-color: #c8ded0;
}

.nav-item::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: #e5ebe6;
}

.nav-fill {
  position: absolute;
  left: 10px;
  bottom: 6px;
  height: 3px;
  width: calc(100% - 20px);
  border-radius: 999px;
  background: var(--green);
  z-index: 1;
  transform-origin: left center;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.nav-code {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #eef2ef;
  color: var(--green-dark);
  font-weight: 800;
}

.nav-item.active .nav-code {
  background: var(--green);
  color: #fff;
}

.nav-title strong,
.nav-title span {
  display: block;
}

.nav-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-title span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.nav-percent {
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 6px;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.94);
  backdrop-filter: blur(10px);
}

.topbar-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h2,
.topbar p {
  margin: 0;
}

.topbar h2 {
  font-size: 21px;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.topbar .school-context {
  color: var(--green-dark);
  font-weight: 700;
}

.school-context.hidden {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.toolbar-group button {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  background: transparent;
}

.toolbar-group button:last-child {
  border-right: 0;
}

.save-status {
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 22px 24px 48px;
  align-items: start;
}

.form-area {
  min-width: 0;
}

.notice-band {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #d5e4d8;
  background: var(--green-soft);
  color: #254231;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  line-height: 1.6;
}

.section-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

.section-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.overview-card,
.section-note-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 13px 14px;
  min-width: 0;
}

.overview-card span,
.overview-card strong,
.section-note-card span,
.section-note-card strong {
  display: block;
}

.overview-card span,
.section-note-card span {
  color: var(--muted);
  font-size: 12px;
}

.overview-card strong {
  font-size: 20px;
  margin-top: 5px;
}

.section-note-card {
  display: grid;
  align-content: center;
  max-width: 360px;
  background: var(--amber-soft);
  border-color: #eed59c;
}

.section-note-card strong {
  color: var(--amber);
  font-size: 15px;
  line-height: 1.45;
  margin-top: 5px;
}

.floating-missing-button {
  position: fixed;
  left: 28px;
  bottom: 28px;
  z-index: 18;
  width: 226px;
  min-height: 48px;
  border-color: #b9291d;
  background: #b9291d;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 16px 34px rgba(163, 59, 49, 0.28);
}

.floating-missing-button:hover {
  border-color: #8f1d14;
  background: #8f1d14;
}

.section-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.section-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.group-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: #fbfcfa;
  border-bottom: 1px solid var(--line);
}

.group-header h3,
.group-header p {
  margin: 0;
}

.group-header h3 {
  font-size: 17px;
  letter-spacing: 0;
}

.group-header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
  line-height: 1.6;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.required {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.identity {
  background: #e7f5ed;
  color: #17683f;
}

.badge.weight {
  background: #ffe6df;
  color: var(--red);
  border: 1px solid #f2b9ae;
  font-size: 13px;
  padding: 6px 10px;
}

.group.weighted {
  border-color: #e8b8ad;
  box-shadow: 0 10px 28px rgba(163, 59, 49, 0.08);
}

.weight-alert {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  background: #fff0ec;
  border-bottom: 1px solid #f0c6be;
  color: #6f2119;
}

.weight-alert strong {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  padding: 5px 10px;
  font-size: 13px;
}

.weight-alert span {
  color: #71352f;
  font-size: 13px;
  line-height: 1.55;
}

.field {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px 18px;
  border-top: 1px solid #eef2ef;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.field.table-field {
  grid-template-columns: 1fr;
  gap: 12px;
}

.field.table-field .field-meta {
  max-width: 760px;
}

.field.table-field .field-control {
  width: 100%;
}

.field:first-of-type {
  border-top: 0;
}

.field:focus-within {
  background: #fbfdfb;
  box-shadow: inset 3px 0 0 var(--green);
}

.field.pulse {
  animation: pulseField 1.2s ease;
}

@keyframes pulseField {
  0% {
    box-shadow: inset 4px 0 0 var(--green), 0 0 0 0 rgba(21, 122, 74, 0.24);
  }
  100% {
    box-shadow: inset 4px 0 0 var(--green), 0 0 0 14px rgba(21, 122, 74, 0);
  }
}

.field.missing .field-code {
  background: var(--amber-soft);
  color: var(--amber);
}

.field.filled .field-code {
  background: var(--green-soft);
  color: var(--green-dark);
}

.field.filled .field-code::after {
  content: " 已填";
  font-weight: 700;
}

.field-meta {
  min-width: 0;
}

.field-label-row {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.field-code {
  font-size: 12px;
  color: var(--green-dark);
  font-weight: 800;
  background: var(--green-soft);
  border-radius: 5px;
  padding: 3px 6px;
}

.field-label {
  font-weight: 700;
  line-height: 1.45;
}

.field-help {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.65;
}

.field-control {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.disclosure-note {
  margin-top: 4px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.disclosure-note summary {
  width: fit-content;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}

.disclosure-note summary::-webkit-details-marker {
  display: none;
}

.disclosure-note summary::before {
  content: "+ ";
  color: var(--green);
  font-weight: 700;
}

.disclosure-note[open] summary::before {
  content: "- ";
}

.disclosure-note textarea {
  margin-top: 6px;
  min-height: 64px;
  background: #fff;
}

.field-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.inline-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.choice {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  line-height: 1.4;
}

.choice input {
  width: auto;
  accent-color: var(--green);
}

.table-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  border: 1px solid #d6e4dc;
  border-radius: 8px;
  background: #f7fbf8;
}

.example-table {
  border: 1px solid #d6e4dc;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 10px 12px;
}

.example-table summary {
  cursor: pointer;
  color: var(--green-dark);
  font-weight: 800;
  font-size: 13px;
}

.example-scroll,
.preview-table-scroll {
  overflow: auto;
  margin-top: 10px;
}

.example-table table,
.preview-table-scroll table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.example-table th,
.example-table td,
.preview-table-scroll th,
.preview-table-scroll td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.example-table th,
.preview-table-scroll th {
  background: var(--green-soft);
  color: var(--green-dark);
}

.table-header-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.table-header-editor label {
  display: grid;
  gap: 6px;
}

.table-header-editor span,
.table-add-control span {
  color: var(--muted);
  font-size: 12px;
}

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

.table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.table-card.compact {
  padding: 10px;
  gap: 8px;
}

.table-card.compact .table-card-head {
  padding-bottom: 7px;
}

.table-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1ee;
}

.table-card-head strong {
  color: var(--green-dark);
}

.table-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.table-card-field.wide {
  grid-column: 1 / -1;
}

.table-card-field {
  display: grid;
  gap: 6px;
}

.table-card-field span {
  color: var(--muted);
  font-size: 13px;
}

.table-card-field textarea {
  min-height: 72px;
}

.table-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.table-add-control {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.table-add-control label {
  display: grid;
  gap: 5px;
  width: 120px;
}

.table-add-control input {
  min-height: 30px;
  padding: 6px 8px;
}

.guide-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
  margin-bottom: 14px;
}

.guide-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: none;
}

.guide-box.secondary {
  background: #fbfcfa;
}

.guide-eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.guide-box h3 {
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: 0;
}

.guide-box p,
.guide-box li {
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.guide-box ul {
  margin: 0;
  padding-left: 20px;
}

.attachment-zone {
  border: 1px dashed #a9b9ae;
  background: #fbfcfa;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.attachment-zone input {
  padding: 9px;
  background: #fff;
}

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

.attachment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.attachment-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.attachment-name {
  min-width: 0;
}

.attachment-name strong,
.attachment-name span {
  display: block;
}

.attachment-name strong {
  overflow-wrap: anywhere;
}

.attachment-name span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.attachment-controls {
  display: grid;
  gap: 8px;
}

.display-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.display-toggle input {
  width: auto;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(17, 28, 22, 0.38);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(980px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.summary-tile span,
.summary-tile strong {
  display: block;
}

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

.summary-tile strong {
  margin-top: 4px;
  font-size: 21px;
}

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

.review-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}

.review-list small {
  color: var(--muted);
}

.preview-page {
  display: grid;
  gap: 14px;
}

.preview-title-block {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.preview-title-block strong {
  font-size: 18px;
}

.preview-title-block span {
  color: var(--muted);
  font-size: 13px;
}

.preview-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.preview-page-label {
  padding: 9px 14px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.preview-section h4 {
  margin: 0;
  padding: 12px 14px;
  background: #fbfcfa;
  border-bottom: 1px solid var(--line);
}

.preview-group {
  padding: 12px 14px;
  border-top: 1px solid #eef2ef;
}

.preview-group:first-of-type {
  border-top: 0;
}

.preview-group h5 {
  margin: 0 0 10px;
  font-size: 15px;
}

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

.preview-field {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
}

.preview-field strong {
  color: var(--green-dark);
  font-size: 13px;
}

.preview-field p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
}

.preview-note {
  color: var(--muted) !important;
  font-size: 12px;
}

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

.preview-attachments {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.preview-attachments small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.mobile-only {
  display: none;
}

.icon-button {
  width: 38px;
  padding: 0;
}

@media (max-width: 1120px) {
  .guide-panel {
    grid-template-columns: 1fr 1fr;
  }

  .section-actions {
    grid-template-columns: 1fr;
  }

  .floating-missing-button {
    left: 18px;
    bottom: 18px;
    width: 196px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 12;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .content-grid {
    padding: 16px;
  }

  .guide-panel {
    grid-template-columns: 1fr;
  }

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

  .group-header,
  .notice-band,
  .section-actions,
  .section-footer,
  .attachment-top,
  .modal-header,
  .modal-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-overview {
    grid-template-columns: 1fr;
  }

  .section-footer {
    display: grid;
  }

  .pair-input strong {
    min-height: 42px;
  }

  .input-affix {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 540px) {
  .login-panel {
    padding: 22px;
  }

  .login-brand {
    align-items: flex-start;
  }

  .login-highlights {
    grid-template-columns: 1fr;
  }

  .key-request {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .key-request-qr {
    justify-self: center;
  }

  .topbar-actions button,
  .topbar-actions .toolbar-group,
  .topbar-actions .save-status {
    width: 100%;
  }

  .toolbar-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-group button {
    border-bottom: 0;
  }

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