* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
}
body {
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: #111;
  background: #e8e8e8;
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  height: 100%;
}

.panel {
  background: #f3f3f3;
  border-right: 1px solid #ccc;
  overflow: auto;
  padding: 20px 18px 28px;
}

.brand h1 { margin: 0; font-size: 22px; }
.brand p {
  margin: 4px 0 16px;
  color: #555;
  font-size: 12px;
}

.card {
  background: #fff;
  border: 1px solid #ccc;
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0;
  font-size: 13px;
  color: #555;
  font-weight: 600;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.mini-actions { display: flex; gap: 10px; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #555;
  margin-bottom: 10px;
}

input, textarea {
  width: 100%;
  border: 1px solid #ccc;
  padding: 8px 10px;
  font: inherit;
  color: #111;
  background: #fff;
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
  font-size: 13px;
}

.link {
  border: 0;
  background: none;
  color: #111;
  text-decoration: underline;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.panel-actions .btn.primary {
  grid-column: 1 / -1;
}
.btn {
  border: 1px solid #111;
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  background: #fff;
  color: #111;
}
.btn.primary {
  background: #111;
  color: #fff;
}

.stage { min-width: 0; min-height: 0; }
.desk {
  height: 100%;
  overflow: auto;
  background: #d8d8d8;
  padding: 20px 16px 60px;
}
.pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.a4-scale { width: 210mm; transform-origin: top center; }
.a4 {
  width: 210mm;
  height: 297mm;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  color: #000;
}
.a4-inner {
  height: 297mm;
  padding: 14mm 12mm 12mm 16mm;
  display: flex;
  flex-direction: column;
}

.sheet-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  padding-bottom: 4mm;
  border-bottom: 1.5px solid #000;
  letter-spacing: 0.04em;
}

.sheet-board {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 24mm;
  align-content: start;
  position: relative;
  font-size: 16px;
  line-height: 1.75;
}
.sheet-board::before {
  content: "";
  position: absolute;
  top: -1.5px;
  bottom: 0;
  right: 24mm;
  border-left: 1.5px solid #000;
}

.row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 24mm;
}
.sec {
  font-weight: 700;
  padding: 4mm 4mm 1.5mm 0;
}
.item {
  padding: 1.2mm 4mm 1.2mm 1.4em;
  word-break: break-word;
}
.note {
  padding: 0 4mm 2mm 2.6em;
}
.mark {
  align-self: end;
  height: 7mm;
  margin: 0 3mm 2.2mm 0;
  border-bottom: 1.5px solid #000;
}

.empty-hint {
  min-height: 180mm;
  display: grid;
  place-items: center;
  color: #444;
  text-align: center;
  line-height: 1.8;
  font-size: 15px;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
  }
  .desk { min-height: 80vh; }
}

@media print {
  body { background: #fff; color: #000; }
  .panel { display: none !important; }
  .app { display: block; height: auto; }
  .desk { overflow: visible; background: #fff; padding: 0; }
  .pages { gap: 0; }
  .a4-scale {
    transform: none !important;
    height: auto !important;
  }
  .a4 {
    box-shadow: none;
    page-break-after: always;
  }
  .a4:last-child { page-break-after: auto; }
}

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