.kdp-main { padding-block: 24px 64px; }

.kdp-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 20px;
}
.kdp-topbar h1 { font-size: 26px; line-height: 1.2; }
.kdp-topbar p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kdp-topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.license-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
.license-pill.is-pro {
  background: #e8f3ef;
  border-color: #9ec9b9;
  color: var(--green-dark);
}

.button-secondary {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.button-secondary:hover { border-color: var(--green); color: var(--green-dark); }
.button-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.button-small { min-height: 31px; padding: 4px 10px; font-size: 12px; }
.button-compact { min-height: 38px; padding: 7px 16px; font-size: 13px; cursor: pointer; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }

.kdp-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 310px;
  gap: 18px;
  align-items: start;
}

.kdp-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-header h2 { font-size: 16px; font-weight: 650; }
.panel-sub { font-size: 12px; color: var(--muted); }

.group + .group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.group-title {
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.field-stack { display: flex; flex-direction: column; gap: 9px; }
.field-stack[hidden] { display: none; }
.field-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; }
.row-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.select-input, .text-input, .textarea-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.textarea-input { min-height: 74px; resize: vertical; font-size: 12px; }
.select-input:focus, .text-input:focus, .textarea-input:focus {
  outline: 2px solid #9ec9b9;
  border-color: var(--green);
}

.segmented {
  display: inline-flex;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.segmented button {
  flex: 1;
  border: 0;
  background: #fff;
  color: var(--ink);
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.is-active { background: var(--dark); color: #fff; }

.mix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mix-grid[hidden] { display: none; }
.check-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.pro-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e8f3ef;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}
.pro-tag[hidden] { display: none; }

/* Center Preview */
.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.page-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 460px;
  padding: 18px;
  background: #e9ecea;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.book-canvas {
  max-width: 100%;
  max-height: 540px;
  background: #fff;
  box-shadow: 0 10px 26px rgb(20 30 25 / 16%);
}

.spec-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.spec-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

/* Right Column */
.export-cta { width: 100%; cursor: pointer; }

.notice-box {
  padding: 10px 12px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 12px;
}
.notice-box[hidden] { display: none; }
.notice-pro { background: #fdf6e9; border: 1px solid #e8cf9d; color: #5f4109; }
.notice-error { background: #fbeaea; border: 1px solid #e4b5b5; color: #7b1d1d; }
.notice-info { background: #e8f3ef; border: 1px solid #b8d8cc; color: #105741; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.spine-result {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
}
.spine-result strong { color: var(--green-dark); }

.feature-bullets {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
}
.feature-bullets li { margin-block: 4px; }

.workspace-toast {
  margin: -10px 0 16px;
  font-size: 13px;
  font-weight: 600;
}
.workspace-toast[hidden] { display: none; }

/* Dialog */
.studio-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(540px, calc(100vw - 28px));
  max-height: calc(100dvh - 36px);
  background: #fff;
  color: var(--ink);
}
.studio-dialog::backdrop { background: rgb(16 23 19 / 68%); }
.studio-dialog-body { padding: 18px 20px; overflow-y: auto; max-height: calc(100dvh - 100px); }
.dialog-section + .dialog-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.dialog-section[hidden] { display: none; }
.dialog-section h3 { font-size: 16px; margin-bottom: 6px; }
.dialog-section p { font-size: 13px; color: var(--muted); }
.key-row { display: flex; gap: 8px; margin-top: 10px; }
.key-row .text-input { flex: 1; }
.dialog-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.device-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }

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