/* Studio: gerarchia degli strumenti, controlli coerenti e pagina al centro. */
.sf-top {
  display:grid;
  grid-template-columns:minmax(190px,1fr) auto auto;
  align-items:center;
  gap:8px 20px;
  padding:12px 20px 0;
  background:#fff;
  border-bottom:1px solid #dce2e9;
}
.sf-top #sf-top-actions { display:contents; }
.sf-brand { min-width:0; grid-column:1; grid-row:1; gap:10px; }
.sf-brand > span { min-width:0; }
.sf-brand small { font-size:10px; letter-spacing:.045em; line-height:1.4; }
.sf-brand h1 { margin-top:2px; font-size:17px; font-weight:650; line-height:1.25; }
.sf-brand-mark { width:38px; height:38px; flex:none; border-radius:9px; }
.sf-header-navigation,.sf-header-publish { display:flex; align-items:center; gap:8px; min-width:0; }
.sf-header-navigation { grid-column:2; grid-row:1; }
.sf-header-publish { grid-column:3; grid-row:1; }
.sf-header-navigation .sf-btn,.sf-header-publish .sf-btn,.sf-utility-strip .sf-btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; padding:9px 13px; border-radius:8px;
  font-size:14px; line-height:1.35; font-weight:600; white-space:nowrap;
}
.sf-header-navigation svg,.sf-header-publish svg,.sf-utility-strip svg {
  width:18px; height:18px; flex:none; fill:none; stroke:currentColor;
  stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round;
}
.sf-header-navigation .sf-btn-library { background:#f3f5f8; border-color:#d5dde6; color:#26374a; }
.sf-header-navigation .sf-admin-button { font-size:14px; }
.sf-header-navigation .sf-file-menu > summary { display:flex; }
.sf-header-navigation .sf-file-panel { padding:8px; box-shadow:0 10px 30px #1b28381c; }
.sf-header-navigation .sf-file-panel .sf-btn { display:block; width:100%; white-space:normal; text-align:left; }
.sf-utility-strip {
  grid-column:1 / -1; grid-row:2; display:flex; align-items:center; justify-content:space-between;
  gap:12px 20px; min-width:0; padding:4px 0; border-top:1px solid #edf0f4;
}
.sf-utility-left { display:flex; align-items:center; flex-wrap:wrap; gap:12px 20px; min-width:0; }
.sf-utility-strip .sf-status { max-width:54ch; margin:0; font-size:12px; line-height:1.45; color:#506074; }
.sf-utility-strip .sf-status:empty { display:none; }
.sf-utility-strip .sf-history-actions { gap:4px; padding:0; border:0; }
.sf-utility-strip .sf-history-actions .sf-btn { padding:6px 10px; background:#fff; border-color:transparent; }
.sf-utility-strip #sf-school-tools { gap:8px; justify-content:flex-end; }
.sf-utility-strip #sf-school-tools .sf-btn { padding:7px 11px; }
.sf-mobile-navigation:empty { display:none; }
body[data-editor-view="library"] .sf-header-publish { display:none; }
body[data-editor-view="library"] .sf-utility-strip { min-height:0; border-top:0; padding:0 0 10px; }
body[data-editor-view="library"] .sf-utility-strip:has(.sf-status:empty) { display:none; }
body[data-editor-view="library"] .sf-top { padding-bottom:12px; }

body[data-editor-view="editor"] {
  --sf-bg:#f4f6f9;
  --sf-card:#fff;
  --sf-line:#dce2e9;
  --sf-muted:#506074;
  --sf-radius:8px;
  background:var(--sf-bg);
}
body[data-editor-view="editor"] #sf-main,
body[data-editor-view="editor"] .sf-work,
body[data-editor-view="editor"] .sf-stage,
body[data-editor-view="editor"] .sf-panel,
body[data-editor-view="editor"] .sf-pane { min-width:0; }
body[data-editor-view="editor"] .sf-work { grid-template-columns:132px minmax(0,1fr) 312px; }
body[data-editor-view="editor"] .sf-pages { padding:16px 10px; background:#fff; }
body[data-editor-view="editor"] .sf-pages h2 { margin:0 2px 12px; font-size:13px; font-weight:650; }
body[data-editor-view="editor"] .sf-pages-count { font-variant-numeric:tabular-nums; }
body[data-editor-view="editor"] .sf-pages-list { gap:10px; }
body[data-editor-view="editor"] .sf-pages-list button {
  min-height:44px; padding:6px; gap:6px; border:1px solid transparent;
  border-radius:7px; background:#f5f6f8;
}
body[data-editor-view="editor"] .sf-pages-list button:hover { border-color:#b3bfcc; background:#eef1f5; }
body[data-editor-view="editor"] .sf-pages-list button[aria-current="true"] {
  border-color:#b82040; background:#fff8fa; box-shadow:inset 0 0 0 1px #b82040;
}
body[data-editor-view="editor"] .sf-pages-list img { max-height:118px; border-radius:3px; }
body[data-editor-view="editor"] .sf-pages-list span { color:#46566b; font-size:11px; line-height:1.4; font-variant-numeric:tabular-nums; }
body[data-editor-view="editor"] .sf-pages-list button[aria-current="true"] span { color:#971a35; font-weight:650; }
body[data-editor-view="editor"] .sf-stage { padding:16px; }
body[data-editor-view="editor"] .sf-stage-head { display:grid; gap:12px; margin:0 0 14px; }
.sf-stage-context { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 16px; min-width:0; }
.sf-page-context { display:flex; align-items:center; gap:12px; min-width:0; flex-wrap:wrap; }
body[data-editor-view="editor"] .sf-stage h2 { margin:0; color:#233246; font-size:16px; line-height:1.35; font-weight:650; white-space:nowrap; }
.sf-page-navigation { display:flex; align-items:center; gap:6px; min-width:0; }
.sf-page-navigation:empty { display:none; }
.sf-tool-group-label { margin:0 0 7px; color:#506074; font-size:12px; line-height:1.4; font-weight:600; }
body[data-editor-view="editor"] .sf-tools-main { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; }
body[data-editor-view="editor"] .sf-tool {
  min-width:0; min-height:44px; padding:9px 10px; gap:7px; border-radius:8px;
  font-size:14px; line-height:1.35; font-weight:600; color:#293a4e; background:#fff;
  border:1px solid #ced7e2;
}
body[data-editor-view="editor"] .sf-tool > svg { width:19px; height:19px; flex:0 0 19px; stroke-width:1.7; }
body[data-editor-view="editor"] .sf-tool:hover { background:#f8f9fb; border-color:#8d9caf; }
body[data-editor-view="editor"] .sf-tool[aria-pressed="true"] { background:#b82040; border-color:#b82040; color:#fff; }
.sf-stage-options { display:flex; flex-wrap:wrap; align-items:flex-start; justify-content:space-between; gap:8px 16px; }
body[data-editor-view="editor"] .sf-stage-options .sf-mode-label { margin:0 0 0 auto; }
body[data-editor-view="editor"] .sf-mode-label,
body[data-editor-view="editor"] .sf-zoom-label { gap:8px; font-size:12px; line-height:1.4; color:#506074; font-weight:600; }
body[data-editor-view="editor"] .sf-zoom-label { margin:0; }
body[data-editor-view="editor"] .sf-mode-label select,
body[data-editor-view="editor"] .sf-zoom-label select {
  min-height:44px; padding:8px 30px 8px 10px; border-color:#ced7e2; border-radius:8px;
  color:#293a4e; font-size:13px; font-weight:500;
}
body[data-editor-view="editor"] .sf-more-tools { flex:1 1 180px; min-width:0; }
body[data-editor-view="editor"] .sf-more-tools > summary {
  min-height:44px; width:max-content; max-width:100%; padding:11px 9px;
  color:#35465b; border-radius:7px; font-size:13px; line-height:1.5; font-weight:600;
}
body[data-editor-view="editor"] .sf-more-tools > summary:hover { background:#e9edf3; }
body[data-editor-view="editor"] .sf-more-tools[open] { flex-basis:100%; order:2; padding:0 12px 10px; border:1px solid #dce2e9; border-radius:8px; background:#fff; }
body[data-editor-view="editor"] .sf-more-tools[open] .sf-tools { gap:8px; padding:2px 0 6px; }
body[data-editor-view="editor"] .sf-more-tools[open] .sf-tool { flex:1 1 130px; background:#f8f9fb; }
body[data-editor-view="editor"] .sf-keyboard-help { margin:8px 0 0; max-width:85ch; color:#506074; font-size:12px; line-height:1.55; }
body[data-editor-view="editor"] .sf-canvas-wrap { padding:16px; border:1px solid #dce2e9; border-radius:8px; background:#e8edf3; }
body[data-editor-view="editor"] .sf-canvas-reader { background:transparent; }
body[data-editor-view="editor"] .sf-paper { box-shadow:0 8px 28px #18283e24; }
body[data-editor-view="editor"] .sf-canvas-help { margin:9px 0 0; color:#506074; font-size:12px; line-height:1.5; max-width:90ch; }
body[data-editor-view="editor"] .sf-panel { background:#fff; border-left-color:#dce2e9; }
body[data-editor-view="editor"] .sf-tabs { flex:none; position:sticky; top:0; z-index:2; background:#fff; padding:7px 10px; gap:4px; border-bottom-color:#e7ebf0; }
body[data-editor-view="editor"] .sf-tabs [role="tab"] { min-height:44px; padding:10px 8px; border:1px solid transparent; border-radius:7px; color:#506074; font-size:14px; font-weight:600; }
body[data-editor-view="editor"] .sf-tabs [role="tab"]:hover { color:#293a4e; background:#f4f6f9; }
body[data-editor-view="editor"] .sf-tabs [role="tab"][aria-selected="true"] { color:#a51d3a; background:#fff1f4; border-color:#f0ccd5; }
body[data-editor-view="editor"] .sf-pane { padding:18px 16px 24px; }
body[data-editor-view="editor"] .sf-pane h3 { margin:24px 0 14px; padding-top:20px; border-top-color:#e7ebf0; font-size:14px; line-height:1.4; font-weight:650; color:#26374a; }
body[data-editor-view="editor"] .sf-pane h3:first-child { margin-top:0; padding-top:0; border-top:0; }
body[data-editor-view="editor"] .sf-field { gap:6px; margin-bottom:16px; }
body[data-editor-view="editor"] .sf-field label { display:grid; gap:6px; }
body[data-editor-view="editor"] .sf-field > span,
body[data-editor-view="editor"] .sf-field > label > span { font-size:12px; line-height:1.4; font-weight:600; color:#405168; }
body[data-editor-view="editor"] .sf-field input[type="text"],
body[data-editor-view="editor"] .sf-field input[type="url"],
body[data-editor-view="editor"] .sf-field input[type="email"],
body[data-editor-view="editor"] .sf-field input[type="tel"],
body[data-editor-view="editor"] .sf-field input[type="number"],
body[data-editor-view="editor"] .sf-field select,
body[data-editor-view="editor"] .sf-field textarea {
  min-height:44px; padding:10px 11px; border:1px solid #becad8; border-radius:8px;
  background:#fff; font-size:14px; line-height:1.5;
}
body[data-editor-view="editor"] .sf-field textarea { min-height:100px; }
body[data-editor-view="editor"] .sf-field input::placeholder,
body[data-editor-view="editor"] .sf-field textarea::placeholder { color:#617186; opacity:1; }
body[data-editor-view="editor"] .sf-field input[type="color"] { width:100%; min-height:44px; height:44px; padding:5px; border-color:#becad8; border-radius:8px; }
body[data-editor-view="editor"] .sf-hint { margin:0; color:#506074; font-size:12px; line-height:1.55; }
body[data-editor-view="editor"] .sf-check { align-items:flex-start; gap:9px; min-height:44px; margin:0 0 4px; padding:9px 0; font-size:13px; line-height:1.6; }
body[data-editor-view="editor"] .sf-check input { flex:none; margin-top:1px; accent-color:#b82040; }
body[data-editor-view="editor"] .sf-btn { min-height:44px; border-radius:8px; font-size:13px; line-height:1.4; }
body[data-editor-view="editor"] .sf-pane .sf-btn { padding:9px 11px; }
body[data-editor-view="editor"] .sf-btn:disabled { opacity:1; color:#8993a2; border-color:#e0e5ec; background:#f5f6f8; }
body[data-editor-view="editor"] .sf-btn:hover:not(:disabled) { background:#f5f7fa; border-color:#95a5b9; }
body[data-editor-view="editor"] .sf-btn-primary:hover:not(:disabled) { background:#961a34; border-color:#961a34; }
body[data-editor-view="editor"] .sf-btn-primary { font-weight:650; }
body[data-editor-view="editor"] .sf-btn-primary:disabled { color:#fff; background:#a55568; border-color:#a55568; }
body[data-editor-view="editor"] .sf-history-actions .sf-btn:disabled { background:transparent; border-color:transparent; }
body[data-editor-view="editor"] .sf-inline-actions { margin-top:14px; gap:8px; }
body[data-editor-view="editor"] .sf-inline-actions .sf-btn { flex:1 1 100px; }
body[data-editor-view="editor"] .sf-advanced { margin:20px 0; border-color:#dce2e9; border-radius:8px; }
body[data-editor-view="editor"] .sf-advanced > summary { min-height:44px; padding:12px; font-size:13px; }
body[data-editor-view="editor"] .sf-advanced-content { padding:16px 12px; border-color:#e7ebf0; }
body[data-editor-view="editor"] .sf-object-adjust { gap:6px; }
body[data-editor-view="editor"] .sf-object-size { gap:6px; }
body[data-editor-view="editor"] .sf-obj-list button { min-height:44px; border-radius:7px; padding:10px; font-size:13px; }
body[data-editor-view="editor"] .sf-obj-list button[aria-current="true"] { border-color:#b82040; background:#fff1f4; }
body[data-editor-view="editor"] :focus-visible { outline:3px solid #275cb5; outline-offset:3px; }
body[data-editor-view="editor"] .sf-pages,
body[data-editor-view="editor"] .sf-pane { scrollbar-width:thin; scrollbar-color:#a5b2c3 #f6f8fa; }
body[data-editor-view="editor"] input,
body[data-editor-view="editor"] textarea { caret-color:#b82040; }
body[data-editor-view="editor"] input[type="number"] { font-variant-numeric:tabular-nums; }

@media (max-width:1199px) {
  .sf-top { gap:10px 12px; padding-inline:16px; grid-template-columns:minmax(170px,1fr) auto auto; }
  .sf-brand small { max-width:190px; font-size:9px; }
  .sf-header-navigation,.sf-header-publish { gap:6px; }
  .sf-header-navigation .sf-btn,.sf-header-publish .sf-btn { padding-inline:10px; font-size:13px; }
  body[data-editor-view="editor"] .sf-tools-main { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (min-width:861px) and (max-width:1100px) {
  body[data-editor-view="editor"] .sf-work { grid-template-columns:100px minmax(0,1fr) 280px; }
  body[data-editor-view="editor"] .sf-pages { padding-inline:7px; }
  body[data-editor-view="editor"] .sf-stage { padding:14px; }
  body[data-editor-view="editor"] .sf-pane { padding-inline:14px; }
  .sf-utility-strip { gap:8px 12px; }
  .sf-utility-left { gap:8px 12px; }
  .sf-utility-strip .sf-status { max-width:38ch; }
}
@media (max-width:960px) {
  .sf-top { grid-template-columns:minmax(0,1fr) auto; }
  .sf-brand { grid-column:1; grid-row:1; }
  .sf-header-navigation { grid-column:2; grid-row:1; }
  .sf-header-publish { grid-column:1 / -1; grid-row:2; justify-content:flex-end; }
  .sf-utility-strip { grid-row:3; }
  .sf-utility-strip .sf-status { max-width:none; }
  .sf-utility-left { flex:1 1 280px; }
  .sf-utility-strip #sf-school-tools { margin-left:auto; }
  body[data-editor-view="library"] .sf-utility-strip { grid-row:2; }
}
@media (max-width:860px) {
  .sf-top { position:relative; }
  .sf-utility-strip { flex-wrap:wrap; }
  .sf-utility-left { justify-content:space-between; }
  body[data-editor-view="editor"] .sf-work { grid-template-columns:minmax(0,1fr); }
  body[data-editor-view="editor"] .sf-pages { padding:10px 14px; border-right:0; }
  body[data-editor-view="editor"] .sf-pages h2 { margin:0 0 8px; }
  body[data-editor-view="editor"] .sf-pages-list { display:flex; gap:8px; padding:3px 3px 5px; }
  body[data-editor-view="editor"] .sf-pages-list > li { flex:0 0 78px; }
  body[data-editor-view="editor"] .sf-pages-list img { height:76px; }
  body[data-editor-view="editor"] .sf-pages-list button { height:100%; }
  body[data-editor-view="editor"] .sf-stage { padding:16px; }
  body[data-editor-view="editor"] .sf-tools-main { grid-template-columns:repeat(3,minmax(0,1fr)); }
  body[data-editor-view="editor"] .sf-panel { border-left:0; }
  body[data-editor-view="editor"] .sf-tabs { position:sticky; top:0; }
  body[data-editor-view="editor"] .sf-pane { padding:18px 20px 28px; }
  body[data-editor-view="editor"] .sf-canvas-wrap { min-width:0; }
  body[data-editor-view="editor"] .sf-field input,
  body[data-editor-view="editor"] .sf-field select,
  body[data-editor-view="editor"] .sf-field textarea { font-size:16px; }
}
/* Gli aiuti restano nella fascia utility; su schermi stretti si aprono da Aiuti. */
.sf-help-menu { display:contents; }
.sf-help-menu > summary { display:none; }
body[data-editor-view="library"] .sf-help-menu { display:none; }
#sf-toggle-pages { display:none; }
@media (max-width:860px) {
  .sf-help-menu { display:block; position:relative; flex:none; margin-left:auto; }
  .sf-help-menu > summary { display:flex; align-items:center; justify-content:center; min-height:44px; padding:9px 12px; border:1px solid #dce2e9; border-radius:8px; background:#fff; font-size:13px; list-style:none; cursor:pointer; }
  .sf-help-menu > summary::-webkit-details-marker { display:none; }
  .sf-help-menu #sf-school-tools { position:absolute; top:calc(100% + 6px); right:0; z-index:42; display:grid; width:min(290px,calc(100vw - 28px)); padding:8px; border:1px solid #dce2e9; border-radius:8px; background:#fff; box-shadow:0 8px 28px #18283e24; }
  .sf-help-menu:not([open]) #sf-school-tools { display:none !important; }
  .sf-help-menu #sf-school-tools .sf-btn { width:100%; justify-content:flex-start; }
  body[data-editor-view="editor"] #sf-toggle-pages { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:8px 11px; font-weight:600; }
  body[data-editor-view="editor"] .sf-pages > h2 { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
  body[data-editor-view="editor"] .sf-pages[data-collapsed="true"] .sf-pages-list { display:none; }
  body[data-editor-view="editor"] .sf-pages[data-collapsed="true"] { padding-block:5px; }
}
@media (max-width:600px) {
  .sf-top { grid-template-columns:minmax(0,1fr) auto; padding:10px 12px 0; gap:8px; }
  .sf-brand { grid-column:1; grid-row:1; gap:7px; }
  .sf-brand small { display:none; }
  .sf-brand h1 { margin:0; font-size:14px; line-height:1.2; }
  .sf-brand-mark { width:32px; height:32px; border-radius:8px; font-size:13px; }
  .sf-header-navigation { grid-column:2; grid-row:1; display:grid; grid-template-columns:44px 44px 56px; gap:6px; width:auto; }
  .sf-header-navigation > .sf-btn,.sf-header-navigation .sf-file-menu > summary { width:100%; white-space:normal; min-width:0; }
  .sf-header-navigation .sf-file-menu { grid-column:auto !important; }
  .sf-header-navigation #btn-biblioteca { width:44px; height:44px; padding:10px; font-size:0; gap:0; }
  .sf-header-navigation #btn-admin { width:44px; height:44px; padding:10px; gap:0; }
  .sf-header-navigation #sf-admin-label { display:none; }
  .sf-header-navigation #btn-biblioteca svg,.sf-header-navigation #btn-admin svg { width:20px; height:20px; }
  .sf-header-publish { grid-column:1 / -1; grid-row:2; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .sf-header-publish .sf-btn { white-space:normal; }
  .sf-utility-strip { grid-column:1 / -1; grid-row:3; display:grid; grid-template-columns:88px minmax(0,1fr) 56px; align-items:center; gap:4px 6px; padding:4px 0; }
  .sf-utility-left { display:contents; }
  .sf-utility-strip .sf-status { grid-column:1 / -1; grid-row:1; max-width:none; font-size:11px; line-height:1.4; }
  .sf-utility-strip .sf-history-actions { grid-column:1; grid-row:2; gap:0; margin:0; }
  .sf-utility-strip .sf-history-actions .sf-btn { width:44px; height:44px; padding:10px; }
  .sf-utility-strip .sf-history-actions .sf-btn span { display:none; }
  body[data-editor-view="editor"].sf-editor-navigation-ready .sf-utility-strip #sf-mobile-navigation { grid-column:2; grid-row:2; width:auto; gap:4px; }
  .sf-utility-strip #sf-mobile-navigation .sf-btn { min-width:0; padding:8px 5px; font-size:12px; }
  .sf-utility-strip .sf-help-menu { grid-column:3; grid-row:2; margin:0; width:56px; }
  .sf-utility-strip .sf-help-menu > summary { width:56px; min-height:44px; padding:9px 6px; justify-content:center; border:1px solid #dce2e9; border-radius:8px; background:#fff; font-size:12px; }
  .sf-utility-strip .sf-help-menu #sf-school-tools { grid-template-columns:minmax(0,1fr); margin:0; }
  .sf-utility-strip .sf-help-menu #sf-school-tools .sf-btn { white-space:normal; padding-inline:10px; font-size:13px; }
  body[data-editor-view="library"] .sf-utility-strip { grid-row:2; }
  body[data-editor-view="editor"] .sf-stage { padding:12px; }
  body[data-editor-view="editor"] .sf-stage h2 { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
  .sf-stage-context { flex-wrap:nowrap; gap:8px; }
  .sf-page-context { gap:0; flex-wrap:nowrap; }
  body[data-editor-view="editor"] .sf-zoom-label { width:auto; flex:none; gap:0; font-size:0; }
  body[data-editor-view="editor"] .sf-zoom-label select { width:88px; min-height:44px; font-size:13px; padding-right:22px; }
  body[data-editor-view="editor"] .sf-stage-head { gap:10px; margin-bottom:10px; }
  body[data-editor-view="editor"] .sf-tools-main { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  body[data-editor-view="editor"] .sf-tool { padding-inline:7px; gap:5px; font-size:12px; }
  body[data-editor-view="editor"] .sf-stage-options { gap:8px; }
  body[data-editor-view="editor"] .sf-more-tools { flex-basis:130px; }
  body[data-editor-view="editor"] .sf-mode-label { gap:6px; }
  body[data-editor-view="editor"] .sf-pane { padding:18px 16px 28px; }
  body[data-editor-view="editor"] .sf-more-tools[open] .sf-tool { flex-basis:calc(50% - 8px); }
  body[data-editor-view="editor"] .sf-canvas-help { font-size:11px; }
}
@media (max-width:339px) {
  .sf-brand-mark { display:none; }
  body[data-editor-view="editor"] .sf-tools-main { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .sf-utility-strip { grid-template-columns:88px minmax(0,1fr); }
  .sf-utility-strip .sf-help-menu { grid-column:1 / -1; grid-row:3; width:100%; }
  .sf-utility-strip .sf-help-menu > summary { width:100%; }
}
@media (forced-colors:active) {
  body[data-editor-view="editor"] .sf-pages-list button[aria-current="true"],
  body[data-editor-view="editor"] .sf-tabs [aria-selected="true"] { border:2px solid Highlight; }
}
