/* Shared writing editor module styles.
   The editor UI is rendered by the shared editor renderer and mounted through the editor instance controller. */

.editor-shell {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: white;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 1px solid var(--color-border);
  background: #FAFBFE;
}

.editor-canvas {
  min-height: 280px;
  padding: 16px;
  outline: none;
}

.editor-canvas:empty::before {
  content: attr(data-placeholder);
  color: var(--color-muted);
}

.assignment-editor-shell {
  gap: 0;
}

.editor-toolbar-stack {
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #fff 0%, #fafbfe 100%);
}

.toolbar-button-icon {
  min-width: 44px;
  justify-content: center;
}

.toolbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
}

.toolbar-icon-image {
  width: 28px;
  height: 28px;
}

.toolbar-svg-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.toolbar-label {
  font-size: 0.78rem;
  font-weight: 700;
}

.toolbar-button-accent {
  min-width: 40px;
  font-weight: 700;
}

.editor-selection-hint {
  padding: 10px 16px 14px;
  font-size: 0.82rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  background: #fff;
}

.editor-ribbon-shell {
  border: 1px solid var(--color-border);
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fdfdfd 0%, #f5f6fb 100%);
}

.editor-ribbon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 0;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(244,245,250,.98));
}

.editor-ribbon-tabs {
  display: flex;
  align-items: end;
  gap: 4px;
  flex-wrap: wrap;
}

.ribbon-tab-button {
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 10px 14px;
}

.ribbon-tab-button:hover {
  color: var(--color-primary);
  background: rgba(178,51,36,.06);
}

.ribbon-tab-button.active {
  background: #fff;
  color: var(--color-primary);
  border-color: rgba(178,51,36,.18);
  box-shadow: inset 0 2px 0 rgba(178,51,36,.18);
}

.ribbon-collapse-button {
  margin-left: auto;
}

.editor-ribbon-panels {
  border-top: 1px solid rgba(178,51,36,.08);
  background: #fff;
}

.editor-ribbon-panel {
  display: none;
  align-items: stretch;
  gap: 12px;
  padding: 14px;
  flex-wrap: wrap;
}

.editor-ribbon-panel.active {
  display: flex;
}

.editor-ribbon-shell.is-collapsed .editor-ribbon-panels {
  display: none;
}

.ribbon-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding-right: 12px;
  border-right: 1px solid rgba(15,23,42,.08);
}

.ribbon-group:last-child {
  border-right: 0;
  padding-right: 0;
}

.ribbon-group-body {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ribbon-group-body.compact-group {
  gap: 6px;
}

.ribbon-group-title {
  margin-top: 10px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.ribbon-group-note {
  min-width: min(280px, 100%);
  max-width: 380px;
}

.ribbon-note {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--color-text-soft);
  max-width: 340px;
}

.toolbar-button-tall {
  min-width: 82px;
  min-height: 66px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
}

.toolbar-button-tall .toolbar-label {
  font-size: 0.72rem;
  line-height: 1.15;
  text-align: center;
}

.ribbon-color-field,
.ribbon-select-field {
  display: grid;
  gap: 6px;
  justify-items: start;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--color-muted);
}

.ribbon-select-shell {
  min-width: 220px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
}

.ribbon-select-shell select {
  border: 0;
  background: transparent;
  font-weight: 700;
  color: var(--color-text);
  padding: 0;
}

.ribbon-select-shell select:focus {
  outline: none;
}

.ribbon-select-label,
.ribbon-color-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.spanish-characters-shell {
  align-items: stretch;
  gap: 12px;
}

.spanish-category-group {
  padding-right: 0;
  border-right: 0;
}

.spanish-category-label {
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.spanish-divider {
  width: 1px;
  align-self: stretch;
  background: linear-gradient(180deg, rgba(15,23,42,.03), rgba(15,23,42,.12), rgba(15,23,42,.03));
}

.editor-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  min-height: 320px;
}

.editor-canvas-wrap {
  min-width: 0;
  display: grid;
}

.editor-workspace--document-map-open {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
}

.editor-workspace--fullscreen.editor-workspace--document-map-open {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
}

.editor-canvas {
  min-height: 320px;
  padding: 18px;
  outline: none;
  background: #fff;
  font-size: 1rem;
  line-height: 1.55;
}

.editor-canvas:empty::before {
  content: attr(data-placeholder);
  color: var(--color-muted);
}

.editor-outline-panel {
  min-width: 0;
  max-width: 320px;
  border-left: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(248,250,254,.96), rgba(255,255,255,.98));
  padding: 16px 14px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.editor-outline-panel.hidden,
.editor-outline-panel[hidden] {
  display: none;
}

.editor-outline-header {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.editor-outline-header strong {
  display: block;
  color: var(--color-text);
}

.editor-outline-header span {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.editor-outline-icon {
  width: 28px;
  height: 28px;
}

.editor-outline-list {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 100%;
  overflow: auto;
}

.editor-outline-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(15,23,42,.06);
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  padding: 10px 12px;
  color: var(--color-text);
  font-weight: 700;
}

.editor-outline-item.level-1 { margin-left: 0; }

.editor-outline-item.level-2 { margin-left: 12px; }

.editor-outline-item.level-3 { margin-left: 24px; }

.editor-outline-item.level-4 { margin-left: 36px; }

.editor-outline-item .outline-kicker {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.editor-outline-empty {
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(15,23,42,.12);
  color: var(--color-text-soft);
  font-size: 0.82rem;
  background: rgba(255,255,255,.72);
}

.assignment-editor-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
}

.assignment-editor-table th,
.assignment-editor-table td {
  border: 1px solid rgba(178,51,36,.22);
  min-width: 112px;
  padding: 10px 12px;
  vertical-align: top;
  background: #fff;
}

.assignment-editor-table th {
  background: rgba(178,51,36,.08);
}

.assignment-editor-table.table-theme-blue th {
  background: rgba(58,164,216,.14);
  border-color: rgba(58,164,216,.28);
}

.assignment-editor-table.table-theme-blue td {
  border-color: rgba(58,164,216,.18);
}

.assignment-editor-table.table-theme-blue tbody tr:nth-child(even) td {
  background: rgba(58,164,216,.05);
}

.assignment-editor-table.table-theme-red tbody tr:nth-child(even) td {
  background: rgba(178,51,36,.035);
}

.editor-table-shell {
  position: relative;
  margin: 14px 0;
  border-radius: 18px;
  border: 1px solid rgba(178,51,36,.12);
  background: #fff;
  padding: 18px 14px 14px;
  box-shadow: 0 12px 28px rgba(15,23,42,.05);
}

.editor-table-shell.is-selected {
  border-color: rgba(178,51,36,.28);
  box-shadow: 0 0 0 3px rgba(178,51,36,.10), 0 14px 30px rgba(178,51,36,.08);
}

.editor-table-scroll {
  overflow-x: auto;
}

.editor-table-hover {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(178,51,36,.2);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,244,241,.98));
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, box-shadow .16s ease;
  box-shadow: 0 8px 20px rgba(178,51,36,.12);
  z-index: 3;
}

.editor-table-hover:hover {
  box-shadow: 0 14px 26px rgba(178,51,36,.18);
}

.editor-table-hover-column {
  top: -16px;
  right: 18px;
}

.editor-table-hover-row {
  left: -16px;
  top: 18px;
}

.editor-table-shell:hover .editor-table-hover,
.editor-table-shell.is-selected .editor-table-hover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.editor-image-block {
  position: relative;
  display: block;
  margin: 16px 0;
  border: 1px solid transparent;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
  cursor: default;
}

.editor-image-block.is-selected {
  border-color: rgba(178,51,36,.28);
  box-shadow: 0 0 0 3px rgba(178,51,36,.12), 0 16px 36px rgba(178,51,36,.12);
}

.editor-image-block img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.editor-image-block figcaption {
  display: block;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  background: #fff;
}

.editor-image-block.is-filename-hidden figcaption {
  display: none;
}

.editor-image-resize-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--color-primary);
  box-shadow: 0 8px 18px rgba(178,51,36,.18);
  opacity: 0;
  pointer-events: none;
}

.editor-image-block.is-selected .editor-image-resize-handle {
  opacity: 1;
  pointer-events: auto;
}

.editor-image-resize-nw { top: 8px; left: 8px; cursor: nwse-resize; }

.editor-image-resize-ne { top: 8px; right: 8px; cursor: nesw-resize; }

.editor-image-resize-sw { bottom: 44px; left: 8px; cursor: nesw-resize; }

.editor-image-resize-se { bottom: 44px; right: 8px; cursor: nwse-resize; }

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

.editor-tools-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--color-text);
}

.table-insert-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.table-dimension-preview {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(250,251,254,.98));
}

.table-dimension-preview-row {
  display: grid;
  gap: 6px;
}

.table-dimension-preview-cell {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(178,51,36,.16);
  background: rgba(255,255,255,.98);
}

.table-dimension-preview-cell.is-header {
  background: rgba(58,164,216,.16);
  border-color: rgba(58,164,216,.24);
}

.editor-tools-note {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--color-text-soft);
}

.editor-canvas {
  position: relative;
  overflow: auto;
}

.editor-canvas > :not(figure.editor-image-block) {
  position: relative;
  z-index: 2;
}

.ribbon-color-chip {
  display: grid;
  gap: 6px;
}

.ribbon-color-label {
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.ribbon-color-chip-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,251,254,.96));
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
}

.ribbon-color-chip-preview {
  width: 26px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.12);
  margin-left: auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

.visually-hidden-color {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.editor-image-block {
  max-width: min(100%, 960px);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

.editor-image-block.is-dragging {
  opacity: .92;
  box-shadow: 0 20px 48px rgba(15,23,42,.16);
}

.editor-image-block.wrap-inline {
  position: relative;
  display: inline-block;
  clear: none;
  max-width: 100%;
  margin: 16px 0;
  vertical-align: middle;
}

.editor-image-block.wrap-square-left {
  float: left;
  clear: left;
  margin: 12px 18px 12px 0;
}

.editor-image-block.wrap-square-right {
  float: right;
  clear: right;
  margin: 12px 0 12px 18px;
}

.editor-image-block.wrap-top-bottom {
  display: block;
  clear: both;
  margin: 18px auto;
}

.editor-image-block.wrap-behind-text,
.editor-image-block.wrap-in-front-of-text {
  position: absolute;
  margin: 0;
  z-index: 1;
}

.editor-image-block.wrap-behind-text {
  z-index: 1;
  opacity: .72;
}

.editor-image-block.wrap-in-front-of-text {
  z-index: 6;
}

.editor-wrap-menu {
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  overflow: hidden;
}

.editor-wrap-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 800;
}

.editor-wrap-menu summary::-webkit-details-marker { display: none; }

.editor-wrap-menu-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.editor-wrap-option {
  justify-content: flex-start;
  text-align: left;
}

.editor-canvas::after { content: ''; display: block; clear: both; }

.editor-ribbon-panel[data-assignment-editor-panel="colors"] {
  align-items: stretch;
}

.editor-ribbon-panel[data-assignment-editor-panel="colors"] .ribbon-group-colors {
  min-width: min(420px, 100%);
}

.assignment-inspect-content .editor-image-block,
.assignment-inspect-content .editor-table-shell {
  pointer-events: none;
}

.assignment-inspect-content figure.editor-image-block {
  max-width: min(100%, 720px);
}

.editor-ribbon-panel[data-assignment-editor-panel="colors"] {
  justify-content: space-between;
}

.editor-ribbon-panel[data-assignment-editor-panel="colors"] .ribbon-group-note {
  display: none;
}

.editor-ribbon-panel[data-assignment-editor-panel="colors"] .ribbon-group-colors {
  min-width: 360px;
  flex: 0 0 auto;
}

.wrap-mode-grid {
  grid-template-columns: 1fr;
}

.compact-wrap-menu .editor-wrap-menu-trigger {
  justify-content: space-between;
  cursor: default;
}

.modal-resize-handle::before {
  content: '⇄';
  color: rgba(255,255,255,.92);
  font-size: 0.9rem;
  font-weight: 800;
}

.editor-image-block.wrap-square-left {
  float: left;
  clear: none;
  margin: 12px 18px 12px 0;
}

.editor-ribbon-panel[data-assignment-editor-panel="colors"] .ribbon-group-colors {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(240px, 340px);
  align-items: start;
  gap: 18px;
}

.editor-ribbon-panel[data-assignment-editor-panel="colors"] .modern-color-group {
  min-width: 0;
}

.editor-wrap-menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 10px;
}

.compact-wrap-menu .editor-wrap-menu-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap] {
  justify-content: center;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap].is-active {
  border-color: rgba(178,51,36,.26);
  box-shadow: inset 0 0 0 1px rgba(178,51,36,.08);
  color: var(--color-primary);
}

.ribbon-select-shell select {
  margin-top: 0;
  min-height: 38px;
  padding: 8px 36px 8px 12px;
  line-height: 1.2;
  appearance: none;
}

.editor-ribbon-panel[data-assignment-editor-panel="spacing"] .ribbon-group-body.compact-group {
  align-items: stretch;
}

.compact-wrap-menu .editor-wrap-menu-heading {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap].is-active,
.toggle-surface-button.is-active {
  background: rgba(178,51,36,.12);
  border-color: rgba(178,51,36,.34);
  color: var(--color-primary);
  box-shadow: inset 0 0 0 1px rgba(178,51,36,.08);
}

.modal-resize-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 116px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(178,51,36,.88);
  color: rgba(255,255,255,.96);
  font-weight: 800;
  letter-spacing: .01em;
  box-shadow: 0 10px 28px rgba(15,23,42,.18);
}

.modal-resize-handle::before {
  content: none;
}

.modal-resize-icon {
  width: 16px;
  height: 16px;
}

.editor-image-block.wrap-inline {
  display: inline-flex;
  vertical-align: baseline;
  float: none;
  clear: none;
  margin: 0 8px 0 0;
}

.editor-image-block.wrap-square-left,
.editor-image-block.wrap-square-right,
.editor-image-block.wrap-top-bottom {
  clear: none;
}

.editor-tools-subheading {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.editor-wrap-menu {
  padding: 12px;
  overflow: visible;
}

.editor-wrap-menu-list {
  padding: 0;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap] {
  justify-content: center;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap].is-active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}

.ribbon-select-shell select {
  color: var(--color-text);
  font-weight: 800;
  font-size: 0.94rem;
}

.ribbon-select-shell select option {
  color: var(--color-text);
}

.editor-tools-subheading {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap] {
  font-size: 0.78rem;
  font-weight: 800;
}

.compact-wrap-menu .action-button.secondary[data-image-wrap].is-active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
}

/* Targeted editor fixes */
.editor-tools-subheading {
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Editor tools cleanup */
.editor-tools-heading-label {
  display: block;
  margin: 4px 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--color-text);
}

.editor-tools-subheading {
  display: block;
  margin: 4px 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-text);
}

.compact-wrap-menu .action-button.secondary[data-image-wrap] { font-size: 0.82rem; font-weight: 800; }

.ribbon-select-shell select { appearance: none; -webkit-appearance: none; background-color: transparent; }

/* Shared editor controls */
.ribbon-select-shell-with-preview {
  grid-template-columns: 44px minmax(0, 1fr);
}

.ribbon-select-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 26px;
  padding: 0 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--color-text);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.ribbon-select-preview.is-numeric {
  font-size: 0.72rem;
}

.editor-image-block figcaption {
  display: block;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.assignment-inspect-content figure.editor-image-block img,
.student-assignment-prompt-body figure.editor-image-block img {
  max-width: 100%;
  height: auto;
}

.profile-picture-busy-card::before,
.editor-busy-spinner {
  content: '';
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 4px solid rgba(148, 163, 184, .32);
  border-top-color: var(--color-primary);
  animation: charlaSpin .85s linear infinite;
  display: inline-block;
  box-sizing: border-box;
}

.editor-busy-host { position: relative; }

.editor-image-upload-busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 25;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(2px);
  border-radius: inherit;
}

.editor-image-upload-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: min(320px, calc(100% - 32px));
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15,23,42,.14);
  text-align: center;
}

.editor-image-upload-card p { margin: 0; color: var(--color-muted); font-size: .86rem; }

.editor-image-block,

.editor-image-block img.editor-resizable-image,

.editor-image-block figcaption,


.editor-tools-toggle {
  margin: 4px 0;
}

.editor-tools-toggle .charla-switch-text {
  font-weight: 800;
}

.wrap-mode-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.editor-tools-toggle.charla-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.editor-tools-toggle.charla-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.editor-tools-toggle .charla-switch-track {
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
  border: 1px solid rgba(100, 116, 139, 0.32);
  position: relative;
  flex: 0 0 54px;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.editor-tools-toggle .charla-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.16);
  transition: transform var(--transition-fast);
}

.editor-tools-toggle.charla-switch input:checked + .charla-switch-track {
  background: var(--color-primary);
  border-color: rgba(178,51,36,.65);
}

.editor-tools-toggle.charla-switch input:checked + .charla-switch-track .charla-switch-thumb {
  transform: translateX(22px);
}


.editor-canvas,
.assignment-inspect-content,
.student-assignment-prompt-body,
.reusable-assignment-editor .editor-canvas {
  position: relative;
  overflow: hidden;
  contain: paint;
}
.editor-image-block,
.editor-image-block img.editor-resizable-image,
.editor-image-block figcaption,
.editor-image-block figcaption:focus,
.editor-image-block.is-filename-hidden figcaption,
.editor-image-block.wrap-behind-text,
.editor-image-block.wrap-in-front-of-text,
.editor-image-block.wrap-behind-text,
.editor-image-block.wrap-in-front-of-text,
.editor-image-block.wrap-inline,
.editor-image-block.wrap-top-bottom,
.assignment-inspect-content figure.editor-image-block.wrap-behind-text,
.assignment-inspect-content figure.editor-image-block.wrap-in-front-of-text,
.student-assignment-prompt-body figure.editor-image-block.wrap-behind-text,
.student-assignment-prompt-body figure.editor-image-block.wrap-in-front-of-text {
  left: min(max(0px, var(--image-left, 0px)), calc(100% - 120px));
  top: min(max(0px, var(--image-top, 0px)), calc(100% - 80px));
}


.ribbon-select-shell {
  position: relative;
  cursor: pointer;
}

.ribbon-select-shell::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 900;
  pointer-events: none;
}

.ribbon-select-shell select {
  width: 100%;
  min-width: 0;
  cursor: pointer;
  pointer-events: auto;
  padding-right: 28px;
}

.ribbon-select-shell.is-open,
.ribbon-select-shell:focus-within {
  border-color: rgba(178,51,36,.38);
  box-shadow: 0 0 0 3px rgba(178,51,36,.08);
}

/* Shared editor fullscreen and colour-slot layout */
.assignment-editor-fullscreen-open {
  overflow: hidden;
}

.assignment-editor-fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 34px);
}

.assignment-editor-fullscreen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .56);
  backdrop-filter: blur(8px);
}

.assignment-editor-fullscreen-dialog {
  position: relative;
  z-index: 1;
  width: min(1360px, calc(100vw - 48px));
  height: min(880px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 32px 90px rgba(15, 23, 42, .28);
}

.assignment-editor-fullscreen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.assignment-editor-fullscreen-heading {
  min-width: 0;
}

.assignment-editor-fullscreen-heading h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--color-text);
}

.assignment-editor-fullscreen-heading p {
  margin: 2px 0 0;
  color: var(--color-muted);
}

.assignment-editor-fullscreen-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.assignment-editor-fullscreen-resize {
  white-space: nowrap;
}

.assignment-editor-fullscreen-body {
  min-height: 0;
  display: flex;
}

.assignment-editor-fullscreen-body > .assignment-editor-shell,
.assignment-editor-shell.is-fullscreen-modal-surface {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 22px;
  overflow: hidden;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-ribbon-shell {
  border-radius: 22px 22px 0 0;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace {
  min-height: 0;
  height: auto;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas {
  min-height: 100%;
  height: 100%;
}

.assignment-editor-fullscreen-footer {
  color: var(--color-muted);
  font-size: .88rem;
}

@media (max-width: 780px) {
  .editor-workspace--document-map-open,
  .editor-workspace--fullscreen.editor-workspace--document-map-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-outline-panel {
    max-width: none;
    border-left: 0;
    border-top: 1px solid var(--color-border);
  }
}




/* Shared editor colour panel layout */
.editor-ribbon-panel[data-assignment-editor-panel="colors"] {
  align-items: stretch;
}

.editor-colors-layout {
  display: grid;
  grid-template-columns: max-content max-content minmax(220px, 1fr) minmax(220px, 1fr) minmax(180px, .7fr);
  grid-template-areas: "pickers pickers text highlight saved";
  gap: 14px;
  align-items: stretch;
  width: 100%;
}

.editor-color-section {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
}

.editor-color-picker-section { grid-area: pickers; }
.editor-color-recent-section[data-assignment-editor-color-recent-text-group] { grid-area: text; }
.editor-color-recent-section[data-assignment-editor-color-recent-highlight-group] { grid-area: highlight; }
.editor-color-saved-section { grid-area: saved; }

.editor-color-pickers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.editor-color-section-title {
  display: block;
  align-self: end;
  margin: 0;
  color: var(--color-muted);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.editor-color-saved-section .editor-color-section-title {
  text-align: left;
}

.editor-color-saved-note {
  margin: 0;
  color: var(--color-muted);
  font-size: .78rem;
  line-height: 1.35;
}


.editor-color-status {
  grid-column: 1 / -1;
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.35;
}

.editor-color-slot-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(34px, 1fr));
  gap: 10px;
  align-items: center;
  justify-items: center;
}

.editor-color-slot {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  justify-self: center;
}

.editor-color-swatch {
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  cursor: pointer;
}

.editor-color-swatch:disabled {
  cursor: default;
}

.editor-color-swatch-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  background: #d9dde4;
}

.editor-color-slot.is-empty .editor-color-swatch {
  opacity: .82;
}

.editor-color-lock {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: inline-flex;
  width: 20px;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  padding: 1px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 4px 12px rgba(15,23,42,.12);
  cursor: pointer;
}

.editor-color-lock input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.editor-color-lock-icon {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--color-muted);
}

.editor-color-lock-icon::before {
  content: '🔓';
  font-size: 11px;
  line-height: 1;
}

.editor-color-lock input:checked + .editor-color-lock-icon {
  background: var(--gradient-primary);
  color: #fff;
}

.editor-color-lock input:checked + .editor-color-lock-icon::before {
  content: '🔒';
}

.editor-color-slot.is-locked .editor-color-swatch {
  box-shadow: 0 0 0 2px rgba(178,51,36,.22), 0 8px 18px rgba(15,23,42,.1);
}

@media (max-width: 1120px) {
  .editor-colors-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(180px, .8fr);
    grid-template-areas:
      "pickers pickers pickers"
      "text highlight saved";
  }
}

@media (max-width: 720px) {
  .editor-colors-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "pickers"
      "text"
      "highlight"
      "saved";
  }

  .editor-color-pickers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Shared ribbon responsiveness and renderer split integration */
.editor-ribbon-panel {
  align-content: start;
  align-items: stretch;
  gap: 10px;
  padding: 10px 12px;
  max-height: none;
}

.editor-ribbon-panel.active {
  display: flex;
}

.ribbon-group {
  flex: 0 1 auto;
  min-width: min(100%, 160px);
  padding-right: 10px;
}

.ribbon-group-body {
  gap: 6px;
  min-width: 0;
}

.ribbon-group-title {
  margin-top: 8px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.ribbon-group-note {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
  max-width: min(100%, 340px);
}

.ribbon-note {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.toolbar-button-tall {
  min-width: 68px;
  min-height: 56px;
  gap: 4px;
  padding: 8px 7px;
}

.toolbar-button-tall .toolbar-label {
  max-width: 84px;
  overflow-wrap: anywhere;
}

.toolbar-svg-icon,
.toolbar-icon-image {
  width: 24px;
  height: 24px;
}

.ribbon-select-shell {
  min-width: clamp(160px, 18vw, 220px);
  padding: 6px 9px;
}

.editor-ribbon-panel[data-assignment-editor-panel="spacing"] .ribbon-group {
  flex: 1 1 260px;
}

.editor-ribbon-panel[data-assignment-editor-panel="spacing"] .ribbon-select-field {
  flex: 1 1 180px;
}

.editor-ribbon-panel[data-assignment-editor-panel="table"] .ribbon-group,
.editor-ribbon-panel[data-assignment-editor-panel="picture"] .ribbon-group,
.editor-ribbon-panel[data-assignment-editor-panel="insert"] .ribbon-group {
  flex: 1 1 320px;
}

.editor-ribbon-panel[data-assignment-editor-panel="table"] .ribbon-group-note,
.editor-ribbon-panel[data-assignment-editor-panel="picture"] .ribbon-group-note,
.editor-ribbon-panel[data-assignment-editor-panel="insert"] .ribbon-group-note,
.editor-ribbon-panel[data-assignment-editor-panel="view"] .ribbon-group-note,
.editor-ribbon-panel[data-assignment-editor-panel="history"] .ribbon-group-note {
  align-self: stretch;
}

@media (max-width: 980px) {
  .editor-ribbon-header {
    align-items: flex-start;
  }

  .editor-ribbon-tabs {
    flex: 1 1 auto;
  }

  .ribbon-tab-button {
    padding: 8px 10px;
  }

  .toolbar-button-tall {
    min-width: 62px;
    min-height: 52px;
  }
}

@media (max-width: 680px) {
  .editor-ribbon-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .editor-ribbon-panel {
    padding: 9px;
  }

  .ribbon-group {
    flex: 1 1 100%;
    border-right: 0;
    border-bottom: 1px solid rgba(15,23,42,.08);
    padding: 0 0 8px;
  }

  .ribbon-group:last-child {
    border-bottom: 0;
  }

  .ribbon-group-body,
  .ribbon-group-body.compact-group {
    align-items: stretch;
  }

  .toolbar-button-tall {
    flex: 1 1 72px;
  }

  .ribbon-select-field {
    flex: 1 1 100%;
  }

  .ribbon-select-shell {
    min-width: 0;
    width: 100%;
  }
}


/* Shared editor ownership across assignment contexts */
.reusable-assignment-editor,
.assignment-editor-shell {
  max-width: 100%;
}

.assignment-editor-shell .editor-ribbon-panels {
  overflow-x: auto;
}


.assignment-editor-shell.is-fullscreen-modal-surface,
.assignment-editor-fullscreen-body .assignment-editor-shell {
  min-width: 0;
  min-height: 0;
}

.assignment-editor-fullscreen-body .editor-ribbon-shell,
.assignment-editor-fullscreen-body .editor-workspace {
  min-height: 0;
}

.assignment-editor-fullscreen-body .editor-canvas {
  min-height: 0;
  height: auto;
  overflow: auto;
}

.editor-image-block,

.editor-image-block figcaption,

/* Shared editor visual parity: ribbon, canvas, disabled tools, fullscreen */
.assignment-editor-shell.reusable-assignment-editor {
  border: 1px solid rgba(178, 51, 36, .14);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff 0%, #fff7f5 100%);
  box-shadow: 0 22px 60px rgba(15, 23, 42, .08);
}

.assignment-editor-shell .editor-ribbon-shell {
  border: 0;
  border-bottom: 1px solid rgba(178, 51, 36, .10);
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #fff 0%, #fff1ee 100%);
}

.assignment-editor-shell .editor-ribbon-header {
  padding: 12px 16px 0;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,244,241,.96));
}

.assignment-editor-shell .ribbon-tab-button {
  min-height: 42px;
  border-color: transparent;
  color: #7c4a43;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.assignment-editor-shell .ribbon-tab-button:hover {
  color: var(--color-primary);
  background: rgba(178, 51, 36, .08);
  transform: translateY(-1px);
}

.assignment-editor-shell .ribbon-tab-button.active {
  background: linear-gradient(180deg, #fff 0%, #fff7f5 100%);
  color: var(--color-primary);
  border-color: rgba(178, 51, 36, .24);
  box-shadow: inset 0 3px 0 rgba(178, 51, 36, .36), 0 -1px 10px rgba(178, 51, 36, .08);
}

.assignment-editor-shell .editor-ribbon-panels {
  border-top: 1px solid rgba(178, 51, 36, .10);
  background: linear-gradient(180deg, #fff 0%, #fffdfc 100%);
}

.assignment-editor-shell .editor-ribbon-panel.active {
  min-height: 92px;
}

.assignment-editor-shell .ribbon-collapse-button[aria-expanded="false"] {
  background: rgba(178, 51, 36, .08);
  color: var(--color-primary);
}

.assignment-editor-shell .toolbar-button:disabled,
.assignment-editor-shell .toolbar-button[aria-disabled="true"],
.assignment-editor-shell .toolbar-button.is-disabled {
  cursor: not-allowed;
  opacity: .46;
  filter: grayscale(.28);
  box-shadow: none;
}

.assignment-editor-shell .toolbar-button:disabled:hover,
.assignment-editor-shell .toolbar-button[aria-disabled="true"]:hover,
.assignment-editor-shell .toolbar-button.is-disabled:hover {
  transform: none;
}

.assignment-editor-shell .editor-workspace {
  background: linear-gradient(180deg, #fff7f5 0%, #f8fafc 100%);
  padding: clamp(18px, 2.4vw, 34px);
}

.assignment-editor-shell .editor-canvas-wrap {
  align-content: start;
  justify-items: center;
  border-radius: 24px;
}

.assignment-editor-shell .editor-canvas {
  width: min(100%, 980px);
  min-height: clamp(420px, 56vh, 720px);
  padding: clamp(28px, 4vw, 58px);
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 54px rgba(15, 23, 42, .10);
}

.assignment-editor-shell .editor-canvas:focus {
  border-color: rgba(178, 51, 36, .32);
  box-shadow: 0 0 0 4px rgba(178, 51, 36, .10), 0 18px 54px rgba(15, 23, 42, .10);
}

.assignment-editor-shell .editor-outline-panel {
  border: 1px solid rgba(178, 51, 36, .12);
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .08);
}

.assignment-editor-shell.is-fullscreen-modal-surface {
  border-radius: 24px;
  box-shadow: none;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace {
  padding: clamp(14px, 2vw, 24px);
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas {
  width: min(100%, 1120px);
  min-height: 100%;
}

.assignment-editor-fullscreen-dialog {
  border: 1px solid rgba(255,255,255,.72);
}

.assignment-editor-fullscreen-body .assignment-editor-shell .editor-ribbon-panel.active {
  min-height: 84px;
}

@media (max-width: 780px) {
  .assignment-editor-shell .editor-workspace {
    padding: 14px;
  }

  .assignment-editor-shell .editor-canvas {
    min-height: 360px;
    padding: 22px;
  }
}


/* Shared editor visual contract recovery */
.assignment-editor-shell.reusable-assignment-editor {
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 30px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .09);
}

.assignment-editor-shell .editor-ribbon-shell {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid rgba(148, 163, 184, .24);
}

.assignment-editor-shell .editor-ribbon-header {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
}

.assignment-editor-shell .ribbon-tab-button.active {
  background: linear-gradient(180deg, #fff 0%, #fff8f6 100%);
  color: var(--color-primary);
  border-color: rgba(178, 51, 36, .20);
  box-shadow: inset 0 3px 0 rgba(178, 51, 36, .28), 0 -1px 10px rgba(178, 51, 36, .06);
}

.assignment-editor-shell .editor-ribbon-panels {
  background: #ffffff;
}

.assignment-editor-shell .editor-ribbon-panel.active {
  min-height: 112px;
  gap: 14px;
  padding: 14px 16px;
}

.assignment-editor-shell .ribbon-group {
  min-width: min(100%, 184px);
}

.assignment-editor-shell .toolbar-button-tall {
  min-width: 76px;
  min-height: 60px;
}

.assignment-editor-shell .editor-workspace.assignment-editor-workspace {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: clamp(22px, 3vw, 42px);
}

.assignment-editor-shell .editor-canvas.assignment-editor-canvas {
  width: min(100%, 1040px);
  min-height: clamp(500px, 62vh, 780px);
  padding: clamp(32px, 4.2vw, 64px);
  border: 1px solid rgba(148, 163, 184, .30);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .11);
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas.assignment-editor-canvas {
  width: min(100%, 1160px);
  min-height: 100%;
}

.practice-dictation-editor-wrap .assignment-editor-shell .editor-canvas.assignment-editor-canvas,
.student-assignment-editor .assignment-editor-shell .editor-canvas.assignment-editor-canvas {
  min-height: clamp(460px, 58vh, 720px);
}

.assignment-editor-shell .editor-selection-hint {
  background: #ffffff;
  border-top: 1px solid rgba(148, 163, 184, .22);
}

@media (max-width: 780px) {
  .assignment-editor-shell .editor-ribbon-panel.active {
    min-height: 0;
  }

  .assignment-editor-shell .editor-workspace.assignment-editor-workspace {
    padding: 14px;
  }

  .assignment-editor-shell .editor-canvas.assignment-editor-canvas {
    min-height: 380px;
    padding: 22px;
  }
}

/* Shared editor fullscreen sizing and drag behavior */
.assignment-editor-fullscreen-dialog {
  width: var(--assignment-editor-fullscreen-width, min(1480px, calc(100vw - 40px)));
  height: min(940px, calc(100vh - 36px));
  max-width: calc(100vw - 32px);
  min-width: min(960px, calc(100vw - 32px));
  transition: width .18s ease, box-shadow .18s ease, transform .18s ease;
}

.assignment-editor-fullscreen-dialog--resizing {
  transition: none;
  box-shadow: 0 34px 96px rgba(15, 23, 42, .34), 0 0 0 4px rgba(178, 51, 36, .12);
}

.assignment-editor-fullscreen-dialog .assignment-editor-fullscreen-body {
  min-height: min(620px, calc(100vh - 220px));
}

.assignment-editor-fullscreen-dialog .assignment-editor-shell.is-fullscreen-modal-surface {
  min-height: 0;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace.assignment-editor-workspace {
  padding: clamp(16px, 2vw, 30px);
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas.assignment-editor-canvas {
  width: min(100%, 1240px);
  min-height: clamp(560px, 68vh, 780px);
}

.assignment-editor-fullscreen-resize {
  min-width: 132px;
  min-height: 44px;
  cursor: ew-resize;
  user-select: none;
  touch-action: none;
}

.assignment-editor-fullscreen-resize[aria-pressed="true"] {
  box-shadow: 0 0 0 4px rgba(178, 51, 36, .12);
}

.assignment-editor-fullscreen-status {
  min-height: 1.25rem;
  color: var(--color-muted);
  font-size: .88rem;
}

@media (max-width: 980px) {
  .assignment-editor-fullscreen-dialog {
    min-width: 0;
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    padding: 14px;
  }

  .assignment-editor-fullscreen-header {
    align-items: stretch;
    flex-direction: column;
  }

  .assignment-editor-fullscreen-actions {
    justify-content: flex-start;
  }

  .assignment-editor-fullscreen-dialog .assignment-editor-fullscreen-body {
    min-height: 0;
  }

  .assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas.assignment-editor-canvas {
    min-height: 420px;
  }
}

/* Shared editor ribbon wrapping and spacing recovery */
.assignment-editor-shell .editor-ribbon-header {
  align-items: flex-end;
  gap: 12px 16px;
}

.assignment-editor-shell .editor-ribbon-tabs {
  flex: 1 1 auto;
  min-width: 0;
  row-gap: 6px;
  overflow: visible;
}

.assignment-editor-shell .ribbon-tab-button {
  min-height: 42px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: normal;
}

.assignment-editor-shell .editor-ribbon-panel.active {
  align-items: stretch;
  gap: 16px;
  min-height: 0;
  overflow: visible;
}

.assignment-editor-shell .editor-ribbon-panel-readable {
  flex-wrap: wrap;
  row-gap: 16px;
}

.assignment-editor-shell .ribbon-group {
  flex: 0 1 auto;
  min-width: min(100%, 196px);
  padding-right: 14px;
}

.assignment-editor-shell .ribbon-group-body,
.assignment-editor-shell .ribbon-group-body.compact-group {
  align-content: flex-start;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.assignment-editor-shell .toolbar-button-tall {
  flex: 0 1 78px;
  min-width: 72px;
  min-height: 60px;
  overflow: visible;
}

.assignment-editor-shell .toolbar-button-tall .toolbar-label {
  max-width: 92px;
  overflow-wrap: anywhere;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-lists {
  flex: 1 1 380px;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls {
  flex: 2 1 560px;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls .ribbon-group-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  align-items: end;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-select-field,
.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-select-shell {
  width: 100%;
  min-width: 0;
}

.assignment-editor-shell .editor-ribbon-panel-spanish .ribbon-group-spanish {
  flex: 1 1 100%;
  min-width: min(100%, 520px);
  padding-right: 0;
  border-right: 0;
}

.assignment-editor-shell .spanish-group-body {
  display: block;
  min-width: 0;
}

.assignment-editor-shell .spanish-characters-shell {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  width: 100%;
  align-items: start;
}

.assignment-editor-shell .spanish-category-group {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, .20);
  border-radius: 16px;
  background: rgba(248, 250, 252, .72);
}

.assignment-editor-shell .spanish-category-label {
  margin-bottom: 8px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.assignment-editor-shell .accents-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
  align-items: stretch;
}

.assignment-editor-shell .toolbar-button-accent {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 8px;
  line-height: 1.15;
  font-size: 1.05rem;
  overflow: visible;
}

.assignment-editor-shell .spanish-character-status {
  margin: 10px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-muted);
}

.assignment-editor-shell .spanish-divider {
  display: none;
}

@media (max-width: 980px) {
  .assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-lists,
  .assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls {
    flex-basis: 100%;
    padding-right: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    padding-bottom: 10px;
  }

  .assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .assignment-editor-shell .spanish-characters-shell {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 680px) {
  .assignment-editor-shell .editor-ribbon-header {
    align-items: start;
  }

  .assignment-editor-shell .editor-ribbon-tabs {
    gap: 4px;
  }

  .assignment-editor-shell .ribbon-tab-button {
    min-height: 38px;
    padding: 8px 9px;
  }

  .assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls .ribbon-group-body {
    grid-template-columns: 1fr;
  }

  .assignment-editor-shell .spanish-characters-shell {
    grid-template-columns: 1fr;
  }

  .assignment-editor-shell .toolbar-button-tall {
    flex: 1 1 78px;
  }
}

/* Shared editor color lock state recovery */
.assignment-editor-shell .editor-color-lock {
  min-width: 26px;
  min-height: 26px;
  border: 1px solid rgba(15, 23, 42, .14);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.assignment-editor-shell .editor-color-lock:hover,
.assignment-editor-shell .editor-color-lock:focus-visible {
  border-color: rgba(178, 51, 36, .42);
  box-shadow: 0 0 0 3px rgba(178, 51, 36, .14), 0 8px 18px rgba(15, 23, 42, .12);
}

.assignment-editor-shell .editor-color-lock[aria-pressed="true"] .editor-color-lock-icon {
  background: var(--gradient-primary);
  color: #fff;
}

.assignment-editor-shell .editor-color-lock[aria-pressed="true"] .editor-color-lock-icon::before {
  content: '🔒';
}

.assignment-editor-shell .editor-color-lock[aria-pressed="false"] .editor-color-lock-icon::before {
  content: '🔓';
}

.assignment-editor-shell .editor-color-slot.is-locked .editor-color-swatch {
  box-shadow: 0 0 0 2px rgba(178, 51, 36, .28), 0 8px 18px rgba(15, 23, 42, .1);
}

/* Shared editor emoji tab */
.assignment-editor-shell .editor-ribbon-panel-emoji .ribbon-group-emoji {
  flex: 1 1 100%;
  min-width: min(100%, 520px);
  padding-right: 0;
  border-right: 0;
}

.assignment-editor-shell .emoji-group-body {
  display: block;
  min-width: 0;
  width: 100%;
}

.assignment-editor-shell .emoji-picker {
  display: grid;
  gap: 12px;
  width: 100%;
}

.assignment-editor-shell .emoji-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assignment-editor-shell .emoji-category-tab,
.assignment-editor-shell .emoji-page-button {
  border: 1px solid rgba(15, 23, 42, .12);
  background: rgba(255, 255, 255, .92);
  color: var(--color-text);
  border-radius: 999px;
  min-height: 36px;
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.assignment-editor-shell .emoji-category-tab:hover,
.assignment-editor-shell .emoji-category-tab:focus-visible,
.assignment-editor-shell .emoji-page-button:hover,
.assignment-editor-shell .emoji-page-button:focus-visible {
  border-color: rgba(178, 51, 36, .36);
  box-shadow: 0 0 0 3px rgba(178, 51, 36, .12);
  outline: none;
}

.assignment-editor-shell .emoji-category-tab.active,
.assignment-editor-shell .emoji-page-button.active {
  background: rgba(178, 51, 36, .10);
  border-color: rgba(178, 51, 36, .34);
  color: var(--color-primary);
}

.assignment-editor-shell .emoji-category-panel,
.assignment-editor-shell .emoji-page {
  display: none;
}

.assignment-editor-shell .emoji-category-panel.active,
.assignment-editor-shell .emoji-page.active {
  display: block;
}

.assignment-editor-shell .emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
  align-items: stretch;
  max-width: 520px;
}

.assignment-editor-shell .emoji-picker-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.assignment-editor-shell .emoji-picker-button:hover,
.assignment-editor-shell .emoji-picker-button:focus-visible {
  background: rgba(255, 248, 246, .98);
  border-color: rgba(178, 51, 36, .34);
  box-shadow: 0 0 0 3px rgba(178, 51, 36, .12), 0 8px 18px rgba(15, 23, 42, .10);
  outline: none;
  transform: translateY(-1px);
}

.assignment-editor-shell .emoji-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.assignment-editor-shell .emoji-picker-status {
  margin: 0;
  color: var(--color-muted);
  font-size: .88rem;
  line-height: 1.4;
}


@media (max-width: 680px) {
  .assignment-editor-shell .emoji-picker-grid {
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  }

  .assignment-editor-shell .emoji-category-tab,
  .assignment-editor-shell .emoji-page-button {
    flex: 1 1 112px;
  }
}

/* Editor width, toolbar wrapping and fullscreen sizing normalization */
.assignment-editor-shell,
.assignment-editor-shell.reusable-assignment-editor,
.assignment-editor-shell .editor-ribbon-shell,
.assignment-editor-shell .editor-ribbon-panels,
.assignment-editor-shell .editor-workspace.assignment-editor-workspace,
.assignment-editor-shell .editor-canvas-wrap,
.assignment-editor-shell .editor-canvas.assignment-editor-canvas {
  box-sizing: border-box;
  min-width: 0;
  max-width: none;
}

.assignment-editor-shell.reusable-assignment-editor {
  width: 100%;
}

.assignment-editor-shell .editor-ribbon-panels {
  overflow-x: visible;
}

.assignment-editor-shell .editor-ribbon-panel.active {
  width: 100%;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px 14px;
}

.assignment-editor-shell .ribbon-group {
  flex: 0 1 auto;
  min-width: fit-content;
  max-width: 100%;
}

.assignment-editor-shell .ribbon-group-body,
.assignment-editor-shell .ribbon-group-body.compact-group {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: stretch;
}

.assignment-editor-shell .toolbar-button-tall {
  flex: 0 0 auto;
  min-width: max-content;
  min-height: 58px;
  padding-inline: 9px;
}

.assignment-editor-shell .toolbar-button-tall .toolbar-label,
.assignment-editor-shell .ribbon-tab-button,
.assignment-editor-shell .ribbon-group-title {
  max-width: none;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: manual;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-lists {
  flex: 0 1 auto;
  min-width: fit-content;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls {
  flex: 1 1 520px;
  min-width: min(100%, 420px);
}

.assignment-editor-shell .editor-workspace.assignment-editor-workspace {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}

.assignment-editor-shell .editor-canvas-wrap {
  width: 100%;
  display: flex;
  align-items: stretch;
}

.assignment-editor-shell .editor-canvas.assignment-editor-canvas {
  width: 100%;
  max-width: none;
}

.assignment-editor-fullscreen-modal {
  display: grid;
  place-items: center;
  padding: 18px;
}

.assignment-editor-fullscreen-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: var(--assignment-editor-fullscreen-width, min(1480px, calc(100vw - 40px)));
  height: calc(100vh - 36px);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 36px);
  min-width: min(960px, calc(100vw - 32px));
  min-height: min(720px, calc(100vh - 36px));
  overflow: hidden;
}

.assignment-editor-fullscreen-dialog .assignment-editor-fullscreen-body {
  min-height: 0;
  height: var(--assignment-editor-fullscreen-body-height, auto);
  overflow: hidden;
  display: flex;
}

.assignment-editor-fullscreen-dialog .assignment-editor-shell.is-fullscreen-modal-surface {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-ribbon-shell {
  min-height: 0;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace.assignment-editor-workspace {
  height: 100%;
  min-height: 0;
  padding: clamp(14px, 1.8vw, 28px);
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas-wrap {
  height: 100%;
  min-height: 0;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-canvas.assignment-editor-canvas {
  width: 100%;
  max-width: none;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

@media (max-width: 980px) {
  .assignment-editor-fullscreen-modal {
    padding: 12px;
  }

  .assignment-editor-fullscreen-dialog {
    min-width: 0;
    min-height: 0;
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .assignment-editor-shell .ribbon-group,
  .assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-lists,
  .assignment-editor-shell .editor-ribbon-panel-spacing .ribbon-group-spacing-controls {
    min-width: 0;
  }
}

/* Editor Home ribbon parity */
.assignment-editor-shell .editor-ribbon-panel-home {
  flex-wrap: wrap;
  align-items: stretch;
  overflow: visible;
}

.assignment-editor-shell .editor-ribbon-panel-home .ribbon-group {
  flex: 0 1 auto;
  min-width: fit-content;
  max-width: 100%;
}

.assignment-editor-shell .editor-ribbon-panel-home .ribbon-group-body {
  flex-wrap: wrap;
  overflow: visible;
}

.assignment-editor-shell .editor-ribbon-panel-home .toolbar-button-tall {
  min-width: max-content;
}

.assignment-editor-shell .editor-ribbon-panel-home .toolbar-label {
  max-width: none;
  white-space: nowrap;
  overflow: visible;
}

.assignment-editor-shell .editor-ribbon-panel-home .ribbon-select-shell {
  min-width: clamp(170px, 18vw, 240px);
}

/* Editor Table ribbon parity */
.assignment-editor-shell .editor-ribbon-panel-table .toolbar-button-tall[data-assignment-editor-requires="table"] {
  min-width: max-content;
}

.assignment-editor-shell .editor-ribbon-panel-table .toolbar-button-tall.is-disabled,
.assignment-editor-shell .editor-ribbon-panel-table .toolbar-button-tall[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
}

.assignment-editor-table-tools-popover {
  border: 1px solid rgba(127, 29, 29, 0.18);
  border-radius: 18px;
  background: #fffdfb;
  box-shadow: 0 18px 40px rgba(80, 28, 28, 0.16);
  margin: 12px 0;
  padding: 14px;
}

.assignment-editor-table-tools-popover.hidden {
  display: none;
}

.assignment-editor-table-tools-popover-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.assignment-editor-picture-tools-popover {
  background: #fffdfb;
  border: 1px solid rgba(178, 51, 36, .18);
  border-radius: 18px;
  box-shadow: 0 18px 38px rgba(80, 28, 28, .16);
  display: grid;
  gap: 12px;
  margin: 10px 0;
  max-width: min(520px, calc(100vw - 32px));
  padding: 14px;
}

.assignment-editor-picture-tools-popover[hidden] {
  display: none;
}

.editor-picture-tools-panel[data-assignment-editor-insert-overlay] {
  width: min(520px, calc(100vw - 32px));
}

.editor-picture-tools-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.editor-picture-tools-header strong {
  color: var(--color-heading, #421f1a);
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

.editor-picture-tools-header p,
.editor-picture-tools-help {
  color: var(--color-muted);
  font-size: .82rem;
  line-height: 1.35;
  margin: 3px 0 0;
}

.editor-picture-tools-body {
  display: grid;
  gap: 10px;
}

.editor-picture-tools-section {
  background: rgba(255, 247, 244, .72);
  border: 1px solid rgba(178, 51, 36, .10);
  border-radius: 14px;
  display: grid;
  gap: 9px;
  padding: 10px;
}

.editor-picture-tools-section--actions {
  background: transparent;
  border: 0;
  padding: 0;
}

.editor-picture-tools-label {
  color: var(--color-heading, #421f1a);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.editor-picture-tools-width-row {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: minmax(180px, 1fr) 86px;
}

.editor-picture-tools-width-row input[type="range"] {
  accent-color: var(--color-primary, #b23324);
  min-width: 0;
  width: 100%;
}

.editor-picture-tools-width-row input[type="number"] {
  border: 1px solid rgba(178, 51, 36, .22);
  border-radius: 10px;
  color: var(--color-heading, #421f1a);
  font-weight: 700;
  padding: .42rem .5rem;
  width: 100%;
}

.editor-picture-size-presets,
.editor-picture-tools-action-row {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-picture-tools-wrap {
  display: grid;
  gap: 7px;
}

.editor-picture-tools-wrap .action-button,
.editor-picture-size-presets .action-button,
.editor-picture-tools-action-row .action-button,
.editor-picture-tools-remove {
  min-height: 34px;
  padding: .42rem .68rem;
  width: 100%;
}

.editor-picture-tools-wrap .is-active {
  background: rgba(178, 51, 36, .12);
  border-color: rgba(178, 51, 36, .45);
  color: var(--color-primary);
}

.editor-picture-caption-switch {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(178, 51, 36, .18);
  border-radius: 999px;
  color: var(--color-heading, #421f1a);
  display: grid;
  gap: .5rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 38px;
  padding: .28rem .36rem .28rem .82rem;
  text-align: left;
  width: 100%;
}

.editor-picture-caption-switch:focus-visible {
  outline: 3px solid rgba(178, 51, 36, .2);
  outline-offset: 2px;
}

.editor-picture-caption-switch-label {
  font-size: .88rem;
  font-weight: 800;
}

.editor-picture-caption-switch-state {
  color: var(--color-muted);
  font-size: .78rem;
  font-weight: 800;
}

.editor-picture-caption-switch-track {
  align-items: center;
  background: rgba(178, 51, 36, .18);
  border-radius: 999px;
  display: inline-flex;
  height: 24px;
  padding: 3px;
  width: 44px;
}

.editor-picture-caption-switch-track span {
  background: var(--color-primary, #b23324);
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(80, 28, 28, .16);
  height: 18px;
  transform: translateX(20px);
  transition: transform .16s ease, background .16s ease;
  width: 18px;
}

.editor-picture-caption-switch[aria-checked="false"] .editor-picture-caption-switch-track span {
  background: #64748b;
  transform: translateX(0);
}

.editor-picture-tools-remove {
  border-color: rgba(178, 51, 36, .34);
  justify-content: center;
}

@media (max-width: 680px) {
  .editor-picture-tools-width-row,
  .editor-picture-size-presets,
  .editor-picture-tools-action-row {
    grid-template-columns: 1fr;
  }
}

/* Editor History ribbon parity */
.assignment-editor-shell .editor-ribbon-panel-history .ribbon-group-history {
  flex: 1 1 420px;
}

.assignment-editor-shell .editor-history-status {
  color: var(--color-muted);
  font-size: .84rem;
  line-height: 1.45;
  margin: 8px 0 0;
  max-width: 56rem;
}

.assignment-editor-clear-dialog {
  align-items: center;
  background: rgba(15, 23, 42, .34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 2600;
}

.assignment-editor-clear-dialog-card {
  background: #fffdfb;
  border: 1px solid rgba(127, 29, 29, .18);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  display: grid;
  gap: 18px;
  max-width: min(520px, 100%);
  padding: 20px;
  width: 100%;
}

.assignment-editor-clear-dialog-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.assignment-editor-clear-dialog-header h3 {
  margin: 0 0 6px;
}

.assignment-editor-clear-dialog-header p {
  color: var(--color-muted);
  line-height: 1.5;
  margin: 0;
}

.assignment-editor-clear-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* Editor spacing ribbon V1 parity */
.assignment-editor-shell .editor-ribbon-panel-spacing .toolbar-button-nowrap,
.assignment-editor-shell .editor-ribbon-panel-spacing .toolbar-button-nowrap .toolbar-label {
  white-space: nowrap;
}

.assignment-editor-shell .editor-ribbon-panel-spacing .toolbar-button-nowrap {
  min-width: 96px;
}

.assignment-editor-shell .editor-spacing-status {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--color-text-soft);
}

/* Editor View ribbon parity */
.assignment-editor-shell .editor-canvas.assignment-editor-canvas.assignment-editor-canvas--zoomed {
  font-size: calc(1rem * var(--assignment-editor-view-scale, 1.18));
  line-height: 1.62;
}

.assignment-editor-shell .editor-outline-item[aria-current="true"] {
  border-color: rgba(178, 51, 36, .34);
  box-shadow: 0 0 0 3px rgba(178, 51, 36, .10);
}

.assignment-editor-shell [data-assignment-editor-document-map-selected="true"] {
  scroll-margin-block: 120px;
}

.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace--document-map-open .editor-canvas-wrap {
  min-width: 0;
  width: 100%;
  justify-content: stretch;
}

/* Editor document map desktop layout contract */
.assignment-editor-shell.assignment-editor--document-map-open .editor-workspace.assignment-editor-workspace,
.assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(236px, 24vw, 320px);
  gap: clamp(16px, 2vw, 28px);
  align-items: stretch;
}

.assignment-editor-shell.assignment-editor--document-map-open .editor-canvas-wrap,
.assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-canvas-wrap {
  min-width: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.assignment-editor-shell.assignment-editor--document-map-open .editor-canvas.assignment-editor-canvas,
.assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-canvas.assignment-editor-canvas {
  width: min(100%, 760px);
  max-width: 760px;
}

.assignment-editor-shell.assignment-editor--document-map-open .editor-outline-panel,
.assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-outline-panel {
  width: 100%;
  max-width: none;
  min-width: 0;
  align-self: stretch;
  border-left: 1px solid rgba(178, 51, 36, .16);
  border-top: 0;
}

.assignment-editor-shell.is-fullscreen-modal-surface.assignment-editor--document-map-open .editor-workspace.assignment-editor-workspace,
.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open {
  grid-template-columns: minmax(0, 1fr) clamp(260px, 22vw, 340px);
}

.assignment-editor-shell.is-fullscreen-modal-surface.assignment-editor--document-map-open .editor-canvas.assignment-editor-canvas,
.assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-canvas.assignment-editor-canvas {
  width: 100%;
  max-width: none;
}

@media (max-width: 780px) {
  .assignment-editor-shell.assignment-editor--document-map-open .editor-workspace.assignment-editor-workspace,
  .assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open,
  .assignment-editor-shell.is-fullscreen-modal-surface.assignment-editor--document-map-open .editor-workspace.assignment-editor-workspace,
  .assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .assignment-editor-shell.assignment-editor--document-map-open .editor-canvas.assignment-editor-canvas,
  .assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-canvas.assignment-editor-canvas,
  .assignment-editor-shell.is-fullscreen-modal-surface.assignment-editor--document-map-open .editor-canvas.assignment-editor-canvas,
  .assignment-editor-shell.is-fullscreen-modal-surface .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-canvas.assignment-editor-canvas {
    width: 100%;
    max-width: none;
  }

  .assignment-editor-shell.assignment-editor--document-map-open .editor-outline-panel,
  .assignment-editor-shell .editor-workspace.assignment-editor-workspace.editor-workspace--document-map-open .editor-outline-panel {
    border-left: 0;
    border-top: 1px solid rgba(178, 51, 36, .16);
  }
}

/* Shared editor table/picture overlay lifecycle */
.assignment-editor-shell,
.reusable-assignment-editor,
[data-assignment-editor-root] {
  position: relative;
}

.assignment-editor-insert-overlay-root {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2rem);
  pointer-events: none;
}

.assignment-editor-insert-overlay-root.is-active {
  pointer-events: auto;
}

.assignment-editor-insert-overlay-root.is-active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(26, 20, 19, 0.22);
  backdrop-filter: blur(2px);
}

.assignment-editor-insert-overlay-root--fullscreen {
  position: absolute;
  inset: 0;
  z-index: 120;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.assignment-editor-insert-overlay-root [data-assignment-editor-insert-overlay] {
  position: relative;
  z-index: 1;
  pointer-events: auto;
  max-height: min(78vh, 620px);
  overflow: auto;
  box-shadow: 0 24px 70px rgba(42, 31, 29, .32);
  transform: translate(var(--editor-insert-overlay-offset-x, 0), var(--editor-insert-overlay-offset-y, 0));
}

.assignment-editor-insert-overlay-root--fullscreen [data-assignment-editor-insert-overlay] {
  max-height: min(76vh, 680px);
}

.assignment-editor-fullscreen-dialog {
  isolation: isolate;
}

.assignment-editor-shell.is-fullscreen-modal-surface .assignment-editor-insert-overlay-root,
.assignment-editor-fullscreen-dialog .assignment-editor-insert-overlay-root--fullscreen {
  z-index: 120;
}

.assignment-editor-table-tools-popover[data-assignment-editor-insert-overlay],
.assignment-editor-picture-tools-popover[data-assignment-editor-insert-overlay] {
  width: min(620px, calc(100vw - 48px));
}


.assignment-editor-table-insert-popover[data-assignment-editor-insert-overlay] {
  width: min(520px, calc(100vw - 48px));
  border: 1px solid rgba(127, 29, 29, 0.18);
  border-radius: 18px;
  background: #fffdfb;
  box-shadow: 0 18px 44px rgba(80, 28, 28, 0.18);
  padding: 14px;
}

.assignment-editor-table-insert-layout {
  align-items: stretch;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(120px, 0.75fr) minmax(180px, 1.25fr);
  margin: 0.75rem 0;
}

.assignment-editor-table-insert-fields {
  display: grid;
  gap: 10px;
}

.assignment-editor-table-insert-fields label {
  color: var(--color-muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 5px;
}

.assignment-editor-table-insert-fields input {
  border: 1px solid rgba(127, 29, 29, 0.18);
  border-radius: 10px;
  min-height: 38px;
  padding: 7px 9px;
}

.assignment-editor-table-insert-preview-card {
  border: 1px solid rgba(127, 29, 29, 0.12);
  border-radius: 14px;
  background: rgba(255, 247, 243, 0.72);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.assignment-editor-table-insert-popover .table-dimension-preview {
  align-content: center;
  display: grid;
  gap: 4px;
  min-height: 6rem;
}

.assignment-editor-table-insert-actions {
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .assignment-editor-table-insert-layout {
    grid-template-columns: 1fr;
  }
}

/* Shared compact table panels */
.editor-table-insert-panel[data-assignment-editor-insert-overlay],
.editor-table-tools-panel[data-assignment-editor-insert-overlay] {
  width: min(520px, calc(100vw - 48px));
  border: 1px solid rgba(127, 29, 29, 0.18);
  border-radius: 18px;
  background: #fffdfb;
  box-shadow: 0 18px 44px rgba(80, 28, 28, 0.18);
  padding: 14px;
}

.editor-table-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.editor-table-panel-header strong {
  color: var(--color-text, #332321);
  display: block;
  font-size: 0.98rem;
  line-height: 1.25;
}

.editor-table-tools-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.editor-table-tools-grid .action-button {
  justify-content: center;
  min-height: 38px;
}

.editor-table-tools-grid .action-button.danger {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .editor-table-tools-grid {
    grid-template-columns: 1fr;
  }
}
