/* Printed Editor UI. Consumes tokens from main.css; defines none of its own colours. */

/* The hidden attribute must always win over display rules below. */
[hidden] {
  display: none !important;
}

/* ============================== shell =================================== */

html, body.ed-body {
  height: 100%;
}

body.ed-body {
  overflow: hidden;
}

.ed-root {
  display: flex;
  flex-direction: column;
  height: 100svh;
  background: var(--paper);
  color: var(--ink);
}

/* ============================== top bar ================================= */

.ed-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  min-height: 54px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
  flex-shrink: 0;
  z-index: 90;
}

.ed-topbar-left,
.ed-topbar-center,
.ed-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.ed-topbar-center {
  margin-inline: auto;
}

.ed-topbar-right {
  justify-content: flex-end;
}

.ed-topbar-sep {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
  flex-shrink: 0;
}

.ed-brand {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.ed-doc-name {
  width: min(240px, 26vw);
  padding: 0.34rem 0.6rem;
  font-weight: 600;
  font-size: 0.92rem;
  background: transparent;
  border-color: transparent;
  border-radius: var(--radius);
}

.ed-doc-name:hover:not(:disabled) {
  border-color: var(--line);
}

.ed-doc-name:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.ed-save-state {
  font-size: 0.72rem;
  color: var(--ink-faint);
  white-space: nowrap;
  min-width: 64px;
}

.ed-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ed-icon-btn svg {
  width: 18px;
  height: 18px;
}

.ed-icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.ed-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.ed-zoom-label {
  min-width: 56px;
  padding: 0.42rem 0.5rem;
  font-size: 0.78rem;
  text-align: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
}

.ed-zoom-label:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* menus */

.ed-menu-wrap {
  position: relative;
}

.ed-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 264px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-paper);
}

.ed-menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.6rem;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
}

.ed-menu-item:hover {
  background: var(--surface-2);
}

.ed-menu-item strong {
  display: block;
  font-size: 0.9rem;
}

.ed-menu-item small {
  display: block;
  color: var(--ink-faint);
  font-size: 0.76rem;
  line-height: 1.45;
  margin-top: 0.15rem;
}

.ed-menu-rule {
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}

.ed-menu-note {
  padding: 0.35rem 0.6rem;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* ============================= workspace ================================ */

.ed-workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* rail */

.ed-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 52px;
  flex-shrink: 0;
  padding-block: var(--space-3);
  border-right: 1px solid var(--line-strong);
  background: var(--surface);
}

.ed-rail-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ed-rail-btn svg {
  width: 19px;
  height: 19px;
}

.ed-rail-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.ed-rail-btn.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.ed-rail-spacer {
  flex: 1;
}

/* left panel */

.ed-leftpanel {
  width: 272px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--line-strong);
  background: var(--surface);
  transition: width 0.16s ease, opacity 0.12s ease;
}

.ed-leftpanel:not(.is-open) {
  width: 0;
  opacity: 0;
  border-right-width: 0;
  overflow: hidden;
}

.ed-panel-view {
  padding: var(--space-4);
}

.ed-panel-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: var(--space-3);
}

.ed-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

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

/* add tiles */

.ed-add-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: var(--space-3);
}

.ed-add-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.ed-add-tile:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.ed-add-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink);
}

.ed-add-glyph.serif { font-family: var(--font-serif); }
.ed-add-glyph.display { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.ed-add-glyph.mono { font-family: var(--font-mono); }
.ed-add-glyph svg { width: 22px; height: 22px; }

.glyph-rect {
  width: 20px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.glyph-circle {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.glyph-line {
  width: 22px;
  height: 0;
  border-top: 2.5px solid currentColor;
}

/* templates list */

.ed-tpl-cat {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: var(--space-3) 0 6px;
}

.ed-tpl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  color: inherit;
}

.ed-tpl-item:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.ed-tpl-thumbwrap {
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(46, 35, 22, 0.18));
}

.ed-tpl-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ed-tpl-title {
  font-size: 0.86rem;
  line-height: 1.25;
}

.ed-tpl-desc {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--ink-faint);
}

/* pages list */

.ed-pages-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ed-pageitem {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--paper);
  cursor: pointer;
}

.ed-pageitem.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.ed-page-thumb {
  display: block;
  width: fit-content;
  margin-inline: auto;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.ed-page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.ed-page-label {
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.ed-page-acts,
.ed-doc-acts {
  display: flex;
  gap: 2px;
}

.ed-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--ink-soft);
  cursor: pointer;
}

.ed-mini-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}

.ed-mini-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.ed-mini-btn.is-danger:hover:not(:disabled) {
  background: var(--crit-soft);
  color: var(--crit);
}

/* docs list */

.ed-doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#docs-list.ed-docs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ed-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.ed-doc-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  min-width: 0;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

.ed-doc-main strong {
  font-size: 0.85rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ed-doc-main small {
  font-size: 0.7rem;
  color: var(--ink-faint);
}

/* design panel */

.ed-field {
  margin-bottom: var(--space-4);
}

.ed-field label,
.ed-field > span {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
}

.ed-inline-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.ed-inline-4 label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--ink-faint);
  margin: 0;
}

.ed-inline-4 input {
  min-width: 0;
  padding: 0.32rem 0.35rem;
  font-size: 0.82rem;
}

.ed-seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
}

.ed-seg-btn {
  flex: 1;
  padding: 0.44rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface);
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
}

.ed-seg-btn:last-child {
  border-right: 0;
}

.ed-seg-btn:hover {
  background: var(--surface-2);
}

.ed-seg-btn.is-active {
  background: var(--ink);
  color: var(--paper);
}

.ed-bg-opts {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.ed-mini-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.ed-mini-field input[type="number"] {
  width: 62px;
  padding: 0.3rem 0.35rem;
  font-size: 0.82rem;
}

.ed-mini-field input[type="color"] {
  width: 40px;
  height: 30px;
  padding: 2px;
}

/* help keys table */

.ed-keys {
  border: 0;
  font-size: 0.8rem;
  background: none;
}

.ed-keys td {
  padding: 0.32rem 0.5rem 0.32rem 0;
  border-bottom: 1px solid var(--line);
}

.ed-keys tr:last-child td {
  border-bottom: 0;
}

.ed-keys td:first-child {
  color: var(--accent);
  white-space: nowrap;
}

/* =============================== stage ================================== */

.ed-stage-outer {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ed-stage {
  flex: 1;
  overflow: auto;
  position: relative;
  outline-offset: -2px;
  background-image:
    radial-gradient(circle at center, var(--line-strong) 0, var(--line-strong) 1px, transparent 1.2px);
  background-size: 22px 22px;
}

.ed-canvas {
  --iz: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: max-content;
  min-width: 100%;
  padding: 48px 48px 96px;
}

.ed-statusbar {
  min-height: 28px;
  padding: 0.35rem var(--space-3);
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* pages */

.ed-page-wrap {
  position: relative;
  flex-shrink: 0;
}

.ed-page-num {
  position: absolute;
  top: -24px;
  left: 0;
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.ed-sheet {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(46, 35, 22, 0.14),
    0 2px 4px rgba(46, 35, 22, 0.08),
    0 18px 40px -18px rgba(46, 35, 22, 0.4);
  overflow: hidden;
}

[data-theme="dark"] .ed-sheet {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 18px 40px -18px rgba(0, 0, 0, 0.65);
}

.ed-bg {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

.ed-margins {
  position: absolute;
  border: 1px dashed rgba(194, 59, 24, 0.45);
  pointer-events: none;
  z-index: 5000;
}

.ed-els {
  position: absolute;
  inset: 0;
}

.ed-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6000;
}

.ed-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7000;
}

/* elements */

.ed-el {
  position: absolute;
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ed-el.is-editing {
  cursor: text;
}

.ed-el img {
  -webkit-user-drag: none;
  user-select: none;
}

.ed-text {
  pointer-events: none;
  min-height: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: pre-wrap;
}

.ed-el.is-editing .ed-text {
  pointer-events: auto;
  outline: none;
  caret-color: var(--accent);
  cursor: text;
}

.ed-shape,
.ed-linebar {
  position: absolute;
  inset: 0;
}

.ed-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
}

/* selection */

.ed-selbox {
  position: absolute;
  pointer-events: none;
  border: calc(1.5px * var(--iz)) solid var(--accent);
}

.ed-h,
.ed-rot {
  position: absolute;
  pointer-events: auto;
  background: #fff;
  border: calc(1px * var(--iz)) solid var(--accent);
}

.ed-h {
  width: calc(9px * var(--iz));
  height: calc(9px * var(--iz));
  border-radius: calc(2px * var(--iz));
}

.ed-h[data-dir="nw"] { left: 0; top: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
.ed-h[data-dir="n"]  { left: 50%; top: 0; transform: translate(-50%, -50%); cursor: ns-resize; }
.ed-h[data-dir="ne"] { left: 100%; top: 0; transform: translate(-50%, -50%); cursor: nesw-resize; }
.ed-h[data-dir="e"]  { left: 100%; top: 50%; transform: translate(-50%, -50%); cursor: ew-resize; }
.ed-h[data-dir="se"] { left: 100%; top: 100%; transform: translate(-50%, -50%); cursor: nwse-resize; }
.ed-h[data-dir="s"]  { left: 50%; top: 100%; transform: translate(-50%, -50%); cursor: ns-resize; }
.ed-h[data-dir="sw"] { left: 0; top: 100%; transform: translate(-50%, -50%); cursor: nesw-resize; }
.ed-h[data-dir="w"]  { left: 0; top: 50%; transform: translate(-50%, -50%); cursor: ew-resize; }

.ed-rot {
  left: 50%;
  top: 0;
  width: calc(13px * var(--iz));
  height: calc(13px * var(--iz));
  transform: translate(-50%, calc(-26px * var(--iz)));
  border-radius: 50%;
  cursor: grab;
  background: var(--accent);
}

.ed-rot::after {
  content: "";
  position: absolute;
  inset: calc(4px * var(--iz));
  border: calc(1.5px * var(--iz)) solid var(--accent-contrast);
  border-radius: 50%;
  border-bottom-color: transparent;
}

/* guides & marquee */

.ed-guide-v,
.ed-guide-h {
  position: absolute;
  background: var(--accent);
  opacity: 0.85;
}

.ed-guide-v {
  top: 0;
  bottom: 0;
  width: calc(1px * var(--iz));
}

.ed-guide-h {
  left: 0;
  right: 0;
  height: calc(1px * var(--iz));
}

.ed-marquee {
  position: absolute;
  border: calc(1px * var(--iz)) dashed var(--accent);
  background: rgba(194, 59, 24, 0.06);
  pointer-events: none;
  z-index: 6500;
}

.is-droptarget .ed-sheet {
  outline: calc(2px * var(--iz)) dashed var(--accent);
  outline-offset: calc(3px * var(--iz));
}

/* thumbnails (pages panel, start screen, preview) */

.ed-thumb {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  display: block;
}

.ed-thumb-sheet {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background: #fff;
}

/* ============================= inspector ================================ */

.ed-inspector {
  width: 292px;
  flex-shrink: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
}

.ed-insp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.ed-insp-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0;
}

.ed-insp-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 var(--space-2);
}

.ed-insp-section {
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.ed-insp-empty {
  padding: var(--space-4);
}

.ed-insp-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--space-3);
  font-size: 0.84rem;
  margin: 0 0 var(--space-4);
}

.ed-insp-meta dt {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 0.1em;
}

.ed-insp-meta dd {
  margin: 0;
}

.ed-tip-list {
  margin: 0;
  padding-left: 1.1em;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.ed-tip-list li + li {
  margin-top: 4px;
}

.ed-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2) var(--space-3);
}

.ed-numfield {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-faint);
  min-width: 0;
}

.ed-numfield input {
  width: 100%;
  min-width: 0;
  padding: 0.36rem 0.45rem;
  font-size: 0.86rem;
}

.ed-numfield-suffix {
  position: relative;
}

.ed-numfield {
  position: relative;
}

.ed-numfield-suffix {
  position: absolute;
  right: 8px;
  bottom: 7px;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--ink-faint);
  pointer-events: none;
}

.ed-selectrow {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-faint);
}

.ed-selectrow select {
  padding: 0.36rem 0.45rem;
  font-size: 0.86rem;
}

.ed-content-ta {
  width: 100%;
  min-height: 4.6rem;
  resize: vertical;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: var(--space-3);
}

.ed-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
}

.ed-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.ed-align-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ed-align-row .btn {
  padding: 0.36rem 0.6rem;
  font-size: 0.76rem;
}

.ed-insp-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.ed-insp-actions .is-danger:not(:hover) {
  color: var(--crit);
  border-color: var(--crit-edge);
}

/* colour picker */

.ed-colorwrap {
  margin-top: var(--space-3);
}

.ed-colorwrap .ed-field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.ed-swatches {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}

.ed-swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
}

.ed-swatch:hover {
  transform: scale(1.12);
}

.ed-swatch.is-active {
  outline: 2px solid var(--accent);
  outline-offset: 1.5px;
}

.ed-native-color {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-faint);
}

.ed-native-color input {
  width: 44px;
  height: 28px;
  padding: 2px;
}

/* ============================ preview overlay ============================ */

.ed-preview {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  background: rgba(22, 18, 16, 0.88);
}

.ed-preview-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  min-height: 0;
}

.ed-preview-scaler {
  filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.5));
}

.ed-preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-3);
  color: #ece4d6;
}

.ed-preview-bar .mono {
  min-width: 64px;
  text-align: center;
}

.ed-preview-bar .ed-icon-btn {
  color: #ece4d6;
}

.ed-preview-bar .ed-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ============================= check drawer ============================== */

.ed-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(22, 18, 16, 0.45);
}

.ed-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 260;
  width: min(440px, 94vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: -18px 0 44px -18px rgba(46, 35, 22, 0.45);
}

.ed-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line-strong);
}

.ed-drawer-title {
  margin: 0;
  font-size: 1.15rem;
}

.ed-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.report-summary.card {
  padding: var(--space-4);
}

.report-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.report-score {
  display: flex;
  align-items: baseline;
  font-family: var(--font-display);
}

.report-score-num {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
}

.report-score-max {
  color: var(--ink-faint);
  font-size: 0.95rem;
}

.report-verdicts {
  min-width: 0;
}

.report-verdicts .report-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.report-meta {
  margin: 0 0 0.4rem;
  font-size: 0.74rem;
  color: var(--ink-faint);
}

.report-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.report-file {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

.report-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.report-finding {
  padding: var(--space-3) var(--space-4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
}

.report-finding.finding-good { border-left-color: var(--good); }
.report-finding.finding-info { border-left-color: var(--info); }
.report-finding.finding-warn { border-left-color: var(--warn); }
.report-finding.finding-crit { border-left-color: var(--crit); }

.report-finding-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 600;
}

.report-finding-body {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px var(--space-3);
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.5;
}

.report-finding-body dt {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 0.15em;
}

.report-finding-body dd {
  margin: 0;
}

.report-note {
  margin-top: var(--space-4);
}

.report-actions {
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ============================= start screen ============================== */

.ed-start {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow-y: auto;
}

.ed-start-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  max-width: 1160px;
  width: 100%;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 0;
}

.ed-start-tag {
  font-family: var(--font-serif);
  color: var(--ink-soft);
  margin: 0;
}

.ed-start-close {
  margin-left: auto;
  border-color: var(--line-strong);
}

.ed-start-tabs {
  display: flex;
  gap: var(--space-2);
  max-width: 1160px;
  width: 100%;
  margin-inline: auto;
  padding: var(--space-5) clamp(1rem, 4vw, 2rem) var(--space-4);
}

.ed-start-tab {
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
}

.ed-start-tab:hover {
  background: var(--surface-2);
}

.ed-start-tab.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.ed-start-body {
  flex: 1;
  max-width: 1160px;
  width: 100%;
  margin-inline: auto;
  padding: 0 clamp(1rem, 4vw, 2rem) var(--space-8);
}

.ed-start-pane h2 {
  margin-bottom: var(--space-2);
}

.ed-start-lede {
  margin-bottom: var(--space-5);
}

.ed-start-panehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.ed-start-panehead h2 {
  margin: 0;
}

.ed-start-tplgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-4);
}

.ed-start-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  text-align: left;
  cursor: pointer;
}

.ed-start-thumb {
  display: flex;
  justify-content: center;
  padding: var(--space-4);
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%),
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%, transparent 75%, var(--surface-2) 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  border-radius: var(--radius);
}

.ed-start-cardbody {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ed-start-cardbody strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.ed-start-cardbody small {
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.ed-start-blank {
  max-width: 560px;
}

.ed-blank-sizes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.ed-blank-size {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: var(--space-4) var(--space-2);
  cursor: pointer;
}

.ed-blank-size small {
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.ed-blank-size.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.ed-blank-shape {
  display: block;
  width: 44px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 2px;
  background: #fff;
}

.ed-blank-orient {
  max-width: 320px;
  margin-bottom: var(--space-5);
}

.ed-doclist-start {
  max-width: 640px;
}

/* ================================ toasts ================================= */

.ed-toasts {
  position: fixed;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.ed-toast {
  padding: 0.55rem 1rem;
  font-size: 0.86rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  box-shadow: var(--shadow-paper);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(90vw, 480px);
  text-align: center;
}

.ed-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.ed-toast-error {
  background: var(--crit);
  color: #fff;
}

/* ============================== print frame ============================== */

.ed-print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
}

/* =============================== responsive ============================== */

@media (max-width: 1180px) {
  .ed-inspector {
    position: absolute;
    top: 54px;
    right: 0;
    bottom: 0;
    z-index: 80;
    box-shadow: -12px 0 30px -18px rgba(46, 35, 22, 0.5);
  }
}

@media (max-width: 900px) {
  .ed-leftpanel {
    position: absolute;
    top: 54px;
    bottom: 0;
    left: 52px;
    z-index: 80;
    box-shadow: 12px 0 30px -18px rgba(46, 35, 22, 0.5);
  }

  .ed-leftpanel:not(.is-open) {
    display: none;
  }

  .ed-doc-name {
    width: 130px;
  }

  .ed-topbar .btn-small {
    padding: 0.44rem 0.6rem;
  }

  #btn-preview span,
  #btn-check {
    font-size: 0;
    padding: 0.44rem 0.6rem;
  }
}

/* =============================== printing ================================ */

@media print {
  .ed-root {
    display: none !important;
  }
}
