.pk-editor {
  --ed-ink: #101010;
  --ed-muted: #575757;
  --ed-red: #bf261f;
  --ed-bg: #f2f1ee;
  color: var(--ed-ink);
  background: #fff;
  min-height: 100dvh;
  font-family: Inter, Arial, sans-serif;
  line-height: 1.35;
}

.pk-editor [hidden] { display: none !important; }

.pk-editor h1,
.pk-editor h2,
.pk-editor h3,
.pk-editor p { margin: 0; }

.pk-editor h2,
.pk-editor h3 {
  font-size: 15px;
  font-weight: 800;
}

.pk-editor a { color: inherit; }

.pk-editor button,
.pk-editor select,
.pk-editor textarea {
  color: inherit;
  font: inherit;
}

.pk-editor button:disabled { opacity: .42; cursor: default; }

.pk-editor :focus-visible {
  outline: 2px solid var(--ed-red);
  outline-offset: 3px;
}

.pk-ed-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pk-ed-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--ed-ink);
}

.pk-ed-title { min-width: 0; }

.pk-ed-title h1 {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(24px, 3.3vw, 52px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.055em;
}

.pk-ed-caption {
  margin-top: 5px;
  color: var(--ed-muted);
  font-size: 12px;
  font-weight: 600;
}

.pk-ed-header-actions,
.pk-ed-btn,
.pk-ed-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.pk-editor .pk-ed-btn,
.pk-editor .pk-ed-primary,
.pk-editor .pk-ed-icon {
  border: 1px solid var(--ed-ink);
  border-radius: 0;
  background: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.pk-editor .pk-ed-btn,
.pk-editor .pk-ed-primary {
  padding: 0 11px;
  min-height: 38px;
}

.pk-editor .pk-ed-primary {
  background: var(--ed-ink);
  color: #fff;
}

.pk-editor .pk-ed-primary:hover:not(:disabled) {
  background: var(--ed-red);
  border-color: var(--ed-red);
}

.pk-editor .pk-ed-btn:hover:not(:disabled),
.pk-editor .pk-ed-icon:hover:not(:disabled) { background: var(--ed-bg); }

.pk-editor .pk-ed-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  padding: 0;
  border-color: transparent;
}

.pk-editor .pk-ed-icon[aria-pressed="true"] {
  border-color: var(--ed-ink);
  color: #fff;
  background: var(--ed-ink);
}

.pk-editor .pk-ed-icon[aria-pressed="true"]:hover { background: var(--ed-ink); }

.pk-ed-workbench {
  display: grid;
  grid-template-columns: clamp(145px, 13vw, 200px) minmax(0, 1fr) clamp(222px, 20vw, 310px);
  height: calc(100dvh - 103px);
  min-height: 540px;
}

.pk-ed-pages,
.pk-ed-inspect {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
}

.pk-ed-pages { border-right: 1px solid var(--ed-ink); }

.pk-ed-inspect { border-left: 1px solid var(--ed-ink); }

.pk-ed-pages-head,
.pk-ed-inspect-head,
.pk-ed-mark-actions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pk-ed-total,
.pk-ed-status,
.pk-ed-mark-count {
  color: var(--ed-muted);
  font-size: 11px;
  font-weight: 700;
}

.pk-ed-status[data-status="feedback"] { color: var(--ed-red); }
.pk-ed-status[data-status="done"] { color: #19734a; }

.pk-editor .pk-ed-filter,
.pk-editor .pk-ed-width {
  max-width: 100%;
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid var(--ed-ink);
  border-radius: 0;
  background: #fff;
  font-size: 12px;
}

.pk-ed-filter { width: 100%; }

.pk-ed-thumbs { display: grid; gap: 10px; }

.pk-editor .pk-ed-thumb {
  display: grid;
  gap: 0;
  width: 100%;
  padding: 3px;
  text-align: left;
  border: 1px solid #bdbdbd;
  border-radius: 0;
  background: #fff;
  cursor: pointer;
}

.pk-ed-thumb[aria-current="page"] {
  border-color: var(--ed-red);
  box-shadow: 0 0 0 1px var(--ed-red);
}

.pk-ed-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: contain;
  background: var(--ed-bg);
}

.pk-ed-thumb-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  padding: 5px 3px 2px;
  color: var(--ed-muted);
  font-size: 10px;
}

.pk-ed-thumb-label strong {
  color: var(--ed-ink);
  font-size: 12px;
}

.pk-ed-thumb[data-status="feedback"] .pk-ed-thumb-label > span { color: var(--ed-red); }
.pk-ed-thumb[data-status="done"] .pk-ed-thumb-label > span { color: #19734a; }

.pk-ed-canvas {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.pk-ed-controls,
.pk-ed-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 47px;
  padding: 5px 12px;
  background: #fff;
}

.pk-ed-controls {
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ed-ink);
}

.pk-ed-toolbar,
.pk-ed-settings,
.pk-ed-zoom,
.pk-ed-swatches {
  display: flex;
  align-items: center;
  gap: 3px;
}

.pk-ed-settings { gap: 9px; }

.pk-ed-divider {
  display: block;
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: #c2c2c2;
}

.pk-ed-zoom { margin-left: auto; }
.pk-editor .pk-ed-zoom-value { width: 44px; }

.pk-editor .pk-ed-swatch {
  position: relative;
  width: 22px;
  height: 25px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.pk-ed-swatch::after {
  content: "";
  position: absolute;
  inset: 5px 3px;
  background: var(--mark-color);
}

.pk-editor .pk-ed-swatch[aria-pressed="true"] { border-color: var(--ed-ink); }

.pk-ed-viewport {
  display: grid;
  position: relative;
  overflow: auto;
  padding: 18px;
  background: var(--ed-bg);
  overscroll-behavior: contain;
}

.pk-editor .pk-ed-viewport.pk-ed-pan { cursor: grab; }
.pk-editor .pk-ed-viewport.pk-ed-panning { cursor: grabbing; }

.pk-ed-paper {
  position: relative;
  width: calc(100% * var(--editor-zoom, 1));
  margin: auto;
  border: 1px solid #bdbdbd;
  background: #fff;
  box-shadow: 0 8px 28px #00000012;
}

.pk-ed-slide {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-select: none;
  user-select: none;
}

.pk-ed-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pk-ed-overlay.pk-ed-drawing {
  cursor: crosshair;
  pointer-events: auto;
  touch-action: none;
}

.pk-ed-image-error {
  position: absolute;
  inset: 24px auto auto 24px;
  padding: 5px 8px;
  background: #fff;
  color: var(--ed-red);
  font-size: 13px;
}

.pk-ed-navigation { border-top: 1px solid var(--ed-ink); }

.pk-ed-page-value {
  min-width: max-content;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pk-ed-save {
  margin-left: auto;
  font-size: 12px;
  color: var(--ed-muted);
  text-align: right;
}

.pk-ed-save-error { color: var(--ed-red); }

.pk-ed-note-wrap {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.pk-editor .pk-ed-note {
  width: 100%;
  min-height: 142px;
  resize: vertical;
  border: 1px solid var(--ed-ink);
  border-radius: 0;
  background: #fff;
  padding: 9px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.pk-editor .pk-ed-note[readonly] { background: var(--ed-bg); }

.pk-editor .pk-ed-empty-note {
  color: var(--ed-muted);
  font-size: 13px;
}

.pk-ed-empty-note:empty { display: none; }

.pk-editor .pk-ed-text-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ed-red);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.pk-ed-attach {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--ed-ink);
  padding-top: 10px;
}

.pk-ed-files { display: grid; gap: 7px; }

.pk-ed-no-files {
  color: var(--ed-muted);
  font-size: 12px;
}

.pk-ed-file {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.pk-ed-file a {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
}

.pk-ed-file a span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-ed-file img {
  width: 33px;
  height: 33px;
  border: 1px solid #bdbdbd;
  object-fit: cover;
}

.pk-ed-add-file,
.pk-ed-status-btn { justify-self: start; }

@media (min-width: 851px) {
  .pk-editor {
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .pk-ed-workbench { height: auto; }
}

@media (max-width: 1050px) {
  .pk-ed-controls { gap: 5px; }
  .pk-ed-controls,
  .pk-ed-navigation { padding-inline: 6px; }
  .pk-ed-toolbar, .pk-ed-settings, .pk-ed-zoom, .pk-ed-swatches { gap: 1px; }
}

@media (max-width: 850px) {
  .pk-ed-header { padding: 9px 11px; gap: 8px; }
  .pk-ed-back span, .pk-ed-header-actions a span { display: none; }
  .pk-editor .pk-ed-back, .pk-editor .pk-ed-header-actions a { min-width: 32px; padding: 0; }
  .pk-ed-header-actions { gap: 4px; }
  .pk-ed-workbench { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); }
  .pk-ed-canvas { grid-row: 1; }
  .pk-ed-viewport { min-height: clamp(190px, 46svh, 480px); max-height: 66svh; padding: 8px; }
  .pk-ed-controls { min-height: 36px; }
  .pk-ed-navigation { border-bottom: 1px solid var(--ed-ink); }
  .pk-ed-pages, .pk-ed-inspect { border: 0; padding: 10px; }
  .pk-ed-pages { border-bottom: 1px solid var(--ed-ink); }
  .pk-ed-thumbs {
    display: flex;
    overflow-x: auto;
    gap: 7px;
    padding: 2px;
  }
  .pk-ed-thumb { flex: 0 0 96px; }
  .pk-ed-pages-head { align-items: center; }
  .pk-ed-filter { width: auto; }
}

@media (max-width: 540px) {
  .pk-editor .pk-ed-header-actions .pk-ed-primary { min-height: 34px; max-width: 87px; padding-inline: 6px; font-size: 11px; }
  .pk-ed-header-actions .pk-ed-primary svg { display: none; }
  .pk-ed-header-actions { flex-wrap: wrap; }
}

@media (max-width: 370px) {
  .pk-editor .pk-ed-controls .pk-ed-icon { width: 28px; }
  .pk-editor .pk-ed-controls .pk-ed-zoom-value { width: 41px; }
}

.pk-ed-doc-actions {
  border-top: 1px solid var(--ed-ink);
  padding-top: 12px;
  font-size: 12px;
}

.pk-ed-doc-actions summary { cursor: pointer; }

.pk-ed-doc-actions[open] > button {
  display: flex;
  margin-top: 8px;
}

.pk-ed-viewport { grid-template-columns: minmax(0, 1fr); }
