/* BachecaSicura Admin — stessi token del sito pubblico (apps/web/assets/css/bs.css): bordeaux #660033. */
:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #fffdf9;
  --surface-2: #fbf8f2;
  --ink: #111425;
  --ink-2: #2a2e42;
  --muted: #5f6475;
  --line: #e4e0d6;
  --line-strong: #d4cfc3;
  --brand: #660033;
  --brand-rgb: 102, 0, 51;
  --brand-2: #8c1d52;
  --brand-ink: #660033;
  --brand-soft: #f6e6ee;
  --grad: linear-gradient(135deg, #660033 0%, #8c1d52 100%);
  --ok: #1f7a4d;
  --ok-bg: #e7f5ec;
  --warn: #8a5a0b;
  --warn-bg: #fdf3dd;
  --danger: #b4232c;
  --danger-bg: #fde8e8;
  --info: #23508f;
  --info-bg: #e7effb;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 20, 37, 0.05);
  --shadow: 0 12px 32px rgba(17, 20, 37, 0.08);
  --shadow-lg: 0 24px 60px rgba(17, 20, 37, 0.18);
  --focus: 0 0 0 3px rgba(102, 0, 51, 0.35);
  --sidebar-w: 256px;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 100% 0%, rgba(140, 29, 82, 0.06), transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', 'Manrope', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
h3 { font-size: 1.05rem; font-weight: 700; }
h4 { font-size: 0.98rem; font-weight: 700; }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.is-hidden { display: none !important; }
.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: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }

/* ---------- Focus & skip link ---------- */
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--brand); }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1000; background: var(--ink); color: #fff; padding: 0.6rem 1rem; border-radius: 10px; }
.skip-link:focus { top: 12px; }

/* ---------- Form controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea,
label > .input-row, label > .input-icon, label > .slug-field, label > small { display: flex; margin-top: 0.35rem; }
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { display: block; }
label > small { display: block; }
label > small, label .muted { font-weight: 400; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 0.4rem; }
legend { font-size: 0.88rem; font-weight: 700; padding: 0; margin-bottom: 0.35rem; color: var(--ink-2); }
fieldset.panel { padding: 1rem; border: 1px solid var(--line); }
fieldset.panel > legend { padding: 0 0.3rem; }
.req { color: var(--brand); }
.input-lg { font-size: 1.2rem; font-weight: 700; padding: 0.75rem 0.9rem; }
.input-narrow { max-width: 6.5rem; }
.input-row { display: flex; gap: 0.5rem; align-items: center; }
.input-row input { flex: 1; }
.input-icon { position: relative; display: block; font-weight: 400; }
.input-icon .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 2.3rem; }
.inline-check { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 500; }
.check-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }

/* ---------- Buttons ---------- */
button { cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.58rem 1rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.9rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: transform 0.05s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  background: #fff; color: var(--ink);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(102, 0, 51, 0.28); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(102, 0, 51, 0.38); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #17633e; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #961c24; color: #fff; }
.btn-danger-outline { background: #fff; border-color: #efb7bb; color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-danger-text { color: var(--danger); }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.82rem; }
.btn-lg { padding: 0.8rem 1.2rem; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); padding: 0;
}
.icon-btn:hover { border-color: var(--ink-2); text-decoration: none; }
.icon-btn-danger { color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-ink); font-weight: 700; text-decoration: underline; }
.link-more { font-size: 0.85rem; font-weight: 700; display: inline-flex; gap: 0.3rem; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 700; color: var(--muted); background: none; border: 0; padding: 0; width: fit-content; }
.crumb:hover { color: var(--ink); text-decoration: none; }

/* ---------- Layout ---------- */
.admin-layout { min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.admin-sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 1.1rem 0.85rem; display: flex; flex-direction: column; gap: 1rem;
}
.sidebar-brand, .login-brand { display: flex; align-items: center; gap: 0.65rem; padding: 0.2rem 0.4rem; color: var(--ink); }
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 2.3rem; height: 2.3rem; border-radius: 12px; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; box-shadow: 0 6px 14px rgba(102, 0, 51, 0.3);
}
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; font-weight: 800; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-weight: 600; }
.admin-nav { display: grid; gap: 0.9rem; }
.nav-group { display: grid; gap: 0.15rem; }
.nav-group-label { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0.7rem 0.2rem; }
.admin-link {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.7rem; border-radius: 12px;
  color: var(--ink-2); font-weight: 600; font-size: 0.92rem;
}
.admin-link .icon { color: var(--muted); }
.admin-link:hover { background: var(--surface-2); text-decoration: none; }
.admin-link.active { background: var(--brand-soft); color: var(--brand-ink); }
.admin-link.active .icon { color: var(--brand); }
.admin-link-label { flex: 1; }
.sidebar-pill {
  min-width: 1.4rem; height: 1.4rem; border-radius: 999px; background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; padding: 0 0.4rem;
}
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 0.7rem; display: grid; gap: 0.15rem; }
.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 0.9rem;
  padding: 0.7rem 1.6rem; background: rgba(246, 243, 236, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-weight: 800; display: none; }
.nav-toggle { display: none; }
.quick-search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; }
.quick-search > .icon { position: absolute; left: 0.85rem; color: var(--muted); pointer-events: none; }
.quick-search input { padding-left: 2.4rem; padding-right: 2.2rem; border-radius: 999px; background: #fff; }
.qs-kbd { position: absolute; right: 0.7rem; font-size: 0.72rem; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 0.35rem; color: var(--muted); font-family: inherit; }
.quick-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; list-style: none; margin: 0; padding: 0.35rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); z-index: 60;
}
.quick-search-results li a { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.6rem; border-radius: 10px; color: var(--ink); }
.quick-search-results li a:hover, .quick-search-results li a:focus { background: var(--surface-2); text-decoration: none; }
.qs-empty { padding: 0.6rem; color: var(--muted); font-size: 0.88rem; }
.qs-all a { justify-content: center !important; font-weight: 700; font-size: 0.85rem; color: var(--brand-ink) !important; }
.topbar-cta { margin-left: auto; }
.admin-content { padding: 1.6rem; width: 100%; max-width: 1440px; outline: none; }
.nav-backdrop { display: none; }
.noscript { padding: 1rem; text-align: center; }

/* ---------- Generic blocks ---------- */
.stack-xs, .stack-sm, .stack-md, .stack-lg { display: grid; align-content: start; }
.stack-xs { gap: 0.3rem; }
.stack-sm { gap: 0.6rem; }
.stack-md { gap: 1rem; }
.stack-lg { gap: 1.4rem; }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-heading { display: grid; gap: 0.3rem; }
.action-inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.action-inline.nowrap { flex-wrap: nowrap; }
.form-actions { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; padding-top: 0.4rem; border-top: 1px solid var(--line); }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.2rem; box-shadow: var(--shadow-sm); min-width: 0;
}
.panel-soft { background: var(--surface-2); box-shadow: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.callout {
  display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.8rem 1rem; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--ink-2); font-size: 0.9rem;
}
.callout > .icon { margin-top: 0.15rem; }
.callout-info { background: var(--info-bg); border: 1px solid #c9daf3; color: var(--info); }
.callout-risk { background: var(--warn-bg); border: 1px solid #f1d590; color: #6b4507; }
.callout-danger { background: var(--danger-bg); border: 1px solid #f3b8bc; color: #7f1820; }
.callout a { color: inherit; font-weight: 700; text-decoration: underline; }
.form-grid { display: grid; gap: 0.9rem; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col-span-2 { grid-column: 1 / -1; }
.toolbar-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.form-status { font-size: 0.9rem; color: var(--muted); }
.form-status:empty { display: none; }
.form-status.is-error { color: var(--danger); font-weight: 600; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem; border-radius: 999px; padding: 0.18rem 0.6rem;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap; background: #f1eee7; color: #4f5366;
}
.badge .icon { width: 0.95em; height: 0.95em; }
.badge-neutral { background: #f1eee7; color: #4f5366; }
.badge-success { background: var(--ok-bg); color: var(--ok); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-risk { background: #fff1c7; color: #7a4b00; border: 1px solid #f0cd6a; }
.badge-tonight { background: var(--grad); color: #fff; }
.badge-tonight .dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.mini-meter { display: inline-block; width: 2.4rem; height: 0.35rem; border-radius: 999px; background: #e4e0d6; overflow: hidden; }
.mini-meter span { display: block; height: 100%; background: var(--grad); }
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 0.22rem 0.65rem; font-size: 0.8rem; background: #fff; font-weight: 600; }
.chip-btn { cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 0.4rem; max-height: 15rem; overflow: auto; padding: 0.1rem; }
.check-chip { display: inline-flex; font-weight: 600; font-size: 0.84rem; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span { border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.3rem 0.75rem; background: #fff; transition: all 0.12s; }
.check-chip input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.check-chip input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Users / avatars ---------- */
.user-inline { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); min-width: 0; }
a.user-inline:hover { text-decoration: none; }
a.user-inline:hover strong { color: var(--brand-ink); }
.user-inline-text { display: grid; min-width: 0; }
.user-inline-text strong { font-weight: 700; }
.user-inline-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.avatar-dot {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; flex: none; background: var(--brand-soft); color: var(--brand-ink);
  display: inline-grid; place-items: center; font-weight: 800;
}
.avatar-dot-large { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; }
.avatar-dot-xl { width: 4rem; height: 4rem; font-size: 1.5rem; background: var(--grad); color: #fff; }
.avatar-photo { width: 2.6rem; height: 2.6rem; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.avatar-photo-large { width: 4rem; height: 4rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
table { width: 100%; border-collapse: collapse; }
.data-table { min-width: 760px; }
th, td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.88rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfbf6; }
th { background: var(--surface-2); font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; display: inline-flex; gap: 0.3rem; align-items: center; }
.th-sort:hover, .th-sort.is-active { color: var(--ink); }
.sort-arrow { font-size: 0.7rem; opacity: 0.6; }
.cell-wrap { max-width: 280px; overflow-wrap: anywhere; }
.cell-bio { max-width: 360px; font-size: 0.84rem; }
.bio-snippet { color: var(--ink-2); }
.table-edit td { padding: 0.45rem 0.5rem; }
.table-edit input, .table-edit select, .table-edit textarea { padding: 0.42rem 0.55rem; font-size: 0.86rem; }
.table-edit textarea { min-height: 2.3rem; }
tr.row-risk { background: #fffaf0; }
tr.row-risk-urgent { background: #fff1ef; box-shadow: inset 3px 0 0 var(--danger); }
mark.risk-mark { background: #ffe08a; color: inherit; border-radius: 4px; padding: 0 2px; }
.pager-row { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; font-size: 0.86rem; }
.pager-pos { font-weight: 600; font-size: 0.85rem; }

/* ---------- States ---------- */
.state { display: grid; justify-items: center; text-align: center; gap: 0.5rem; padding: 2.4rem 1rem; }
.state-icon { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.state-icon .icon { width: 1.4rem; height: 1.4rem; }
.state-empty strong { font-size: 1.02rem; }
.state-empty p { max-width: 42ch; }
.state-error { grid-template-columns: auto 1fr auto; text-align: left; justify-items: start; align-items: center; padding: 1rem; background: var(--danger-bg); border-radius: var(--radius-md); color: #7f1820; }
.state-error .state-icon { background: #fff; color: var(--danger); width: 2.4rem; height: 2.4rem; }
.tech-details summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); }
.tech-details code { display: block; margin-top: 0.3rem; font-size: 0.75rem; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
.skeleton-list { display: grid; gap: 0.7rem; padding: 0.4rem 0; }
.skeleton-line { height: 0.9rem; border-radius: 6px; background: linear-gradient(90deg, #efebe2 25%, #f7f4ee 50%, #efebe2 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skeleton-line.wide { height: 1.8rem; width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi {
  display: grid; gap: 0.35rem; align-content: start; padding: 1rem 1.1rem; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.12s;
}
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.kpi-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-hint { font-size: 0.8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.kpi-alert { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 26px rgba(102, 0, 51, 0.3); }
.kpi-alert .kpi-label, .kpi-alert .kpi-hint { color: rgba(255, 255, 255, 0.92); }
.kpi-calm .kpi-value { color: var(--ok); }
.kpi-tonight { border-color: #e6c6d5; background: linear-gradient(160deg, #fff 0%, #fbf0f5 100%); }
.kpi-tonight .kpi-value { color: var(--brand-ink); }
.kpi-skeleton { min-height: 100px; }
.dash-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-grid-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: #ebe7de; stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart-bar { fill: url(#barGrad); }
.chart-bar.is-today { fill: var(--ink); }
.chart-hit { fill: transparent; }
.chart-bar-g:hover .chart-bar { opacity: 0.8; }
.chart-bar-g:hover .chart-hit { fill: rgba(102, 0, 51, 0.06); }
.breakdown { display: grid; gap: 0.75rem; }
.breakdown-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 0.6rem; align-items: center; font-size: 0.88rem; }
.breakdown-label a { color: var(--ink-2); font-weight: 600; }
.breakdown-track { height: 0.55rem; border-radius: 999px; background: #efebe2; overflow: hidden; }
.breakdown-fill { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.fill-ok { background: #3aa66f; }
.fill-danger { background: #d9545c; }
.fill-muted { background: #b9b5aa; }
.list-rows { list-style: none; margin: 0; padding: 0; display: grid; }
.list-rows li { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.list-rows li:last-child { border-bottom: 0; }
.list-rows-meta { display: flex; gap: 0.6rem; align-items: center; }
.shortcut-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.shortcut { display: flex; gap: 0.7rem; align-items: center; padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--ink); background: #fff; }
.shortcut > .icon { width: 2.2rem; height: 2.2rem; padding: 0.5rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.shortcut span { display: grid; }
.shortcut small { color: var(--muted); }
.shortcut:hover { border-color: var(--brand); text-decoration: none; }

/* ---------- Segmented / tabs ---------- */
.segmented, .editor-tabs { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; background: #ece8df; border-radius: 999px; width: fit-content; max-width: 100%; }
.seg { border: 0; background: transparent; padding: 0.45rem 0.9rem; border-radius: 999px; font-weight: 700; font-size: 0.86rem; color: var(--muted); display: inline-flex; gap: 0.4rem; align-items: center; }
.seg:hover { color: var(--ink); }
.seg.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-count { background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; padding: 0 0.45rem; font-size: 0.74rem; }
.tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 0.6rem 0.9rem; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 0; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tab-panel.is-hidden { display: none; }
.toggle-field { align-self: end; }
.toggle { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.8rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; font-weight: 600; cursor: pointer; }

/* ---------- User detail ---------- */
.profile-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.profile-title { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.detail-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.8rem; margin: 0; }
.detail-dl > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 0.7rem 0.8rem; display: grid; gap: 0.25rem; }
.detail-dl dt { font-size: 0.76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.detail-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mini-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.8rem; font-size: 0.82rem; margin: 0.5rem 0 0; }
.mini-dl dt { color: var(--muted); }
.mini-dl dd { margin: 0; }
.risk-quote { margin: 0.3rem 0 0; padding: 0.6rem 0.8rem; background: #fff; border-radius: var(--radius-sm); border-left: 3px solid #f0cd6a; white-space: pre-wrap; font-size: 0.88rem; color: var(--ink); }
.report-replies { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.report-replies li { display: grid; gap: 0.15rem; padding: 0.55rem 0.75rem; background: var(--surface-2, #f7f4f6); border-radius: var(--radius-sm); border-left: 3px solid var(--brand, #660033); overflow-wrap: anywhere; }
.report-replies li .small:last-child { white-space: pre-wrap; color: var(--muted, #555); }
.gallery-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.gallery-thumb { width: 4.4rem; height: 4.4rem; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.gallery-thumb-lg { width: 8rem; height: 8rem; }
.gallery-fig { margin: 0; display: grid; gap: 0.25rem; font-size: 0.78rem; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); display: grid; gap: 0.9rem; }
.timeline li { position: relative; display: grid; gap: 0.2rem; }
.timeline li::before { content: ''; position: absolute; left: calc(-1rem - 6px); top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.timeline-head { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.json-inline { margin: 0.4rem 0 0; white-space: pre-wrap; word-break: break-word; font-size: 0.76rem; color: var(--ink-2); background: var(--surface-2); padding: 0.6rem; border-radius: 8px; max-height: 260px; overflow: auto; }

/* ---------- Wizard ---------- */
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.stepper li { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.step-num { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: #efebe2; font-size: 0.8rem; flex: none; }
.stepper li.is-current { border-color: var(--brand); color: var(--ink); }
.stepper li.is-current .step-num { background: var(--grad); color: #fff; }
.stepper li.is-done .step-num { background: var(--ok); color: #fff; }
.preview-profile { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem; background: var(--surface-2); display: grid; gap: 0.8rem; max-width: 560px; }
.preview-head { display: flex; align-items: center; gap: 0.75rem; }
.success-panel { border-color: #bfe3cc; }

/* ---------- Taxonomies ---------- */
.taxonomy-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1rem; align-items: start; }
.taxonomy-side { display: grid; gap: 0.9rem; padding: 0.8rem; position: sticky; top: 80px; }
.side-group { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0.5rem; }
.taxonomy-link { text-align: left; padding: 0.5rem 0.7rem; border-radius: 10px; border: 0; background: none; font-weight: 600; width: 100%; }
.taxonomy-link:hover { background: var(--surface-2); }
.taxonomy-link.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.search-inline { max-width: 360px; }
.switch { display: inline-flex; }
.switch input { width: 1.1rem; height: 1.1rem; }

/* ---------- Content editor ---------- */
.content-cell { display: flex; align-items: center; gap: 0.7rem; background: none; border: 0; padding: 0; text-align: left; color: var(--ink); }
.content-cell span { display: grid; }
.content-cell:hover strong { color: var(--brand-ink); }
.content-thumb { width: 3rem; height: 2.4rem; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.content-thumb-empty { display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.editor-side { position: sticky; top: 80px; }
.side-title { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.slug-field { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; font-weight: 400; }
.slug-field:focus-within { border-color: var(--brand); box-shadow: var(--focus); }
.slug-prefix { padding: 0.6rem 0 0.6rem 0.75rem; color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; align-self: center; }
.slug-field input { border: 0; box-shadow: none !important; padding-left: 0.1rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.editor-body { display: grid; gap: 0.6rem; }
.editor-textarea { min-height: 420px; font-size: 1rem; line-height: 1.7; padding: 1rem; }
.editor-foot { margin-top: -0.2rem; }
.prose-preview { min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.4rem 1.6rem; background: #fff; line-height: 1.7; font-size: 1rem; }
.prose-preview h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 0.6rem; line-height: 1.15; }
.prose-preview p { margin: 0 0 1em; }
.prose-kicker { color: var(--brand-ink); font-weight: 800; text-transform: uppercase; font-size: 0.78rem; letter-spacing: 0.06em; }
.prose-lead { color: var(--muted); font-size: 1.1rem; }
.prose-cover { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius-md); margin-bottom: 1rem; }
.image-field { display: grid; gap: 0.5rem; }
.image-preview { border: 1px dashed var(--line-strong); border-radius: var(--radius-md); min-height: 140px; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); }
.image-preview img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.image-empty { color: var(--muted); font-size: 0.85rem; display: inline-flex; gap: 0.4rem; align-items: center; padding: 1rem; text-align: center; }
.char-counter { font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.char-counter.is-good { color: var(--ok); }
.char-counter.is-over { color: var(--danger); }
.serp { display: grid; gap: 0.2rem; padding: 0.85rem; border-radius: var(--radius-md); background: #fff; border: 1px solid var(--line); font-family: Arial, Helvetica, sans-serif; }
.serp-site { display: flex; gap: 0.5rem; align-items: center; font-size: 0.8rem; color: #202124; }
.serp-site span { display: grid; line-height: 1.2; }
.serp-site small { color: #4d5156; font-size: 0.74rem; overflow-wrap: anywhere; }
.serp-fav { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--grad); color: #fff; display: grid !important; place-items: center; font-weight: 700; font-size: 0.8rem; }
.serp-title { color: #1a0dab; font-size: 1.12rem; line-height: 1.3; }
.serp-desc { color: #4d5156; font-size: 0.85rem; line-height: 1.45; }
.save-state:empty { display: none; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; right: 1rem; bottom: 1rem; z-index: 2000; display: grid; gap: 0.5rem; width: min(380px, calc(100vw - 2rem)); }
.toast {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.8rem 0.9rem; border-radius: var(--radius-md);
  background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-size: 0.9rem; font-weight: 600;
  animation: toast-in 0.2s ease-out;
}
.toast-success .toast-icon { color: #7ee2a8; }
.toast-error { background: #7f1820; }
.toast-text { flex: 1; }
.toast-close { background: none; border: 0; color: inherit; opacity: 0.7; padding: 0; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 1500; background: rgba(17, 20, 37, 0.45); display: grid; place-items: center; padding: 1rem; animation: fade 0.15s; }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 2rem); overflow: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: grid; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; padding: 1.1rem 1.2rem 0.4rem; }
.modal-body { padding: 0.4rem 1.2rem 0.6rem; display: grid; gap: 0.8rem; }
.modal-error { margin: 0 1.2rem; color: var(--danger); font-weight: 600; font-size: 0.88rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.8rem 1.2rem 1.1rem; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Login ---------- */
.login-body {
  background:
    radial-gradient(circle at 0% 0%, rgba(140, 29, 82, 0.12), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(102, 0, 51, 0.12), transparent 50%),
    var(--bg);
}
.admin-login-page { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; }
.admin-login-card { width: min(100%, 26rem); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 2rem; box-shadow: var(--shadow); display: grid; gap: 1rem; }
.admin-login-card h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; margin-top: 0.4rem; }
.login-brand { padding: 0; }
.login-foot { border-top: 1px solid var(--line); padding-top: 0.9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash-grid, .dash-grid-even { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side { position: static; }
}
@media (max-width: 960px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 85vw); z-index: 300;
    transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .admin-sidebar { transform: none; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 250; background: rgba(17, 20, 37, 0.4); }
  .nav-toggle { display: inline-grid; }
  .admin-topbar { padding: 0.6rem 1rem; gap: 0.6rem; }
  .admin-content { padding: 1.1rem 1rem 2rem; }
  .taxonomy-layout { grid-template-columns: 1fr; }
  .taxonomy-side { position: static; display: flex; flex-wrap: wrap; gap: 0.3rem; }
  .taxonomy-side > div { display: contents; }
  .side-group { display: none; }
  .taxonomy-link { width: auto; border: 1px solid var(--line); }
  .qs-kbd { display: none; }
}
@media (max-width: 640px) {
  :root { font-size: 14.5px; }
  h2 { font-size: 1.35rem; }
  .topbar-cta { display: none; }
  .form-grid.two-col { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(4, auto); }
  .stepper .step-label { display: none; }
  .stepper li { justify-content: center; }
  .stepper li.is-current .step-label { display: inline; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .kpi { padding: 0.8rem; }
  .kpi-value { font-size: 1.6rem; }
  .panel { padding: 0.95rem; border-radius: 16px; }
  .page-header-row { align-items: flex-start; }
  .page-header-row .action-inline { width: 100%; }
  .profile-hero .action-inline .btn { flex: 1; }
  .state-error { grid-template-columns: 1fr; }
  .modal-overlay { place-items: end center; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; }
  .admin-login-card { padding: 1.5rem; }
  .list-rows li { flex-wrap: wrap; }
  .breakdown-row { grid-template-columns: 90px 1fr auto; }
}
@media (max-width: 640px) {
  .table-wrap:has(.table-stack) { overflow: visible; border: 0; background: transparent; }
  .table-stack { min-width: 0; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: grid; gap: 0.35rem; padding: 0.8rem; margin-bottom: 0.6rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); }
  .table-stack tr.row-risk-urgent { box-shadow: inset 3px 0 0 var(--danger); }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; border: 0; padding: 0.1rem 0; max-width: none; text-align: right; }
  .table-stack td:first-child { text-align: left; padding-bottom: 0.3rem; }
  .table-stack td[data-label]::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; text-align: left; }
  .table-stack td:first-child::before { content: none; }
  .table-stack td:last-child { justify-content: flex-start; padding-top: 0.45rem; border-top: 1px solid var(--line); margin-top: 0.2rem; }
  .table-stack td:last-child .action-inline.nowrap { flex-wrap: wrap; }
  .table-stack .cell-bio { display: block; text-align: left; }
  .table-stack .cell-bio::before { display: block; margin-bottom: 0.2rem; }
  .table-stack .stack-xs { justify-items: end; }
  .pager-row { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Ritocchi ---------- */
label > .toggle { display: flex; width: fit-content; margin-top: 0.35rem; }
#profiles-summary:empty { display: none; }
#profiles-summary { display: grid; gap: 0.6rem; }
.slug-prefix { flex: none; max-width: none; }

/* ---------- Aggiornamenti database ---------- */
.callout-ok { background: var(--ok-bg); border: 1px solid #bfe3cc; color: var(--ok); }
.panel-ok { border-color: #bfe3cc; background: #f6fcf8; }
.panel-danger { border-color: #f3b8bc; background: #fff7f7; }
.migration-name { display: grid; gap: 0.1rem; }
.migration-name small { overflow-wrap: anywhere; }
.migration-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.25rem; font-size: 0.9rem; }
.migration-list small { overflow-wrap: anywhere; }
.bullet-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; }
.backup-check { padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.progress-note { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; color: var(--info); }
.spinner { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; cursor: pointer; font-weight: 800; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 0.3rem; display: grid; }
.row-menu-list button { background: none; border: 0; text-align: left; padding: 0.55rem 0.7rem; border-radius: 8px; font-weight: 600; font-size: 0.86rem; }
.row-menu-list button:hover, .row-menu-list button:focus-visible { background: var(--surface-2); }
.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.result-list li { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.7rem; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--line); }
.result-list li.is-error { border-color: #f3b8bc; }
.result-icon { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-bg); color: var(--ok); }
.is-error .result-icon { background: var(--danger-bg); color: var(--danger); }
@media (max-width: 640px) { .row-menu-list { right: auto; left: 0; } }
#db-last-run:empty, #db-alerts:empty { display: none; }
#db-alerts { display: grid; gap: 0.6rem; }
.migration-name + * , td > .stack-xs { justify-items: start; }

/* ---------- Moderazione ---------- */
.badge-critical { background: #7f1820; color: #fff; }
.sidebar-pill-urgent { background: #7f1820; box-shadow: 0 0 0 2px #f3b8bc; }
tr.row-critical { background: #ffe9e6; }
.kpi-urgent { background: linear-gradient(135deg, #7f1820 0%, #b4232c 100%); border-color: transparent; color: #fff; box-shadow: 0 10px 26px rgba(127, 24, 32, 0.3); }
.kpi-urgent .kpi-label, .kpi-urgent .kpi-hint { color: rgba(255, 255, 255, 0.92); }
.kpi-pending { border-color: #f1d590; background: linear-gradient(160deg, #fff 0%, #fff8e6 100%); }
.kpi-pending .kpi-value { color: var(--warn); }
.filter-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.filter-inline { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; color: var(--muted); }
.filter-inline select { width: auto; margin: 0; padding: 0.4rem 0.6rem; font-size: 0.86rem; }
.snippet { display: inline-flex; gap: 0.35rem; align-items: center; color: var(--ink-2); }
.modal-lg { width: min(860px, 100%); }
.modal-xl { width: min(1180px, 100%); }
.sheet-body { padding-bottom: 1.2rem; gap: 1rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.detail-grid h4, .tale-reader h1 { margin-bottom: 0.1rem; }
.decision-box { padding: 0.8rem 0.9rem; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 0.35rem; }
.mod-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.media-frame { border-radius: var(--radius-md); overflow: hidden; background: #1b1d2b; display: grid; place-items: center; min-height: 200px; }
.media-frame .media-el { width: 100%; max-height: 420px; object-fit: contain; display: block; }
.media-missing { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; min-height: 160px; padding: 1rem; text-align: center; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); font-size: 0.86rem; width: 100%; }
.media-frame .media-missing { background: transparent; border: 0; color: #c9cbd6; }

/* Card messaggi / racconti */
.mod-card { display: grid; gap: 0.8rem; }
.mod-card-open { border-left: 4px solid #f0cd6a; }
.mod-card-head { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.mod-route { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.msg-quote { font-size: 0.98rem; line-height: 1.55; }
.msg-context summary { cursor: pointer; font-weight: 700; font-size: 0.86rem; }
.thread { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.thread li { display: grid; gap: 0.15rem; padding: 0.5rem 0.7rem; border-radius: 12px; background: var(--surface-2); max-width: 85%; font-size: 0.88rem; }
.thread li.from-recipient { justify-self: end; background: #eef3fb; }
.thread li.is-flagged { outline: 2px solid #f0cd6a; background: #fffaf0; }
.tale-list { display: grid; gap: 0.8rem; }
.tale-card { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; }
.tale-card.has-risk { border-left: 4px solid #f0cd6a; }
.tale-excerpt { color: var(--ink-2); font-size: 0.92rem; max-width: 80ch; }
.tale-reader { min-height: 0; max-height: 55vh; overflow: auto; }

/* Griglia media */
.kbd-hint kbd, .media-card kbd { font-family: inherit; font-size: 0.72rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 0.35rem; background: #fff; color: var(--ink-2); }
.media-card kbd { background: rgba(255, 255, 255, 0.25); border-color: currentColor; color: inherit; opacity: 0.85; }
.media-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.media-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow 0.15s, border-color 0.15s, opacity 0.18s, transform 0.18s; outline: none; }
.media-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(102, 0, 51, 0.35), var(--shadow); }
.media-card.is-explicit { border-top: 4px solid #7f1820; }
.media-card.is-busy { opacity: 0.6; pointer-events: none; }
.media-card.is-leaving { opacity: 0; transform: scale(0.96); }
.media-card-preview { position: relative; background: #1b1d2b; aspect-ratio: 4 / 5; display: grid; place-items: center; }
.media-card-preview .media-el { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.media-card-preview video.media-el { cursor: default; }
.media-card-preview .media-missing { background: transparent; border: 0; color: #c9cbd6; height: 100%; }
.media-card-tags { position: absolute; top: 0.5rem; left: 0.5rem; right: 0.5rem; display: flex; gap: 0.3rem; flex-wrap: wrap; pointer-events: none; }
.media-card-tags .badge-neutral { background: rgba(255, 255, 255, 0.92); }
.media-card-body { padding: 0.8rem 0.9rem; display: grid; gap: 0.45rem; flex: 1; align-content: start; }
.media-caption { color: var(--ink-2); overflow-wrap: anywhere; }
.media-card-actions { display: flex; gap: 0.5rem; padding: 0 0.9rem 0.9rem; }
.media-card-actions .btn { flex: 1; }

/* Documenti verifica */
.doc-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.doc-slot { margin: 0; display: grid; gap: 0.4rem; align-content: start; }
.doc-slot figcaption { display: grid; gap: 0.1rem; font-size: 0.86rem; }
.doc-zoom { position: relative; display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: #1b1d2b; aspect-ratio: 4 / 3; cursor: zoom-in; }
.doc-zoom img { width: 100%; height: 100%; object-fit: contain; display: block; }
.doc-zoom-hint { position: absolute; right: 0.5rem; bottom: 0.5rem; width: 2rem; height: 2rem; border-radius: 50%; background: rgba(255, 255, 255, 0.92); display: grid; place-items: center; color: var(--ink); }
.doc-zoom:hover .doc-zoom-hint, .doc-zoom:focus-visible .doc-zoom-hint { background: var(--brand); color: #fff; }
.doc-pdf { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-2); }
.doc-slot-empty .media-missing { aspect-ratio: 4 / 3; min-height: 0; }

/* Lightbox */
.lightbox-overlay { background: rgba(10, 11, 20, 0.88); padding: 0; z-index: 1800; }
.lightbox { width: 100vw; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; color: #fff; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; padding: 0.7rem 1rem; flex-wrap: wrap; }
.lightbox-bar .icon-btn { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.lightbox-zoom { min-width: 3.2rem; text-align: center; font-weight: 700; font-size: 0.85rem; }
.lightbox-stage { overflow: auto; display: grid; place-items: center; padding: 0 1rem; outline: none; }
.lightbox-stage img { max-width: none; width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; cursor: zoom-in; user-select: none; }
.lightbox-stage img.is-zoomed { max-height: none; cursor: zoom-out; place-self: start; }
.lightbox-hint { text-align: center; padding: 0.5rem 1rem 0.8rem; color: rgba(255, 255, 255, 0.7); }

@media (max-width: 960px) {
  .detail-grid { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .doc-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: 1fr; }
  .media-card-preview { aspect-ratio: 4 / 3; }
  .kbd-hint { display: none; }
  .media-card kbd { display: none; }
  .tale-card { flex-direction: column; align-items: stretch; }
  .mod-actions .btn { flex: 1 1 calc(50% - 0.5rem); }
  .filter-row, .filter-inline, .filter-inline select { width: 100%; }
  .filter-inline { justify-content: space-between; }
  .filter-inline select { width: auto; flex: 1; }
  .modal-lg, .modal-xl { width: 100%; }
  .thread li { max-width: 100%; }
  .lightbox-hint { display: none; }
}
.media-missing.has-poster { position: relative; padding: 0; gap: 0; background: #1b1d2b; border: 0; }
.media-missing.has-poster img { width: 100%; height: 100%; object-fit: contain; opacity: 0.75; }
.media-missing-note { position: absolute; left: 0.5rem; right: 0.5rem; bottom: 0.5rem; display: flex; gap: 0.35rem; align-items: center; padding: 0.4rem 0.6rem; border-radius: 10px; background: rgba(17, 20, 37, 0.85); color: #fff; font-size: 0.78rem; text-align: left; }
.media-card-preview { overflow: hidden; }
.media-card-preview > .media-el, .media-card-preview > .media-missing { position: absolute; inset: 0; }
.media-missing.has-poster img { position: absolute; inset: 0; }

/* ---------- Marketing e tracciamento ---------- */
.mkt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
.mkt-preview { position: sticky; top: 1rem; }
.mkt-field { min-width: 0; }
.mkt-hint { margin: 0.35rem 0 0; line-height: 1.45; }
.mkt-hint a { color: var(--brand-ink); font-weight: 600; white-space: nowrap; }
.mkt-error { margin: 0.3rem 0 0; font-size: 0.84rem; font-weight: 600; color: var(--danger); }
.mkt-error:empty { display: none; }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.mkt-code { font-size: 0.82rem; min-height: 110px; }
.mkt-scenario { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.7rem 0.8rem; background: var(--surface-2); display: grid; gap: 0.4rem; }
.mkt-scenario ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.mkt-scenario li { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.85rem; min-width: 0; }
.mkt-scenario li span:first-child { overflow-wrap: anywhere; }
.mkt-scenario p { margin: 0; }
.callout.small { font-size: 0.84rem; }
@media (max-width: 1180px) {
  .mkt-layout { grid-template-columns: 1fr; }
  .mkt-preview { position: static; }
}

/* ---------- Tassonomie v2 (TASSONOMIE) ---------- */
.tax-side { gap: 0.25rem; }
.tax-link { display: flex; gap: 0.6rem; align-items: center; }
.tax-link-text { display: grid; min-width: 0; }
.tax-link-label { font-weight: 700; }
.tax-link-meta { font-size: 0.74rem; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tax-ico { width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; opacity: 0.78; }
.tax-ico.sm { width: 16px; height: 16px; flex-basis: 16px; }
.tax-ico-big { width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; opacity: 0.8; }
.tax-ico-empty { display: inline-block; border: 1.5px dashed var(--line-strong); border-radius: 6px; }
.tax-head-title { display: flex; gap: 0.9rem; align-items: flex-start; }
.tax-head h2 { margin: 0; font-size: 1.3rem; }
.tax-settings > summary { cursor: pointer; display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.tax-settings[open] > summary { margin-bottom: 0.9rem; }
.tax-settings-grid .span-2 { grid-column: 1 / -1; }
.field-label { font-weight: 600; font-size: 0.86rem; }
.icon-pick { display: inline-flex; align-items: center; gap: 0.45rem; }
.group-editor { display: grid; gap: 0.45rem; }
.group-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 10rem; gap: 0.5rem; align-items: center; }
.input-code { font-size: 0.82rem; }
.tax-work { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.tax-preview { position: sticky; top: 80px; }
.toolbar-inline { display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.term-group-title { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.5rem; font-size: 0.95rem; }
.term-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.term-empty { padding: 0.4rem 0.2rem; }
.term-row { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; padding: 0.55rem 0.65rem; display: grid; gap: 0.5rem; }
.term-row.is-inactive { background: var(--surface-2); opacity: 0.75; }
.term-row.is-dragging { opacity: 0.4; }
.term-row.drop-before { box-shadow: 0 -3px 0 var(--brand); }
.term-main { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.drag-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; user-select: none; padding: 0 0.1rem; }
.term-move { display: inline-flex; gap: 0.2rem; }
.icon-btn.sm { width: 1.7rem; height: 1.7rem; font-size: 0.85rem; }
.term-icon { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 0.3rem; }
.term-icon:hover { border-color: var(--brand); }
.term-name { display: grid; flex: 1 1 12rem; min-width: 10rem; }
.term-name input { font-weight: 600; }
.term-extra { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.5rem; font-size: 0.82rem; }
.term-extra label { display: grid; gap: 0.2rem; color: var(--muted); font-weight: 600; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.45rem; max-height: 52vh; overflow: auto; padding: 0.2rem; }
.icon-cell { display: grid; justify-items: center; gap: 0.3rem; padding: 0.6rem 0.3rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-size: 0.72rem; color: var(--muted); word-break: break-word; text-align: center; }
.icon-cell:hover { border-color: var(--ink-2); }
.icon-cell[aria-selected="true"] { border-color: var(--brand); box-shadow: var(--focus); color: var(--brand-ink); }
.preview-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.9rem; background: var(--bg); display: grid; gap: 0.5rem; }
.preview-q { display: flex; align-items: center; gap: 0.45rem; margin: 0; }
.preview-hint { color: var(--muted); margin: 0; }
.preview-group { display: flex; align-items: center; gap: 0.4rem; margin: 0.4rem 0 0; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.preview-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.preview-chip { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 0.35rem 0.7rem; font-weight: 600; font-size: 0.82rem; color: var(--ink); }
.preview-chip:hover { border-color: var(--brand); }
.preview-chip.is-on { background: var(--grad); border-color: transparent; color: #fff; }
.preview-chip.is-on .tax-ico { filter: brightness(0) invert(1); opacity: 1; }
.pv-lock { color: var(--brand); font-weight: 900; }
.preview-chip.is-on .pv-lock { color: #fff; }
.preview-lock { display: flex; gap: 0.5rem; align-items: center; color: var(--info); background: var(--info-bg); padding: 0.6rem 0.7rem; border-radius: var(--radius-sm); margin: 0; }
.notice-warn { border-color: #f0cd6a; background: var(--warn-bg); color: var(--warn); }
@media (max-width: 1180px) {
  .tax-work { grid-template-columns: 1fr; }
  .tax-preview { position: static; }
}
@media (max-width: 640px) {
  .group-row { grid-template-columns: auto minmax(0, 1fr); }
  .group-row .input-code { grid-column: 2; }
  .term-name { flex-basis: 100%; order: 3; }
  .term-main [data-save] { order: 4; }
}
.term-row input, .term-row select { padding: 0.36rem 0.55rem; font-size: 0.86rem; min-height: 0; }
.term-main .btn-sm { margin-left: auto; }
.term-name { flex: 1 1 9rem; }
.term-extra { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.9fr); }
.term-extra label { font-size: 0.74rem; }
@media (max-width: 760px) {
  .term-extra { grid-template-columns: 1fr; }
  .taxonomy-side.tax-side { flex-wrap: nowrap; overflow-x: auto; padding: 0.5rem; scroll-snap-type: x proximity; }
  .tax-side .tax-link { width: auto; flex: 0 0 auto; white-space: nowrap; scroll-snap-align: start; }
  .tax-side .tax-link-meta { display: none; }
  .term-main .btn-sm { margin-left: 0; }
}

/* Eventi e Club */
.evc-badges { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.evc-thumb { width: 3rem; height: 2.4rem; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; }
.evc-cell strong, .evc-event-cell strong { overflow-wrap: anywhere; }
.evc-cell small, .evc-event-cell small { overflow-wrap: anywhere; }
.evc-event-cell { min-width: 0; }
.evc-date { display: grid; justify-items: center; align-content: center; flex: none; width: 3.1rem; min-height: 3.1rem; padding: 0.2rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); line-height: 1.05; text-align: center; }
.evc-date strong { font-size: 1.35rem; font-weight: 800; }
.evc-date small { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.evc-table td { vertical-align: middle; }
.evc-actions { flex-wrap: wrap; }
.evc-menu .row-menu-list a { padding: 0.55rem 0.7rem; border-radius: 8px; font-weight: 600; font-size: 0.86rem; color: var(--ink); display: flex; gap: 0.4rem; align-items: center; }
.evc-menu .row-menu-list a:hover { background: var(--surface-2); text-decoration: none; }
.evc-menu .row-menu-list button { display: flex; gap: 0.4rem; align-items: center; }
.evc-menu .row-menu-list button:disabled { opacity: 0.5; cursor: not-allowed; }
.evc-hero { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--ink); min-height: 180px; display: grid; align-items: end; box-shadow: var(--shadow-sm); }
.evc-hero-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.evc-hero-body { position: relative; display: flex; gap: 1rem; align-items: flex-end; padding: 1.2rem; color: #fff; min-width: 0; }
.evc-hero-body h2 { color: #fff; overflow-wrap: anywhere; }
.evc-hero-body .muted { color: rgba(255, 255, 255, 0.85); }
.evc-hero-text { min-width: 0; }
.evc-logo { width: 4.5rem; height: 4.5rem; border-radius: 16px; object-fit: cover; background: #fff; border: 3px solid #fff; flex: none; }
.evc-logo-empty { display: grid; place-items: center; color: var(--muted); }
.evc-logo-empty .icon { width: 1.8rem; height: 1.8rem; }
.evc-detail-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: start; }
.evc-lead { font-size: 1.02rem; font-weight: 600; color: var(--ink-2); }
.evc-prose { min-height: 0; padding: 1rem; font-size: 0.95rem; }
.evc-prose h2 { font-size: 1.2rem; margin: 0.6rem 0 0.3rem; }
.evc-prose h3, .evc-prose h4 { margin: 0.6rem 0 0.3rem; }
.evc-prose ul, .evc-prose ol { margin: 0 0 1em; padding-left: 1.2rem; }
.evc-desc > summary { cursor: pointer; font-weight: 700; margin-bottom: 0.5rem; }
.evc-kv { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; font-size: 0.88rem; }
.evc-kv li { display: flex; gap: 0.5rem; flex-wrap: wrap; overflow-wrap: anywhere; }
.evc-kv .muted { min-width: 6rem; }
.evc-gallery { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); }
.evc-gallery-btn { border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); padding: 0; overflow: hidden; display: grid; text-align: left; cursor: zoom-in; }
.evc-gallery-btn img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.evc-gallery-btn span { font-size: 0.76rem; color: var(--muted); padding: 0.3rem 0.5rem; }
.evc-gallery-btn:hover { border-color: var(--brand); }
.evc-private { border-color: #c9daf3; background: #f7faff; }
.evc-private h3, .evc-private legend { display: flex; gap: 0.4rem; align-items: center; }
.evc-stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.evc-stat-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.evc-stat-row > div { display: grid; gap: 0.1rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: 0.6rem; }
.evc-stat-row strong { font-size: 1.35rem; font-weight: 800; }
.evc-mini-event { display: flex; gap: 0.6rem; align-items: center; color: var(--ink); min-width: 0; }
.evc-mini-event span { display: grid; min-width: 0; }
.evc-mini-event strong { overflow-wrap: anywhere; }
.evc-mini-event .evc-date { width: 2.6rem; min-height: 2.6rem; }
.evc-mini-event .evc-date strong { font-size: 1.05rem; }
.evc-diff td { vertical-align: top; }
.evc-diff-old { color: var(--muted); }
.evc-diff-old .chip, .evc-diff-old img { opacity: 0.75; }
.evc-diff-new { background: #f4fbf6; }
.evc-diff-text { white-space: normal; max-height: 12rem; overflow: auto; font-size: 0.86rem; overflow-wrap: anywhere; }
.evc-diff-img { width: 6rem; height: 4rem; object-fit: cover; border-radius: 8px; }
.evc-diff-panel { border-color: #f1d590; }
.evc-image-preview { min-height: 120px; position: relative; }
.evc-image-preview.is-logo img { width: 8rem; height: 8rem; object-fit: cover; }
.evc-default-note { position: absolute; left: 0.5rem; bottom: 0.5rem; background: rgba(17, 20, 37, 0.7); color: #fff; font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; }
.evc-file-btn { position: relative; cursor: pointer; }
.evc-file-btn:focus-within { box-shadow: var(--focus); }
.evc-defaults { border: 0; padding: 0; margin: 0; }
.evc-default-grid { display: grid; gap: 0.4rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.evc-default { border: 2px solid transparent; background: none; padding: 0; border-radius: 10px; overflow: hidden; display: grid; text-align: center; cursor: pointer; }
.evc-default img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.evc-default span { font-size: 0.68rem; font-weight: 700; color: var(--muted); padding: 0.15rem 0.1rem; overflow-wrap: anywhere; }
.evc-default[aria-pressed="true"] { border-color: var(--brand); }
.evc-default[aria-pressed="true"] span { color: var(--brand-ink); }
.evc-gallery-edit { display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); }
.evc-gallery-item { position: relative; margin: 0; }
.evc-gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.evc-gallery-item .icon-btn { position: absolute; top: 0.2rem; right: 0.2rem; width: 1.7rem; height: 1.7rem; min-width: 0; padding: 0; background: rgba(255, 255, 255, 0.92); }
.evc-hours { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.evc-hours label { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.evc-hours label > input { margin-top: 0; }
.evc-owner-results { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 0.6rem; background: #fff; }
.evc-owner-results .link-btn { text-decoration: none; }
.evc-radio-seg { cursor: pointer; position: relative; }
.evc-radio-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.evc-radio-seg:focus-within { box-shadow: var(--focus); }
.evc-radio-seg.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.evc-card-preview { max-width: 320px; }
.evc-card { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.evc-card-media { position: relative; }
.evc-card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.evc-card-media .evc-date { position: absolute; left: 0.6rem; top: 0.6rem; background: #fff; }
.evc-card-body { display: grid; gap: 0.2rem; padding: 0.7rem 0.85rem 0.9rem; }
.evc-card-body strong { overflow-wrap: anywhere; }
.evc-card-kicker { color: var(--brand-ink); font-weight: 800; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.05em; }
.evc-cal-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.evc-cal-title { font-size: 1.15rem; }
.evc-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.evc-cal-wd { background: var(--surface-2); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; color: var(--muted); padding: 0.4rem; text-align: center; }
.evc-cal-cell { background: #fff; min-height: 6.5rem; padding: 0.35rem; display: grid; align-content: start; gap: 0.2rem; min-width: 0; }
.evc-cal-cell.is-out { background: var(--surface-2); }
.evc-cal-cell.is-today .evc-cal-day { background: var(--grad); color: #fff; }
.evc-cal-day { font-size: 0.78rem; font-weight: 800; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.evc-cal-ev { display: block; font-size: 0.72rem; line-height: 1.25; padding: 0.15rem 0.3rem; border-radius: 6px; background: var(--ok-bg); color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid currentColor; }
.evc-cal-ev:hover { text-decoration: none; filter: brightness(0.96); }
.evc-cal-ev span { font-weight: 800; }
.evc-cal-ev.is-pending { background: var(--info-bg); color: var(--info); }
.evc-cal-ev.is-cancelled, .evc-cal-ev.is-suspended { background: var(--warn-bg); color: var(--warn); text-decoration: line-through; }
.evc-cal-ev.is-draft, .evc-cal-ev.is-rejected { background: #f0eee9; color: var(--muted); }
.evc-cal-ev.is-featured { box-shadow: inset 0 0 0 1px #f0b04a; }
.evc-cal-more { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.evc-cal-list { display: none; gap: 1rem; }
.evc-cal-list h4 { text-transform: capitalize; }
.evc-legend { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; vertical-align: middle; }
.evc-legend span { font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 6px; background: var(--ok-bg); color: var(--ok); }
.evc-legend .is-pending { background: var(--info-bg); color: var(--info); }
.evc-legend .is-cancelled { background: var(--warn-bg); color: var(--warn); }
.evc-legend .is-draft { background: #f0eee9; color: var(--muted); }
.evc-rules ul { margin-top: 0.2rem; }
.evc-req .mini-dl dd { overflow-wrap: anywhere; }
.evc-req .msg-quote { margin: 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.evc-pick-list { max-height: 16rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 0.6rem; }
.evc-pick-list:empty { display: none; }
.evc-pick { display: flex; gap: 0.6rem; align-items: center; background: none; border: 0; padding: 0.2rem; border-radius: 8px; text-align: left; color: var(--ink); min-width: 0; flex: 1; }
.evc-pick span { display: grid; min-width: 0; }
.evc-pick strong { overflow-wrap: anywhere; }
.evc-pick[aria-pressed="true"] { background: var(--brand-soft); outline: 2px solid var(--brand); }
.evc-spark { width: 100%; height: 36px; margin-top: 0.3rem; }
.evc-spark polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.evc-spark-views { stroke: var(--brand); }
.evc-spark-clicks { stroke: var(--info); }
#dash-evc:empty { display: none; }
@media (max-width: 1180px) {
  .evc-detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .evc-cal, .evc-cal-head + p .evc-legend { display: none; }
  .evc-cal-list { display: grid; }
  .evc-hide-xs { display: none; }
  .evc-hero { min-height: 150px; }
  .evc-hero-body { padding: 0.9rem; gap: 0.7rem; }
  .evc-logo { width: 3.2rem; height: 3.2rem; border-radius: 12px; }
  .evc-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evc-menu .row-menu-list { position: static; margin-top: 0.3rem; min-width: 0; }
  .evc-actions > .btn, .evc-actions > .evc-menu { flex: 1 1 auto; }
  .evc-default-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-stack.evc-table td:first-child { display: block; }
  .evc-event-cell { flex-wrap: wrap; }
  .evc-req .mini-dl { grid-template-columns: 1fr; }
}
#e-venue-free[hidden], #e-venue-registered[hidden], .evc-owner-results[hidden] { display: none !important; }
.evc-gallery-edit > .muted { grid-column: 1 / -1; }
/* Sotto i 960px la griglia a 1 colonna deve poter restringersi: le tabelle larghe scorrono nel proprio .table-wrap (prima a 768px la pagina andava in overflow). */
@media (max-width: 960px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
}
.stack-xs, .stack-sm, .stack-md, .stack-lg { grid-template-columns: minmax(0, 1fr); }
.table-wrap { position: relative; } /* gli .sr-only assoluti nelle intestazioni restano dentro l'area che scorre */

/* ------------------------------------------------------------------ */
/* Moderazione v2: azioni multiple, filtro parole, registro attività   */
/* ------------------------------------------------------------------ */
.check-inline { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; cursor: pointer; }
.check-inline input { width: 1.1rem; height: 1.1rem; margin: 0; }
.bulk-toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; padding: 0.15rem 0; }
.panel.panel-tight { padding: 0.65rem 1rem; }
.bulk-check { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; margin: -0.35rem 0; border-radius: 8px; cursor: pointer; flex: none; }
.bulk-check:hover { background: var(--brand-soft); }
.bulk-check input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; }
.col-check { width: 2.5rem; }
.media-card-check { position: absolute; right: 0.45rem; bottom: 0.45rem; z-index: 2; background: rgba(255, 255, 255, 0.94); border-radius: 10px; box-shadow: var(--shadow-sm); }
.media-card-check .bulk-check { margin: 0; }
.tale-card > .bulk-check { align-self: flex-start; order: -1; }
.is-bulk-selected { outline: 2px solid var(--brand); outline-offset: -2px; }
tr.is-bulk-selected td { background: var(--brand-soft); }
.bulk-bar { position: fixed; z-index: 40; left: calc(var(--sidebar-w) + 1rem); right: 1rem; bottom: 1rem; display: flex; justify-content: center; pointer-events: none; }
.bulk-bar[hidden] { display: none; }
.bulk-bar-inner { pointer-events: auto; display: flex; align-items: center; gap: 0.6rem 0.9rem; flex-wrap: wrap; max-width: 100%; padding: 0.7rem 0.9rem; background: var(--ink); color: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.bulk-bar-inner .bulk-count { white-space: nowrap; }
.bulk-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.bulk-bar-inner .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.bulk-bar-inner .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
body.has-bulk-bar .admin-content { padding-bottom: 6.5rem; }
.plain-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.3rem; }
.kw-form-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0.6rem; }
.kw-form-grid-wide { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); margin-top: 0; }
.kw-draft summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.kw-code { font-size: 0.82rem; word-break: break-word; background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 6px; }
.kw-mark { padding: 0 0.15rem; border-radius: 4px; }
.kw-mark-flag { background: var(--warn-bg); box-shadow: inset 0 -2px 0 #e0a43a; }
.kw-mark-mask { background: var(--info-bg); box-shadow: inset 0 -2px 0 #6f97d6; }
.kw-mark-block { background: var(--danger-bg); box-shadow: inset 0 -2px 0 var(--danger); }
.kw-outcome { display: grid; gap: 0.6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kw-outcome > div { display: grid; gap: 0.3rem; justify-items: start; padding: 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.kw-preview { word-break: break-word; }
.kw-match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.kw-match-list li { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.kw-table select { width: auto; min-width: 9rem; padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.kw-table tr.is-muted td { opacity: 0.6; }
.audit-filters { display: grid; gap: 0.75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.audit-filter-actions { grid-column: 1 / -1; }
.audit-table code { font-size: 0.8rem; word-break: break-all; }
.audit-table .badge { white-space: normal; max-width: 100%; text-align: left; line-height: 1.3; height: auto; }
.audit-table td.cell-wrap { min-width: 12rem; }
.audit-table .link-btn { text-decoration: none; text-align: left; }
.audit-table .link-btn:hover code { text-decoration: underline; }
.audit-meta summary { cursor: pointer; color: var(--brand-ink); font-weight: 700; font-size: 0.85rem; }
.audit-meta .json-inline { max-width: 32rem; }
@media (max-width: 960px) {
  .bulk-bar { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; }
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kw-form-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kw-form-grid-wide > label:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .kw-form-grid, .kw-form-grid-wide, .kw-outcome { grid-template-columns: minmax(0, 1fr); }
  .audit-filters { grid-template-columns: minmax(0, 1fr); }
  .bulk-bar-inner { width: 100%; justify-content: space-between; }
  .bulk-actions .btn { flex: 1 1 auto; }
  .table-stack td.col-check { width: auto; justify-content: flex-start; }
  .audit-meta .json-inline { max-width: 100%; text-align: left; }
  .audit-table td:last-child { display: block; }
  .audit-meta summary { text-align: left; }
}

/* Tabelle admin su mobile: nickname lunghi non allargano la pagina */
@media (max-width: 767px) { table td, table th { overflow-wrap: anywhere; word-break: break-word; } }

/* ---- Dati di test ---- */
.demo-danger { border-color: #efb7bb; }
.demo-danger h3 { color: var(--danger); display: flex; align-items: center; gap: 0.4rem; }
.demo-password { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.demo-password code, .demo-preview code { background: #f1eee7; padding: 0.05rem 0.35rem; border-radius: 6px; color: var(--text, #1f2233); }
.demo-accounts summary { cursor: pointer; font-weight: 700; }
.demo-accounts .table-wrap { margin-top: 0.6rem; max-height: 420px; overflow: auto; }
.demo-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.demo-steps li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; font-size: 0.92rem; }
.demo-step-dot { width: 12px; height: 12px; border-radius: 50%; background: #e3ded3; }
.demo-steps li.is-running .demo-step-dot { background: var(--info, #2f6fdb); box-shadow: 0 0 0 4px rgba(47, 111, 219, 0.18); }
.demo-steps li.is-done .demo-step-dot { background: var(--ok); }
.demo-steps li.is-error .demo-step-dot { background: var(--danger); }
.demo-steps li.is-done .demo-step-label { color: var(--muted); }
.demo-step-info { overflow-wrap: anywhere; text-align: right; }
.demo-progress { height: 10px; border-radius: 999px; background: #efeae0; overflow: hidden; }
.demo-progress span { display: block; height: 100%; width: 0; background: var(--grad, #660033); border-radius: inherit; transition: width 0.4s ease; }
.demo-progress-danger span { background: var(--danger); }
.demo-preview ul { margin: 0.3rem 0 0; padding-left: 1.2rem; columns: 2 220px; column-gap: 1.5rem; }
.demo-preview li { break-inside: avoid; margin-bottom: 0.2rem; }
.demo-confirm { max-width: 320px; display: grid; gap: 0.35rem; }
.demo-confirm input { font-weight: 700; letter-spacing: 0.08em; }

.callout .mono { overflow-wrap: anywhere; word-break: break-word; }

/* Utenti: colonna "Verificato" (badge + pulsante) e azioni compatte, senza allargare la tabella */
.users-verify-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.users-verify-cell .btn { white-space: nowrap; }
.users-actions-cell { display: grid; grid-template-columns: auto; gap: 0.3rem; justify-content: end; }
.users-actions-cell .btn-sm { padding-block: 0.2rem; }
.users-actions-cell .btn { white-space: nowrap; justify-content: center; }
.data-table td.cell-wrap { overflow-wrap: anywhere; min-width: 8.5rem; }
@media (max-width: 760px) {
  .users-verify-cell { align-items: flex-end; }
  .users-actions-cell { justify-content: end; }
}
