/* =========================================================
   Goldberg Securitization Reserved — foglio di stile
   ========================================================= */

:root {
  /* Palette derivata dal marchio Goldberg Securitization.
     --brand-500 è il colore esatto campionato dal logo: #5c9885 = hsl(161, 25%, 48%).
     Le altre tonalità mantengono la stessa tinta (161°) variando luminosità. */
  --brand-050: #f3f6f5;
  --brand-100: #e1eae7;
  --brand-200: #bed5ce;
  --brand-400: #87b5a7;
  --brand-500: #5c9885;
  --brand-600: #477b6a;
  --brand-700: #355f52;
  --brand-900: #1d352d;

  /* Neutri nella stessa famiglia cromatica, a saturazione minima */
  --ink-900: #18201d;
  --ink-800: #242e2b;
  --ink-700: #3a4542;
  --ink-500: #6b7b76;
  --ink-400: #8d9a96;

  --bg: #f6f9f8;
  --surface: #ffffff;
  --line: #e5ebe9;
  --line-strong: #ced9d6;

  --danger: #a8433c;
  --danger-bg: #fbeceb;
  --warn: #8a6420;
  --warn-bg: #fbf3e4;
  --ok: #2f6b52;
  --ok-bg: #e8f2ed;
  --info-bg: #ecf1f7;
  --info: #33587f;

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(24, 32, 29, .06), 0 1px 3px rgba(24, 32, 29, .04);
  --shadow: 0 4px 16px rgba(24, 32, 29, .07);
  --shadow-lg: 0 18px 48px rgba(24, 32, 29, .14);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .4em; color: var(--ink-900); font-weight: 600; line-height: 1.25; }
h1 { font-size: 25px; letter-spacing: -.01em; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- Marchio ---------- */
.brand-logo { display: block; height: 42px; width: auto; }
.brand-logo--bar { height: 34px; }
.brand-logo--light { height: 48px; filter: brightness(0) invert(1); }

.brand-logo--text { display: flex; flex-direction: column; line-height: 1; height: auto; }
.brand-logo__name {
  font-size: 22px; font-weight: 300; letter-spacing: .28em;
  text-transform: uppercase; color: var(--brand-500);
}
.brand-logo__sub {
  font-size: 9px; font-weight: 300; letter-spacing: .38em;
  text-transform: uppercase; color: var(--brand-400); margin-top: 5px;
}
.brand-logo--light .brand-logo__name,
.brand-logo--light .brand-logo__sub { color: #fff; }
.brand-logo--bar .brand-logo__name { font-size: 17px; }
.brand-logo--bar .brand-logo__sub { font-size: 7px; margin-top: 3px; }

/* ---------- Selettore di lingua ---------- */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; }
.lang-switch a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 5px 9px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  color: var(--ink-400); text-decoration: none;
}
.lang-switch a:hover { background: var(--brand-050); color: var(--brand-700); text-decoration: none; }
.lang-switch a.is-active { background: var(--brand-050); color: var(--brand-700); }
.lang-switch--bar { margin-right: 4px; padding-right: 12px; border-right: 1px solid var(--line); }

/* =========================================================
   Pagine pubbliche (login / registrazione)
   ========================================================= */
.page-public { background: var(--bg); }

.public-shell { display: grid; grid-template-columns: 420px 1fr; min-height: 100vh; }

.public-aside {
  background: linear-gradient(160deg, var(--brand-700) 0%, var(--brand-900) 100%);
  color: #fff;
  padding: 48px 44px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.public-aside::after {
  content: ''; position: absolute; right: -120px; bottom: -140px;
  width: 380px; height: 380px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .12);
}
.public-aside::before {
  content: ''; position: absolute; right: -60px; bottom: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .09);
}
.public-aside__inner { position: relative; z-index: 1; }
.public-aside__brand { display: inline-block; margin-bottom: 56px; }
.public-aside__brand:hover { text-decoration: none; }
.public-aside__title { color: #fff; font-size: 27px; font-weight: 500; letter-spacing: -.01em; margin-bottom: 16px; }
.public-aside__text { color: rgba(255, 255, 255, .82); font-size: 14.5px; max-width: 34ch; }
.public-aside__list { list-style: none; padding: 0; margin: 28px 0 0; }
.public-aside__list li {
  position: relative; padding-left: 24px; margin-bottom: 12px;
  color: rgba(255, 255, 255, .9); font-size: 14px;
}
.public-aside__list li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand-400);
}
.public-aside__footer { position: relative; z-index: 1; color: rgba(255, 255, 255, .55); font-size: 12.5px; margin: 0; }

.public-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 32px;
}
.public-main__top { width: 100%; max-width: 460px; display: flex; justify-content: flex-end; margin-bottom: 14px; }
.public-card--wide + .public-main__legal, .public-main__top:has(+ .public-card--wide) { max-width: 640px; }
.public-card {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 36px 32px;
}
.public-card--wide { max-width: 640px; }
.public-card__head { margin-bottom: 24px; }
.public-card__head h2 { font-size: 22px; margin-bottom: 6px; }
.public-card__head p { color: var(--ink-500); font-size: 14px; margin: 0; }
.public-main__legal { margin-top: 26px; font-size: 12.5px; color: var(--ink-400); text-align: center; max-width: 460px; }

.public-foot { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-500); text-align: center; }

/* =========================================================
   Form
   ========================================================= */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

label, .label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink-700); margin-bottom: 6px;
}
.label--required::after { content: ' *'; color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 10px 13px;
  font-family: inherit; font-size: 14.5px; color: var(--ink-900);
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7b76' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}

input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(92, 152, 133, .20);
}
input:disabled, select:disabled, textarea:disabled { background: #f3f6f5; color: var(--ink-400); }

.field__hint { font-size: 12.5px; color: var(--ink-400); margin-top: 6px; }
.field__error { font-size: 12.5px; color: var(--danger); margin-top: 6px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-row--3 { grid-template-columns: repeat(3, 1fr); }

/* Checkbox / radio */
.check { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 14px; }
.check input[type=checkbox], .check input[type=radio] {
  width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0;
  accent-color: var(--brand-600); cursor: pointer;
}
.check label { margin: 0; font-size: 13.5px; font-weight: 400; color: var(--ink-700); line-height: 1.5; cursor: pointer; }
.check--box {
  background: var(--brand-050); border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.check--box.has-error { background: var(--danger-bg); border-color: #eec6c2; }

fieldset { border: 0; padding: 0; margin: 0 0 22px; }
legend {
  padding: 0; margin-bottom: 14px; font-size: 12px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-400);
}

/* =========================================================
   Bottoni
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: .55; pointer-events: none; }

.btn--primary { background: var(--brand-600); color: #fff; }
.btn--primary:hover { background: var(--brand-700); color: #fff; }

.btn--secondary { background: #fff; color: var(--ink-700); border-color: var(--line-strong); }
.btn--secondary:hover { background: #f5f9f8; border-color: var(--brand-400); color: var(--brand-700); }

.btn--ghost { background: transparent; color: var(--ink-500); border-color: transparent; }
.btn--ghost:hover { background: rgba(24, 32, 29, .05); color: var(--ink-800); }

.btn--danger { background: #fff; color: var(--danger); border-color: #e8c7c4; }
.btn--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn--block { display: flex; width: 100%; }
.btn--sm { padding: 6px 13px; font-size: 13px; }
.btn--lg { padding: 13px 26px; font-size: 15px; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* =========================================================
   Avvisi
   ========================================================= */
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
  font-size: 14px; border: 1px solid transparent;
}
.alert--success, .alert--ok { background: var(--ok-bg); color: var(--ok); border-color: #c5e0d3; }
.alert--error, .alert--danger { background: var(--danger-bg); color: var(--danger); border-color: #f0ccc9; }
.alert--warning, .alert--warn { background: var(--warn-bg); color: var(--warn); border-color: #ecdcbe; }
.alert--info { background: var(--info-bg); color: var(--info); border-color: #d2dfeb; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }

/* =========================================================
   Struttura applicazione
   ========================================================= */
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar__inner {
  max-width: 1280px; margin: 0 auto; padding: 0 28px;
  height: 66px; display: flex; align-items: center; gap: 28px;
}
.topbar__brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar__brand:hover { text-decoration: none; }
.topbar__label {
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-400); padding-left: 14px; border-left: 1px solid var(--line);
}
.page-app--admin .topbar { border-bottom-color: var(--brand-200); box-shadow: inset 0 -3px 0 var(--brand-500); }

.topbar__nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar__nav a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--ink-500);
}
.topbar__nav a:hover { background: var(--brand-050); color: var(--brand-700); text-decoration: none; }
.topbar__nav a.is-active { background: var(--brand-050); color: var(--brand-700); }

.topbar__user { display: flex; align-items: center; gap: 14px; padding-left: 22px; border-left: 1px solid var(--line); }
.topbar__name { font-size: 13.5px; color: var(--ink-700); font-weight: 500; white-space: nowrap; }
.topbar__switch { font-size: 13px; color: var(--ink-400); white-space: nowrap; }

.topbar__toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.topbar__toggle span { display: block; width: 22px; height: 2px; background: var(--ink-700); margin: 4px 0; border-radius: 2px; }

.app-main { max-width: 1280px; margin: 0 auto; padding: 32px 28px 56px; }
.app-main--wide { max-width: 1480px; }

.app-footer {
  max-width: 1280px; margin: 0 auto; padding: 22px 28px 36px;
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 12.5px; color: var(--ink-400); border-top: 1px solid var(--line);
}

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 26px; flex-wrap: wrap;
}
.page-head__sub { color: var(--ink-500); font-size: 14px; margin: 0; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================================================
   Card, griglie, tabelle
   ========================================================= */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.card__head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.card__head h2, .card__head h3 { margin: 0; }
.card__body { padding: 22px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 16px 22px; border-top: 1px solid var(--line); background: #f9fbfa; border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 22px; }
.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)); }
.grid--sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.stat__label { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400); margin-bottom: 8px; }
.stat__value { font-size: 30px; font-weight: 600; color: var(--ink-900); line-height: 1.1; }
.stat__hint { font-size: 12.5px; color: var(--ink-400); margin-top: 6px; }
.stat--alert { border-color: #ecdcbe; background: var(--warn-bg); }
.stat--alert .stat__value { color: var(--warn); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 12px 18px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-400);
  border-bottom: 1px solid var(--line); white-space: nowrap; background: #f9fbfa;
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f9fbfa; }
.table__actions { text-align: right; white-space: nowrap; }
.table__actions .btn { margin-left: 6px; }
.table__main { font-weight: 500; color: var(--ink-900); }
.table__muted { color: var(--ink-400); font-size: 13px; }

.empty { padding: 52px 24px; text-align: center; color: var(--ink-400); }
.empty h3 { color: var(--ink-700); margin-bottom: 8px; }
.empty p { font-size: 14px; margin-bottom: 18px; }

/* =========================================================
   Badge
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  background: #eaeeed; color: var(--ink-500);
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--alert { background: var(--danger); color: #fff; min-width: 19px; justify-content: center; padding: 2px 6px; }
.badge--muted { background: #eaeeed; color: var(--ink-400); }
.badge--brand { background: var(--brand-050); color: var(--brand-700); }

/* =========================================================
   Documenti e cartelle
   ========================================================= */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13.5px; margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-500); }
.breadcrumb a:hover { color: var(--brand-700); }
.breadcrumb span.sep { color: var(--ink-400); }
.breadcrumb strong { color: var(--ink-900); font-weight: 600; }

.file-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  font-size: 9.5px; font-weight: 700; letter-spacing: .03em;
  background: #eaeeed; color: var(--ink-500);
}
.file-icon--pdf { background: #fdeeec; color: #b4453c; }
.file-icon--doc { background: #eaf1fa; color: #35608c; }
.file-icon--xls { background: #eaf5ef; color: #3c7a5c; }
.file-icon--ppt { background: #fdf1e8; color: #a4633a; }
.file-icon--zip { background: #f2f0fa; color: #5b4f96; }
.file-icon--img { background: #fdf5e6; color: #9a6b21; }

.folder-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  background: var(--brand-050); color: var(--brand-600);
}
.folder-icon svg { width: 21px; height: 21px; }

.item-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.item-row__text { min-width: 0; }
.item-row__name { font-weight: 500; color: var(--ink-900); display: block; overflow: hidden; text-overflow: ellipsis; }
a.item-row__name:hover { color: var(--brand-700); }
.item-row__meta { font-size: 12.5px; color: var(--ink-400); }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  padding: 30px 24px; text-align: center; background: #f9fbfa;
  transition: border-color .15s, background .15s; cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--brand-500); background: var(--brand-050); }
.dropzone__title { font-weight: 500; color: var(--ink-700); margin-bottom: 4px; }
.dropzone__hint { font-size: 12.5px; color: var(--ink-400); }
.dropzone__files { margin-top: 14px; font-size: 13px; color: var(--brand-700); text-align: left; }
.dropzone__files div { padding: 3px 0; }

/* Menu contestuale nelle tabelle */
.inline-menu { position: relative; display: inline-block; }
.inline-menu > summary { list-style: none; cursor: pointer; }
.inline-menu > summary::-webkit-details-marker { display: none; }
.inline-menu > summary::marker { content: ''; }
.inline-menu[open] > summary { background: var(--brand-050); border-color: var(--brand-400); color: var(--brand-700); }
.inline-menu > .card {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 300px; box-shadow: var(--shadow-lg); margin: 0; text-align: left;
  white-space: normal; z-index: 30;
}
/* Su schermi ampi il contenitore non deve tagliare il menu aperto */
@media (min-width: 1081px) {
  .table-wrap--menus { overflow: visible; }
}
/* Su schermi stretti il menu diventa un pannello fisso, non soggetto al ritaglio */
@media (max-width: 1080px) {
  .inline-menu > .card {
    position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px;
    min-width: 0; max-height: 70vh; overflow-y: auto;
  }
}
.inline-menu > .card label { margin-top: 8px; }
.inline-menu > .card form:first-child label:first-child { margin-top: 0; }

/* Contenuto redazionale del comparto */
.richtext { font-size: 15px; line-height: 1.7; color: var(--ink-700); }
.richtext h1, .richtext h2, .richtext h3 { margin-top: 1.4em; }
.richtext h1:first-child, .richtext h2:first-child, .richtext h3:first-child { margin-top: 0; }
.richtext ul, .richtext ol { padding-left: 22px; margin: 0 0 1em; }
.richtext li { margin-bottom: .4em; }
.richtext table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; }
.richtext th, .richtext td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.richtext th { background: #f9fbfa; font-weight: 600; }
.richtext img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.richtext blockquote {
  margin: 1em 0; padding: 4px 0 4px 18px;
  border-left: 3px solid var(--brand-200); color: var(--ink-500);
}

/* Selettore comparti */
.compartment-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.compartment-tabs a {
  padding: 9px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: #fff; border: 1px solid var(--line); color: var(--ink-500);
}
.compartment-tabs a:hover { border-color: var(--brand-400); color: var(--brand-700); text-decoration: none; }
.compartment-tabs a.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* Schede lingua nei form multilingua */
.lang-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.lang-tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--line); color: var(--ink-500);
  font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.lang-tabs button:hover { border-color: var(--brand-400); color: var(--brand-700); }
.lang-tabs button.is-active { background: var(--brand-050); border-color: var(--brand-400); color: var(--brand-700); }

/* Filtri */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 22px; }
.filters .field { margin: 0; min-width: 190px; }
.filters .field--grow { flex: 1; }

/* Tab interne */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tabs a {
  padding: 11px 18px; font-size: 14px; font-weight: 500; color: var(--ink-500);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--brand-700); text-decoration: none; }
.tabs a.is-active { color: var(--brand-700); border-bottom-color: var(--brand-600); }

/* Paginazione */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 11px; border-radius: var(--radius-sm); font-size: 13.5px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-500);
}
.pagination a:hover { border-color: var(--brand-400); color: var(--brand-700); text-decoration: none; }
.pagination .is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* Elenco descrittivo */
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 12px 20px; font-size: 14px; }
.dl dt { color: var(--ink-400); font-size: 13px; }
.dl dd { margin: 0; color: var(--ink-800); word-break: break-word; }

/* Riquadro informativo */
.notice {
  background: var(--brand-050); border: 1px solid var(--brand-100);
  border-radius: var(--radius-sm); padding: 15px 18px; font-size: 13.5px; color: var(--brand-900);
}
.notice--plain { background: #f9fbfa; border-color: var(--line); color: var(--ink-700); }
.notice a { font-weight: 500; }

/* Utility */
.text-muted { color: var(--ink-400); }
.text-small { font-size: 13px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.nowrap { white-space: nowrap; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.break-all { word-break: break-all; }

/* Editor TinyMCE */
.tox-tinymce { border-radius: var(--radius-sm) !important; border-color: var(--line-strong) !important; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .public-shell { grid-template-columns: 1fr; }
  .public-aside { padding: 32px 28px; }
  .public-aside__brand { margin-bottom: 28px; }
  .public-aside__title { font-size: 22px; }
  .public-aside__list, .public-aside__footer { display: none; }
  .public-main { padding: 32px 20px; }
  .public-card { padding: 28px 22px; }

  .topbar__inner { gap: 16px; }
  .topbar__label { display: none; }
  .topbar__nav, .topbar__user { display: none; }
  .topbar.is-open .topbar__nav, .topbar.is-open .topbar__user {
    display: flex; position: absolute; left: 0; right: 0; top: 66px;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 12px 20px; gap: 4px;
  }
  .topbar.is-open .topbar__user { top: auto; border-left: 0; border-top: 1px solid var(--line); position: static; }
  .topbar__toggle { display: block; margin-left: auto; }

  .app-main { padding: 22px 18px 44px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .field-row, .field-row--3 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 4px 0; }
  .dl dd { margin-bottom: 12px; }
  .app-footer { flex-direction: column; gap: 6px; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  h1 { font-size: 21px; }
  .card__body { padding: 18px; }
  .table th, .table td { padding: 11px 13px; }
  .page-head { flex-direction: column; gap: 14px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
}

@media print {
  .topbar, .app-footer, .page-head__actions, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* =========================================================
   Elementi introdotti dall'interfaccia a chiamate API
   ========================================================= */

/* Indicatore di caricamento */
.loader {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 60vh;
}
.loader__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--brand-400);
  animation: loader-pulse 1.2s ease-in-out infinite;
}
.loader__dot:nth-child(2) { animation-delay: .15s; }
.loader__dot:nth-child(3) { animation-delay: .3s; }
@keyframes loader-pulse {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40%           { opacity: 1;   transform: scale(1); }
}

/* Notifiche temporanee */
.notices {
  position: fixed; top: 18px; right: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(420px, calc(100vw - 36px));
}
.notice-toast {
  padding: 13px 17px; border-radius: var(--radius-sm);
  background: var(--ink-900); color: #fff;
  font-size: 14px; line-height: 1.45;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s ease-out;
}
.notice-toast--success { background: var(--ok); }
.notice-toast--error   { background: var(--danger); }
.notice-toast.is-leaving { opacity: 0; transform: translateX(12px); transition: opacity .3s, transform .3s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Il guscio pubblico senza colonna laterale (schermate d'errore) */
.public-shell--plain { grid-template-columns: 1fr; }

/* Barra del pannello di amministrazione */
.topbar--admin { border-bottom-color: var(--brand-200); box-shadow: inset 0 -3px 0 var(--brand-500); }

@media (max-width: 560px) {
  .notices { top: auto; bottom: 14px; left: 14px; right: 14px; max-width: none; }
}
