/* Portale offerte: aspetto sobrio da strumento di lavoro. Nessuna risorsa esterna (CSP default-src 'self'). */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1c2230;
  --muted: #5d6677;
  --border: #d5dae2;
  --border-strong: #b7bfcc;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --focus: #2f7de1;

  /* Significato dei colori ripreso dal Faro */
  --plus: #0b62a8;          /* azzurro: punto di forza */
  --plus-bg: #e3f1fc;
  --attenzione: #b42318;    /* rosso: attenzione */
  --attenzione-bg: #fdeceb;
  --total: #18794e;         /* verde: corrispettivo per consumo complessivo */
  --total-bg: #e5f5ec;
  --soon: #8a5300;
  --soon-bg: #fff3d6;
  --info: #3c4a63;
  --info-bg: #e7ebf2;
  --draft: #6b3fa0;
  --draft-bg: #f1eafa;
  --dim: #7a8292;
  --dim-bg: #f7f7f8;

  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #242932;
    --text: #e4e7ec;
    --muted: #9aa3b2;
    --border: #343a45;
    --border-strong: #4a5260;
    --accent: #5b9bf0;
    --accent-text: #0d1117;
    --focus: #79b0ff;

    --plus: #6cb8f5;
    --plus-bg: #13314a;
    --attenzione: #ff8a80;
    --attenzione-bg: #4a1d1a;
    --total: #5fd39a;
    --total-bg: #123a29;
    --soon: #f3c363;
    --soon-bg: #3d2e10;
    --info: #c3cddd;
    --info-bg: #2a3242;
    --draft: #c9a7f2;
    --draft-bg: #33264a;
    --dim: #8790a0;
    --dim-bg: #191c22;
  }
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  overflow-x: hidden;
}

h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--accent); }

main { padding: 12px 16px 40px; }
main.narrow { max-width: 900px; margin: 0 auto; }

.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.pre { white-space: pre-line; }
.form-error { color: var(--attenzione); min-height: 1.2em; margin: 6px 0; }
.form-error:empty { min-height: 0; margin: 0; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ------------------------------------------------------------ controlli */

button, .button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
button:hover:not(:disabled), .button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

button.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
button.link.danger { color: var(--attenzione); }
button.link.name {
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}
button.link.name:hover { text-decoration: underline; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 5px 8px;
  max-width: 100%;
  min-width: 0;
}
textarea { resize: vertical; width: 100%; }
input[type="checkbox"] { padding: 0; margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
input.bad, .bad { border-color: var(--attenzione) !important; background: var(--attenzione-bg); }

.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }

.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin-right: 12px; }
.field .check { margin: 2px 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 14px;
  align-items: start;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

/* ------------------------------------------------------------ intestazione */

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 15px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.tab {
  background: none;
  color: var(--text);
  border: 1px solid transparent;
  padding: 5px 10px;
}
.tab:hover { background: var(--surface-2); filter: none; }
.tab.active { background: var(--surface-2); border-color: var(--border); font-weight: 600; }
.user { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; }

/* ------------------------------------------------------------ barra filtri */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}
.toolbar input[type="search"] { flex: 1 1 220px; }
.sheets { display: flex; flex-wrap: wrap; gap: 0; }
.sheet {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  margin-left: -1px;
  font-weight: 600;
}
.sheet:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.sheet:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.sheet.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); position: relative; }
.admin-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }

/* ------------------------------------------------------------ tabella offerte */

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; }

table.offers { font-size: 13px; min-width: 1100px; }
table.offers th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.offers td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
table.offers td:first-child { border-left: none; }
table.offers tbody tr { cursor: pointer; }
table.offers tbody tr:hover td { background: var(--surface-2); }
table.offers tr.first td { border-top: 1px solid var(--border-strong); }
table.offers .mandate { font-weight: 600; white-space: nowrap; }
table.offers .offer-name { min-width: 180px; max-width: 260px; }
table.offers .variant { white-space: nowrap; color: var(--muted); }
table.offers .notes { min-width: 220px; max-width: 340px; }
table.offers .storno { min-width: 80px; max-width: 150px; }
table.offers .commission { min-width: 140px; max-width: 240px; }

.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

tr.group td {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 10px 8px 6px;
  cursor: default;
}
tr.group:hover td { background: var(--surface-2); }

/* Offerte non vendibili: attenuate in grigio ma leggibili */
tr.dim td { color: var(--dim); background: var(--dim-bg); }
tr.dim .price, tr.dim .note, tr.dim .storno, tr.dim button.link.name { color: var(--dim); }
tr.dim .price.plus, tr.dim .price.attenzione, tr.dim .price.total,
tr.dim .note.plus, tr.dim .note.attenzione, tr.dim .num.plus, tr.dim .num.attenzione { background: transparent; }

.band {
  display: inline-block;
  min-width: 22px;
  font-size: 11px;
  color: var(--muted);
  margin-right: 4px;
}

/* ------------------------------------------------------------ evidenze di colore */

.price { display: inline-block; text-align: right; padding: 1px 4px; border-radius: 4px; }
.price.plus, .num.plus, dd.plus { color: var(--plus); background: var(--plus-bg); font-weight: 600; }
.price.attenzione, .num.attenzione, dd.attenzione { color: var(--attenzione); background: var(--attenzione-bg); font-weight: 600; }
.price.total { color: var(--total); background: var(--total-bg); font-weight: 600; }
.price .tiny { color: inherit; opacity: .85; font-weight: 400; white-space: normal; }

.note { margin: 0 0 3px; padding-left: 8px; border-left: 3px solid var(--border); }
.note.plus { color: var(--plus); border-left-color: var(--plus); }
.note.attenzione { color: var(--attenzione); border-left-color: var(--attenzione); }

.storno.plus { color: var(--plus); font-weight: 600; }
.storno.attenzione { color: var(--attenzione); font-weight: 600; }

/* La provvigione contiene a capo significativi */
.commission { white-space: pre-line; }
.commission.plus { color: var(--plus); font-weight: 600; }
.commission.attenzione { color: var(--attenzione); font-weight: 600; }
tr.dim .commission.plus, tr.dim .commission.attenzione { color: var(--dim); }

/* Limiti di consumo, potenza ed età sotto il nome o la variante */
.limits { white-space: normal; }
#updated { white-space: nowrap; }
.grid > .hint.wide { grid-column: 1 / -1; margin: 0; }

/* ------------------------------------------------------------ etichette di stato */

.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.badges:empty { display: none; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--info-bg);
  color: var(--info);
}
.badge.off { background: var(--attenzione-bg); color: var(--attenzione); }
.badge.stop { background: var(--attenzione); color: #fff; }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.soon { background: var(--soon-bg); color: var(--soon); }
.badge.draft { background: var(--draft-bg); color: var(--draft); }

/* ------------------------------------------------------------ schede da telefono */

.group-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin: 18px 0 8px;
}

.offer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.offer-card h3 { margin: 4px 0 2px; font-size: 16px; }
.offer-card.dim { background: var(--dim-bg); color: var(--dim); }
.offer-card.dim h3, .offer-card.dim .price, .offer-card.dim .note { color: var(--dim); }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card-head .mandate { font-weight: 700; font-size: 13px; }
.card-row { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; }
.card-row .variant { font-weight: 600; font-size: 13px; }
.offer-card .notes { margin-top: 8px; }
.offer-card dl, .facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 12px;
  margin: 6px 0 0;
}
.offer-card dt, .facts dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
.offer-card dd, .facts dd { margin: 0; min-width: 0; }
.offer-card dd.plus, .offer-card dd.attenzione { justify-self: start; padding: 0 4px; border-radius: 4px; }
.offer-card .price { text-align: left; }

/* ------------------------------------------------------------ dettaglio e finestre */

dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; }
dialog.wide { width: min(1100px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 14, 20, .5); }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.dialog-head h2 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.dialog-body { padding: 14px 16px 18px; overflow: auto; }

.detail .facts { margin-bottom: 10px; }
.detail .notes { margin-top: 10px; }

table.mini { font-size: 13px; }
table.mini th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-strong);
}
table.mini td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
table.mini tr.dim td { color: var(--dim); }
.detail table.mini { display: block; overflow-x: auto; max-width: 100%; }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; }

.docs { list-style: none; padding: 0; margin: 4px 0 8px; }
.docs li { padding: 3px 0; overflow-wrap: anywhere; }
.docs li button.link { margin-left: 10px; }

details.history {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  margin-bottom: 6px;
}
details.history summary { cursor: pointer; font-weight: 600; }
details.history[open] summary { margin-bottom: 6px; }

/* ------------------------------------------------------------ editor */

.editor h3 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.row-edit {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 12px;
  margin: 0 0 10px;
  min-width: 0;
}
.row-edit legend { font-weight: 600; padding: 0 4px; }
.notes-edit { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.note-row { display: flex; gap: 6px; align-items: center; width: 100%; flex-wrap: wrap; }
.note-row input { flex: 1 1 220px; }
.confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--soon-bg);
  color: var(--soon);
  font-size: 12px;
  cursor: pointer;
}
.confirm:has(input:checked) { background: var(--total-bg); color: var(--total); }
.confirm .tiny { color: inherit; }

.drop {
  display: block;
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  margin-top: 6px;
}
.drop:hover { border-color: var(--accent); color: var(--text); }
.drop input[type="file"] { display: block; margin: 8px auto 0; max-width: 100%; }

/* Modifica rapida nella tabella */
.quick {
  width: 86px;
  padding: 2px 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.quick-stack { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.numfield { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ richiesta di conferma */

.ask-lines { margin: 0 0 10px; padding-left: 18px; }
.ask-lines li { margin-bottom: 4px; }
.ask-lines li.warn { color: var(--attenzione); font-weight: 600; }

/* ------------------------------------------------------------ avvisi */

.notice {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}
.notice.ok { border-color: var(--total); background: var(--total-bg); color: var(--total); }
.notice.error { border-color: var(--attenzione); background: var(--attenzione-bg); color: var(--attenzione); }
.notice.warn { border-color: var(--soon); background: var(--soon-bg); color: var(--soon); }
.notice button.link { color: inherit; }

/* ------------------------------------------------------------ accesso */

main.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
main.login .card { width: 100%; max-width: 380px; }
main.login .field { margin-bottom: 10px; }
main.login button[type="submit"] { width: 100%; justify-content: center; }

/* ------------------------------------------------------------ ultime modifiche */

.change {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.change .time { color: var(--muted); font-variant-numeric: tabular-nums; }
.change.internal { color: var(--muted); }

/* ------------------------------------------------------------ mandati e utenti */

.mandate-card .actions { justify-content: space-between; }
.secret {
  font-family: var(--mono);
  font-size: 18px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  user-select: all;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ caricamento CTE */

main.narrow.cte { max-width: 1200px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  margin: 8px 0 16px;
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}
.dropzone strong { color: var(--text); font-size: 15px; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); color: var(--text); }
.dropzone.over { border-color: var(--accent); background: var(--plus-bg); color: var(--text); }
.cte-card { overflow-wrap: anywhere; }
.cte-card.status-da_controllare { border-left: 4px solid var(--soon); }
.cte-card.status-non_riconosciuto, .cte-card.status-errore { border-left: 4px solid var(--attenzione); }
.cte-card.status-riconosciuto, .cte-card.status-pronto { border-left: 4px solid var(--total); }
.cte-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.cte-name { font-size: 15px; }
.cte-head button.link { margin-left: auto; }
.cte-card .facts { margin-bottom: 10px; }
.cte-card .facts select { max-width: 100%; }
.cte-card .code { font-family: var(--mono); font-size: 12px; }
.warn { color: var(--attenzione); font-weight: 600; }
.tiny.warn { color: var(--attenzione); }
.cte-warnings { margin: 0 0 10px; padding: 8px 12px 8px 28px; border-radius: var(--radius);
  background: var(--soon-bg); color: var(--soon); }
.cte-warnings li { margin: 2px 0; }
.badge.ok { background: var(--total-bg); color: var(--total); }
table.cte-fields { min-width: 860px; }
table.cte-fields th[scope="row"] { font-weight: 600; white-space: nowrap; background: none; color: var(--text);
  font-size: 13px; border-bottom: 1px solid var(--border); }
table.cte-fields td.use { width: 36px; text-align: center; }
table.cte-fields td.src { font-size: 12px; color: var(--muted); max-width: 360px; }
table.cte-fields td.src .page { font-weight: 600; color: var(--text); }
table.cte-fields td.changed { font-weight: 600; }
table.cte-fields tr.uncertain td, table.cte-fields tr.uncertain th { background: var(--soon-bg); }
table.cte-fields tr.conflict td, table.cte-fields tr.conflict th { background: var(--attenzione-bg); }
table.cte-fields tr.conflict th { color: var(--attenzione); }
table.cte-fields .note-line { margin-top: 2px; }
table.cte-fields .badge { margin: 0 4px 2px 0; }
.cte-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--plus);
  border-radius: 8px;
  background: var(--plus-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ------------------------------------------------------------ documenti */

main.narrow.docs-page { max-width: 1000px; }
.doc-group { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
}
.doc-item.restricted { border-left: 4px solid var(--attenzione); }
.doc-item.archived { background: var(--dim-bg); color: var(--dim); }
.doc-item.archived .doc-title strong { color: var(--dim); }
.doc-type {
  justify-self: stretch;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--info-bg);
  color: var(--info);
}
.doc-type.t-pdf { background: var(--attenzione-bg); color: var(--attenzione); }
.doc-type.t-xlsx, .doc-type.t-xls { background: var(--total-bg); color: var(--total); }
.doc-type.t-docx, .doc-type.t-doc { background: var(--plus-bg); color: var(--plus); }
.doc-type.t-png, .doc-type.t-jpg { background: var(--draft-bg); color: var(--draft); }
.doc-type.t-pptx { background: var(--soon-bg); color: var(--soon); }
.doc-type.t-csv, .doc-type.t-txt { background: var(--info-bg); color: var(--info); }
.doc-item.highlight { outline: 3px solid var(--accent); outline-offset: 2px; }
.conflict { border: 1px solid var(--attenzione); background: var(--attenzione-bg); color: var(--attenzione);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; }
.conflict ul { margin: 6px 0; padding-left: 20px; }
.conflict p { margin: 6px 0 0; }
.empty-action { text-align: center; margin: -8px 0 16px; }
.doc-type.t-link { background: var(--soon-bg); color: var(--soon); }
.doc-main { min-width: 0; }
.doc-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 15px; }
.doc-note { margin-top: 4px; font-size: 13px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.doc-admin { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.kind-switch { margin-bottom: 10px; }
.dropzone.small { padding: 16px; margin: 0 0 12px; }
.dropzone .tiny.warn { color: var(--attenzione); }

/* ------------------------------------------------------------ telefono */

@media (max-width: 820px) {
  body { font-size: 15px; }
  header.top { position: static; padding: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
  .user { margin-left: auto; }
  main { padding: 10px 12px 32px; }
  .toolbar > select, .toolbar input[type="search"] { flex: 1 1 100%; }
  .sheets { flex: 1 1 100%; }
  .sheet { flex: 1; justify-content: center; padding: 8px 4px; }
  .admin-tools { margin-left: 0; }
  .grid { grid-template-columns: 1fr; }
  .dialog-body { padding: 12px; }
  dialog, dialog.wide { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .actions { justify-content: stretch; }
  .actions > button { flex: 1 1 auto; justify-content: center; }
  .actions > button.link { flex: 0 0 auto; }
  .change { grid-template-columns: 40px 1fr; }
  .doc-item { grid-template-columns: minmax(0, 1fr); }
  .doc-type { justify-self: start; }
  .doc-actions { justify-content: flex-start; }
  .doc-actions .button { flex: 1 1 auto; justify-content: center; padding: 8px 12px; }
  .doc-admin { grid-column: auto; }
}
