/* Ricevimento genitori — foglio di stile unico (sito pubblico + pannello) */

:root {
  --ink: #17212B;
  --muted: #566476;
  --paper: #EDF0F3;
  --surface: #FFFFFF;
  --line: #CDD5DD;
  --accent: #0B5563;
  --accent-2: #083F4A;
  --plate: #123A44;
  --signal: #F5C518;
  --on-plate: #FFFFFF;      /* testo sopra il colore principale (calcolato dal tema) */
  --on-accent: #FFFFFF;     /* testo sopra il colore dei pulsanti */
  --on-signal: #17212B;     /* testo sopra il colore di evidenza */
  --on: #1C7443;
  --on-bg: #E3F2E9;
  --off: #B42318;
  --off-bg: #FCE9E7;
  --warn-bg: #FFF6D6;
  --radius-s: 4px;
  --radius-m: 8px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-sign: "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", "Helvetica Neue", Arial, sans-serif;
  --focus: 0 0 0 3px rgba(245, 197, 24, .85);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--paper); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--signal); color: var(--on-signal); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* ------------------------------------------------------------------ bottoni e campi */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 44px; padding: 0 1.1em; border: 1.5px solid var(--accent); border-radius: var(--radius-s);
  background: var(--surface); color: var(--accent); font: 600 1rem var(--font); text-decoration: none; cursor: pointer;
}
.btn:hover { background: #E4EFF1; color: var(--accent-2); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-2); color: var(--on-accent); }
.btn-danger { border-color: var(--off); color: var(--off); }
.btn-danger:hover { background: var(--off-bg); color: var(--off); }
.btn:disabled { opacity: .5; cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--off); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font: 600 1.35rem/1 var(--font); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: .55em .7em; min-height: 44px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: var(--focus); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 1.15em; height: 1.15em; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: .25rem 0 1rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35em; min-height: 40px; padding: 0 .9em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-on { background: var(--plate); border-color: var(--plate); color: var(--on-plate); }
.chip-on:hover { color: var(--on-plate); }
.chip-sm { min-height: 32px; padding: 0 .7em; font-size: .875rem; }
.chip small { font-weight: 400; color: var(--muted); }

/* ------------------------------------------------------------------ targa dell'aula */
.plate {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 76px; padding: 6px 10px 7px; border-radius: var(--radius-s);
  background: var(--plate); color: var(--on-plate); font-family: var(--font-sign); font-stretch: condensed; text-align: center;
  border-bottom: 4px solid var(--signal);
}
.plate-kind { font-size: .7rem; letter-spacing: .06em; opacity: .8; line-height: 1; }
.plate-num { font-size: 1.9rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.plate-word { font-size: 1rem; font-weight: 700; line-height: 1.1; max-width: 8.5em; }
.plate-empty { background: #DDE3E8; color: var(--muted); border-bottom-color: #B9C3CC; }
.plate-xl { min-width: 150px; padding: 12px 18px 12px; border-bottom-width: 7px; }
.plate-xl .plate-kind { font-size: 1rem; }
.plate-xl .plate-num { font-size: 4.2rem; }
.plate-xl .plate-word { font-size: 1.75rem; }

/* ------------------------------------------------------------------ sito pubblico */
.pub-head { background: var(--plate); color: var(--on-plate); }
.pub-head .pub-head-in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { color: var(--on-plate); text-decoration: none; display: flex; align-items: center; gap: 14px; }
.brand-text { display: flex; flex-direction: column; }
.brand:hover { color: var(--on-plate); }
.brand-school { font-size: .875rem; opacity: .8; }
.brand-event { font-size: 1.15rem; font-weight: 700; }
.pub-dates { margin: 0; font-weight: 600; }
.pub-hours { display: block; font-weight: 400; opacity: .85; font-size: .9rem; }
.notice { background: var(--signal); color: var(--on-signal); font-weight: 600; padding: 10px 0; }
.wrap.pub-main { padding-top: 28px; padding-bottom: 40px; min-height: 60vh; }
.pub-foot { color: var(--muted); font-size: .875rem; padding-bottom: 32px; }

.finder { margin-bottom: 18px; }
.finder-title { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.02em; margin-bottom: .35em; font-weight: 800; }
.search-label { display: block; font-weight: 600; margin-bottom: 6px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; min-width: 0; font-size: 1.25rem; min-height: 56px; border-width: 2px; border-color: var(--plate); }
.search-row .btn { min-height: 56px; font-size: 1.1rem; }

.res-h, .sec-h { font-size: 1.1rem; margin: 1.4em 0 .6em; }
.empty-msg { background: var(--surface); border-left: 4px solid var(--signal); padding: 14px 16px; }
.page-h { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.01em; }
.lead { color: var(--muted); margin-top: -.2em; }
.crumbs { display: flex; gap: 18px; font-size: .95rem; margin-bottom: 14px; }

.tlist { display: grid; gap: 8px; }
.trow {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 12px 12px 12px 16px; color: var(--ink); text-decoration: none;
}
a.trow:hover { border-color: var(--accent); color: var(--ink); }
.trow-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trow-name { font-weight: 700; font-size: 1.08rem; }
.trow-extra { font-size: .85rem; color: var(--accent); font-weight: 600; }
.trow-sub { font-size: .9rem; color: var(--muted); font-style: italic; margin-top: -2px; }
.trow-meta { font-size: .9rem; color: var(--muted); }
.trow-where { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.trow-floor { font-weight: 700; font-size: 1.08rem; line-height: 1.2; white-space: nowrap; color: var(--ink); }
.trow-off .trow-name { text-decoration: line-through; text-decoration-color: var(--off); }
.trow-na { background: transparent; border-style: dashed; }

.days { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.day { display: inline-flex; gap: .35em; align-items: baseline; font-size: .8rem; padding: 2px 8px; border-radius: 10px; }
.day-on { background: var(--on-bg); color: var(--on); }
.day-off { background: var(--off-bg); color: var(--off); font-weight: 700; }
.day-name { font-weight: 600; }

.years { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 28px; }
.year-h { font-size: .95rem; color: var(--muted); margin: .6em 0 .2em; }
.year .chips { margin-bottom: .4rem; }
.chip-floor { border-radius: var(--radius-s); }

/* scheda docente */
.teacher-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.teacher-name { font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -.015em; margin-bottom: .15em; }
.teacher-subj { color: var(--muted); margin: 0; max-width: 34em; }
.where { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.where-floor { font-weight: 800; font-size: 1.75rem; line-height: 1.15; margin: 10px 0 0; }
.where-hint { margin: 2px 0 0; color: var(--muted); }
.daycards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.daycard { padding: 12px 16px; border-radius: var(--radius-m); display: flex; flex-direction: column; }
.daycard-on { background: var(--on-bg); color: var(--on); }
.daycard-off { background: var(--off-bg); color: var(--off); }
.daycard-day { font-size: .9rem; color: var(--ink); }
.daycard-state { font-size: 1.4rem; }
.daycard-sub { color: var(--ink); font-weight: 600; margin-top: 2px; }
.callout { background: var(--surface); border-left: 4px solid var(--accent); padding: 12px 16px; margin: 0 0 12px; }
.callout-note { border-left-color: var(--signal); }
.subjects { display: grid; grid-template-columns: minmax(160px, max-content) 1fr; gap: 10px 20px; margin: 0; }
.subjects dt { font-weight: 700; }
.subjects dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.map-link { margin-top: 8px; }

/* ------------------------------------------------------------------ planimetria */
.map { position: relative; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.map-scroll { overflow: auto; max-height: 72vh; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.map-svg { display: block; width: 100%; height: auto; }
.map-full .map-scroll { max-height: 80vh; }
.map-tools { position: absolute; right: 10px; top: 10px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.map-caption { font-size: .85rem; color: var(--muted); padding: 6px 12px; border-top: 1px solid var(--line); }
.pin-label { fill: var(--plate); font-family: var(--font-sign); font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 6px; stroke-linejoin: round; }
.pin-ring { fill: none; stroke: var(--signal); stroke-width: 6; opacity: .9; transform-box: fill-box; transform-origin: center; animation: ring 1.8s ease-out infinite; }
.pin-halo { fill: rgba(245, 197, 24, .35); }
.pin-plate { fill: var(--plate); stroke: var(--signal); stroke-width: 5; }
.pin-plate-text { fill: var(--on-plate); font-family: var(--font-sign); font-weight: 700; }
@keyframes ring { from { transform: scale(.55); opacity: .95; } to { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin-ring { animation: none; opacity: .8; } }

/* ------------------------------------------------------------------ errori e vuoti */
.empty { text-align: center; padding: 60px 0; }

/* ------------------------------------------------------------------ accesso */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--plate); }
.auth-box { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius-m); padding: 28px; border-bottom: 6px solid var(--signal); }
.auth-school { color: var(--muted); margin: 0 0 .5em; font-size: .9rem; }
.code-input { font: 700 1.6rem var(--font-sign); letter-spacing: .3em; text-align: center; }

/* ------------------------------------------------------------------ pannello */
.admin { background: #F4F6F8; }
.adm { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.adm-side { background: var(--plate); color: var(--on-plate); padding: 18px 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: auto; }
.adm-brand { color: var(--on-plate); text-decoration: none; padding: 0 18px 16px; display: flex; flex-direction: column; font-weight: 700; }
.adm-brand small { font-weight: 400; opacity: .7; }
.adm-brand:hover { color: var(--on-plate); }
.adm-nav { display: flex; flex-direction: column; }
.adm-nav a { color: var(--on-plate); opacity: .82; text-decoration: none; padding: 9px 18px; border-left: 4px solid transparent; }
.adm-nav a:hover { opacity: 1; color: var(--on-plate); background: rgba(255, 255, 255, .06); }
.adm-nav a[aria-current] { opacity: 1; color: var(--on-plate); border-left-color: var(--signal); background: rgba(255, 255, 255, .09); font-weight: 600; }
.adm-nav-sep { height: 1px; background: rgba(255, 255, 255, .15); margin: 10px 18px; }
.adm-user { margin-top: auto; padding: 16px 18px 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.adm-user .linkbtn { color: var(--on-plate); opacity: .85; }
.adm-main { padding: 26px 32px 60px; min-width: 0; }
.adm-main h1 { font-size: 1.7rem; }
.adm-main h2 { font-size: 1.15rem; }

.flash { padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 14px; border-left: 4px solid var(--accent); background: #E4EFF1; }
.flash-error { border-color: var(--off); background: var(--off-bg); }
.flash-ok { border-color: var(--on); background: var(--on-bg); }
.ok-text { color: var(--on); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 22px; margin-bottom: 20px; }
.narrow { max-width: 560px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.grid2 > .panel { margin-bottom: 0; }
.grid2 + * { margin-top: 20px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.form legend { font-weight: 600; padding: 0 4px; }
.form .btn { align-self: flex-start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset.row2 { display: grid; }
.form-inline { display: flex; gap: 8px; flex-direction: row; }
.form-inline input { flex: 1; min-width: 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; }
.w100 { width: 100%; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 16px 0 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; color: var(--muted); text-decoration: none; display: flex; flex-direction: column; font-size: .9rem; }
.stat strong { font: 700 2.2rem/1 var(--font-sign); color: var(--ink); margin-bottom: 4px; }
.stat:hover { border-color: var(--accent); }
.issue { background: var(--surface); border-left: 4px solid var(--signal); padding: 14px 18px; margin-bottom: 12px; border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.issue h3 { font-size: 1rem; }
.issue p:last-child { margin-bottom: 0; }
.issue-soft { border-left-color: var(--line); }
ul.plain { padding-left: 1.1em; margin: .3em 0; }
.warnlist { background: var(--warn-bg); padding: 10px 14px 10px 30px; border-radius: var(--radius-s); max-height: 320px; overflow: auto; font-size: .9rem; }
.report { border-left: 4px solid var(--on); }

.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .93rem; }
.tbl th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 10px; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tbl td { padding: 6px 10px; border-bottom: 1px solid #E6EAEE; vertical-align: middle; }
.tbl-dense td { padding: 4px 10px; }
.tbl .c { text-align: center; }
.tbl .actions { display: flex; gap: 14px; }
.tbl input:not([type=checkbox]) { min-height: 36px; padding: .3em .5em; width: 100%; min-width: 7em; }
.tbl select { min-height: 36px; padding: .2em .4em; max-width: 280px; }
.tbl-edit tr.saving { background: #F6F8FA; }
.tbl-edit tr.saved { background: var(--on-bg); transition: background .2s; }
.tbl-edit tr.failed { background: var(--off-bg); }
.row-warn td { background: var(--warn-bg); }
.floorcell { white-space: nowrap; color: var(--muted); }
.warn-dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--signal); color: var(--on-signal); font-weight: 700; font-size: .75rem; margin-left: 4px; cursor: help; }



.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 8px; }
.toolbar input[type=search] { flex: 1; min-width: 240px; max-width: 420px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 16px; text-decoration: none; color: var(--muted); }
.tabs a:hover { color: var(--ink); background: #E4E9EE; }
.tabs a[aria-current] { background: var(--plate); color: var(--on-plate); }
.count { font-weight: 400; color: var(--muted); font-size: .8em; }
.ed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.ed-head h1 { margin: 0; }

.pwrules { list-style: none; padding: 0; margin: -4px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; color: var(--muted); }
.pwrules li::before { content: "○ "; }
.pwrules li.met { color: var(--on); }
.pwrules li.met::before { content: "● "; }
.steps { padding-left: 1.2em; display: flex; flex-direction: column; gap: 10px; }
.secret { display: inline-block; margin-top: 6px; padding: 6px 10px; background: #F0F3F6; border-radius: var(--radius-s); font-size: 1.05rem; letter-spacing: .05em; word-break: break-all; }
.qr { width: 200px; margin: 8px 0; }
.qr svg { width: 100%; height: auto; }

.floorcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 16px 0 24px; }
.floorcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.floorcard-img { display: grid; place-items: center; aspect-ratio: 1.41; background: #F7F8FA; border-bottom: 1px solid var(--line); color: var(--muted); }
.floorcard-img img { width: 100%; height: 100%; object-fit: contain; }
.floorcard-body { padding: 12px 16px; }
.floorcard-body h2 { margin: 0; }
.floor-uploads { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 12px; }
.floor-up { border: 1px dashed var(--line); border-radius: var(--radius-s); padding: 12px; gap: 8px; }
.floor-up input[type=file] { min-height: 0; padding: 6px; font-size: .85rem; }

/* editor planimetria */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; margin-top: 14px; align-items: start; }
.ed-canvas { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; position: sticky; top: 12px; }
.ed-status { padding: 8px 12px; font-size: .9rem; border-bottom: 1px solid var(--line); background: #F7F8FA; padding-right: 110px; min-height: 40px; }
.ed-status-act { background: var(--signal); color: var(--on-signal); font-weight: 600; }
.ed-status-ok { background: var(--on-bg); color: var(--on); }
.ed-status-err { background: var(--off-bg); color: var(--off); }
.ed-canvas .map-tools { flex-direction: row; top: 4px; right: 8px; }
.ed-canvas .icon-btn { width: 32px; height: 32px; font-size: 1.1rem; }
.ed-scroll { overflow: auto; max-height: calc(100vh - 110px); }
.ed-svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; touch-action: none; }
.is-placing .ed-svg { cursor: crosshair; }
.ed-label { cursor: grab; }
.ed-label rect { fill: #fff; stroke: var(--plate); stroke-width: 3; }
.ed-label text { fill: var(--plate); font-family: var(--font-sign); font-weight: 700; pointer-events: none; }
.ed-label.is-empty rect { stroke-dasharray: 6 4; }
.ed-label:hover rect { fill: #FFF8DC; }
.ed-label.is-selected rect { fill: var(--signal); stroke-width: 5; }
.ed-cand rect { fill: rgba(28, 116, 67, .12); stroke: var(--on); stroke-width: 3; stroke-dasharray: 8 5; }
.ed-cand text { fill: var(--on); font-family: var(--font-sign); font-weight: 700; }
.ed-side { display: flex; flex-direction: column; gap: 12px; }
.ed-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.ed-box h2 { font-size: 1rem; margin-bottom: .6em; }
.ed-box summary { cursor: pointer; font-weight: 600; }
.ed-box .btn { min-height: 38px; padding: 0 .8em; font-size: .92rem; }
.ed-box input { min-height: 38px; }
.roomlist { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.roomlist small { color: var(--muted); }
.progress { height: 8px; background: #E4E9EE; border-radius: 4px; margin: 10px 0; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { position: static; height: auto; flex-direction: column; padding: 12px 0; }
  .adm-nav { flex-direction: row; flex-wrap: wrap; padding: 0 10px; }
  .adm-nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 6px 10px; }
  .adm-nav a[aria-current] { border-bottom-color: var(--signal); }
  .adm-nav-sep { display: none; }
  .adm-user { flex-direction: row; flex-wrap: wrap; gap: 14px; padding-top: 10px; }
  .adm-main { padding: 18px 16px 40px; }
  .editor { grid-template-columns: 1fr; }
  .ed-canvas { position: static; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 14px; }
  .search-row .btn { padding: 0 .8em; }
  .teacher-head { flex-direction: column; }
  .where { align-items: flex-start; text-align: left; }
  .plate { min-width: 64px; }
  .plate-num { font-size: 1.6rem; }
  .subjects { grid-template-columns: 1fr; gap: 4px; }
  .subjects dd { margin-bottom: 10px; }
  .row2 { grid-template-columns: 1fr; }
  .map-scroll { max-height: 60vh; }
}
@media print {
  .pub-head, .map-tools, .crumbs, .pub-foot, .search { display: none; }
  body { background: #fff; }
}

/* aggiunte versione PHP */
.inline-details summary { cursor: pointer; color: var(--accent); }
.inline-details[open] { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.roomcell { white-space: nowrap; }
.roomcell select { width: calc(100% - 26px); min-width: 8.5em; max-width: none; }
.report { border-left: 4px solid var(--on); }
.ed-canvas.no-image .ed-scroll { min-height: 200px; display: grid; place-items: center; }

.teacher-subof { margin: -.1em 0 .4em; font-size: 1.15rem; color: var(--muted); font-style: italic; }

/* blocco dei docenti e assegnazione automatica */
.lockcell { width: 56px; }
.lock { position: relative; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.lock span::after { content: ""; font-size: .95rem; }
.lock input:checked + span::after { content: "🔒"; }
tr.is-locked td { background: #FFF8DC; }
.autoassign summary { cursor: pointer; }
.autoassign[open] summary { margin-bottom: 12px; }
.autoassign .row2 { align-items: start; }
.restore { margin-top: 10px; }
.plan { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.plan h3 { font-size: 1.05rem; }
.plan-table { max-height: 420px; overflow: auto; margin: 10px 0; }
.row-changed td { background: #E4EFF1; }
.toolbar-sub { justify-content: space-between; }
.toolbar-sub p { margin: 0; }
.btn-small { min-height: 34px; padding: 0 .8em; font-size: .88rem; }

/* materie e classi inserite a mano */
.subj-rows { display: flex; flex-direction: column; gap: 10px; }
.subj-row { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 8px; align-items: end; }
.subj-row .subj-del { margin-bottom: 2px; }
.subjcell { font-size: .85rem; min-width: 180px; max-width: 320px; }
.subjcell .subj-line { display: block; line-height: 1.35; }
.subjcell .subj-line b { font-weight: 600; }
.subjcell .edit { font-size: .8rem; }
.subjcell .tag-manual { font-size: .72rem; background: #E4EFF1; color: var(--accent); border-radius: 8px; padding: 0 6px; margin-left: 4px; }
@media (max-width: 600px) { .subj-row { grid-template-columns: 1fr; } }

/* accesso dei genitori */
.gate h1 { font-size: 1.6rem; }
.gate-dates { font-weight: 700; margin-top: -.3em; }
.gate .auth-box p { line-height: 1.45; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; font-size: .85rem; }
.qr-box { width: 220px; margin: 10px 0; }
.qr-box svg { width: 100%; height: auto; display: block; }
.save-version { margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
fieldset.subj-row { display: block; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin: 0; }
.subj-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.subj-top > label:first-child { flex: 1 1 220px; }
.subj-top select { width: 100%; }
.subj-new { flex: 1 1 200px; }
.subj-lab { padding-bottom: 10px; }
.subj-del { margin-left: auto; margin-bottom: 2px; }
.cls-pick { margin-top: 8px; }
.cls-pick > summary { cursor: pointer; list-style: none; display: flex; align-items: center; min-height: 44px; padding: .4em .7em;
  border: 1.5px solid var(--line); border-radius: var(--radius-s); background: var(--surface); font-variant-numeric: tabular-nums; }
.cls-pick > summary::-webkit-details-marker { display: none; }
.cls-pick > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.cls-pick[open] > summary { border-color: var(--accent); }
.cls-panel { border: 1px solid var(--line); border-top: 0; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: #FAFBFC; }
.cls-year { display: flex; flex-wrap: wrap; gap: 4px; }
.cls-item { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 0 !important; cursor: pointer; font-weight: 600 !important; }
.cls-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cls-item span { display: inline-block; padding: 4px 9px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: .85rem; }
.cls-item input:checked + span { background: var(--plate); border-color: var(--plate); color: var(--on-plate); }
.cls-item input:focus-visible + span { box-shadow: var(--focus); }

/* pianta pubblica: aule cliccabili ed elenco dei docenti per aula */
.pin-link { cursor: pointer; }
.pin-btn { fill: #fff; stroke: var(--plate); stroke-width: 3; }
.pin-click .pin-label { stroke: none; }
.pin-link:hover .pin-btn, .pin-link:focus .pin-btn { fill: #FFF3C4; stroke-width: 4; }
.pin-link.is-active .pin-btn { fill: var(--signal); stroke-width: 5; }
.pin-link:focus { outline: none; }
.pin-empty .pin-label { fill: #8A96A3; }
.room-index { margin-top: 24px; }
.room-block { margin: 0 0 20px; scroll-margin-top: 16px; }
.room-block:target .room-block-h { background: var(--signal); }
.room-block-h { display: flex; align-items: baseline; gap: 10px; font-size: 1.15rem; padding: 4px 8px; margin: 0 0 8px; border-left: 5px solid var(--plate); }
.room-block-h small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.room-sheet { position: fixed; inset: 0; z-index: 50; background: rgba(18, 31, 40, .45); display: flex; align-items: flex-end; justify-content: center; }
.room-sheet-box { background: var(--paper); width: 100%; max-width: 640px; max-height: 80vh; overflow: auto; border-radius: 14px 14px 0 0;
  border-top: 6px solid var(--signal); padding: 14px 16px 22px; box-shadow: 0 -6px 30px rgba(0,0,0,.25); }
.room-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.room-sheet-head h2 { margin: 0; font-size: 1.4rem; display: flex; align-items: baseline; gap: 10px; }
.room-sheet-head h2 small { font-weight: 400; color: var(--muted); font-size: .9rem; }
body.sheet-open { overflow: hidden; }
@media (min-width: 701px) { .room-sheet { align-items: center; } .room-sheet-box { border-radius: 12px; } }
.room-block .trow-where, .room-sheet .trow-where, .room-block .trow-meta, .room-sheet .trow-meta { display: none; }

/* capienza delle aule e situazione delle aule */
.room-caps { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px; background: #FAFBFC; }
.room-caps > summary { cursor: pointer; }
.room-caps[open] > summary { margin-bottom: 8px; }
.caps-floor { font-size: .95rem; margin: 12px 0 6px; }
.caps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cap-item { display: grid; grid-template-columns: 1fr 64px; grid-template-rows: auto auto; gap: 2px 6px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 8px; }
.cap-item .cap-label { font-weight: 600; font-size: .9rem; }
.cap-item input[type=number] { grid-row: span 2; min-height: 36px; padding: .2em .4em; text-align: center; }
.cap-item .cap-excl { font-size: .8rem; font-weight: 400 !important; gap: 4px !important; }
.cap-item.is-excluded { background: #F1F1F1; opacity: .7; }
.cap-item.is-excluded .cap-label { text-decoration: line-through; }
.occ-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.occ-chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 9px; border-radius: 12px; background: #E4EFF1; font-size: .88rem; }
.occ-chip b { font-size: .95rem; }
.occ-chip.occ-part { background: #FFF3C4; }
.occ-chip.occ-free { background: var(--on-bg); color: var(--on); font-weight: 600; }
.occ-chip.occ-excl { background: #EEE; color: #666; text-decoration: line-through; }
.occ-free-label { margin-left: 8px; color: var(--muted); font-size: .88rem; }
.occ-floor h2 .count { margin-left: 6px; }
.occ-table { margin-bottom: 4px; }
.occ-n { font: 700 1.15rem var(--font-sign); }
@page { size: A4 portrait; margin: 12mm; }
@media print {
  .admin .adm-side, .admin .no-print, .admin .flash { display: none !important; }
  .admin .adm { display: block; }
  .admin .adm-main { padding: 0; }
  .admin { background: #fff; }
  .occ-floor { break-inside: avoid; border: 0; padding: 0 0 6mm; }
}

/* utenti e funzioni */
.perm-box { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin: 0; }
.perm-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 14px; }
.perm-item { align-items: flex-start !important; padding: 6px 4px; border-radius: var(--radius-s); }
.perm-item:hover { background: #F4F6F8; }
.perm-item input { margin-top: 3px; flex: none; }
.perm-item span { display: flex; flex-direction: column; }
.perm-item small { color: var(--muted); font-weight: 400; line-height: 1.3; }
.user-manage[open] { min-width: min(560px, 80vw); }
.user-manage .perm-grid { grid-template-columns: 1fr 1fr; }
input:disabled, select:disabled, textarea:disabled { background: #EEF1F3; color: #7B8794; cursor: not-allowed; }
@media (max-width: 700px) { .user-manage .perm-grid { grid-template-columns: 1fr; } }

/* logo della scuola */
.brand-logo { flex: none; display: block; height: 56px; width: auto; max-width: 200px; object-fit: contain; }
.brand-logo.on-white { background: #fff; border-radius: 6px; padding: 4px; }
.adm-brand .brand-logo { height: 40px; max-width: 160px; margin-bottom: 8px; }
.gate .brand-logo { height: 72px; max-width: 240px; margin: 0 auto 12px; }
@media (max-width: 600px) { .pub-head .brand-logo { height: 44px; max-width: 120px; } }

/* aspetto del sito: logo e colori */
.logo-preview-box { background: #E9EDF0; border-radius: var(--radius-s); padding: 12px; display: inline-flex; margin-bottom: 10px; }
.logo-preview-box .brand-logo { height: 64px; }
.theme-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-preset { display: inline-flex; align-items: center; gap: 3px; padding: 5px 9px 5px 6px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; font: inherit; font-size: .85rem; }
.theme-preset:hover { border-color: var(--ink); }
.theme-preset .sw { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.theme-preset .tp-name { margin-left: 4px; }
.color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color-row label small { font-weight: 400; color: var(--muted); font-size: .78rem; line-height: 1.25; min-height: 2.5em; }
.color-row input[type=color] { width: 100%; height: 44px; padding: 2px; cursor: pointer; }
.theme-preview { border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.tpv-head { padding: 10px 14px; display: flex; flex-direction: column; }
.tpv-school { font-size: .8rem; opacity: .8; }
.tpv-body { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--paper); flex-wrap: wrap; }
.tpv-plate { display: inline-flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px 10px; border-radius: 4px; border-bottom: 4px solid; font: 700 1.6rem/1 var(--font-sign); }
.tpv-plate small { font-size: .65rem; font-weight: 400; letter-spacing: .06em; }
.tpv-btn { padding: 10px 16px; border-radius: 4px; font-weight: 600; }
.tpv-notice { padding: 8px 14px; border-radius: 4px; font-weight: 600; }
@media (max-width: 700px) { .color-row { grid-template-columns: 1fr; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: .3em; }
.page-head .page-h { margin: 0; }
.btn-download::before { content: ""; width: 14px; height: 14px; flex: none;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1h2v8l3-3 1.4 1.4L8 12.8 2.6 7.4 4 6l3 3zM2 14h12v2H2z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M7 1h2v8l3-3 1.4 1.4L8 12.8 2.6 7.4 4 6l3 3zM2 14h12v2H2z'/%3E%3C/svg%3E") center/contain no-repeat; }
/* stile del manuale (pagina Guida e PDF) */
.manual { max-width: 980px; }
.manual .man-sec { background: var(--surface, #fff); border: 1px solid var(--line, #CDD5DD); border-radius: 8px; padding: 18px 24px 8px; margin: 0 0 22px; }
.manual h2 { display: flex; align-items: center; gap: 12px; font-size: 1.45rem; margin: 0 0 .7em; padding-bottom: .4em; border-bottom: 3px solid var(--signal, #F5C518); }
.manual h2 .n { display: inline-grid; place-items: center; min-width: 38px; height: 38px; border-radius: 6px; background: var(--plate, #123A44); color: var(--on-plate, #fff); font: 700 1.2rem/1 var(--font-sign, Arial); }
.manual h3 { font-size: 1.12rem; margin: 1.3em 0 .5em; }
.manual p, .manual li, .manual dd { line-height: 1.55; }
.manual li { margin: .25em 0; }
.manual code { background: #EEF1F3; padding: 1px 5px; border-radius: 3px; font-size: .92em; }
.manual figure { margin: 14px 0 18px; }
.manual figure img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line, #CDD5DD); border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.manual figcaption { font-size: .86rem; color: var(--muted, #566476); margin-top: 6px; }
.manual .man-small img { max-width: 520px; }
.manual .man-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.manual .tip, .manual .warn { padding: 10px 14px; border-radius: 6px; margin: 12px 0 16px; }
.manual .tip { background: #E4EFF1; border-left: 4px solid var(--accent, #0B5563); }
.manual .tip::before { content: "Suggerimento. "; font-weight: 700; }
.manual .warn { background: #FFF6D6; border-left: 4px solid var(--signal, #F5C518); }
.manual .warn::before { content: "Attenzione. "; font-weight: 700; }
.manual .steps-big { padding-left: 1.4em; }
.manual .steps-big li { margin: .45em 0; }
.manual .man-tbl { width: 100%; border-collapse: collapse; font-size: .93rem; margin: 10px 0 16px; }
.manual .man-tbl th, .manual .man-tbl td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line, #CDD5DD); vertical-align: top; }
.manual .man-tbl th { background: #EEF1F3; font-size: .85rem; }
.manual .man-tbl td:last-child { text-align: center; font-weight: 700; color: var(--on, #1C7443); }
.manual .man-faq dt { font-weight: 700; margin-top: 12px; }
.manual .man-faq dd { margin: 4px 0 0; }
.man-toc ol { columns: 2; column-gap: 30px; margin: 0; padding-left: 1.4em; }
.man-toc li { margin: 3px 0; break-inside: avoid; }
@media (max-width: 800px) { .manual .man-2col { grid-template-columns: 1fr; } .man-toc ol { columns: 1; } .manual .man-sec { padding: 14px; } }
@media print {
  .man-toc { break-after: page; }
  .manual .man-sec { border: 0; padding: 0; break-before: page; }
  .manual figure, .manual .tip, .manual .warn, .manual .man-tbl tr { break-inside: avoid; }
}

/* ------------------------------------------------------------------ portale con più scuole */
.pub-portal { padding-top: 10px; font-size: .9rem; }
.pub-foot-links a { color: var(--muted); }
.gate-links { margin-top: 18px; text-align: center; }
.portal-intro { padding: 28px 0 8px; }
.portal-intro .lead { max-width: 60ch; }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 16px; margin: 18px 0 34px; }
.pcard { display: flex; flex-direction: column; background: var(--surface, #fff); border: 1px solid var(--line, #D6DADD); border-radius: 10px; overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.pcard:hover, .pcard:focus-visible { box-shadow: 0 6px 18px rgba(0, 0, 0, .12); transform: translateY(-2px); color: inherit; }
.pcard-banner { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover; background: var(--sc, var(--plate)); }
.pcard-band { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 1; background: var(--sc, var(--plate)); color: var(--on-sc, #fff); }
.pcard-logo { max-height: 58%; max-width: 70%; object-fit: contain; }
.pcard-logo.on-white { background: #fff; border-radius: 6px; padding: 4px; }
.pcard-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 14px; border-top: 4px solid var(--sc, var(--plate)); }
.pcard-name { font-size: 1.1rem; line-height: 1.25; }
.pcard-place { color: var(--muted); font-size: .9rem; }
.pcard-event { font-size: .85rem; margin-top: 4px; }
.pall-search { margin: 6px 0 18px; max-width: 520px; }
.pall-search input { width: 100%; }
.pg-prov { margin: 0 0 22px; }
.pg-prov-h { font-size: 1.15rem; border-bottom: 2px solid var(--plate); padding-bottom: 4px; margin: 0 0 10px; }
.pg-city { margin: 0 0 12px 4px; }
.pg-city-h { font-size: .95rem; color: var(--muted); margin: 0 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.pg-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 18px; }
.pg-list a { display: block; padding: 6px 0; font-weight: 600; }
[hidden] { display: none !important; }

/* pannello: scuola in uso e sezione del dominio */
.adm-switch { margin: -6px 18px 12px; font-size: .85rem; color: var(--on-plate); opacity: .9; }
.adm-switch:hover { color: var(--on-plate); opacity: 1; }
.adm-nav-h { padding: 2px 18px 4px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--on-plate); opacity: .65; }
.school-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.school-pick form { margin: 0; }
.school-pick button { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line, #D6DADD); border-left: 6px solid var(--sc, var(--plate)); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; }
.school-pick button:hover { background: var(--surface, #F2F4F6); }
.school-pick button strong { font-size: 1.05rem; }
.school-pick button small { color: var(--muted); }
.school-pick .is-current { outline: 3px solid var(--signal); }
.tag { display: inline-block; font-size: .75rem; padding: 1px 7px; border-radius: 10px; background: #E8ECEF; color: #33414F; vertical-align: middle; }
.tag-off { background: #FCE9E7; color: #8A1C12; }
.tag-on { background: #E3F4EA; color: #1C5B36; }
.privacy h2 { font-size: 1.15rem; margin-top: 28px; }
.privacy { max-width: 75ch; }
.privacy table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.privacy th, .privacy td { text-align: left; border-bottom: 1px solid var(--line, #D6DADD); padding: 6px 8px; vertical-align: top; }
.danger-zone { border-color: var(--off); }
.input-short { max-width: 8em; }
.banner-preview { display:block; width:100%; max-width:420px; aspect-ratio:3/1; object-fit:cover; border-radius:6px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; margin: 8px 0 12px; }
.role-grid label { display: flex; flex-direction: column; gap: 3px; font-size: .9rem; }
.role-grid label span { font-weight: 600; }
.pcard-mono { font-size: 2.4rem; font-weight: 800; letter-spacing: .06em; opacity: .9; }
.tbl-wrap + .panel, .tbl-wrap + p + .panel { margin-top: 22px; }
.manual .man-side { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: start; break-inside: avoid; }
.manual .man-menu img { max-width: 170px; }
@media (max-width: 600px) { .manual .man-side { grid-template-columns: 1fr; } }
.manual .man-tbl.man-tbl-text td:last-child { text-align: left; color: inherit; font-weight: 400; }
