/* Editor dei documenti: il foglio ha le misure di un A4 (testo largo come nel PDF). */
@font-face { font-family: "DocCarlito"; src: url("/doc-fonts/Carlito-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "DocCarlito"; src: url("/doc-fonts/Carlito-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DocCarlito"; src: url("/doc-fonts/Carlito-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "DocCarlito"; src: url("/doc-fonts/Carlito-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "DocCaladea"; src: url("/doc-fonts/Caladea-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "DocCaladea"; src: url("/doc-fonts/Caladea-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DocCaladea"; src: url("/doc-fonts/Caladea-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "DocCaladea"; src: url("/doc-fonts/Caladea-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }

.ed-bar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.ed-bar-inner { max-width: 1280px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 10px; }
.ed-title { flex: 1; min-width: 0; height: 40px; font-size: 16px; font-weight: 600; }
.ed-state { white-space: nowrap; }
.ed-state.unsaved { color: var(--warning); font-weight: 600; }
.ed-layout { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 24px; align-items: start; }
.ed-main { min-width: 0; }

.ed-toolbar { position: sticky; top: 61px; z-index: 10; display: flex; flex-wrap: wrap; gap: 6px 4px; padding: 8px; margin-bottom: 16px; }
.ed-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--border); }
.ed-group:last-child { border-right: 0; }
.ed-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.ed-btn:hover { background: var(--surface-2); color: var(--text); }
.ed-btn[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-text); }
.ed-size { height: 36px; width: 120px; padding: 0 28px 0 10px; font-size: 14px; }
.ed-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; margin: 0 2px; }
.ed-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--primary); }

.ed-paper-wrap { overflow-x: auto; padding-bottom: 8px; }
.ed-paper {
  width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; padding: 18mm; box-sizing: border-box;
  background: #fff; color: #111; box-shadow: 0 6px 24px rgba(15, 23, 42, .14); border-radius: 4px; outline: none;
  font-family: "Inter", system-ui, sans-serif; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere;
}
.ed-paper:focus { box-shadow: 0 6px 24px rgba(15, 23, 42, .14), 0 0 0 3px var(--primary-soft); }
.ed-paper.font-carlito { font-family: "DocCarlito", Calibri, sans-serif; }
.ed-paper.font-caladea { font-family: "DocCaladea", Cambria, serif; }
.ed-paper p, .ed-paper div { margin: 0 0 0.5em; min-height: 1.3em; }
.ed-paper ul, .ed-paper ol { margin: 0 0 0.5em; padding-left: 1.6em; }
.ed-paper li { margin-bottom: 0.25em; }
.ed-paper:empty::before { content: attr(data-placeholder); color: #9ca3af; }
/* dimensioni (in pt come nel PDF) e colori della tavolozza */
.ed-paper .s-small { font-size: 9.5pt; }
.ed-paper .s-normal { font-size: 12pt; }
.ed-paper .s-large { font-size: 16pt; }
.ed-paper .s-title { font-size: 26pt; }
.ed-paper { font-size: 12pt; }
.ed-paper .f-b { font-weight: 700; } .ed-paper .f-i { font-style: italic; } .ed-paper .f-u { text-decoration: underline; }
.ed-paper .c-black { color: #111111; } .ed-paper .c-indigo { color: #4338ca; } .ed-paper .c-blue { color: #1d4ed8; }
.ed-paper .c-green { color: #15803d; } .ed-paper .c-red { color: #b91c1c; } .ed-paper .c-orange { color: #c2410c; }
.ed-paper .c-purple { color: #7e22ce; } .ed-paper .c-grey { color: #52525b; }
.ed-count { text-align: center; margin-top: 10px; }

.ed-side { position: sticky; top: 80px; display: grid; gap: 16px; }
.ed-card { padding: 18px; }
.ed-card .section-label { margin-bottom: 12px; }
.ed-layouts { display: grid; gap: 8px; }
.ed-layout-opt { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13px; }
.ed-layout-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.ed-layout-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ed-layout-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.ed-layout-opt strong { display: block; font-size: 13.5px; }
.ed-layout-opt small { color: var(--muted); }
/* miniature dei layout */
.mini { width: 44px; height: 60px; background: #fff; border: 1px solid #d4d4d8; border-radius: 3px; position: relative; overflow: hidden; }
.mini i { position: absolute; display: block; background: #c7cad6; border-radius: 1px; }
.mini b { position: absolute; display: block; background: #4338ca; border-radius: 1px; }
.mini .t { left: 5px; right: 5px; height: 3px; }

@media (max-width: 980px) {
  .ed-layout { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .ed-side { position: static; }
  .ed-layouts { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .ed-paper { padding: 8mm; min-height: 60vh; }
}
@media (max-width: 640px) {
  .ed-bar-inner { padding: 8px 12px; gap: 6px; }
  .ed-hide-sm { display: none; }
  .ed-state { display: none; }
  .ed-toolbar { top: 57px; }
}
