/* WebProjects — pannello del blog.
   Mobile prima di tutto: un solo foglio di stile, nessun framework. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #191c21;
  --muted: #5d6470;
  --faint: #8a919c;
  --border: #e2e5ea;
  --border-strong: #cfd4db;
  --accent: #2456d3;
  --accent-hover: #1b45b3;
  --accent-soft: #e9effc;
  --accent-text: #ffffff;
  --ok: #137347;
  --ok-soft: #e4f3ea;
  --warn: #8f5b00;
  --warn-soft: #fcf2df;
  --err: #be2f28;
  --err-soft: #fcebe9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --read: "Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --topbar-h: 60px;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --surface: #1a1d23;
    --surface-2: #22262d;
    --text: #e9ebef;
    --muted: #a3aab5;
    --faint: #7c8390;
    --border: #2c3139;
    --border-strong: #3a4049;
    --accent: #6d95f2;
    --accent-hover: #87a8f5;
    --accent-soft: #1f2a44;
    --accent-text: #0e1320;
    --ok: #5cc48d; --ok-soft: #17301f;
    --warn: #e2b053; --warn-soft: #33270f;
    --err: #f07a72; --err-soft: #3a1b19;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
h1, .h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2, .h2 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.01em; }
.h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
.h4 { font-size: 1rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .875rem; margin: .35rem 0 0; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 600; color: var(--muted); margin: 0 0 .25rem; }
.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; }
.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 14px; height: 14px; display: inline-block; vertical-align: -1px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ── Barra in alto ───────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 650; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
}
.brand-mark-lg { width: 48px; height: 48px; border-radius: 13px; font-size: 1.35rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }

.nav { display: flex; gap: .25rem; margin-left: 1.5rem; }
.nav-item {
  display: flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: 10px;
  color: var(--muted); font-weight: 550; font-size: .95rem;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); }

/* ── Contenuto ───────────────────────────────────────────────────────────── */
.main { max-width: 780px; margin: 0 auto; padding: 1.75rem 1rem 3rem; }
.main-wide { max-width: 1120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .3rem 0 0; }
.back { display: inline-flex; align-items: center; gap: .2rem; color: var(--muted); font-weight: 550; margin: 0 0 1rem -.3rem; padding: .3rem; }
.back:hover { color: var(--text); text-decoration: none; }
.stack { display: grid; gap: 1rem; align-content: start; }
.grid-2 { display: grid; gap: 1rem; margin-bottom: 1rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem;
}
.stack > .card, .grid-2 > .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-head .h4 { margin: 0; }
.card-danger { border-color: color-mix(in srgb, var(--err) 30%, var(--border)); }
.card-details > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.card-details > summary::-webkit-details-marker { display: none; }
.card-details > summary .h4 { margin: 0; }
.card-details > summary::after { content: "›"; color: var(--faint); font-size: 1.3rem; line-height: 1; transition: transform .15s; }
.card-details[open] > summary::after { transform: rotate(90deg); }
.card-details[open] > summary { margin-bottom: .9rem; }
.card-details > summary .hint { margin: 0 0 0 auto; }

/* ── Pulsanti ────────────────────────────────────────────────────────────── */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1.05rem; border-radius: 11px;
  font: 600 .95rem/1.2 var(--font); cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  text-decoration: none !important;
}
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--err) 16%, var(--surface)); }
.btn-sm { min-height: 36px; padding: .35rem .7rem; font-size: .875rem; border-radius: 9px; }
.btn-icon { padding: .35rem; min-width: 36px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-stack { display: grid; gap: .5rem; margin: .25rem 0 .5rem; }
form.inline { display: inline; margin: 0; }

/* ── Moduli ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
label, .field > label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input:not([type]), textarea {
  width: 100%; font: 16px/1.45 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .65rem .75rem; min-height: 44px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.has-error input, .has-error textarea, .is-invalid { border-color: var(--err) !important; }
.error { color: var(--err); font-size: .875rem; margin: .35rem 0 0; font-weight: 550; }
.counter { font-weight: 500; color: var(--faint); font-size: .8rem; font-variant-numeric: tabular-nums; }
.counter.is-over { color: var(--warn); }
.check { display: flex; justify-content: flex-start; align-items: flex-start; gap: .6rem; font-weight: 500; font-size: .92rem; margin: .5rem 0 1rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--accent); flex: none; }
.inline-form { display: flex; gap: .5rem; margin-top: .75rem; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form-wrap { flex-wrap: wrap; }
.inline-form-wrap input { flex: 1 1 200px; }

/* ── Messaggi ────────────────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-radius: 12px; margin: 0 0 1.25rem;
  font-weight: 550; font-size: .95rem;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash-error { background: var(--err-soft); color: var(--err); }
.pill {
  display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 999px;
  font-size: .75rem; font-weight: 650; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-err { background: var(--err-soft); color: var(--err); }
.pill-admin { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-right: .35rem; vertical-align: 1px; }
.dot-ok { background: var(--ok); }
.dot-err { background: var(--err); }
.dot-busy { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.warn-text { color: var(--warn); }

/* ── Stato del sito ──────────────────────────────────────────────────────── */
.site-card {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; margin-bottom: 1.25rem;
  border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}
.site-link { font-weight: 650; font-size: 1.05rem; color: var(--text); }
.site-state { margin: .3rem 0 0; font-size: .875rem; color: var(--muted); }

/* ── Elenchi ─────────────────────────────────────────────────────────────── */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.post-row {
  display: flex; align-items: center; gap: .9rem; padding: .7rem .9rem .7rem .7rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow); transition: border-color .12s, transform .12s;
}
.post-row:hover { text-decoration: none; border-color: var(--border-strong); }
.post-row:active { transform: scale(.995); }
.thumb {
  width: 64px; height: 48px; border-radius: 9px; flex: none; overflow: hidden;
  background: var(--surface-2); color: var(--faint); display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-letter { font-weight: 700; color: var(--accent); background: var(--accent-soft); width: 48px; }
.post-row-text { flex: 1; min-width: 0; display: grid; gap: .2rem; }
.post-row-title { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-row-meta { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.chevron { color: var(--faint); font-size: 1.5rem; line-height: 1; }

.empty { text-align: center; padding: 3rem 1.25rem; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty .btn { margin-top: .5rem; }

/* ── Editor ──────────────────────────────────────────────────────────────── */
.editor-layout { display: grid; gap: 1.25rem; align-items: start; }
.editor-main { min-width: 0; }
.title-input {
  border: 0 !important; background: transparent !important; box-shadow: none !important; padding: .25rem 0 !important;
  font: 700 1.9rem/1.2 var(--font) !important; letter-spacing: -.015em; resize: none; overflow: hidden; min-height: 0 !important;
  margin-bottom: .75rem;
}
.title-input::placeholder { color: var(--faint); }

.editor { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.editor.is-focused { border-color: var(--border-strong); }
.editor.is-uploading { opacity: .6; pointer-events: none; }
.editor-toolbar {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 5;
  display: flex; align-items: center; gap: 2px; padding: .4rem;
  background: var(--surface); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
  overflow-x: auto; scrollbar-width: none;
}
.editor-toolbar::-webkit-scrollbar { display: none; }
.tb {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 40px; height: 40px; border-radius: 9px; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.tb:hover { background: var(--surface-2); color: var(--text); }
.tb.is-on { background: var(--accent-soft); color: var(--accent); }
.tb-text { font: 700 1.05rem/1 var(--font); }
.tb-sm { font-size: .82rem; }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 .3rem; flex: none; }
.editor-content { padding: 1.1rem 1.25rem 1.5rem; min-height: 320px; }
.editor-content .ProseMirror { outline: none; min-height: 280px; }

/* Regole di base di ProseMirror/TipTap. TipTap le inietterebbe con un <style>
   in linea, che la Content-Security-Policy blocca: per questo stanno qui. */
.ProseMirror { position: relative; word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces;
  -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; }
.ProseMirror [contenteditable="false"] { white-space: normal; }
.ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; }
.ProseMirror pre { white-space: pre-wrap; }
img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; }
.ProseMirror-gapcursor::after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid currentColor; animation: pm-blink 1.1s steps(2, start) infinite; }
@keyframes pm-blink { to { visibility: hidden; } }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-hideselection * { caret-color: transparent; }
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); color: var(--faint); float: left; height: 0; pointer-events: none;
}
.ProseMirror img.ProseMirror-selectednode { outline: 3px solid var(--accent); }

/* Tipografia del testo: editor, anteprima. */
.prose { font: 1.075rem/1.7 var(--read); color: var(--text); overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose h2 { font: 700 1.4rem/1.3 var(--font); margin: 1.6em 0 .5em; }
.prose h3 { font: 700 1.15rem/1.35 var(--font); margin: 1.4em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose li > p { margin: 0; }
.prose blockquote { margin: 1.2em 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose img { border-radius: 10px; margin: 1.2em 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

.cover-preview { margin: 0 0 .5rem; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.cover-preview img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.file-drop {
  display: grid !important; justify-items: center; gap: .2rem; text-align: center;
  padding: 1.1rem; border: 1.5px dashed var(--border-strong); border-radius: 12px; cursor: pointer;
  color: var(--muted); font-weight: 600; transition: border-color .12s, background .12s; position: relative;
}
.file-drop:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.file-drop .hint { font-weight: 400; margin: 0; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop.has-file { border-style: solid; border-color: var(--accent); color: var(--accent); }
.file-drop-preview { width: 100%; border-radius: 8px; aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: .4rem; }

.serp { margin-top: .5rem; padding: .85rem 1rem; border-radius: 10px; background: var(--surface-2); }
.serp-title { margin: 0 0 .2rem; color: #1a0dab; font: 1.05rem/1.3 Arial, sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serp-desc { margin: 0; color: #4d5156; font: .85rem/1.45 Arial, sans-serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (prefers-color-scheme: dark) { .serp-title { color: #99c3ff; } .serp-desc { color: #bdc1c6; } }

.actionbar { display: none; }

/* Lettura (anteprima). */
.reader { max-width: 680px; margin: 0 auto; }
.reader-note { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); background: var(--surface-2); padding: .55rem .8rem; border-radius: 10px; margin-bottom: 1.5rem; }
.reader-cover { width: 100%; border-radius: 14px; margin-bottom: 1.5rem; aspect-ratio: 16 / 9; object-fit: cover; }
.reader-title { font-size: 2.1rem; margin: .2rem 0 .8rem; }
.reader-lead { font: 1.2rem/1.55 var(--read); color: var(--muted); margin-bottom: 1.5rem; }

/* ── Immagini ────────────────────────────────────────────────────────────── */
.meter { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--surface-2); margin: -.5rem 0 1.25rem; overflow: hidden; display: block; }
.meter::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
.meter::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.meter::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.upload-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.upload-bar .hint { flex: 1 1 260px; margin: 0; }
.upload-bar label.btn { margin: 0; font-size: .95rem; font-weight: 600; }
.media-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; }
.media-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.media-thumb { display: block; background: var(--surface-2); }
.media-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.media-alt { display: flex; gap: .4rem; padding: .7rem .7rem 0; }
.media-alt input { min-height: 38px; padding: .4rem .6rem; font-size: 16px; }
.media-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem .4rem .4rem .7rem; margin-top: auto; }
.media-foot .hint { margin: 0; font-size: .78rem; }

/* ── Admin ───────────────────────────────────────────────────────────────── */
.chips { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .2rem; background: var(--surface-2); border-radius: 999px; padding: .2rem .25rem .2rem .75rem; font-size: .9rem; }
.chip form { margin: 0; }
.chip-x { border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.chip-x:hover { background: var(--err-soft); color: var(--err); }
.howto { margin-top: .9rem; font-size: .875rem; color: var(--muted); }
.howto summary { cursor: pointer; font-weight: 600; color: var(--text); }
.howto ol { padding-left: 1.2rem; margin: .5rem 0 0; }
.howto li { margin-bottom: .35rem; }
.user-list { list-style: none; margin: 0; padding: 0; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.user-row .hint { margin-top: .15rem; }
.row-actions { display: flex; gap: .25rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.audit { list-style: none; padding: 0; margin: 0; font-size: .875rem; display: grid; gap: .35rem; }
.card-secret { max-width: 560px; margin: 0 auto; }
.secret { display: flex; align-items: center; gap: .6rem; padding: .9rem; background: var(--surface-2); border-radius: 12px; margin: 1rem 0; }
.secret code { flex: 1; font-size: 1.1rem; background: none; padding: 0; overflow-wrap: anywhere; user-select: all; }
.steps { padding-left: 1.2rem; color: var(--muted); }
.steps li { margin-bottom: .4rem; }

/* ── Accesso ─────────────────────────────────────────────────────────────── */
.bare { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.bare-main { width: 100%; max-width: 400px; }
.bare-brand { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.15rem; text-align: center; }
.card-auth { padding: 1.6rem 1.4rem; }
.card-auth h1 { margin-bottom: .25rem; }
.card-auth > .muted { margin-bottom: 1.25rem; }
.card-auth .btn-block { margin-top: .4rem; }
.bare-foot { text-align: center; color: var(--faint); font-size: .8rem; margin-top: 1.5rem; }

/* ── Schermi larghi ──────────────────────────────────────────────────────── */
@media (min-width: 960px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 1.75rem; }
  .editor-side { position: sticky; top: calc(var(--topbar-h) + 1.25rem); }
  .editor-side .card { padding: 1.1rem; }
  .grid-2 { grid-template-columns: 1.1fr 1fr; align-items: start; }
}

/* ── Telefono ────────────────────────────────────────────────────────────── */
@media (max-width: 719px) {
  :root { --topbar-h: 56px; }
  h1, .h1 { font-size: 1.5rem; }
  .main { padding: 1.1rem .9rem calc(var(--nav-h) + 1.75rem + env(safe-area-inset-bottom)); }
  .hide-sm, .hide-on-mobile { display: none !important; }
  /* Un backdrop-filter sull'intestazione la renderebbe il riferimento della
     barra di navigazione "fixed" che contiene: la barra finirebbe in alto
     invece che in fondo allo schermo. Su telefono l'intestazione è piena. */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  .topbar-inner { padding: 0 .75rem; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 0 .5rem env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--border); justify-content: space-around; gap: 0;
  }
  .nav-item { flex-direction: column; gap: .15rem; font-size: .72rem; padding: .45rem .5rem; flex: 1; justify-content: center; border-radius: 12px; background: none !important; }
  .nav-item .icon { width: 23px; height: 23px; }
  .nav-item.is-active { color: var(--accent); }

  .page-head { align-items: center; }
  .page-head .btn-primary span { display: none; }
  .page-head .btn-primary { width: 44px; padding: 0; border-radius: 50%; }
  .page-head .btn-primary .icon { width: 22px; height: 22px; }

  .card { padding: 1rem; border-radius: 13px; }
  .title-input { font-size: 1.55rem !important; }
  .editor { border-radius: 12px; margin: 0 -.15rem; }
  .editor-content { padding: .9rem 1rem 1.25rem; min-height: 260px; }
  .tb { width: 42px; height: 42px; }

  /* Nell'editor la barra di navigazione lascia il posto ai pulsanti Salva/Pubblica. */
  body:has(.actionbar) .nav { display: none; }
  body:has(.actionbar) .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .actionbar {
    display: grid; grid-template-columns: 1fr 1.3fr; gap: .6rem;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: .7rem .9rem calc(.7rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .actionbar .btn { min-height: 48px; }

  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .media-alt { flex-direction: column; padding: .55rem .55rem 0; }
  .media-alt .btn { width: 100%; }
  .media-foot .hint { display: none; }
  .upload-bar label.btn { width: 100%; }
  .reader-title { font-size: 1.65rem; }
  .user-row { align-items: flex-start; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
