.veditor {
  --ve-border: #c9ced6;
  --ve-bg: #fff;
  --ve-toolbar-bg: #f5f6f8;
  --ve-text: #1f2328;
  --ve-hover: #e3e6ea;
  --ve-active: #d4e4ff;
  --ve-active-text: #0b57d0;
  --ve-focus: #0b57d0;

  border: 1px solid var(--ve-border);
  border-radius: 6px;
  background: var(--ve-bg);
  color: var(--ve-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: relative;
}

.veditor:focus-within {
  border-color: var(--ve-focus);
  box-shadow: 0 0 0 2px rgba(11, 87, 208, .15);
}

.veditor-toolbar {
  border-radius: 6px 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: var(--ve-toolbar-bg);
  border-bottom: 1px solid var(--ve-border);
}

.veditor-select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: var(--ve-bg);
  color: inherit;
  font: inherit;
  font-size: 14px;
}

.veditor-separator {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--ve-border);
}

.veditor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

/* Przyciski ukryte atrybutem hidden (np. AI bez edycji AI albo bez ai.url) – display: inline-flex by je pokazał. */
.veditor-toolbar [hidden] {
  display: none;
}

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

.veditor-btn:hover {
  background: var(--ve-hover);
}

.veditor-btn:disabled {
  opacity: .4;
  cursor: default;
  background: transparent;
}

.veditor-btn.is-active {
  background: var(--ve-active);
  color: var(--ve-active-text);
}

.veditor-btn:focus-visible,
.veditor-select:focus-visible {
  outline: 2px solid var(--ve-focus);
  outline-offset: 1px;
}

.veditor-content {
  padding: 12px 16px;
  outline: none;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.veditor-content > :first-child {
  margin-top: 0;
}

.veditor-content img {
  max-width: 100%;
  height: auto;
}

/* Modal file managera */
.veditor-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .45);
}

.veditor-modal {
  display: flex;
  flex-direction: column;
  width: min(900px, 100%);
  height: min(640px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  overflow: hidden;
}

.veditor-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #c9ced6;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
}

.veditor-modal-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* Okna bez ramki (podgląd, skróty): wysokość z treści */
.veditor-modal-auto {
  height: auto;
  max-height: min(640px, 100%);
}

.veditor-modal-body {
  overflow: auto;
  padding: 12px 16px;
}

.veditor-preview {
  max-width: 760px;
  margin: 0 auto;
}

.veditor-shortcuts {
  width: 100%;
  border-collapse: collapse;
  font: 14px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.veditor-shortcuts td {
  padding: 6px 4px;
  border-bottom: 1px solid #e3e6ea;
}

.veditor-shortcuts td:last-child {
  text-align: right;
  white-space: nowrap;
}

.veditor-shortcuts kbd {
  padding: 2px 6px;
  border: 1px solid #c9ced6;
  border-radius: 4px;
  background: #f5f6f8;
  font: 12px ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Ramka wydruku (niewidoczna) */
.veditor-print-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
  visibility: hidden;
}

/* Lista do wyboru w dymku (data i godzina) */
.veditor-menu {
  display: flex;
  flex-direction: column;
  min-width: 200px;
}

.veditor-menu button {
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.veditor-menu button:hover,
.veditor-menu button:focus-visible {
  background: var(--ve-hover);
  outline: none;
}

.veditor-modal-frame {
  flex: 1;
  width: 100%;
  border: 0;
}

/* Dymek (link) */
.veditor-balloon {
  position: absolute;
  z-index: 20;
  max-width: calc(100% - 8px);
  padding: 8px;
  border: 1px solid var(--ve-border);
  border-radius: 6px;
  background: var(--ve-bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
  font-size: 14px;
}

.veditor-link-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 300px;
  max-width: 100%;
}

.veditor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.veditor-field input {
  padding: 6px 8px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  font: inherit;
}

.veditor-field input[aria-invalid="true"] {
  border-color: #b3261e;
}

.veditor-field[hidden],
.veditor-input-row button[hidden] {
  display: none;
}

/* Pole z przyciskiem obok (adres + „Przeglądaj”) */
.veditor-input-row {
  display: flex;
  gap: 6px;
}

.veditor-input-row input {
  flex: 1;
  min-width: 0;
}

.veditor-field-buttons {
  display: flex;
  gap: 6px;
}

.veditor-field-buttons:not(:has(button:not([hidden]))),
.veditor-field-buttons button[hidden] {
  display: none;
}

.veditor-field-buttons button,
.veditor-input-row button {
  padding: 5px 10px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: var(--ve-bg);
  font: inherit;
  cursor: pointer;
}

.veditor-field .veditor-select {
  width: 100%;
}

/* Wymiary obrazu: szerokość × wysokość + „Oryginalny” */
.veditor-size-row {
  align-items: center;
}

.veditor-size-row input {
  width: 5.5em;
  flex: 0 1 auto;
}

/* Rzadziej używane opcje formularza (zwinięte) */
.veditor-more summary {
  cursor: pointer;
  color: #5b616b;
  font-size: 13px;
}

.veditor-more > .veditor-field {
  margin-top: 6px;
}

.veditor-more .veditor-check {
  margin-top: 6px;
  font-size: 13px;
}

.veditor-field-error {
  margin: 0;
  color: #b3261e;
  font-size: 13px;
}

.veditor-check {
  display: flex;
  align-items: center;
  gap: 6px;
}

.veditor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.veditor-actions button {
  padding: 5px 12px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: var(--ve-bg);
  font: inherit;
  cursor: pointer;
}

.veditor-actions .veditor-action-primary,
.veditor-input-row .veditor-action-primary {
  border-color: var(--ve-focus);
  background: var(--ve-focus);
  color: #fff;
}

.veditor-link-preview {
  display: flex;
  align-items: center;
  gap: 4px;
}

.veditor-link-url {
  max-width: 240px;
  margin-right: 4px;
  overflow: hidden;
  color: var(--ve-active-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Obrazy w trybie edycji */
.veditor-content figure.image {
  position: relative;
  cursor: default;
}

.veditor-content figure.image figcaption {
  position: relative;
  outline: none;
  cursor: text;
}

.veditor-content figure.image figcaption.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  left: .4em;
  right: .4em;
  color: #8a9099;
  pointer-events: none;
}

.veditor-content figure.image figcaption:focus {
  box-shadow: inset 0 0 0 1px var(--ve-focus);
}

.veditor-content figure.is-uploading img {
  opacity: .5;
}

.veditor-image-frame {
  position: absolute;
  z-index: 10;
  box-sizing: border-box;
  outline: 2px solid var(--ve-focus);
  pointer-events: none;
}

.veditor-resize-handle {
  display: none;
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid #fff;
  background: var(--ve-focus);
  pointer-events: auto;
  touch-action: none;
}

.veditor-image-frame.is-resizable .veditor-resize-handle {
  display: block;
}

.veditor-resize-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.veditor-resize-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.veditor-resize-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.veditor-resize-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.veditor-image-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
}

.veditor-image-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 340px;
  max-width: 100%;
}

.veditor-image-form [hidden] {
  display: none;
}

.veditor-has-object .veditor-content::selection,
.veditor-has-object .veditor-content ::selection {
  background: transparent;
}

/* Tabele w trybie edycji */
.veditor-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.veditor-table-picker-grid {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  gap: 3px;
  outline: none;
}

.veditor-table-picker-grid:focus-visible {
  box-shadow: 0 0 0 2px var(--ve-focus);
}

.veditor-table-picker-grid span {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 1px solid var(--ve-border);
  border-radius: 2px;
  cursor: pointer;
}

.veditor-table-picker-grid span.is-on {
  border-color: var(--ve-focus);
  background: var(--ve-active);
}

.veditor-table-picker-label {
  margin-top: 6px;
  text-align: center;
}

/* Przyklejony pasek narzędzi (--ve-sticky-top: wysokość stałego nagłówka strony) */
.veditor-toolbar {
  position: sticky;
  top: var(--ve-sticky-top, 0);
  z-index: 15;
}

/* Placeholder */
.veditor-content[data-placeholder] {
  position: relative;
}

.veditor.is-empty .veditor-content[data-placeholder]::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 16px;
  right: 16px;
  color: #8a9099;
  pointer-events: none;
}

/* Tylko do odczytu */
.veditor.is-read-only {
  background: #fafbfc;
}

.veditor.is-read-only .veditor-content {
  cursor: default;
}

/* Źródło HTML */
.veditor-source {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 200px;
  padding: 12px 16px;
  border: 0;
  outline: none;
  resize: vertical;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  tab-size: 2;
}

/* Pełny ekran */
html.veditor-fullscreen-open {
  overflow: hidden;
}

.veditor.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  border-radius: 0;
}

.veditor.is-fullscreen .veditor-body {
  flex: 1;
  min-height: 0;
}

.veditor.is-fullscreen .veditor-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.veditor.is-fullscreen .veditor-sidepanel {
  max-height: none;
}

.veditor.is-fullscreen .veditor-content,
.veditor.is-fullscreen .veditor-source {
  flex: 1;
  overflow: auto;
  min-height: 0 !important;
}

.veditor.is-fullscreen .veditor-source {
  height: auto !important;
  resize: none;
}

/* Pasek stanu */
.veditor-statusbar {
  display: flex;
  justify-content: flex-end;
  padding: 3px 10px;
  border-top: 1px solid var(--ve-border);
  background: var(--ve-toolbar-bg);
  border-radius: 0 0 6px 6px;
  color: #5b616b;
  font-size: 12px;
}

/* Podział strony w edytorze: widoczna przerywana linia z opisem */
.veditor .veditor-content hr.page-break {
  visibility: visible;
  position: relative;
  overflow: visible;
  height: 0;
  border: 0;
  border-top: 2px dashed #8a9099;
  margin: 1.5em 0;
}

.veditor .veditor-content hr.page-break::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: -.75em;
  transform: translateX(-50%);
  padding: 0 .5em;
  background: var(--ve-bg);
  color: #5b616b;
  font-size: 12px;
}

/* Pokazywanie bloków: obrys i nazwa znacznika każdego bloku */
.veditor.is-showing-blocks .veditor-content :is(p, h1, h2, h3, h4, h5, h6, blockquote, ul, ol, pre, figure, table, details) {
  outline: 1px dashed #a9b4c2;
  outline-offset: 2px;
}

.veditor.is-showing-blocks .veditor-content :is(p, h1, h2, h3, h4, h5, h6, blockquote, pre) {
  position: relative;
}

.veditor.is-showing-blocks .veditor-content p::after { content: 'P'; }
.veditor.is-showing-blocks .veditor-content h1::after { content: 'H1'; }
.veditor.is-showing-blocks .veditor-content h2::after { content: 'H2'; }
.veditor.is-showing-blocks .veditor-content h3::after { content: 'H3'; }
.veditor.is-showing-blocks .veditor-content h4::after { content: 'H4'; }
.veditor.is-showing-blocks .veditor-content h5::after { content: 'H5'; }
.veditor.is-showing-blocks .veditor-content h6::after { content: 'H6'; }
.veditor.is-showing-blocks .veditor-content blockquote::after { content: 'BLOCKQUOTE'; }
.veditor.is-showing-blocks .veditor-content pre::after { content: 'PRE'; }

.veditor.is-showing-blocks .veditor-content :is(p, h1, h2, h3, h4, h5, h6, blockquote, pre)::after {
  position: absolute;
  top: -.2em;
  right: 2px;
  color: #8a9099;
  font: 10px/1 system-ui, sans-serif;
  text-transform: uppercase;
  pointer-events: none;
}

/* Zmiana szerokości kolumn tabeli */
.veditor.is-column-resize .veditor-content,
.veditor.is-column-resize .veditor-content td,
.veditor.is-column-resize .veditor-content th {
  cursor: col-resize;
}

/* Asystent AI: menu, panel wyniku, okna */
.veditor-ai-menu,
.veditor-ai-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 380px;
  max-width: 100%;
}

.veditor-ai-menu [hidden] {
  display: none;
}

.veditor-ai-group-title {
  margin-top: 4px;
  color: #5b616b;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.veditor-ai-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.veditor-ai-actions button,
.veditor-ai-row button,
.veditor-ai-menu > button,
.veditor-ai-metadata button {
  padding: 5px 8px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: var(--ve-bg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.veditor-ai-actions button:hover:not(:disabled),
.veditor-ai-row button:hover:not(:disabled),
.veditor-ai-menu > button:hover {
  background: var(--ve-hover);
}

.veditor-ai-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.veditor-ai-row label {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.veditor-ai-result {
  max-height: 280px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: #fafbfc;
}

.veditor-ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.veditor-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ve-border);
  border-top-color: var(--ve-focus);
  border-radius: 50%;
  animation: veditor-spin .8s linear infinite;
}

@keyframes veditor-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .veditor-spinner { animation-duration: 3s; }
}

.veditor-ai-modal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font: 14px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.veditor-ai-metadata {
  margin: 0;
}

.veditor-ai-metadata dt {
  margin-top: 8px;
  color: #5b616b;
  font-size: 12px;
  font-weight: 600;
}

.veditor-ai-metadata dd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 2px 0 0;
}

.veditor-ai-metadata dd span {
  flex: 1;
}

/* Układ treści i panel boczny (przegląd tekstu, czat AI) */
.veditor-body {
  display: flex;
  align-items: stretch;
}

.veditor-main {
  flex: 1;
  min-width: 0;
}

.veditor-sidepanel {
  display: flex;
  flex-direction: column;
  width: 340px;
  max-height: 640px;
  border-left: 1px solid var(--ve-border);
  background: var(--ve-toolbar-bg);
  font-size: 14px;
}

.veditor-sidepanel[hidden] {
  display: none;
}

.veditor-sidepanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--ve-border);
}

.veditor-sidepanel-header h2 {
  margin: 0;
  font-size: 14px;
}

.veditor-sidepanel-close {
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.veditor-sidepanel-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

/* Autouzupełnianie AI: podpowiedź za kursorem (nakładka, nie treść) */
.veditor-ghost {
  position: absolute;
  z-index: 15;
  color: #8a9099;
  pointer-events: none;
  white-space: pre-wrap;
}

.veditor-ghost[hidden] {
  display: none;
}

.veditor-ghost-hint {
  margin-left: .5em;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--ve-toolbar-bg);
  font: 11px system-ui, sans-serif;
  vertical-align: middle;
}

/* Przegląd tekstu */
.veditor-review-section + .veditor-review-section {
  margin-top: 12px;
}

.veditor-review-title {
  margin: 0 0 6px;
  font-size: 13px;
}

.veditor-review-count {
  color: #5b616b;
  font-weight: 400;
}

.veditor-review-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.veditor-review-item {
  padding: 8px;
  border: 1px solid var(--ve-border);
  border-radius: 6px;
  background: var(--ve-bg);
}

.veditor-review-item:focus-visible {
  outline: 2px solid var(--ve-focus);
}

.veditor-review-item p {
  margin: 0 0 6px;
}

.veditor-review-type {
  display: inline-block;
  margin-bottom: 4px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--ve-active);
  color: var(--ve-active-text);
  font-size: 11px;
}

.veditor-review-change {
  cursor: pointer;
}

.veditor-review-change del {
  color: #b3261e;
}

.veditor-review-change ins {
  color: #146c2e;
  text-decoration: none;
  font-weight: 600;
}

.veditor-review-explanation {
  color: #5b616b;
  font-size: 13px;
}

.veditor-review-actions,
.veditor-chat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.veditor-review-actions button,
.veditor-review-section > button,
.veditor-chat-actions button,
.veditor-chat .veditor-actions button {
  padding: 4px 10px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: var(--ve-bg);
  font: inherit;
  cursor: pointer;
}

.veditor-review-actions .veditor-action-primary,
.veditor-review-section > .veditor-action-primary,
.veditor-chat .veditor-actions .veditor-action-primary {
  border-color: var(--ve-focus);
  background: var(--ve-focus);
  color: #fff;
}

::highlight(veditor-review) {
  background-color: #ffe08a;
}

/* Czat AI */
.veditor-chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 320px;
}

.veditor-chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.veditor-chat-message {
  max-width: 92%;
  padding: 6px 10px;
  border-radius: 8px;
}

.veditor-chat-user {
  align-self: flex-end;
  background: var(--ve-active);
  white-space: pre-wrap;
}

.veditor-chat-assistant {
  align-self: flex-start;
  border: 1px solid var(--ve-border);
  background: var(--ve-bg);
}

.veditor-chat-assistant .veditor-content {
  padding: 0;
  font-size: 14px;
}

.veditor-chat-assistant .veditor-content > :first-child {
  margin-top: 0;
}

.veditor-chat-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  font: inherit;
  resize: vertical;
}

.veditor-chat-context {
  margin: 0;
}

/* Wąski ekran: panel pod treścią */
@media (max-width: 760px) {
  .veditor-body {
    flex-direction: column;
  }

  .veditor-sidepanel {
    width: auto;
    border-left: 0;
    border-top: 1px solid var(--ve-border);
  }
}

/* Pusty pasek stanu (bez licznika słów i informacji o licencji) nie zajmuje miejsca. */
.veditor-statusbar:empty {
  display: none;
}

/* Licencja: przycisk na pasku stanu otwiera komunikat ponownie. */
.veditor-license-button {
  margin-right: auto;
  padding: 0 6px;
  border: 1px solid #b3261e;
  border-radius: 4px;
  background: #fff;
  color: #b3261e;
  font: inherit;
  cursor: pointer;
}

.veditor-license-button[hidden] {
  display: none;
}

.veditor-license-notice a {
  color: inherit;
  font-weight: 600;
}

/* Znajdź i zamień */
.veditor-find {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--ve-border);
  background: var(--ve-toolbar-bg);
  font-size: 14px;
}

.veditor-find[hidden] {
  display: none;
}

.veditor-find-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.veditor-find input[type="search"],
.veditor-find input[type="text"] {
  flex: 1 1 180px;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  font: inherit;
}

.veditor-find.has-no-results input[name="find"] {
  border-color: #b3261e;
}

.veditor-find-count {
  min-width: 3.5em;
  color: #5b616b;
  font-size: 13px;
  text-align: center;
}

.veditor-find-action {
  padding: 4px 10px;
  border: 1px solid var(--ve-border);
  border-radius: 4px;
  background: var(--ve-bg);
  font: inherit;
  cursor: pointer;
}

.veditor-find-close {
  margin-left: auto;
  font-size: 20px;
}

::highlight(veditor-find) {
  background-color: #ffe58a;
}

::highlight(veditor-find-current) {
  background-color: #ffb54c;
}

/* Znaki specjalne */
.veditor-special-chars {
  width: 330px;
  max-width: 100%;
  max-height: 320px;
  overflow: auto;
}

.veditor-special-chars-group {
  margin: 6px 0 4px;
  color: #5b616b;
  font-size: 12px;
  font-weight: 600;
}

.veditor-special-chars-grid {
  display: grid;
  grid-template-columns: repeat(var(--ve-columns, 10), 1fr);
  gap: 2px;
}

.veditor-special-chars-grid button {
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}

.veditor-special-chars-grid button:hover,
.veditor-special-chars-grid button:focus-visible {
  border-color: var(--ve-focus);
  background: var(--ve-active);
  outline: none;
}

/* Komunikat (autozapis) */
.veditor-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #e8d48a;
  background: #fff8db;
  font-size: 14px;
}

.veditor-notice[hidden] {
  display: none;
}

.veditor-notice button {
  padding: 3px 10px;
  border: 1px solid #c9b45a;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.veditor-source[hidden],
.veditor-content[hidden] {
  display: none;
}

/* Etap 5 – tryb edycji */
.veditor .veditor-content figure.media iframe {
  pointer-events: none; /* w edytorze klik zaznacza film zamiast go odtwarzać */
}

.veditor .veditor-content [id]::after {
  content: " #" attr(id);
  color: #8a9099;
  font-size: .7em;
  font-weight: 400;
}

.veditor .veditor-content ul.task-list > li::before {
  cursor: pointer;
}

.veditor .veditor-content caption.is-empty::before {
  content: attr(data-placeholder);
  color: #8a9099;
  font-weight: 400;
}

.veditor .veditor-content details > summary.is-empty::before {
  content: attr(data-placeholder);
  color: #8a9099;
  font-weight: 400;
}

.veditor-code-toolbar .veditor-select {
  min-width: 140px;
}

.veditor-templates {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 280px;
  max-width: 100%;
}

.veditor-templates button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.veditor-templates button span {
  color: #5b616b;
  font-size: 12px;
}

.veditor-templates button:hover,
.veditor-templates button:focus-visible {
  border-color: var(--ve-focus);
  background: var(--ve-active);
  outline: none;
}

.veditor-font-colors {
  display: grid;
  grid-template-columns: repeat(7, 28px);
  gap: 4px;
}

.veditor-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .2);
  border-radius: 4px;
  cursor: pointer;
}

.veditor-swatch-none {
  background: #fff;
  color: #5b616b;
}

.veditor-swatch:focus-visible,
.veditor-swatch:hover {
  outline: 2px solid var(--ve-focus);
  outline-offset: 1px;
}

.veditor-font-sizes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}

.veditor-font-sizes button {
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.veditor-font-sizes button:hover,
.veditor-font-sizes button:focus-visible {
  border-color: var(--ve-focus);
  background: var(--ve-active);
  outline: none;
}

.veditor-field-hint {
  margin: 0;
  color: #5b616b;
  font-size: 12px;
}

/* Pasek nad zaznaczeniem */
.veditor-balloon-toolbar {
  position: absolute;
  z-index: 19;
  border: 1px solid var(--ve-border);
  border-radius: 6px;
  background: var(--ve-bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

.veditor-balloon-toolbar[hidden] {
  display: none;
}

.veditor-balloon-toolbar .veditor-toolbar {
  position: static;
  border: 0;
  border-radius: 6px;
}

/* Tryb inline: bez ramki, pasek nad treścią tylko przy fokusie */
.veditor.is-inline {
  border-color: transparent;
  background: transparent;
}

.veditor.is-inline:focus-within {
  box-shadow: none;
  border-color: transparent;
}

.veditor.is-inline > .veditor-toolbar {
  position: absolute;
  top: auto; /* nadpisuje top z przyklejonego paska */
  bottom: 100%;
  left: 0;
  right: 0;
  display: none;
  border: 1px solid var(--ve-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

.veditor.is-inline:focus-within > .veditor-toolbar {
  display: flex;
}

.veditor.is-inline .veditor-content {
  outline: 1px dashed transparent;
}

.veditor.is-inline .veditor-content:hover {
  outline-color: var(--ve-border);
}

.veditor.is-inline .veditor-statusbar {
  display: none;
}
