.editor-page {
  min-height: 100vh;
  background: #eef1f8;
}
.editor-header {
  min-height: 70px;
  padding: 0 max(4vw, 20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border-bottom: 1px solid #e2e6ef;
}
.editor-title {
  color: #667087;
  font-size: 0.84rem;
  margin: 0;
}
.editor-title span {
  color: #b2b9c8;
  margin: 0 0.25rem;
}
.editor-back {
  color: #335dff;
  font-weight: 750;
  font-size: 0.86rem;
}
.editor-intro {
  max-width: 760px;
  margin: 0 auto;
  padding: 5rem 24px;
  text-align: center;
}
.editor-intro h1 {
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
  margin: 0.2rem 0 1.2rem;
}
.editor-intro > p:not(.eyebrow):not(.editor-note) {
  max-width: 630px;
  margin: 0 auto 2rem;
  color: #5e677f;
  font-size: 1.05rem;
}
.editor-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 245px;
  margin: 2rem 0 1rem;
  padding: 2rem;
  background: #fff;
  border: 2px dashed #aab8e9;
  border-radius: 22px;
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: 0 14px 40px rgba(32, 46, 92, 0.07);
}
.editor-upload:hover,
.editor-upload.is-dragging {
  transform: translateY(-2px);
  border-color: #335dff;
  background: #f8f9ff;
}
.editor-upload input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.editor-upload-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 0.9rem;
  border-radius: 17px;
  color: #fff;
  background: #335dff;
  font-size: 1.7rem;
}
.editor-upload strong {
  font-size: 1.05rem;
}
.editor-upload small {
  margin-top: 0.2rem;
  color: #737d95;
}
.editor-note {
  max-width: 650px;
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  color: #5f6780;
  background: #e5e9f5;
  text-align: left;
  font-size: 0.79rem;
}
.editor-workspace {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px max(2vw, 14px) 30px;
  display: grid;
  grid-template-columns: 206px minmax(500px, 1fr) 245px;
  gap: 15px;
  align-items: start;
}
.editor-workspace[hidden] {
  display: none !important;
}
.editor-sidebar,
.editor-actions {
  padding: 1rem;
  background: #fff;
  border: 1px solid #e1e5ef;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(32, 46, 92, 0.05);
}
.file-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.55rem;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid #edf0f5;
}
.file-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}
.file-summary small {
  grid-column: 2;
  color: #7a8397;
  font-size: 0.72rem;
}
.file-pill {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  grid-row: span 2;
  border-radius: 8px;
  color: #d7472b;
  background: #ffe5df;
  font-size: 0.59rem;
  font-weight: 900;
}
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0.7rem;
  font-size: 0.74rem;
  color: #687188;
}
.page-nav button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #e1e5ef;
  border-radius: 8px;
  color: #27324c;
  background: #fff;
}
.page-nav button:disabled {
  color: #c0c6d1;
  cursor: not-allowed;
}
.page-thumbnails {
  max-height: 66vh;
  overflow: auto;
  display: grid;
  gap: 0.55rem;
  padding: 0.2rem;
}
.page-thumb {
  position: relative;
  padding: 4px;
  background: #f1f3f8;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.page-thumb.is-active {
  border-color: #335dff;
  background: #edf0ff;
}
.page-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}
.page-thumb span {
  position: absolute;
  right: 7px;
  bottom: 6px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #27324c;
  font-size: 0.6rem;
}
.editor-stage {
  min-width: 0;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid #e1e5ef;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(32, 46, 92, 0.05);
}
.toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #dde2ed;
  border-radius: 8px;
  padding: 0.46rem 0.58rem;
  color: #303a53;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 750;
}
.toolbar-button:hover {
  background: #f2f4fb;
  border-color: #b9c5f8;
}
.toolbar-button span {
  font-size: 0.95rem;
  color: #335dff;
}
.toolbar-button.danger {
  color: #bb3b29;
}
.image-button input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
}
.toolbar-divider {
  width: 1px;
  height: 24px;
  background: #e2e5ed;
}
.toolbar-field {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #687188;
  font-size: 0.72rem;
}
.toolbar-field input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 1px;
  border: 0;
  background: transparent;
}
.toolbar-field input[type="number"] {
  width: 54px;
  border: 1px solid #dde2ed;
  border-radius: 6px;
  padding: 0.32rem;
}
.canvas-wrap {
  display: flex;
  justify-content: center;
  min-height: 70vh;
  padding: clamp(0.7rem, 2vw, 2rem);
  overflow: auto;
  background: #dfe4ef;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.canvas-container {
  box-shadow: 0 18px 38px rgba(32, 46, 92, 0.22);
}
.editor-status {
  min-height: 1.3rem;
  margin: 0.6rem 0.15rem 0;
  color: #69738a;
  font-size: 0.78rem;
}
.editor-status.is-error {
  color: #bd4230;
}
.editor-status.is-success {
  color: #087f71;
}
.editor-actions {
  position: sticky;
  top: 86px;
}
.editor-actions h2 {
  margin: 0.15rem 0 0.75rem;
  font-size: 1.32rem;
  line-height: 1.05;
  letter-spacing: -0.05em;
}
.editor-actions p:not(.eyebrow) {
  margin: 0 0 1rem;
  color: #667087;
  font-size: 0.82rem;
}
.editor-actions .button {
  width: 100%;
  margin: 0.25rem 0;
}
.editor-actions .button-quiet {
  color: #536078;
  border: 1px solid #e0e4ed;
  background: #fff;
}
.editor-actions .text-link {
  display: block;
  margin-top: 1rem;
  font-size: 0.78rem;
}
@media (max-width: 1120px) {
  .editor-workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .editor-actions {
    grid-column: 1/-1;
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 1rem;
    align-items: center;
  }
  .editor-actions .eyebrow,
  .editor-actions h2,
  .editor-actions p {
    grid-column: 1/-1;
  }
  .editor-actions .text-link {
    margin: 0;
  }
}
@media (max-width: 720px) {
  .editor-title {
    display: none;
  }
  .editor-workspace {
    display: block;
    padding: 12px;
  }
  .editor-sidebar {
    margin-bottom: 12px;
  }
  .page-thumbnails {
    display: flex;
    max-height: 130px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .page-thumb {
    flex: 0 0 78px;
  }
  .editor-toolbar {
    gap: 0.35rem;
  }
  .toolbar-field {
    order: 2;
  }
  .canvas-wrap {
    min-height: 55vh;
    padding: 0.7rem;
    justify-content: flex-start;
  }
  .editor-actions {
    display: block;
    margin-top: 12px;
  }
  .editor-intro {
    padding: 3.5rem 20px;
  }
  .editor-upload {
    min-height: 210px;
  }
}
.toolbar-button.is-active {
  color: #fff;
  border-color: #27324c;
  background: #27324c;
}
.toolbar-button.is-active span {
  color: #fff;
}

/* Word-style editing ribbon */
.word-ribbon {
  align-items: stretch;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem 0.8rem;
  background: linear-gradient(180deg, #fff 0%, #f4f6fb 100%);
  border: 1px solid #dce1ec;
  border-radius: 14px 14px 10px 10px;
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.08);
}
.word-ribbon .ribbon-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 45px;
  padding: 0.1rem 0.52rem 0.32rem;
  border-right: 1px solid #dce1ec;
}
.word-ribbon .ribbon-group:last-child {
  border-right: 0;
}
.ribbon-label {
  position: absolute;
  right: 0.5rem;
  bottom: -0.02rem;
  left: 0.5rem;
  overflow: hidden;
  color: #78829a;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}
.word-ribbon .toolbar-button {
  min-height: 34px;
  border-color: #d9dfeb;
  background: rgba(255, 255, 255, 0.86);
  color: #27324c;
}
.word-ribbon .toolbar-button:hover {
  border-color: #9eafee;
  background: #edf1ff;
  color: #2948bd;
  transform: translateY(-1px);
}
.word-ribbon .tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 0.34rem 0.4rem;
  font-size: 1.08rem;
  line-height: 1;
}
.word-ribbon .format-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 31px;
  padding: 0.32rem 0.35rem;
  font-size: 1rem;
}
.word-ribbon .toolbar-button.is-active {
  border-color: #2d56e6;
  background: #335dff;
  box-shadow: 0 4px 10px rgba(51, 93, 255, 0.24);
  color: #fff;
}
.toolbar-select select,
.toolbar-size input {
  min-height: 34px;
  border: 1px solid #d9dfeb;
  border-radius: 7px;
  background: #fff;
  color: #27324c;
  font: inherit;
  font-size: 0.78rem;
  outline: none;
}
.toolbar-select select {
  width: 100px;
  padding: 0 0.28rem;
}
.toolbar-size input {
  width: 47px;
  padding: 0 0.25rem;
  text-align: center;
}
.toolbar-select select:focus,
.toolbar-size input:focus {
  border-color: #335dff;
  box-shadow: 0 0 0 3px rgba(51, 93, 255, 0.13);
}
.word-ribbon .toolbar-field {
  margin: 0;
}
.word-ribbon .colour-field {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid #d9dfeb;
  border-radius: 7px;
  background: #fff;
}
.word-ribbon .colour-field input {
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  cursor: pointer;
}
.word-ribbon .danger {
  color: #c03545;
}
.word-ribbon .danger:hover {
  border-color: #e9b4bd;
  background: #fff0f2;
  color: #b21e31;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 900px) {
  .word-ribbon .ribbon-group {
    border-right: 0;
  }
  .word-ribbon {
    gap: 0.1rem;
  }
}
@media (max-width: 620px) {
  .word-ribbon {
    padding: 0.4rem;
  }
  .word-ribbon .ribbon-group {
    min-height: 36px;
    padding: 0.05rem;
  }
  .ribbon-label {
    display: none;
  }
  .word-ribbon .tool-icon {
    min-width: 32px;
  }
  .toolbar-select select {
    width: 88px;
  }
}
.pdf-page-stack {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.pdf-page-stack .canvas-container {
  position: relative;
  z-index: 1;
}
.pdf-text-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  line-height: 1;
}
.pdf-text-layer.is-editing {
  pointer-events: auto;
  cursor: text;
}
.pdf-text-hit {
  position: absolute;
  display: block;
  box-sizing: border-box;
  color: transparent;
  border: 1px dashed transparent;
  transform-origin: left top;
  white-space: pre;
  user-select: none;
}
.pdf-text-layer.is-editing .pdf-text-hit {
  border-color: rgba(51, 93, 255, 0.34);
  background: rgba(51, 93, 255, 0.05);
}
.pdf-text-layer.is-editing .pdf-text-hit:hover,
.pdf-text-layer.is-editing .pdf-text-hit:focus {
  border-color: #335dff;
  background: rgba(51, 93, 255, 0.16);
  outline: 0;
}
