/* Monete d'Italia - editor dei contenuti (admin/editor.php). Usa le variabili di numismatica.css */
.nt-editor .nt-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }
.nt-prose .ed ul, .nt-prose .ed ol { max-width: none; padding-left: 0; margin-top: 0; }
.nt-prose .ed .ed-help ul, .nt-prose .ed .ed-note ul:not(.ed-diff) { padding-left: 1.2em; }
.nt-prose .ed p { max-width: none; }
.ed-foto-box small { word-break: break-all; }
.nt-editor .nt-side { display: none; }
.ed { --ok: #3f8a4a; --warn: #c9822b; }
.ed-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ed-top > div { flex: 1 1 320px; }
.ed-h1 { margin: 0; font: 700 clamp(1.4rem, 1rem + 1.4vw, 2rem)/1.2 var(--serif); color: var(--gold-hi); }
.ed-sub { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.ed-back { flex: 0 0 100%; font-size: .9rem; text-decoration: none; color: var(--muted) !important; }
.ed-back:hover { color: var(--gold-hi) !important; }
.ed-pill { padding: 5px 12px; border-radius: 99px; background: #3a2b10; border: 1px solid #6d5522; color: #f6dd96; font: 600 .82rem var(--sans); white-space: nowrap; }
.ed-muted { color: var(--faint); font-size: .9rem; }
.ed-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0 0 16px; }
.ed-card > h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 700 1.15rem/1.3 var(--serif); color: var(--gold-hi); }
.ed-step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 99px; background: var(--gold); color: #2a0d07; font: 800 .9rem var(--sans); }
.ed-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ed-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ed-field { display: block; margin: 0 0 12px; }
.ed-field > span, .ed-lbl { display: block; margin: 0 0 5px; font: 600 .86rem/1.3 var(--sans); color: var(--muted); }
.ed-field small { display: block; margin-top: 5px; color: var(--faint); font-size: .84rem; }
.ed-field > span small { display: inline; margin-left: 6px; }
.ed input[type=text], .ed input[type=search], .ed input[type=date], .ed select, .ed textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: 400 1rem/1.4 var(--sans);
}
.ed input:focus, .ed select:focus, .ed textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,176,100,.18); }
.ed textarea.ed-area[wrap=off] { white-space: pre; overflow-x: auto; }
.ed textarea.ed-area { font: 400 .95rem/1.55 ui-monospace, 'Cascadia Mono', Consolas, monospace; min-height: 380px; resize: vertical; tab-size: 4; }
.ed-count.over { color: #f08a6a !important; font-weight: 700; }

/* barra degli strumenti */
.ed-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.ed-tools button { height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: 600 .88rem var(--sans); cursor: pointer; }
.ed-tools button:hover { border-color: var(--gold-lo); color: var(--gold-hi); }
.ed-tools .ed-open-blocchi, .ed-tools .ed-open-modelli { background: #3a2b10; border-color: #6d5522; color: #f6dd96; }
.ed-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.ed-help { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-s); background: var(--bg-2); border: 1px solid var(--line-soft); font-size: .92rem; }
.ed-help p { margin: 0 0 6px; }
.ed-help ul { margin: 0; padding-left: 1.2em; }
.ed-help code, .ed code { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 4px; font-size: .88em; color: var(--gold-hi); }

/* testo + anteprima affiancati */
.ed-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ed-prev { min-height: 380px; max-height: 75vh; overflow: auto; padding: 14px 18px; border-radius: var(--radius-s); border: 1px solid var(--line-soft); background: var(--bg); position: sticky; top: 12px; transition: opacity .2s; font-size: .98rem; }
.ed-prev.ed-loading { opacity: .6; }
.ed-prev > :first-child { margin-top: 0; }
.ed-adph { margin: 10px 0; padding: 14px; border: 1px dashed var(--line); border-radius: 8px; color: var(--faint); text-align: center; font-size: .85rem; }

/* foto */
.ed-foto { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.ed-foto-box { display: grid; justify-items: center; gap: 6px; width: 200px; padding: 12px; border-radius: var(--radius-s); background: var(--bg-2); border: 1px solid var(--line-soft); text-align: center; }
.ed-foto-img { width: 150px; height: 150px; display: grid; place-items: center; border-radius: 8px; background: radial-gradient(circle at 50% 45%, #33170e 0%, var(--bg-2) 80%); overflow: hidden; }
.ed-foto-img img { max-width: 100%; max-height: 100%; }
.ed-foto-img span { color: var(--faint); font-size: .85rem; }
.ed-upload { display: block; font-size: .85rem; color: var(--gold); cursor: pointer; }
.ed-upload input { display: block; width: 100%; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.ed-orfane ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ed-orfane button { padding: 5px 12px; border-radius: 99px; border: 1px solid #6d5522; background: #3a2b10; color: #f6dd96; font: 600 .85rem var(--sans); cursor: pointer; }

/* pulsanti e azioni */
.ed-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px -4px 0; padding: 12px 14px; border-radius: var(--radius); background: rgba(20,5,4,.94); border: 1px solid var(--line); backdrop-filter: blur(4px); }
.ed-btn { display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text) !important; font: 600 .98rem var(--sans); text-decoration: none; cursor: pointer; }
.ed-btn:hover { border-color: var(--gold-lo); }
.ed-btn.pri { background: var(--gold); border-color: var(--gold); color: #2a0d07 !important; }
.ed-btn.pri:hover { background: var(--gold-hi); }
.ed-btn.ghost { background: none; }

/* avvisi e riepilogo del salvataggio */
.ed-note { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); }
.ed-note.ok { border-color: #2f6b38; background: #14240f; }
.ed-note.info { border-color: #6d5522; background: #1b1309; }
.ed-note.warn, .ed-warn { border: 1px solid #8a4a1c; background: #2a1408; border-radius: var(--radius-s); padding: 10px 14px; white-space: pre-line; }
.ed-note ul { margin: 6px 0 0; padding-left: 1.2em; }
.ed-diff { list-style: none; padding: 0 !important; }
.ed-diff li { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.ed-diff del { color: #e29a8a; text-decoration: line-through; text-decoration-color: rgba(226,154,138,.5); white-space: pre-wrap; }
.ed-diff ins { color: #a9dca0; text-decoration: none; white-space: pre-wrap; }

/* anteprima Google */
.ed-serp { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius-s); background: #fff; color: #202124; font-family: Arial, sans-serif; max-width: 640px; }
.ed-serp-t { color: #1a0dab; font-size: 19px; line-height: 1.3; }
.ed-serp-u { color: #188038; font-size: 13px; margin: 2px 0; }
.ed-serp-d { color: #4d5156; font-size: 14px; line-height: 1.45; }

/* pagina iniziale */
.ed-scelte { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ed-scelte a { display: grid; gap: 4px; height: 100%; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.ed-scelte a:hover { border-color: var(--gold); transform: translateY(-2px); }
.ed-scelte b { font: 700 1.1rem var(--serif); color: var(--gold-hi); }
.ed-scelte small { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.ed-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: #3a2b10; color: #f6dd96; font-size: 1.3rem; margin-bottom: 6px; }
.ed-cerca { display: flex; gap: 8px; margin: 0 0 14px; max-width: 640px; }
.ed-cerca input { flex: 1; }
.ed-monete { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.ed-monete a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line-soft); text-decoration: none; color: var(--text); }
.ed-monete a:hover { border-color: var(--gold-lo); }
.ed-monete img, .ed-noimg { width: 48px; height: 48px; object-fit: contain; flex: 0 0 48px; border-radius: 50%; background: var(--bg-2); }
.ed-monete b { display: block; font-weight: 600; font-size: .95rem; line-height: 1.25; }
.ed-monete small { color: var(--faint); font-size: .8rem; }
.ed-alb { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; align-items: start; }
.ed-alb details { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-s); }
.ed-alb summary { cursor: pointer; padding: 9px 12px; font-weight: 600; color: var(--gold-hi); }
.ed-alb ul { list-style: none; margin: 0; padding: 0 12px 10px; }
.ed-alb li { padding: 3px 0; font-size: .93rem; }
.ed-mini { font-size: .78rem; color: var(--faint) !important; margin-left: 6px; }
.nt-prose .ed .ed-elenco { columns: 3 220px; padding-left: 1.2em; }

/* finestre di scelta */
.ed-dlg { width: min(720px, 94vw); max-height: 86vh; padding: 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.ed-dlg::backdrop { background: rgba(0,0,0,.65); }
.ed-dlg form { display: flex; flex-direction: column; max-height: 86vh; padding: 18px 20px; gap: 10px; }
.ed-dlg h2 { margin: 0; font: 700 1.2rem var(--serif); color: var(--gold-hi); }
.ed-dlg p { margin: 0; }
.ed-inline { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.ed-inline input { flex: 1; }
.ed-lista { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; border: 1px solid var(--line-soft); border-radius: var(--radius-s); }
.ed-lista li[hidden] { display: none; }
.ed-lista button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--text); font: 400 .95rem var(--sans); text-align: left; cursor: pointer; }
.ed-lista button:hover { background: var(--surface-2); color: var(--gold-hi); }
.ed-lista small { color: var(--faint); }
.ed-dlg-foot { display: flex; justify-content: flex-end; }

@media (max-width: 900px) {
  .ed-split, .ed-grid2, .ed-grid3 { grid-template-columns: minmax(0, 1fr); }
  .ed-prev { position: static; min-height: 160px; max-height: none; }
  .ed textarea.ed-area[wrap=off] { white-space: pre; overflow-x: auto; }
.ed textarea.ed-area { min-height: 260px; }
  .ed-diff li { grid-template-columns: 1fr; }
  .ed-card { padding: 14px; }
  .ed-foto-box { width: calc(50% - 8px); }
  .ed-foto-img { width: 100%; height: auto; aspect-ratio: 1; }
}
