:root {
  --ink: #20231f;
  --muted: #6b7168;
  --line: #d8ddd4;
  --paper: #ffffff;
  --wash: #f3f5f1;
  --panel: #fbfcfa;
  --accent: #0f766e;
  --accent-2: #9b5c2e;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e9ece6;
  font-family: Arial, "Noto Sans KR", sans-serif;
  letter-spacing: 0;
}

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

button,
.file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  min-height: 38px;
}

button:hover,
.file-button:hover {
  border-color: #9aa399;
}

#printBtn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.editor {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
}

.editor > form {
  display: contents;
}

.editor-top {
  order: 0;
}

.pro-panel {
  order: 1;
}

.link-panel {
  order: 2;
}

.work-panel {
  order: 3;
}

.template-panel {
  order: 4;
}

.advanced-fields {
  order: 5;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.advanced-fields summary {
  padding: 14px 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.advanced-fields form {
  display: grid;
  gap: 0;
}

.editor-top,
.preview-head,
.toolbar,
.inline-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.editor-top,
.preview-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.backup-status {
  align-self: center;
  max-width: 180px;
  padding: 7px 9px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  color: var(--accent);
  background: #eef8f5;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.button-group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.button-group button {
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 38px;
}

.button-group button + button {
  border-left: 1px solid var(--line);
}

.button-group button:hover {
  background: var(--wash);
}

.button-group button:first-child {
  color: var(--accent);
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
}

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

.editor h1,
.preview-head h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.panel {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.link-first {
  border-top: 0;
  padding-top: 4px;
}

.panel h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

.panel-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.pro-action-grid button {
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 800;
}

.pro-settings-grid {
  margin-top: 12px;
}

.library-preview {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: #eef8f5;
}

.library-preview-head,
.library-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.library-preview-head strong {
  font-size: 13px;
}

.library-preview-head span,
.library-preview-row small,
.library-preview-empty {
  color: var(--muted);
  font-size: 11px;
}

.library-preview-row {
  padding: 8px;
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.76);
}

.library-preview-row strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-preview-row button {
  min-height: 30px;
  padding: 5px 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

#saveProductLibraryBtn.is-saved {
  border-color: var(--accent);
  background: #eef8f5;
  color: var(--accent);
}

.quality-badge {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 800;
}

.quality-badge.is-ready {
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--accent);
  background: #eef8f5;
}

.quality-badge.is-check {
  border-color: rgba(180, 83, 9, 0.26);
  color: var(--warn);
  background: #fff7df;
}

.quality-badge.is-empty {
  border-color: rgba(139, 26, 26, 0.22);
  color: #8b1a1a;
  background: #fff1f2;
}

.subheading {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.grid {
  display: grid;
  gap: 10px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--ink);
}

.checkbox-row input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
}

input.is-focus-pulse,
select.is-focus-pulse,
textarea.is-focus-pulse {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

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

input[type="file"] {
  padding: 7px;
}

.checkbox-row input {
  width: 16px;
  min-height: 16px;
}

#importJson {
  display: none;
}

.admin-only {
  display: none;
}

.inline-actions {
  margin-top: 10px;
  flex-wrap: wrap;
}

.inline-actions.compact {
  margin-top: 0;
  gap: 6px;
}

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

.field-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.panel-title-row {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title-row h2 {
  margin-bottom: 0;
}

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

.product-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
}

.current-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #eef8f5;
}

.current-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.current-card strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.product-tab {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 3px 10px;
  width: 100%;
  text-align: left;
  align-items: center;
  padding: 10px;
}

.product-tab span {
  grid-row: span 2;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.product-tab strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-tab small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-tab.is-active {
  border-color: var(--accent);
  background: #eef8f5;
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.upload-preview {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fff;
}

.upload-preview img {
  width: 96px;
  height: 72px;
  object-fit: contain;
  object-position: center center;
  background: var(--wash);
  border: 1px solid var(--line);
}

.upload-preview span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.paste-zone {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  background: #eef8f5;
  outline: none;
}

.paste-zone:focus {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.paste-zone strong {
  font-size: 13px;
}

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

.preview-shell {
  position: relative;
  padding: 26px;
  overflow: auto;
}

.sheet-navigator {
  position: fixed;
  top: 92px;
  right: 18px;
  z-index: 30;
  width: 230px;
  max-height: calc(100vh - 122px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(27, 31, 24, 0.16);
  overflow: auto;
}

.sheet-navigator-head {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
}

.sheet-navigator-head strong {
  font-size: 13px;
}

.sheet-navigator-head span {
  color: var(--muted);
  font-size: 11px;
}

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

.navigator-sheet {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.navigator-sheet:first-child {
  padding-top: 0;
  border-top: 0;
}

.navigator-sheet-title {
  margin: 0;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
}

.navigator-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: grab;
}

.navigator-item:hover,
.navigator-item:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  outline: none;
}

.navigator-item.is-active {
  border-color: var(--accent);
  background: #eef8f5;
}

.navigator-item.is-dragging {
  opacity: 0.55;
}

.navigator-item.is-drop-target,
.navigator-drop-end.is-drop-target {
  outline: 2px solid rgba(15, 118, 110, 0.52);
  outline-offset: 2px;
  background: #eef8f5;
}

.navigator-item-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.navigator-item-main span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.navigator-item-main strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigator-item-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navigator-item-controls {
  display: grid;
  grid-template-columns: repeat(2, 24px);
  gap: 4px;
  align-items: center;
}

.navigator-item-controls button,
.navigator-drag-hint {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.navigator-item-controls button {
  color: var(--accent);
}

.navigator-item-controls button:disabled {
  color: #b9c0b6;
  cursor: default;
}

.navigator-drag-hint {
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--wash);
}

.navigator-drop-end {
  padding: 8px;
  border: 1px dashed rgba(15, 118, 110, 0.34);
  border-radius: 7px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.pages-preview {
  display: grid;
  gap: 24px;
}

.review-pill {
  border: 1px solid #e6b966;
  background: #fff7df;
  color: var(--warn);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}

.spec-page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 17mm;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(27, 31, 24, 0.18);
}

.spec-page.is-selected {
  outline: 3px solid rgba(15, 118, 110, 0.34);
  outline-offset: 6px;
}

.spec-page:not(.two-up-page).is-selected::before,
.two-up-card.is-selected::before {
  content: "선택됨 · 저장 대상";
  position: absolute;
  z-index: 6;
  top: 8mm;
  left: 17mm;
  padding: 5px 8px;
  border: 1px solid rgba(15, 118, 110, 0.32);
  border-radius: 999px;
  background: rgba(238, 248, 245, 0.96);
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(27, 31, 24, 0.12);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.two-up-card.is-selected {
  outline: 3px solid rgba(15, 118, 110, 0.48);
  outline-offset: 4px;
  background: linear-gradient(0deg, rgba(15, 118, 110, 0.05), rgba(15, 118, 110, 0.05)), var(--paper);
}

.two-up-card.is-selected::before {
  top: 3mm;
  left: 3mm;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13mm;
  border-bottom: 2px solid var(--ink);
}

.doc-label {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.page-header h2 {
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.25;
}

.page-meta {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 94px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hero-row {
  display: grid;
  grid-template-columns: 47% 1fr;
  gap: 12mm;
  padding: 12mm 0;
}

.image-frame {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: var(--wash);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.preview-editable {
  cursor: text;
  transition: background 160ms ease, outline-color 160ms ease;
}

.preview-editable:hover {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
  background: rgba(15, 118, 110, 0.04);
}

.preview-inline-editing {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
  background: #eef8f5 !important;
  min-height: 1.25em;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-inline-editing:empty::before {
  content: " ";
}

.sheet-actions {
  position: absolute;
  top: 7mm;
  right: 7mm;
  z-index: 4;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.spec-page:hover > .sheet-actions,
.two-up-card:hover > .sheet-actions,
.spec-page.is-selected > .sheet-actions,
.two-up-card.is-selected > .sheet-actions {
  opacity: 1;
  pointer-events: auto;
}

.sheet-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(27, 31, 24, 0.12);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.sheet-insert {
  color: var(--accent);
}

.sheet-delete {
  color: #8b1a1a;
}

.sheet-insert:hover {
  border-color: var(--accent);
  background: #eef8f5;
}

.sheet-delete:hover {
  border-color: #ef4444;
  background: #fff1f2;
}

.page-add-actions {
  position: absolute;
  right: -2px;
  bottom: -18px;
  z-index: 5;
}

.page-add-button {
  min-height: 34px;
  padding: 7px 12px;
  border-color: rgba(15, 118, 110, 0.38);
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(27, 31, 24, 0.14);
  font-size: 13px;
  font-weight: 800;
}

.page-add-button:hover {
  border-color: var(--accent);
  background: #eef8f5;
}

.spec-page[data-draggable="true"],
.two-up-card[data-draggable="true"] {
  cursor: grab;
}

body.is-preview-dragging {
  cursor: grabbing;
  user-select: none;
}

.spec-page.is-dragging,
.two-up-card.is-dragging {
  opacity: 0.56;
}

.spec-page.is-drop-target,
.two-up-card.is-drop-target {
  outline: 3px solid rgba(15, 118, 110, 0.52);
  outline-offset: 5px;
  background: linear-gradient(0deg, rgba(15, 118, 110, 0.06), rgba(15, 118, 110, 0.06)), var(--paper);
}

body.is-printing .sheet-actions,
body.is-printing .page-add-actions,
body.is-printing .spec-page.is-selected::before,
body.is-printing .two-up-card.is-selected::before,
body.is-printing .sheet-navigator {
  display: none !important;
}

.identity-block {
  min-width: 0;
}

.identity-block > p {
  margin-bottom: 7px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.identity-block h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.18;
}

.identity-block h3 {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.25;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

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

dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.spec-grid > div {
  min-height: 76px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.spec-grid > div:last-child {
  border-right: 0;
}

.field-label,
.section-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.spec-grid p:last-child,
.page-footer p:last-child,
.note-box p:last-child {
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm;
  padding-top: 10mm;
}

.detail-box {
  min-height: 136px;
  border-top: 1px solid var(--ink);
  padding-top: 12px;
}

.detail-box ul {
  margin: 0;
  padding-left: 17px;
  line-height: 1.55;
  font-size: 13px;
}

.missing-spec {
  color: var(--warn);
  font-weight: 700;
}

.muted-spec {
  color: var(--muted);
  font-weight: 700;
}

.note-box p:last-child {
  line-height: 1.55;
  font-weight: 500;
}

.page-footer {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10mm;
  margin-top: 12mm;
  padding-top: 6mm;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.page-source {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.spec-page.theme-premium .page-header,
.spec-page.theme-premium .detail-box,
.spec-page.theme-premium .two-up-note {
  border-color: #5f4938;
}

.spec-page.theme-premium .doc-label {
  color: #7f4d2a;
}

.spec-page.theme-submittal {
  font-family: Arial, "Noto Sans KR", sans-serif;
}

.spec-page.theme-submittal .page-header {
  border-bottom-width: 3px;
}

.spec-page.theme-submittal .image-frame {
  background: #fff;
}

.spec-page.theme-client .page-header {
  border-bottom-color: #6f8f86;
}

.spec-page.theme-client .doc-label {
  color: #2f6f65;
}

.spec-page.theme-client .image-frame {
  border-color: #cddbd5;
  background: #f6f8f5;
}

.two-up-page {
  display: flex;
  flex-direction: column;
  min-height: 297mm;
}

.two-up-body {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 7mm;
  padding-top: 10mm;
  flex: 1 1 auto;
  min-height: 0;
}

.two-up-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 20mm;
  gap: 5mm;
  min-height: 0;
  padding-bottom: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
}

.two-up-card .sheet-actions {
  top: 3mm;
  right: 3mm;
}

.two-up-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.two-up-card.is-placeholder {
  cursor: default;
  opacity: 0.72;
}

.two-up-card.is-placeholder > .sheet-actions-placeholder {
  opacity: 1;
  pointer-events: auto;
}

.two-up-main {
  display: grid;
  grid-template-columns: 38% 1fr;
  gap: 8mm;
  align-items: start;
  min-height: 0;
  overflow: hidden;
}

.two-up-image {
  width: 100%;
}

.two-up-info > p {
  margin-bottom: 5px;
  font-size: 11px;
}

.two-up-info h1 {
  margin-bottom: 5px;
  font-size: 22px;
  line-height: 1.16;
}

.two-up-info h3 {
  margin-bottom: 10px;
  font-size: 13px;
}

.two-up-info dl {
  gap: 4px;
}

.two-up-info dl div {
  grid-template-columns: 70px 1fr;
  padding: 5px 0;
}

.two-up-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
  margin-top: 8px;
}

.two-up-summary > div {
  min-height: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.two-up-summary .field-label {
  margin-bottom: 3px;
}

.two-up-summary p:last-child {
  margin-bottom: 0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.two-up-note {
  margin-top: 0;
  border-top: 1px solid var(--ink);
  padding-top: 7px;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.two-up-note p:last-child {
  margin-bottom: 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}

.two-up-footer {
  margin-top: auto;
  flex: 0 0 auto;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 24, 18, 0.62);
}

.crop-modal.is-open {
  display: flex;
}

.workspace-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 24, 18, 0.46);
}

.workspace-modal.is-open {
  display: flex;
}

.workspace-dialog {
  width: min(1080px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(27, 31, 24, 0.24);
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.workspace-head h2 {
  margin-bottom: 4px;
  font-size: 21px;
}

.workspace-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.workspace-body {
  max-height: calc(88vh - 94px);
  overflow: auto;
  padding: 18px;
}

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

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

.workspace-row strong {
  display: block;
  margin-bottom: 4px;
}

.workspace-row small {
  color: var(--muted);
  font-size: 11px;
}

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

.library-manager {
  display: grid;
  gap: 14px;
}

.library-toolbar {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: #eef8f5;
}

.library-toolbar input {
  min-height: 38px;
  background: #fff;
}

.library-toolbar small {
  color: var(--muted);
  font-size: 11px;
}

.library-group-list {
  gap: 12px;
}

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

.library-group summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: var(--wash);
  cursor: pointer;
}

.library-group summary::-webkit-details-marker {
  display: none;
}

.library-group summary::before {
  content: "+";
  color: var(--accent);
  font-weight: 900;
}

.library-group[open] summary::before {
  content: "-";
}

.library-group summary span {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.library-group summary strong {
  font-size: 14px;
}

.library-group summary small {
  color: var(--muted);
  font-size: 11px;
}

.library-group summary button {
  min-height: 30px;
  padding: 5px 9px;
  background: #fff;
  font-size: 11px;
}

.library-group-items {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.library-product-row {
  border-radius: 7px;
}

.library-group-edit {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 7px;
  align-items: center;
  max-width: 360px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.library-group-edit input {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--wash);
  text-align: center;
}

.bulk-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bulk-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

.bulk-table th,
.bulk-table td {
  padding: 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.bulk-table th {
  color: var(--muted);
  background: var(--wash);
  font-size: 11px;
}

.bulk-table input {
  min-height: 32px;
  padding: 6px 7px;
  border-radius: 5px;
  font-size: 12px;
}

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

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

.plan-card.is-featured {
  border-color: rgba(15, 118, 110, 0.42);
  background: #eef8f5;
}

.plan-card strong {
  font-size: 16px;
}

.plan-card ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.crop-dialog {
  width: min(1100px, 96vw);
  max-height: 94vh;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

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

.crop-head h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.crop-stage {
  position: relative;
  height: min(68vh, 700px);
  border: 1px solid var(--line);
  background: var(--wash);
  cursor: crosshair;
  overflow: hidden;
  user-select: none;
}

.crop-stage.is-moving-crop {
  cursor: move;
}

.crop-stage.is-resizing-crop {
  cursor: nwse-resize;
}

.crop-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#cropBox {
  position: absolute;
  display: none;
  border: 2px solid var(--accent);
  background: rgba(15, 118, 110, 0.12);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.34);
  pointer-events: auto;
  cursor: move;
}

#cropBox::before,
#cropBox::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

#cropBox::before {
  top: -8px;
  left: -8px;
}

#cropBox::after {
  right: -8px;
  bottom: -8px;
}

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

  .editor {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sheet-navigator {
    position: static;
    width: auto;
    max-height: none;
    margin-bottom: 16px;
  }
}

@media (max-width: 760px) {
  .grid.two,
  .field-config-row,
  .hero-row,
  .two-up-main,
  .detail-row,
  .spec-grid {
    grid-template-columns: 1fr;
  }

  .spec-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .spec-grid > div:last-child {
    border-bottom: 0;
  }

  .preview-shell {
    padding: 12px;
  }

  .sheet-navigator {
    padding: 8px;
  }

  .spec-page {
    width: 100%;
    min-height: auto;
    padding: 18px;
  }
}

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

@media print {
  body {
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .editor,
  .preview-head {
    display: none;
  }

  .preview-editable:hover,
  .preview-inline-editing {
    outline: 0;
    background: transparent;
  }

  .sheet-actions,
  .page-add-actions,
  .spec-page.is-selected::before,
  .two-up-card.is-selected::before,
  .sheet-navigator {
    display: none !important;
  }

  .spec-page.is-dragging,
  .two-up-card.is-dragging,
  .spec-page.is-drop-target,
  .two-up-card.is-drop-target {
    opacity: 1;
    outline: 0;
    background: var(--paper);
  }

  .app {
    display: block;
    min-height: auto;
  }

  .preview-shell {
    padding: 0;
    overflow: visible;
  }

  .spec-page {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    margin: 0;
    padding: 14mm 17mm 12mm;
    box-shadow: none;
    outline: 0;
    break-after: page;
    page-break-after: always;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 9mm;
    border-bottom: 2px solid var(--ink);
    flex: 0 0 auto;
  }

  .page-header h2 {
    font-size: 23px;
  }

  .hero-row {
    display: grid;
    grid-template-columns: 42% 1fr;
    gap: 10mm;
    padding: 9mm 0;
    flex: 0 0 auto;
  }

  .image-frame {
    aspect-ratio: 1 / 1;
  }

  .identity-block h1 {
    font-size: 26px;
    line-height: 1.14;
  }

  .identity-block h3 {
    margin-bottom: 12px;
    font-size: 15px;
  }

  dl {
    gap: 5px;
  }

  dl div {
    padding: 6px 0;
  }

  .spec-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    flex: 0 0 auto;
  }

  .spec-grid > div {
    min-height: 18mm;
    padding: 9px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .spec-grid > div:last-child {
    border-right: 0;
  }

  .detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8mm;
    min-height: 0;
    padding-top: 7mm;
    flex: 1 1 auto;
  }

  .detail-box {
    min-height: 0;
    max-height: 62mm;
    padding-top: 8px;
    overflow: hidden;
  }

  .detail-box ul {
    font-size: 11px;
    line-height: 1.35;
  }

  .two-up-page {
    display: flex;
    flex-direction: column;
  }

  .two-up-body {
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 6mm;
    padding-top: 7mm;
    min-height: 0;
  }

  .two-up-card {
    display: grid;
    grid-template-rows: minmax(0, 1fr) 17mm;
    gap: 4mm;
    padding-bottom: 0;
    min-height: 0;
    overflow: hidden;
  }

  .two-up-main {
    display: grid;
    grid-template-columns: 36% 1fr;
    gap: 7mm;
  }

  .two-up-info h1 {
    font-size: 20px;
    line-height: 1.14;
  }

  .two-up-info h3 {
    margin-bottom: 7px;
    font-size: 12px;
  }

  .two-up-info dl div {
    padding: 4px 0;
  }

  .two-up-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
    margin-top: 6px;
  }

  .two-up-summary > div {
    min-height: 0;
    padding: 5px 0;
    border-bottom: 1px solid var(--line);
  }

  .two-up-summary p:last-child {
    font-size: 10px;
    line-height: 1.25;
  }

  .two-up-note {
    margin-top: 0;
    min-height: 0;
    max-height: none;
    padding-top: 6px;
  }

  .two-up-note p:last-child {
    font-size: 10px;
    line-height: 1.35;
  }

  .note-box p:last-child {
    font-size: 11px;
    line-height: 1.45;
  }

  .page-footer {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 10mm;
    margin-top: auto;
    padding-top: 5mm;
    flex: 0 0 auto;
  }

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