/**
 * Modal „Edytuj materiał”: 90vw, duży edytor treści, pola meta w jednym rzędzie.
 * Po index-*.css i radix-dialog-wide.css.
 */

/* Pełnoekranowa edycja (/articles/…/embed): Sonner na dole zasłaniał Zapisz / Zamknij — podnosimy stos tostów */
body:has([data-article-edit-embed='true']) [data-sonner-toaster] {
  bottom: 6rem !important;
}

/* Modal edycji: szerokość, kolumna, treść przewijalna, przyciski zawsze na dole; tło ciemniejsze od białych pól */
[role="dialog"][data-state="open"]:has(#art-content),
[data-radix-dialog-content]:has(#art-content) {
  width: 90vw !important;
  max-width: 90vw !important;
  min-width: 0 !important;
  max-height: 92vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background: hsl(var(--muted) / 0.72) !important;
}

[role="dialog"]:has(#art-content) form,
[data-radix-dialog-content]:has(#art-content) form {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  gap: 0.75rem !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem !important;
}

/* Wiersz z Zapisz / Anuluj / Usuń — przyklejony do dołu; tło jak reszta modala (nie biały pasek) */
[role="dialog"]:has(#art-content) form > div:has(button[type="submit"]),
[data-radix-dialog-content]:has(#art-content) form > div:has(button[type="submit"]) {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 20 !important;
  flex-shrink: 0 !important;
  margin-top: auto !important;
  padding-top: 0.75rem !important;
  padding-bottom: 0.25rem !important;
  background: hsl(var(--muted) / 0.35) !important;
  border-top: 1px solid hsl(var(--border)) !important;
  box-shadow: 0 -10px 24px -12px rgba(0, 0, 0, 0.15);
}

[role="dialog"]:has(#art-content) form > div:has(button[type="submit"]) button[type="button"],
[data-radix-dialog-content]:has(#art-content) form > div:has(button[type="submit"]) button[type="button"] {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
}

[role="dialog"]:has(#art-content) form > div:has(button[type="submit"]) button[type="submit"],
[data-radix-dialog-content]:has(#art-content) form > div:has(button[type="submit"]) button[type="submit"] {
  background-color: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}

[role="dialog"]:has(#art-content) form.space-y-4 > * + *,
[data-radix-dialog-content]:has(#art-content) form.space-y-4 > * + * {
  margin-top: 0 !important;
}

.article-edit-wysiwyg-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  gap: 0.5rem;
}

.article-edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #2a2a2a;
  border-radius: calc(var(--radius) - 2px);
  background: #252525;
  color: #f5f5f5;
  width: 100%;
  box-sizing: border-box;
}

.article-edit-toolbar .article-edit-toolbar-btn-corr {
  margin-left: auto !important;
  background: #ffffff !important;
  color: #0a0a0a !important;
  border-color: #ffffff !important;
  font-weight: 600 !important;
}

.article-edit-toolbar .article-edit-toolbar-btn-corr:hover {
  background: #f0f0f0 !important;
  border-color: #f0f0f0 !important;
  color: #0a0a0a !important;
}

.article-edit-toolbar button {
  font-size: 0.75rem;
  padding: 0.28rem 0.55rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid #3d3d3d;
  background: #0a0a0a;
  color: #fafafa;
  cursor: pointer;
}

.article-edit-toolbar button:hover {
  background: #1f1f1f;
  border-color: #555;
  color: #fff;
}

.article-edit-toolbar button[aria-pressed="true"] {
  background: #fff !important;
  color: #0a0a0a !important;
  border-color: #fff !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0a0a0a;
  font-weight: 700;
}

.article-edit-toolbar-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #b4b4b4;
  margin: 0 0.1rem 0 0.15rem;
  align-self: center;
  user-select: none;
}

.article-edit-editable {
  flex: 1 1 auto;
  min-height: min(55vh, 520px);
  max-height: min(65vh, 640px);
  overflow: auto;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  font-size: 0.9375rem;
  line-height: 1.55;
  outline: none;
}

.article-edit-editable:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.article-edit-editable.article-edit-h3,
.article-edit-editable h3.article-edit-h3 {
  font-size: 1.5em;
  font-weight: 700;
  margin: 0.35em 0;
}

.article-edit-editable ul,
.article-edit-editable ol {
  margin: 0.5em 0;
  padding-left: 1.5rem;
}

.article-edit-editable li {
  margin: 0.2em 0;
}

.article-edit-editable p {
  margin: 0.35em 0;
}

.article-edit-editable img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  cursor: pointer;
  border-radius: 2px;
}

.article-edit-editable img:hover {
  outline: 2px solid hsl(var(--primary) / 0.55);
  outline-offset: 2px;
}

/* Wymuszone style treści (Tailwind / reset nie gaszą pogrubienia itd.) */
.article-edit-editable strong,
.article-edit-editable b {
  font-weight: 700 !important;
}

.article-edit-editable em,
.article-edit-editable i {
  font-style: italic !important;
}

.article-edit-editable u {
  text-decoration: underline !important;
}

.article-edit-editable a {
  color: hsl(var(--primary)) !important;
  text-decoration: underline !important;
}

.article-edit-editable ol {
  list-style-type: decimal !important;
}

.article-edit-editable ul {
  list-style-type: disc !important;
}

/* Import DOCX / zwykły tekst: listy z jawnum prefiksem w <li> (list-style:none w inline) */
.article-edit-editable ol.docx-import-list,
.article-edit-editable ul.docx-import-list {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0.35em 0 !important;
}

.article-edit-editable h1 {
  font-size: 1.75rem !important;
  font-weight: 700 !important;
  margin: 0.5em 0 0.35em !important;
}

.article-edit-editable h2 {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  margin: 0.5em 0 0.35em !important;
}

.article-edit-editable blockquote {
  margin: 0.5em 0 !important;
  padding-left: 0.75rem !important;
  border-left: 3px solid hsl(var(--border)) !important;
  color: hsl(var(--muted-foreground)) !important;
}

.article-edit-meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
  width: 100%;
}

/* Tytuł: większy label, pogrubiony input (dialog materiału) */
[role="dialog"]:has(#art-content) label[for='art-title'],
[data-radix-dialog-content]:has(#art-content) label[for='art-title'] {
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
}

[role="dialog"]:has(#art-content) #art-title,
[data-radix-dialog-content]:has(#art-content) #art-title {
  font-size: calc(1em * 1.5);
  line-height: 1.25;
  font-weight: 700;
}

/* Host bloku zdjęć, gdy brak .article-edit-meta-row (article-edit-dialog.js) */
.article-edit-photos-meta-host {
  margin-top: 0.65rem;
  width: 100%;
}

/* Slot obok „Wersje” (pasek chrome) */
.article-edit-photos-chrome {
  flex: 1 1 auto;
  min-width: 8rem;
  max-width: 100%;
}

/* Powiązane zdjęcia (wstrzyknięte przez article-edit-dialog.js) */
.article-edit-photos-meta {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.28);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.article-edit-photos-meta--chrome {
  grid-column: auto;
  width: auto;
  max-width: 100%;
  padding: 0.28rem 0.45rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.article-edit-photos-meta--chrome .article-edit-photos-meta__label {
  display: inline;
  margin-bottom: 0;
  font-size: 0.75rem;
}

.article-edit-photos-meta--chrome .article-edit-photos-meta__row {
  display: inline;
  font-size: 0.75rem;
}

.article-edit-photos-meta__label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: hsl(var(--foreground));
}

.article-edit-photos-meta a {
  color: hsl(var(--primary));
  text-decoration: underline;
  font-weight: 500;
}

.article-edit-photos-meta--btn.article-edit-photos-meta--chrome {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  display: block;
  width: 100%;
  max-width: 100%;
}

.article-edit-photos-meta__btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  padding: 0.4rem 0.55rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  text-align: left;
  pointer-events: auto;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-edit-photos-meta__btn:hover {
  background: hsl(var(--accent));
}

.article-edit-meta-row > .space-y-2 {
  min-width: 0;
}

#art-content.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Pasek: szukaj, podgląd, pełny ekran, wersje */
.article-edit-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  width: 100%;
  box-sizing: border-box;
}

/* Sloty w rogach modala: zwarte rzędy */
.article-edit-chrome--tr,
.article-edit-chrome--br {
  width: auto;
  max-width: 100%;
  padding: 0.25rem 0.35rem;
  margin: 0;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border) / 0.85);
  background: hsl(var(--card) / 0.96);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.article-edit-chrome--tr .article-edit-photos-chrome {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30rem;
}

.article-edit-chrome-search {
  min-width: 8rem;
  flex: 1 1 10rem;
  max-width: 20rem;
  font-size: 0.8125rem;
  padding: 0.35rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.article-edit-chrome-btn {
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  white-space: nowrap;
}

.article-edit-chrome-btn:hover {
  background: hsl(var(--accent));
}

.article-edit-chrome-btn[aria-pressed='true'] {
  background: hsl(var(--primary) / 0.2);
  border-color: hsl(var(--primary) / 0.45);
}

/* Natywne selecty w modalach zdjęć — jak pola w kolumnie metadanych (wysokie, czytelne) */
.editorial-ui-select {
  width: 100%;
  max-width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  font-size: 0.875rem;
  line-height: 1.35;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  box-sizing: border-box;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, hsl(var(--muted-foreground)) 50%),
    linear-gradient(135deg, hsl(var(--muted-foreground)) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) calc(50% - 0.15rem), calc(100% - 0.75rem) calc(50% - 0.15rem);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.editorial-ui-select:hover {
  border-color: hsl(var(--ring));
}

.editorial-ui-select:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.35);
}

.article-edit-versions-panel {
  position: fixed;
  z-index: 48;
  right: 1rem;
  top: 6.75rem;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(70vh, 28rem);
  display: flex;
  flex-direction: column;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.article-edit-versions-panel[hidden] {
  display: none !important;
}

.article-edit-versions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid hsl(var(--border));
}

.article-edit-versions-close {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.4rem;
}

.article-edit-versions-list {
  overflow: auto;
  padding: 0.35rem;
  font-size: 0.78rem;
}

.article-edit-version-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
}

.article-edit-version-line:last-child {
  border-bottom: none;
}

.article-edit-version-meta {
  min-width: 0;
  word-break: break-word;
}

/* Pełny ekran — panel dialogu + formularz siatka (tytuł/lead z lewej, treść na całą wysokość) */
html.article-edit-fs-html,
body.article-edit-fs-body {
  overflow: hidden !important;
}

.article-edit-fullscreen-panel {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  transform: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  z-index: 60 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  background-color: hsl(var(--background)) !important;
  background: hsl(var(--background)) !important;
}

/* Radix: [data-radix-dialog-content] wewnątrz zewnętrznego fixed — PE na obu warstwach */
.article-edit-fullscreen-shell {
  position: fixed !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  transform: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 100 !important;
  background-color: hsl(var(--background)) !important;
  background: hsl(var(--background)) !important;
}

.article-edit-fullscreen-panel.article-edit-fullscreen-panel--nested {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  z-index: auto !important;
}

.article-edit-fullscreen-panel form.article-edit-fullscreen-form {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
  padding: 0.5rem 0.75rem 0.75rem !important;
}

/* Trzy pionowe kolumny (wrappery) — wiersz na całą wysokość, 25% / 50% / 25% */
.article-edit-fullscreen-panel form.article-edit-fullscreen-form.article-edit-fs-three-col,
[data-radix-dialog-content] form.article-edit-fullscreen-form.article-edit-fs-three-col {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  align-content: stretch !important;
  overflow: hidden !important;
  overflow-y: hidden !important;
  overflow-x: hidden !important;
  gap: 0.65rem !important;
}

/*
 * radix-dialog-wide.css: [data-radix-dialog-content] .flex { flex-wrap: wrap !important }
 * — może złamać kolumny PE (form lub wrapper ma klasę .flex).
 */
[data-radix-dialog-content].article-edit-fullscreen-panel.flex,
[data-radix-dialog-content].article-edit-fullscreen-panel .flex.flex-col,
.article-edit-fullscreen-panel[data-radix-dialog-content].flex,
.article-edit-fullscreen-panel[data-radix-dialog-content] .flex.flex-col,
.article-edit-fullscreen-shell .article-edit-fullscreen-panel .flex.flex-col,
.article-edit-fullscreen-shell [data-radix-dialog-content] .flex.flex-col {
  flex-wrap: nowrap !important;
}

.article-edit-fs-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Boczne kolumny PE — jeden szary; białe tylko na input / textarea (reguły niżej) */
.article-edit-fs-col-left,
.article-edit-fs-col-right {
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: calc(var(--radius) + 2px);
  background: hsl(var(--muted) / 0.25) !important;
}

.article-edit-fs-col-left {
  flex: 0 0 25%;
  width: 25%;
  max-width: 25%;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 0.5rem;
}

.article-edit-fs-col-center {
  flex: 0 0 50%;
  width: 50%;
  max-width: 50%;
  min-width: 0;
}

.article-edit-fs-col-center > * {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.article-edit-fs-col-right {
  flex: 0 0 25%;
  width: 25%;
  max-width: 25%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 0.65rem;
}

.article-edit-fs-col-right > div:has(button[type='submit']) {
  flex-shrink: 0;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.45rem;
  position: relative !important;
  bottom: auto !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  box-shadow: none !important;
  border-top: none !important;
  background: transparent !important;
}

.article-edit-fs-col-right .article-edit-meta-row {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  margin-top: 0.35rem;
  padding: 0.5rem 0.35rem 0.65rem;
  box-sizing: border-box;
}

.article-edit-fs-col-right .article-edit-meta-row > .space-y-2,
.article-edit-fs-col-right .article-edit-meta-row > div[class*='space-y'] {
  width: 100%;
  min-width: 0;
  padding: 0.15rem 0;
  box-sizing: border-box;
}

.article-edit-fs-col-right .article-edit-meta-row > .space-y-2 > label,
.article-edit-fs-col-right .article-edit-meta-row > div[class*='space-y'] > label {
  display: block;
  margin-bottom: 0.35rem;
}

.article-edit-fs-col-right .article-edit-meta-row [data-radix-select-trigger],
.article-edit-fs-col-right .article-edit-meta-row button[role='combobox'] {
  min-height: 2.35rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

/* Tailwind bg-background / bg-card — szaro jak kolumna; bez button (select trigger, CTA) */
.article-edit-fs-col-left .bg-background:not(input):not(textarea):not(button),
.article-edit-fs-col-left .bg-card:not(input):not(textarea):not(button),
.article-edit-fs-col-right .bg-background:not(input):not(textarea):not(button),
.article-edit-fs-col-right .bg-card:not(input):not(textarea):not(button) {
  background-color: hsl(var(--muted) / 0.25) !important;
}

.article-edit-fs-col-left input:not([type='hidden']):not([type='checkbox']):not([type='radio']),
.article-edit-fs-col-left textarea,
.article-edit-fs-col-right input:not([type='hidden']):not([type='checkbox']):not([type='radio']),
.article-edit-fs-col-right textarea {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground));
}

/*
 * PE pełny ekran: bundel Tailwind często wygrywa nad pojedynczą klasą kolumny —
 * wymuszamy to samo hsl(muted/0.25) na kolumnie + scrollu + typowych opakowaniach pól.
 */
html.article-edit-fs-html
  .article-edit-fullscreen-form.article-edit-fs-three-col
  > .article-edit-fs-col.article-edit-fs-col-right {
  background: hsl(var(--muted) / 0.25) !important;
  background-color: hsl(var(--muted) / 0.25) !important;
}

html.article-edit-fs-html .article-edit-fs-col-right [data-radix-scroll-area-viewport] {
  background-color: hsl(var(--muted) / 0.25) !important;
}

html.article-edit-fs-html .article-edit-fs-col-right [class*='space-y'],
html.article-edit-fs-html .article-edit-fs-col-right .article-edit-meta-row,
html.article-edit-fs-html .article-edit-fs-col-right .grid {
  background-color: hsl(var(--muted) / 0.25) !important;
}

html.article-edit-fs-html .article-edit-fs-col-right .bg-background:not(input):not(textarea):not(button),
html.article-edit-fs-html .article-edit-fs-col-right .bg-card:not(input):not(textarea):not(button),
html.article-edit-fs-html
  .article-edit-fs-col-right
  [class*='bg-background/']:not(input):not(textarea):not(button) {
  background-color: hsl(var(--muted) / 0.25) !important;
}

html.article-edit-fs-html
  .article-edit-fs-col-right
  input:not([type='hidden']):not([type='checkbox']):not([type='radio']),
html.article-edit-fs-html .article-edit-fs-col-right textarea {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground));
}

.article-edit-fs-col-right .article-edit-meta-row select,
.article-edit-fs-col-right .article-edit-meta-row [role='combobox'],
.article-edit-fs-col-right .article-edit-meta-row button[data-state] {
  width: 100%;
  max-width: 100%;
}

.article-edit-fullscreen-form.article-edit-fs-three-col > * {
  margin-top: 0 !important;
}

/* Środkowa „kartka” PE: tło + padding; edytor na całą szerokość kolumny (50%). */
.article-edit-fs-paper-wrap {
  background: hsl(var(--muted) / 0.25) !important;
  border-radius: calc(var(--radius) + 2px);
  padding: 0.35rem 0.5rem 0.5rem !important;
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.article-edit-fs-paper-wrap .article-edit-wysiwyg-wrap {
  max-width: 100% !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  min-width: 0 !important;
}

.article-edit-fs-paper-wrap .article-edit-toolbar {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.article-edit-fs-paper-wrap .article-edit-editable {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/*
 * Pełny ekran: obszar „kartki” jak A4 pionowo — skalowanie proporcjonalne (container queries).
 * Obramowanie = SVG w tle (stały stosunek 210×297 mm).
 */
.article-edit-fs-paper-portrait-host {
  /* Wymiary kartki w mm (domyślnie A4 pion); można nadpisać inline z formatu strony */
  --ae-paper-mm-w: 210;
  --ae-paper-mm-h: 297;
  container-type: size;
  container-name: editorial-paper;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 0.35rem !important;
  box-sizing: border-box !important;
  background-color: hsl(var(--muted) / 0.2) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 210 297' preserveAspectRatio='xMidYMid meet'%3E%3Crect x='1' y='1' width='208' height='295' fill='%23ffffff' stroke='%23b8b8b8' stroke-width='1' rx='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(100cqw, calc(100cqh * var(--ae-paper-mm-w) / var(--ae-paper-mm-h)))
    min(100cqh, calc(100cqw * var(--ae-paper-mm-h) / var(--ae-paper-mm-w)));
}

.article-edit-fs-paper-portrait-host > .article-edit-wysiwyg-wrap {
  width: min(100cqw, calc(100cqh * var(--ae-paper-mm-w) / var(--ae-paper-mm-h))) !important;
  height: min(100cqh, calc(100cqw * var(--ae-paper-mm-h) / var(--ae-paper-mm-w))) !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: var(--ae-paper-mm-w) / var(--ae-paper-mm-h) !important;
  box-shadow: 0 0 0 1px hsl(var(--border)), 0 8px 32px rgba(0, 0, 0, 0.1) !important;
  border-radius: 3px !important;
  overflow: hidden !important;
  background: hsl(var(--background)) !important;
  box-sizing: border-box !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.article-edit-fullscreen-form .article-edit-wysiwyg-wrap {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.article-edit-fullscreen-form .article-edit-editable {
  max-height: none !important;
  flex: 1 1 auto !important;
  min-height: 6rem !important;
}

/* Selecty w formularzu materiału — białe pole (nie szare od rodzica) */
[data-radix-dialog-content]:has(#art-content) [data-radix-select-trigger],
[role='dialog']:has(#art-content) [data-radix-select-trigger],
[data-radix-dialog-content]:has(#art-content) button[role='combobox'],
[role='dialog']:has(#art-content) button[role='combobox'] {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground));
}

/* Prawa kolumna PE: ostatnia warstwa — szare tło kolumny (nad późnym Tailwindem) */
html.article-edit-fs-html .article-edit-fs-col.article-edit-fs-col-right,
body.article-edit-fs-body .article-edit-fs-col.article-edit-fs-col-right {
  background: hsl(var(--muted) / 0.25) !important;
  background-color: hsl(var(--muted) / 0.25) !important;
}

/* Edycja jako podstrona: paski narzędzi przyklejone do okna (nad treścią przewijaną w main) */
[data-article-edit-embed='true'] {
  overflow: visible !important;
  max-height: none !important;
  padding-right: 1em !important;
  box-sizing: border-box;
}

/* Górny blok (Materiały + nagłówek) — fixed względem okna, obok sidebara (w-56) */
.article-edit-embed-fixed-top {
  position: fixed;
  top: 0;
  left: 14rem;
  right: 0;
  z-index: 40;
  background: hsl(var(--background));
  box-shadow: 0 1px 0 hsl(var(--border));
  padding-right: 1em;
}

.article-edit-embed-fixed-bottom {
  right: 0 !important;
  padding-right: 1em !important;
}

/* Odstęp pod fixed header + nad fixed dolną belką — przewija się dokument (main), nie wewnętrzny panel */
.article-edit-embed-form-offset {
  padding-top: 6.75rem;
  padding-bottom: 5.75rem;
}

@media (max-width: 1023px) {
  .article-edit-embed-fixed-top {
    left: 0;
    right: 0.5rem;
  }

  .article-edit-embed-fixed-bottom {
    left: 0 !important;
    right: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* Slot narzędzi w jednym rzędzie z „Materiały” — w układzie, bez cienia */
[data-article-edit-embed='true'] #article-edit-chrome-tr-slot {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  z-index: 1 !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 1em 0 0 !important;
  pointer-events: none !important;
}

[data-article-edit-embed='true'] #article-edit-chrome-tr-slot > * {
  pointer-events: auto !important;
}

[id='article-edit-chrome-tr-slot'] > *,
[id='article-edit-chrome-br-slot'] > * {
  pointer-events: auto !important;
}

[data-article-edit-embed='true'] #article-edit-chrome-br-slot {
  padding-right: 1em !important;
  box-sizing: border-box;
}

[id='article-edit-chrome-tr-slot'] a,
[id='article-edit-chrome-br-slot'] a,
.article-edit-photos-meta a {
  pointer-events: auto !important;
  cursor: pointer;
}

[data-article-edit-embed='true'] #article-edit-chrome-tr-slot .article-edit-chrome--tr {
  max-width: min(100%, 48rem);
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
}

/* ScrollArea: treść strony przewija się w main — nie ucinać w środku */
[data-article-edit-embed='true'] [data-radix-scroll-area-root].article-edit-page-no-inner-scroll {
  overflow: visible !important;
  height: auto !important;
}
[data-article-edit-embed='true'] .article-edit-page-no-inner-scroll {
  overflow: visible !important;
}
[data-article-edit-embed='true'] .article-edit-page-no-inner-scroll [data-radix-scroll-area-viewport] {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
}

[data-article-edit-embed='true'] textarea#art-content.article-edit-ta-page {
  min-height: 12rem !important;
  max-height: none !important;
  field-sizing: content;
}

/* Pełna treść w widoku podstrony — bez wewnętrznego scrolla w edytorze */
[data-article-edit-embed='true'] .article-edit-editable {
  max-height: none !important;
  overflow: visible !important;
}

@supports not (field-sizing: content) {
  [data-article-edit-embed='true'] textarea#art-content.article-edit-ta-page {
    min-height: min(70vh, 48rem);
  }
}

