/* Avau Atelier: stile comune a tutte le pagine. Colori e caratteri si cambiano qui, nei token di :root. */
@font-face {
  font-family: "Atelier Script";
  src: url("/fonts/PinyonScript-Regular.ttf") format("truetype");   /* Pinyon Script, licenza SIL OFL (fonts/OFL-PinyonScript.txt) */
  font-display: swap;
}
:root {
  --bg: #f4f1ec; --surface: #fff; --ink: #1f1c19; --muted: #6a625b; --line: #e2dcd4; --accent: #2c5f5d; --brand: #2c5f5d;
  --pos: #2a7f52; --neg: #b3402c; --warn: #9a6a12; --soft: color-mix(in srgb, var(--accent) 8%, transparent);
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif; --f-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, Consolas, monospace; --f-script: "Atelier Script", "Edwardian Script ITC", "Segoe Script", cursive;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121614; --surface: #1a201e; --ink: #e6e9e7; --muted: #9aa49f; --line: #2a3330; --accent: #7cc0b9; --brand: #cfe5e1;
  --pos: #5cc28f; --neg: #ef8068; --warn: #e3b25a; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #121614; --surface: #1a201e; --ink: #e6e9e7; --muted: #9aa49f; --line: #2a3330; --accent: #7cc0b9; --brand: #cfe5e1;
  --pos: #5cc28f; --neg: #ef8068; --warn: #e3b25a; color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f-body); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.01em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-block: 24px 48px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* testata di ogni pagina: AVAU + Atelier, titolo della pagina, utente */
.testata { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.testata .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.marchio { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--brand); border-radius: 8px; padding: 2px 6px; }
.marchio:hover { background: var(--soft); }
.marchio b { font: 700 19px/1 var(--f-display); letter-spacing: .28em; }
.scritta { font-family: var(--f-script); font-weight: 400; font-size: 30px; line-height: 1; color: var(--brand); white-space: nowrap; }
.testata .sep { width: 1px; align-self: stretch; background: var(--line); }
.testata h1 { font-size: 18px; margin: 0; }
.testata .destra { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; flex-wrap: wrap; }

/* pulsanti e campi */
.btn { font: inherit; font-size: 14px; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 600; }
.btn.primario:hover { filter: brightness(1.08); color: var(--surface); }
.btn.pericolo:hover { border-color: var(--neg); color: var(--neg); }
.btn:disabled { opacity: .55; cursor: default; }
label.campo { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.riga-campi { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.errore { color: var(--neg); font-weight: 600; min-height: 1.4em; }

/* riquadri, schede, tabelle */
.riquadro { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.schede { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.schede button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; }
.schede button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-box { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clic { cursor: pointer; }
tbody tr.clic:hover td { background: var(--soft); }
.etichetta { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.etichetta.ok { color: var(--pos); border-color: color-mix(in srgb, var(--pos) 40%, transparent); }
.etichetta.no { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, transparent); }
.etichetta.att { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.vuoto { color: var(--muted); padding: 32px 16px; text-align: center; }

/* finestre */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); width: min(560px, calc(100% - 32px));
  padding: 20px; max-height: calc(100vh - 40px); overflow-x: hidden; overflow-wrap: anywhere; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog h2 { margin: 0 0 12px; font-size: 19px; }
dialog form { display: grid; gap: 12px; }
.azioni { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.provvisoria { font: 600 22px/1 var(--f-num); letter-spacing: .08em; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px;
  padding: 12px; text-align: center; user-select: all; }

/* avvisi in basso */
.avviso { position: fixed; right: 16px; bottom: 16px; z-index: 60; background: var(--ink); color: var(--bg); border-radius: 10px; padding: 10px 14px;
  font-weight: 600; box-shadow: 0 6px 20px rgb(0 0 0 / .2); max-width: calc(100% - 32px); }
.avviso.no { background: var(--neg); color: #fff; }
.sola-consultazione { position: fixed; left: 12px; bottom: 12px; z-index: 50; font: 600 11px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase;
  padding: 7px 10px; border-radius: 999px; background: var(--accent); color: var(--surface); opacity: .85; pointer-events: none; }

@media (max-width: 640px) {
  .testata .sep, .testata .nome { display: none; }
  .scritta { font-size: 26px; }
  th, td { padding: 7px 9px; }
}
@media print { .testata, .sola-consultazione, .avviso { display: none; } body { background: #fff; } }
