:root {
  --navy: #172f62;
  --navy-900: #0f2148;
  --navy-100: #e8ecf4;
  --slate: #8ea3b5;
  --beige: #e7e4dd;
  --paper: #f6f5f2;
  --card: #ffffff;
  --line: #dcd9d2;
  --line-strong: #c3bfb6;
  --text: #1c2333;
  --muted: #667085;
  --green: #1f7a4d;
  --green-bg: #e3f2ea;
  --amber: #9a6212;
  --amber-bg: #fbefd9;
  --red: #b42318;
  --red-bg: #fde8e6;
  --blue-bg: #e6edf9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Montserrat", var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--paper);
}
a { color: var(--navy); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  height: 58px; padding: 0 24px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark { font-family: var(--font-head); font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.brand-sub { font-size: 13px; opacity: .75; }
.brand--dark { color: var(--navy); margin-bottom: 24px; }
.mainnav { display: flex; gap: 4px; height: 100%; }
.mainnav a {
  display: flex; align-items: center; padding: 0 14px;
  color: rgba(255,255,255,.72); text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent;
}
.mainnav a:hover { color: #fff; }
.mainnav a.is-active { color: #fff; border-bottom-color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 13px; }
.topbar-link { color: rgba(255,255,255,.8); }
.savestate { opacity: .85; white-space: nowrap; }
.savestate.is-error { color: #ffc9c2; opacity: 1; font-weight: 600; }

.app { max-width: 1440px; margin: 0 auto; padding: 24px; }
.loading { padding: 80px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- common */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f2f1ed; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-900); }
.btn--danger { color: var(--red); border-color: #f0c2bd; }
.btn--danger:hover { background: var(--red-bg); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: rgba(0,0,0,.05); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn--icon { width: 30px; padding: 0; }
.btn--block { width: 100%; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 0; }
.card-head h2 { font-size: 16px; }
.card-head .hint { margin: 0; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 20px 20px; }
.card-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--navy-100); color: var(--navy); font: 600 12px var(--font-head);
}

.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.hint code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #f1efe9; padding: 1px 5px; border-radius: 4px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: #344054; }
.field-label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=search], input[type=password], input:not([type]), select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input:focus, select:focus, textarea:focus, .rte-area:focus, .btn:focus-visible {
  outline: 2px solid rgba(23,47,98,.35); outline-offset: 1px; border-color: var(--navy);
}
input[readonly] { background: #f6f5f2; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: #eee; color: #444;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--si, .pill--approvato { background: var(--green-bg); color: var(--green); }
.pill--no { background: #eeeeec; color: #7a7a74; }
.pill--da_decidere, .pill--in_revisione { background: var(--amber-bg); color: var(--amber); }
.pill--da_compilare { background: var(--red-bg); color: var(--red); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--navy-100); color: var(--navy); font-size: 12px; margin: 1px 2px 1px 0; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- list view */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; box-shadow: var(--shadow);
}
.stat:hover { border-color: var(--line-strong); }
.stat.is-active { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.stat b { display: block; font: 700 26px/1.1 var(--font-head); color: var(--navy); }
.stat span { font-size: 13px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 260px; }
.filters select { width: auto; flex: 0 1 190px; }

.table-wrap { overflow-x: auto; }
table.projects { width: 100%; border-collapse: collapse; font-size: 14px; }
.projects th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; cursor: pointer;
}
.projects th.is-sorted { color: var(--navy); }
.projects th.is-sorted::after { content: " ↓"; }
.projects th.is-sorted.is-desc::after { content: " ↑"; }
.projects td { padding: 10px 12px; border-bottom: 1px solid #eeece7; vertical-align: top; }
.projects tbody tr { cursor: pointer; }
.projects tbody tr:hover { background: #faf9f6; }
.projects .t-code { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); white-space: nowrap; }
.projects .t-title { font-weight: 600; }
.projects .t-title small { display: block; font-weight: 400; color: var(--muted); }
.empty { padding: 50px; text-align: center; color: var(--muted); }

.meter { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.meter-bar { flex: 1; height: 6px; border-radius: 3px; background: #ecebe6; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--slate); }
.meter-bar i.is-full { background: var(--green); }
.meter span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }

/* ----------------------------------------------------------- editor view */
.edit-head {
  position: sticky; top: 58px; z-index: 40;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: -24px -24px 20px; padding: 12px 24px;
  background: rgba(246,245,242,.96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.edit-head h1 { font-size: 19px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 200px; }
.edit-head h1 small { font: 600 14px var(--font); color: var(--muted); margin-right: 8px; }
.edit-head select { width: auto; min-height: 36px; padding: 6px 10px; }
.edit-head .sel-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.edit-side { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 150px); overflow: auto; }

.intro-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fcfbf9; }
.intro-box input.label-input { font-weight: 700; color: var(--navy); border-style: dashed; margin-bottom: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-size: 13px; line-height: 1.3;
}
.chip:hover { border-color: var(--navy); }
.chip.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.is-on::before { content: "✓"; font-size: 11px; }
.chips-more { font-size: 13px; }
.tax-block + .tax-block { margin-top: 18px; }
.tax-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.tax-head a { font-size: 12px; }

.combo { display: flex; gap: 6px; }
.combo select { flex: 1; }
.combo-add { display: flex; gap: 6px; margin-top: 6px; }

.img-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.img-slot {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px;
  border: 1px dashed var(--line-strong); border-radius: 8px; text-align: center; font-size: 12px; color: var(--muted);
}
.img-slot b { color: var(--text); font-size: 13px; }
.img-shape { background: linear-gradient(135deg, #d5dde6, #b8c6d3); border-radius: 8px; }
.img-shape--sq { width: 48px; height: 48px; }
.img-shape--v { width: 36px; height: 52px; }
.img-shape--h { width: 64px; height: 42px; }
.img-shape--g { width: 64px; height: 42px; background: repeating-linear-gradient(90deg, #d5dde6 0 18px, transparent 18px 23px); }

.repeater-item { border: 1px solid var(--line); border-radius: 8px; background: #fcfbf9; }
.repeater-item + .repeater-item { margin-top: 12px; }
.repeater-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.repeater-head b { font-size: 13px; color: var(--muted); flex: 1; }
.repeater-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 14px; padding: 14px; }

.kpi-col { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fcfbf9; display: flex; flex-direction: column; gap: 10px; }
.kpi-col h3 { font-size: 13px; color: var(--muted); font-family: var(--font); font-weight: 600; }

/* checklist + legacy */
.side-card .card-body { padding: 14px 16px 16px; }
.side-card h2 { font-size: 14px; }
.checklist { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.checklist li { display: flex; gap: 8px; padding: 3px 0; }
.checklist li::before { content: "○"; color: var(--red); }
.checklist li.ok::before { content: "✓"; color: var(--green); }
.checklist a { color: inherit; text-decoration: none; }
.checklist a:hover { text-decoration: underline; }
.legacy dl { margin: 8px 0 0; font-size: 13px; }
.legacy dt { font-weight: 600; color: #344054; margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; }
.legacy dd { margin: 2px 0 0; color: #475467; white-space: pre-line; }
.legacy .desc { font-size: 13px; color: #475467; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fcfbf9; margin-top: 8px; }
.legacy .desc p { margin: 0 0 6px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.thumbs a { display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #eee; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.copy-btn { font: 500 11px var(--font); border: 0; background: none; color: var(--navy); cursor: pointer; padding: 0; text-decoration: underline; }

/* --------------------------------------------------------- rich editor */
.rte { border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.rte:focus-within { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(23,47,98,.18); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border-bottom: 1px solid var(--line); background: #faf9f6; border-radius: 8px 8px 0 0; }
.rte-bar button {
  min-width: 30px; height: 28px; padding: 0 7px; border: 0; border-radius: 5px; background: transparent; cursor: pointer; font-size: 13px;
}
.rte-bar button:hover { background: #ebe9e3; }
.rte-bar button.is-on { background: var(--navy-100); color: var(--navy); }
.rte-bar select { width: auto; min-height: 28px; height: 28px; padding: 0 6px; font-size: 13px; }
.rte-bar .sep { width: 1px; background: var(--line); margin: 3px 4px; }
.rte-area { min-height: 130px; max-height: 480px; overflow: auto; padding: 10px 12px; line-height: 1.55; }
.rte-area:empty::before { content: attr(data-placeholder); color: #a0a4ab; }
.rte-area p { margin: 0 0 .7em; }
.rte-area h2, .rte-area h3, .rte-area h4 { margin: .6em 0 .4em; }
.rte-area h2 { font-size: 20px; } .rte-area h3 { font-size: 17px; } .rte-area h4 { font-size: 15px; }
.rte-area ul, .rte-area ol { margin: 0 0 .7em; padding-left: 22px; }
.rte-source { display: block; width: 100%; min-height: 130px; border: 0; border-radius: 0 0 8px 8px; font: 12px/1.5 ui-monospace, Menlo, monospace; }

/* ------------------------------------------------------------ lists view */
.lists-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; }
.subnav a { padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--text); display: flex; justify-content: space-between; }
.subnav a span { color: var(--muted); font-size: 13px; }
.subnav a:hover { background: #ecebe6; }
.subnav a.is-active { background: var(--navy); color: #fff; }
.subnav a.is-active span { color: rgba(255,255,255,.7); }
.list-rows { display: flex; flex-direction: column; gap: 6px; }
.list-row { display: grid; grid-template-columns: repeat(3, minmax(120px, 1.3fr)) minmax(110px, 1fr) 90px auto; gap: 8px; align-items: center; min-width: 760px; }
.list-row--tech { grid-template-columns: repeat(3, minmax(120px, 1.3fr)) minmax(130px, 1fr) minmax(110px, 1fr) 90px auto; min-width: 920px; }
.list-row--single { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 90px auto; min-width: 0; max-width: 620px; }
.list-row--head { font-size: 12px; color: var(--muted); font-weight: 600; }
.list-row select { min-height: 38px; }
.list-row .usage { font-size: 12px; color: var(--muted); text-align: right; }
.list-row .actions { display: flex; gap: 2px; }
.list-row.is-new input { border-color: #9fb3d9; background: #f7f9fe; }
.list-foot { display: flex; gap: 10px; margin-top: 16px; align-items: center; }

/* ------------------------------------------------------------ export */
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 38px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--navy); color: #fff; display: grid; place-items: center; font: 600 12px var(--font-head);
}
.export-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.export-action { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.export-action b { font-size: 14px; }
.export-action .btn { align-self: flex-start; margin-top: auto; }
.warn-list { font-size: 13px; margin: 8px 0 0; padding-left: 18px; max-height: 360px; overflow: auto; }
.warn-list li { margin-bottom: 4px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.radio-row label { display: flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal--wide { width: min(1240px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.tabs button.is-on { background: var(--navy-100); color: var(--navy); }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy-900); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.is-error { background: var(--red); }

/* ------------------------------------------------ preview (template site) */
.pv { font-family: var(--font); color: var(--navy); background: #fafaf8; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.pv-hero { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; padding: 48px 56px 32px; }
.pv-hero h1 { font-size: 34px; margin-bottom: 30px; }
.pv-hero p { margin: 0 0 18px; color: #3d4a66; font-size: 14px; }
.pv-hero p strong { color: var(--navy); font-size: 15px; }
.pv-imgs { position: relative; min-height: 450px; }
.pv-img { position: absolute; border-radius: 18px; background: linear-gradient(135deg, #cfd8e2, #9eb0c2); color: #fff; display: grid; place-items: center; font: 600 13px var(--font-head); text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.pv-img--1 { left: 8%; top: 0; width: 30%; aspect-ratio: 1; }
.pv-img--2 { right: 0; top: -20px; width: 30%; aspect-ratio: 3/4; }
.pv-img--3 { left: 0; bottom: 0; width: 66%; aspect-ratio: 16/10; }
.pv-cats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 20px 56px 28px; }
.pv-cats div { padding: 4px 18px; border-left: 1px solid var(--line); font-size: 13px; color: #3d4a66; }
.pv-cats div:first-child { border-left: 0; padding-left: 0; }
.pv-cats b { display: block; font: 700 14px var(--font-head); color: var(--navy); margin-bottom: 4px; }
.pv-sections { background: var(--beige); padding: 40px 56px 56px; }
.pv-sec { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; border-top: 1px solid #9aa3b5; padding: 26px 0; }
.pv-sec h2 { font-size: 30px; }
.pv-sec .pv-content { font-size: 14px; color: #3d4a66; }
.pv-sec .pv-content p { margin: 0 0 10px; }
.pv-sec:first-child .pv-content { font-weight: 600; color: var(--navy); }
.pv-kpi { padding: 44px 56px; }
.pv-kpi > h2 { font-size: 30px; margin-bottom: 30px; }
.pv-kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #7d879c; border-top: 0; }
.pv-kpi-row > div { padding: 16px 20px 20px; text-align: center; border-left: 1px solid #7d879c; }
.pv-kpi-row > div:first-child { border-left: 0; }
.pv-kpi-row h4 { font: 600 10px var(--font); letter-spacing: .04em; margin-bottom: 18px; }
.pv-kpi-row h3 { font-size: 26px; margin-bottom: 14px; }
.pv-kpi-row p { font-size: 12px; font-weight: 600; margin: 0; }
.pv-gallery { background: var(--navy); color: #fff; padding: 40px 56px 50px; }
.pv-gallery h2 { color: #fff; font-size: 24px; margin-bottom: 20px; }
.pv-gallery-row { display: flex; gap: 14px; }
.pv-gallery-row span { flex: 1; aspect-ratio: 4/3; border-radius: 16px; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 12px; color: rgba(255,255,255,.6); }
.pv-empty { color: #a37c2c; font-style: italic; }
.html-out { width: 100%; min-height: 110px; font: 12px/1.5 ui-monospace, Menlo, monospace; background: #fbfaf7; }
.html-block + .html-block { margin-top: 14px; }

/* ------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login-card { width: min(360px, 100%); background: #fff; border-radius: 14px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login-error { color: var(--red); margin: 0; font-size: 14px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .edit-layout { grid-template-columns: 1fr; }
  .edit-side { position: static; max-height: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { padding: 16px; }
  .topbar { gap: 12px; padding: 0 16px; overflow-x: auto; }
  .brand-sub, .savestate { display: none; }
  .mainnav a { padding: 0 8px; font-size: 14px; }
  .edit-head { margin: -16px -16px 16px; padding: 10px 16px; }
  .grid-2, .grid-3, .grid-4, .img-guide, .export-actions, .lists-layout { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .repeater-body { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-row { grid-template-columns: 1fr 1fr; }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; }
  .pv-hero, .pv-sec, .pv-cats, .pv-kpi-row { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ multilingua */
.role { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,.14); }
.lang-tabs { display: inline-flex; padding: 3px; gap: 2px; background: #e9e7e1; border-radius: 9px; }
.lang-tabs button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 7px;
  background: transparent; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted);
}
.lang-tabs button.is-on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #c9c6be; display: inline-block; }
.dot.is-full { background: var(--green); }
.dot.is-partial { background: #d99a2b; }
.dot.is-empty { background: #d5d2ca; }
.trans-bar {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: space-between;
  padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius);
  background: var(--blue-bg); border: 1px solid #c8d5ee; font-size: 14px;
}
.trans-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ref { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; font-size: 12.5px; color: #5b6475; line-height: 1.4; }
.ref-lang { flex: none; font: 600 10px var(--font); padding: 2px 5px; border-radius: 4px; background: #e8e5de; color: #6a6559; margin-top: 1px; }
.ref-body { white-space: pre-line; min-width: 0; }
.ref-body em { color: #a0a4ab; }
.ref--html .ref-body { white-space: normal; max-height: 160px; overflow: auto; border-left: 2px solid #e1ded6; padding-left: 8px; }
.ref--html .ref-body p { margin: 0 0 6px; }
.langs { display: flex; gap: 4px; }
.lang-badge { font: 600 11px var(--font); padding: 2px 6px; border-radius: 5px; }
.lang-badge.is-full { background: var(--green-bg); color: var(--green); }
.lang-badge.is-partial { background: var(--amber-bg); color: var(--amber); }
.lang-badge.is-empty { background: #efeeea; color: #9a988f; }
.projects small.sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tech-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.tech-row select { flex: 1 1 320px; max-width: 520px; }
.cap-out { font-size: 14px; }
.ml-row + .ml-row, .ml-with-del + .ml-with-del { margin-top: 14px; }
.ml-with-del { display: flex; gap: 10px; align-items: flex-end; }
.ml-with-del .ml-row { flex: 1; }
.ml-with-del + .btn { margin-top: 14px; }
.lang-table { border-collapse: collapse; font-size: 14px; margin-bottom: 6px; }
.lang-table th, .lang-table td { text-align: left; padding: 5px 16px 5px 0; border-bottom: 1px solid #eeece7; }
.lang-table th { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------ v3 */
.primary-mark { font-size: 10px; color: #b7791f; margin-left: -2px; }
.tech-rows { display: flex; flex-direction: column; gap: 8px; }
.tech-row { display: flex; gap: 6px; align-items: center; }
.tech-row select { flex: 1 1 320px; max-width: 520px; }
.cap-out { margin-top: 6px; }
.img-files { margin-top: 14px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 8px; }
.img-file { display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: var(--muted); font-size: 11px; }
.img-file img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; background: #eee; border: 2px solid transparent; }
.img-file.is-banner img { border-color: var(--navy); }
.img-file span { font-weight: 600; color: var(--text); font-size: 12px; }
.img-file.is-banner span { color: var(--navy); }

/* ------------------------------------------------------------ banner drag & drop */
.banner-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.banner-slot {
  display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px;
  border: 2px dashed var(--line-strong); background: #fcfbf9; transition: border-color .15s, background .15s;
}
.banner-slot.has-img { border-style: solid; border-color: var(--line); }
.img-files.is-dragging .banner-slot { border-color: #9fb3d9; background: #f5f8fe; }
.banner-slot.is-over, .img-files.is-dragging .banner-slot.is-over { border-color: var(--navy); background: var(--navy-100); }
.banner-slot-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-height: 30px; }
.banner-slot-head b { color: var(--navy); font-family: var(--font-head); }
.banner-slot-head .btn { margin-left: auto; }
.banner-slot-img { cursor: grab; }
.banner-slot-img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.banner-slot-empty { aspect-ratio: 4/3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.banner-slot-name { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-files .img-grid { padding: 8px; margin: 8px -8px 0; border-radius: 10px; border: 2px dashed transparent; }
.img-files.is-dragging .img-grid { border-color: #d7d3ca; }
.img-files .img-grid.is-over { border-color: var(--navy); background: var(--navy-100); }
.img-file { cursor: grab; }
.img-file.is-dragging, .banner-slot-img.is-dragging { opacity: .4; }
.img-file small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-file-actions { display: flex; gap: 4px; }
.img-file-actions .btn { height: 24px; min-width: 28px; padding: 0 6px; font-size: 12px; }
@media (max-width: 760px) { .banner-slots { grid-template-columns: 1fr; } }
/* anteprima del ritaglio come nel template */
.banner-slots { align-items: start; }
.banner-slot--sq .banner-slot-img img, .banner-slot--sq .banner-slot-empty { aspect-ratio: 1; }
.banner-slot--v .banner-slot-img img, .banner-slot--v .banner-slot-empty { aspect-ratio: 3/4; width: 75%; margin: 0 auto; }
.banner-slot--h .banner-slot-img img, .banner-slot--h .banner-slot-empty { aspect-ratio: 16/10; }
.banner-slot-img img { border-radius: 14px; }

/* ------------------------------------------------------------ anteprima v5 */
.pv-img { overflow: hidden; }
.pv-img.has-img { background: #ddd; }
.pv-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-cats { grid-template-columns: 1.4fr 1fr 1fr 1fr; align-items: center; }
.pv-cap { display: flex; gap: 16px; align-items: center; }
.pv-cap-icon {
  flex: none; width: 60px; height: 60px; border-radius: 50%; background: #8d9fae;
  position: relative; overflow: hidden;
}
.pv-cap-icon::before { content: ""; position: absolute; left: 0; right: 0; top: 36%; height: 11%; background: #fafaf8; }
.pv-cap-icon::after { content: ""; position: absolute; left: 34%; right: 34%; top: 47%; bottom: 0; background: #fafaf8; }
.pv-cap-list { display: flex; flex-direction: column; gap: 8px; }
.pv-cap-list b { display: block; font: 700 15px var(--font-head); color: var(--navy); margin-bottom: 2px; }
.pv-gallery-row { overflow-x: auto; padding-bottom: 6px; }
.pv-gallery-row img { flex: none; height: 180px; width: auto; max-width: 320px; aspect-ratio: 4/3; object-fit: cover; border-radius: 16px; }

/* ------------------------------------------------------------ agente AI */
.agent-files { margin: 0; padding-left: 18px; font-size: 14px; }
.agent-files li { margin-bottom: 4px; }
.agent-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 2px dashed var(--line-strong);
  border-radius: 10px; background: #fcfbf9; cursor: pointer; text-align: center; color: var(--muted);
}
.agent-drop b { color: var(--navy); }
.agent-drop.is-over { border-color: var(--navy); background: var(--navy-100); }
.agent-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.agent-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.agent-errors { margin-top: 14px; padding: 10px 14px; border-radius: 8px; background: var(--red-bg); color: var(--red); }
.agent-errors p { margin: 0; }
.agent-items { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.agent-item { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.agent-item--error { border-color: #f0c2bd; }
.agent-item--unchanged { opacity: .7; }
.agent-item summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; cursor: pointer; font-size: 14px; }
.agent-item summary b { flex: 1 1 240px; }
.agent-warn-inline { font-size: 12px; color: var(--amber); font-weight: 600; }
.agent-item-body { padding: 0 12px 12px; }
.agent-list { margin: 0 0 8px; padding-left: 18px; font-size: 13px; }
.agent-list--err { color: var(--red); }
.agent-list--warn { color: var(--amber); }
table.diff { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
table.diff th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.diff th:nth-child(1) { width: 170px; } table.diff th:nth-child(2) { width: 38px; }
table.diff td { padding: 5px 6px; border-bottom: 1px solid #f0eee9; vertical-align: top; word-wrap: break-word; }
.diff-before { color: #8a5a55; background: #fdf4f3; }
.diff-after { color: #2d5f45; background: #f1f8f4; }
.diff em { color: #a0a4ab; }
.agent-done { margin-top: 16px; padding: 12px 14px; border-radius: 8px; background: var(--green-bg); color: var(--green); }

/* ------------------------------------------------------------ stato salvataggio */
.save-ind { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; justify-content: flex-end; font-size: 13px; color: var(--muted); white-space: nowrap; }
.save-ind--saved span { color: var(--green); }
.save-ind--saving span, .save-ind--pending span { color: var(--muted); font-style: italic; }
.save-ind--error span, .save-ind--conflict span { color: var(--red); font-weight: 600; }

/* ------------------------------------------------------------ ordine gallery */
.gallery-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.gallery-head b { font-size: 14px; color: var(--navy); }
.gallery-head .btn { margin-left: auto; }
.img-grid--order { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.img-file { position: relative; }
.img-file-thumb { position: relative; }
.img-pos, .img-role {
  position: absolute; top: 6px; font: 600 11px var(--font); padding: 1px 6px; border-radius: 5px; pointer-events: none;
}
.img-pos { left: 6px; background: rgba(15, 33, 72, .78); color: #fff; }
.img-role { right: 6px; background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.img-file-actions .btn.is-on { background: var(--navy); border-color: var(--navy); color: #fff; opacity: 1; }
.img-file-actions .btn--ghost { min-width: 22px; padding: 0 4px; }
.img-file.drop-before::before, .img-file.drop-after::after {
  content: ""; position: absolute; top: 0; bottom: 18px; width: 3px; border-radius: 2px; background: var(--navy);
}
.img-file.drop-before::before { left: -7px; }
.img-file.drop-after::after { right: -7px; }
.img-file .img-pos, .img-file.is-banner .img-pos { color: #fff; font-size: 11px; }
.img-file .img-role, .img-file.is-banner .img-role { color: var(--navy); font-size: 11px; }
