.admin { min-height: 100vh; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------- Accesso ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding: 24px 16px; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; text-align: center; }
.auth-head img { width: 120px; height: auto; }
.auth-head .brand-name { font-size: 30px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--blue); }
.panel-card { display: flex; flex-direction: column; gap: 16px; padding: 24px 20px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow-lg); }
.panel-card h1 { margin: 0; font-family: var(--serif); font-size: 28px; }
.panel-card p { margin: 0; font-size: 14px; color: var(--muted); }
.note { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 14px; border: 1px solid #E2D3AE; background: var(--gold-paper); font-size: 13px; line-height: 1.45; color: var(--gold-deep); }
.note svg { flex: none; margin-top: 1px; }

/* ---------- Campi ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13px; font-weight: 700; }
.field .help { font-size: 12px; color: var(--soft-text); }
.input, .field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="url"], .field input[type="date"], .field input[type="time"], .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #F7F9FB; font-size: 16px; color: var(--ink);
}
.field textarea { min-height: 110px; line-height: 1.5; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(31, 111, 184, .18); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }
.error { padding: 12px 14px; border-radius: 12px; background: #FCEBEA; color: var(--danger); font-size: 14px; font-weight: 600; }
.ok { padding: 12px 14px; border-radius: 12px; background: #E3F1E8; color: #1E5B37; font-size: 14px; font-weight: 600; }

/* ---------- Pulsanti ---------- */
.b { min-height: 48px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; border: none; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.b[disabled] { opacity: .55; cursor: default; }
.b-blue { background: var(--blue); color: #fff; }
.b-blue:hover:not([disabled]) { background: var(--blue-dark); color: #fff; }
.b-line { background: #fff; border: 1.5px solid var(--blue); color: var(--blue); }
.b-ghost { background: transparent; color: var(--muted); }
.b-gold { background: var(--gold-paper); border: 1.5px solid var(--gold); color: var(--gold-deep); }
.b-danger { background: transparent; color: var(--danger); }
.b-full { width: 100%; }
.link-btn { align-self: center; min-height: 44px; background: none; border: none; color: var(--blue); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; }
.icon-btn { flex: none; width: 42px; height: 42px; border-radius: 12px; border: none; background: #F2F5F8; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover:not([disabled]) { background: #E6EBF1; color: var(--ink); }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.icon-btn.edit { background: var(--blue-soft); color: var(--blue); }

/* ---------- Pannello ---------- */
.bar { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 2px solid var(--gold); }
.bar-in { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar .brand img { width: 32px; }
.bar .brand-name { font-size: 21px; }
.bar small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--blue); }
.bar-actions { display: flex; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.bar-actions .b { min-height: 40px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
@media (max-width: 380px) { .bar-actions .b-line { padding: 0 10px; } .bar .brand-name { font-size: 18px; } }
.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.hello h1 { margin: 0; font-family: var(--serif); font-size: 34px; }
.hello p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.block { margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.block-head h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--blue); }
.block-head span { font-size: 12px; color: var(--soft-text); }
.item { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.item.off { background: #F6F8FA; }
.item.off .item-title { color: var(--soft-text); }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item-title { font-size: 15px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.item-sub { font-size: 12px; color: var(--muted); }
.item-sub.warn { font-weight: 700; color: var(--gold-ink); }
.order { display: flex; flex-direction: column; gap: 2px; }
.order .icon-btn { width: 34px; height: 26px; border-radius: 8px; }
.date-box { flex: none; width: 54px; min-height: 56px; border-radius: 12px; background: var(--gold-soft); color: var(--gold-deep); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.date-box b { font-size: 18px; line-height: 1; }
.date-box span { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.badge { align-self: flex-start; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #E6EBF1; color: var(--muted); }
.add { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 16px; border: 2px dashed var(--gold); background: transparent; color: var(--gold-ink); font-size: 15px; font-weight: 700; cursor: pointer; }
.add:hover { background: var(--gold-paper); }
.switch { flex: none; width: 52px; height: 32px; border-radius: 999px; border: none; padding: 0; position: relative; background: #B9C6D4; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 999px; background: #fff; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--blue); }
.switch[aria-checked="true"]::after { left: 24px; }
.news-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.news-card .line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.news-card .line + .line { padding-top: 12px; border-top: 1px solid #EDF1F5; }

/* ---------- Modifica ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.form-card h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--blue); }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); }
.tab { min-height: 44px; border: none; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tab[aria-selected="true"] { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(22, 38, 61, .15); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: #C3CDD8; }
.dot.full { background: #2E8B57; }
.img-field { display: flex; flex-direction: column; gap: 10px; }
.img-preview { height: 170px; border-radius: 14px; border: 2px dashed #B9C6D4; background: #F7F9FB; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); font-size: 14px; font-weight: 600; text-align: center; padding: 8px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.img-actions label.b { position: relative; }
.img-actions input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.form-actions { display: flex; flex-direction: column; gap: 8px; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.icon-pick button { height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: #F7F9FB; color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-pick button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(120px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); transition: transform .2s; z-index: 20; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { .toast, .switch::after { transition: none; } }

/* ---------- Editor testi lunghi ---------- */
.rich-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rich-toggle { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--blue); background: #fff; color: var(--blue); font-size: 13px; font-weight: 700; cursor: pointer; }
.rich-toggle[aria-pressed="true"] { background: var(--blue); color: #fff; }
.rich-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-radius: 12px; background: var(--bg); }
.rich-bar button { min-height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.rich-bar button:hover { border-color: var(--blue); color: var(--blue); }
.field textarea.rich-ta { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.55; }
.rich-preview { padding: 16px; border-radius: 12px; border: 1.5px dashed var(--line); background: #fff; max-height: 70vh; overflow: auto; }
.rich-help summary { min-height: 40px; display: flex; align-items: center; font-size: 13px; font-weight: 700; color: var(--blue); cursor: pointer; }
.rich-help p { margin: 4px 0; font-size: 13px; color: var(--muted); }
.field select { appearance: auto; }
.form-card .rich-preview h2 { margin: 22px 0 8px; font-family: var(--serif); font-size: 26px; letter-spacing: 0; text-transform: none; color: var(--ink); }
.form-card .rich-preview h2:first-child { margin-top: 0; }
