/* Dossier Manager – one hand-written stylesheet (UI.md says where things go and why).

   Five colours, defined only here (:root) and used everywhere through their variables:
   white       the page, the rows of the tables, the buttons at rest
   black       the main text and the values
   light grey  the boxes (data box, numbers), the bar of the column titles and the lines between rows, the questions
               sent in the chat, the field of the chat and every field, a button while pressed
   dark grey   labels (the names in the data box, the labels of the numbers), counts, the placeholders
               ("Chiedi all'assistente…"), «Sto pensando», the border of the buttons
   yellow      every notice (a yellow box), the warning labels (Da incassare, a deadline near), the reminders in the chat

   Every corner round, one radius (--oval): a one-line thing oval, a taller box with round corners. Buttons: always a
   word with a border, never an icon. One font (Inter), two weights. */

:root {
  --white: #ffffff;
  --black: #111111;
  --light: #e3e3e3;
  --grey: #555555;
  --yellow: #ffd43b;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --size-label: 12px;  /* small labels: dates of the histories, the version, the labels of the numbers, the tags */
  --gap: 1.5rem;       /* the space around the page and between its columns */
  --button: calc(15px * 1.5 + 2 * var(--row) + 2px);  /* the height of a button, a field, a row: 37 px */
  /* Buttons and fields: half of a 37 px line, so a one-line button or field is oval (round ends) and a taller field
     (a text area, the chat) has the same round corners */
  --oval: calc(var(--button) / 2);
  /* A secondary button (in a row of a table, Sfoglia… in a file field, a link in an answer of the chat): 29 px high
     (2 px above and below the text), 12 px on the sides (room for the round ends) */
  --row-small: 0.125rem;
  --side-small: 0.75rem;
  --button-small: calc(15px * 1.5 + 2 * var(--row-small) + 2px);
  /* The line of the name, top left: the button and 16 px under it, like from Chiudi to what follows on the right */
  --user-row: calc(var(--button) + 1rem);
  --row: 0.391rem;     /* vertical padding of a 37 px line (15 px × 1.5 + 2 × 0.391rem + 2 × 1 px border) */
}

/* Inter (SIL Open Font License, static/fonts/Inter-LICENSE.txt), served by the app: the same text on every device. */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Inter-Regular.3875f8357497.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/Inter-Bold.66894432e7ff.woff2") format("woff2"); }


/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
*, *::before, *::after, ::file-selector-button { border-radius: 0; }  /* no corners of the browser: only --oval */

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--black);
  background: var(--white);
}

a { color: inherit; }
input, select, textarea, button { font: inherit; color: var(--black); }
::placeholder { color: var(--grey); opacity: 1; }
:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

/* Three levels of type: the page 28 px, its sections and the numbers 20 px, the data 15 px */
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 20px; line-height: 1.25; margin: 0 0 0.75rem; }


/* ---------- Frame: the name on top, the chat on the left, the page on its right ---------- */

.app { min-height: 100vh; }
.content { padding: var(--gap); }

/* Top left, the name of the user; a click opens Impostazioni, Segnala, Esci (a popover of the browser, no JavaScript) */
.user-row { display: flex; align-items: flex-start; height: var(--user-row); }
.user-menu > .button:has(+ :popover-open) { background: var(--light); }  /* the name (a button): its menu open */
.user-menu-items {
  position: fixed; inset: auto; top: calc(var(--gap) + var(--button) + 0.25rem); left: var(--gap); margin: 0;
  min-width: 10rem; padding: 0.5rem; border: 1px solid var(--grey); background: var(--white);
  border-radius: calc(var(--oval) + 0.5rem);  /* round like its items, around them (their radius + the padding) */
}
.user-menu-items a,
.user-menu-items button {
  display: block; width: 100%; padding: var(--row) 1rem; border: 1px solid transparent; border-radius: var(--oval);
  background: transparent; text-align: left; text-decoration: none; cursor: pointer;
}
.user-menu-items a:hover, .user-menu-items button:hover { background: var(--light); }
.user-menu-items form { margin: 0; }
.app-version { margin: 1.25rem 0 0.25rem; padding: 0 1rem; color: var(--grey); font-size: var(--size-label); }

/* The chat (1/3) and the page open on its right (2/3), both as tall as the window: each scrolls by itself. Nothing
   open: the chat alone, in the middle. */
.with-assistant {
  display: grid; grid-template-columns: minmax(15rem, 1fr) minmax(40rem, 2fr); gap: var(--gap); align-items: start;
}
.with-assistant .assistant-column {
  display: flex; flex-direction: column; height: calc(100vh - 2 * var(--gap) - var(--user-row));
}
.with-assistant .assistant { flex: 1; }
.with-assistant .side-panel {
  height: calc(100vh - 2 * var(--gap)); margin-top: calc(-1 * var(--user-row));  /* from the top, next to the name */
  padding-right: 0.75rem; scrollbar-gutter: stable;  /* its scrollbar in a strip of its own */
}
.with-assistant:has(> .side-panel:empty) { grid-template-columns: minmax(0, 1fr); }
.with-assistant:has(> .side-panel:empty) .assistant-column { width: 100%; max-width: 50rem; margin: 0 auto; }
.with-assistant > .side-panel:empty { display: none; }

/* The right part: it scrolls inside; its tables adapt to its width (container queries, below) */
.side-panel { min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; container-type: inline-size; }
.side-panel .section:last-child { margin-bottom: 0; }
/* Every page of the right part: one width, the same for every page and every box of it: the right part's, up to 60 rem
   (at least 40 rem: the column of .with-assistant); a file: all the room there is */
.panel-page { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; max-width: 60rem; }
.panel-page > * { min-width: 0; }
.panel-page:has(.document-view) { max-width: none; }
.document-view iframe {
  display: block; width: 100%; height: calc(100vh - 12rem); border: 0; border-radius: var(--oval);
}

/* On top of a page: Indietro, Chiudi and the action of the page (Salva...), 16 px above the first title */
.panel-bar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }


/* ---------- Buttons: a word with a border ---------- */

/* One model for every button (the name top left, the pages and the reminders of the chat, its links, Salva…): at rest
   white with the dark grey border; under the mouse the border black; pressed light grey. Two variants: small (a
   secondary button: in a row of a table, a link of the chat) and yellow (the reminders of the chat). */
.button {
  display: inline-block; padding: var(--row) 1rem; border: 1px solid var(--grey); background: var(--white);
  color: var(--black); font-weight: 400; line-height: 1.5; text-decoration: none; white-space: nowrap; cursor: pointer;
  border-radius: var(--oval);
}
.button:hover { border-color: var(--black); }
.button:active { background: var(--light); }
.button.small { padding: var(--row-small) var(--side-small); }
.button.yellow { background: var(--yellow); }
.section-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; }
.section-actions form { margin: 0; }

/* The button of a form (Salva, Controlla, Importa, Richiedi, ...) is in the bar on top (base.html): nothing under the
   last section */
.form > .section:last-child { margin-bottom: 0; }

/* A warning label (Da incassare, a deadline near): yellow, as big as a secondary button, normal text */
.tag {
  display: inline-block; padding: var(--row-small) var(--side-small); border: 1px solid transparent;
  border-radius: var(--oval); background: var(--yellow); color: var(--black); font-weight: 400; line-height: 1.5;
  vertical-align: middle;
}


/* ---------- Sections, the data box, the numbers ---------- */

/* A section: its h2 title and its content, no box; 32 px from the next one */
.card { padding: 0; border: 0; background: transparent; }
.section { margin-bottom: 2rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.section-header h1, .section-header h2 { margin: 0; }
/* A list: Cerca and its buttons end where the list ends (it keeps 0.75 rem on the right for its scrollbar strip) */
.list-search { padding-right: 0.75rem; }
.section-note { margin: 0.75rem 0 0; color: var(--grey); }
.upload-what { margin: 0; color: var(--grey); }  /* under the title of a form section: what to upload */

/* The data box (dossier, client, technician, request, quote): a light grey box; the names of the data dark
   grey, the values black; the title cut with «…» when too long */
.card.data-box { padding: 1rem 1.25rem; border-radius: var(--oval); background: var(--light); }
.data-box h1 { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; font-variant-numeric: tabular-nums; }
.details dt { color: var(--grey); }
.details dd { margin: 0; }
.data-box .details a { text-decoration: none; }
.data-box .details a:hover { text-decoration: underline; }
.details.client-summary { margin-top: 1.25rem; }  /* Nuova pratica: the data of the client chosen */

/* Conti and the reports: the numbers in light grey boxes, side by side */
.tiles { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.tile { flex: 1 1 10rem; min-width: 0; padding: 0.75rem 1rem; border-radius: var(--oval); background: var(--light); }
.tile p { margin: 0; }
.tile-label { color: var(--grey); font-size: var(--size-label); }
.side-panel .tile { flex: 1 1 0; }  /* in the right part: on one line */
.tile-value { margin: 0.25rem 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }


/* ---------- Notices ---------- */

/* Every notice (saved, created, a warning, an error, the errors of a field): a yellow box, black text */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; }  /* on top of a page: 16 px from Indietro/Chiudi above, 16 px to what follows */
.messages li {
  margin-bottom: 0.5rem; padding: 0.5rem 1rem; border-radius: var(--oval); background: var(--yellow);
  color: var(--black);
}
.messages li:last-child { margin-bottom: 0; }
.errorlist {
  list-style: none; margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-radius: var(--oval); background: var(--yellow);
  color: var(--black);
}
/* A notice with its button under it (Crea cliente), 8 px apart */
.notice-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; margin-bottom: 1rem; }
.notice-row .messages { margin: 0; }
/* A notice under a field of a form (Cliente creato, Dati del documento inseriti, the differences of the document, the
   bank transfer read, the errors of a field): always 8 px under it and 8 px above what follows */
.form :is(.messages, .notice-row, .errorlist) { margin: 0.5rem 0; }
.form .notice-row .messages { margin: 0; }


/* ---------- Tables ---------- */

/* White rows on a light grey bar of column titles, a light grey line between the rows; every row 37 px; one line per
   cell (long texts cut with «…», whole on hover) */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }  /* separate: round corners on cells */
.table th, .table td {
  padding: 0.42rem 1.25rem; border-bottom: 1px solid var(--light);  /* 0.42rem, not round: the row 37 px */
  text-align: left; vertical-align: middle; white-space: nowrap;
}
.table th { background: var(--light); font-weight: 700; }
.table td { font-variant-numeric: tabular-nums; }  /* figures of the same width: amounts and dates line up */
.table th a.sort { text-decoration: none; }
.table th a.sort:hover { text-decoration: underline; }
.table td.cut { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }
.table td.cut.main { max-width: 20rem; }  /* the name of the row (Titolo, Nome, File): more room before «…» */
.table td.cut > a { overflow: hidden; text-overflow: ellipsis; }
.table td.file-name { min-width: 10rem; }
.table th.amount, .table td.amount { text-align: right; }
.table form { margin: 0; }

/* Rows that open a page or a file: every cell is a link filling the cell; light grey under the mouse */
.table .row-link td { padding: 0; }
.table .row-link td > a { display: block; padding: 0.42rem 1.25rem; text-decoration: none; }
.table .row-link:hover td { background: var(--light); }
/* The bar of the column titles and the row under the mouse: oval, like the buttons (round ends on the first and the
   last cell) */
.table th:first-child, .table .row-link:hover td:first-child {
  border-top-left-radius: var(--oval); border-bottom-left-radius: var(--oval);
}
.table th:last-child, .table .row-link:hover td:last-child {
  border-top-right-radius: var(--oval); border-bottom-right-radius: var(--oval);
}

/* An empty table: its «Nessun…» in the middle, dark grey (the button to add one: at the top right of the section) */
.table .empty-row td { padding: 1.5rem 1.25rem; border-bottom: none; color: var(--grey); text-align: center; }

/* Buttons and marks inside a row do not make it taller */
.table td :is(.button, .tag) { margin: -0.3rem 0; }  /* a secondary button or a label: the row stays 37 px (not round: computed) */
.table td.phase-reached, .table th.phase-reached { text-align: center; }
.table td .reach-form { display: inline-block; margin: 0; }
/* Movimenti: the buttons of a phase (Raggiunta, Carica bonifico) side by side, on the right */
.table td.row-actions { padding-right: 0; white-space: nowrap; text-align: right; }  /* flush right, like the buttons above the table */
.table td.row-actions > * + * { margin-left: 0.5rem; }
.reached-mark { display: inline-flex; vertical-align: middle; }
.reached-mark svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }

/* Compact tables (reports) */
.table.compact :is(th, td, .row-link a) { padding: 0.35rem 0.75rem; }  /* 0.35rem, not round: a row of 35 px */
.table.compact .row-link td { padding: 0; }

/* Long lists scroll inside their box (the column titles stay on top), so the page fits the window */
.scroll-box { max-height: calc(100vh - 12rem); overflow-y: auto; padding-right: 0.75rem; scrollbar-gutter: stable; }
.scroll-box.below-search { max-height: calc(100vh - 15.5rem); }  /* not round: what is above, Cerca included */
.scroll-box.table-scroll { max-height: 18.5rem; }     /* a table of a page: 5 rows of 37 px and the titles, then it scrolls */
.scroll-box.activities-scroll { max-height: 20rem; }  /* Storico: about 4–5 updates, then it scrolls */
.scroll-box .table th { position: sticky; top: 0; z-index: 1; }
.card .table { width: 100%; }  /* every table ends where the data box and the buttons of its section end */
.starts-at-bottom { display: flex; flex-direction: column-reverse; }  /* opens scrolled to the newest, at the bottom */

/* Narrower right part (a laptop, a tablet): long texts cut sooner, cells closer */
@container (max-width: 1000px) {
  .table td.cut { max-width: 8rem; }
  .table td.cut.main { max-width: 12rem; }
  .table th, .table td, .table .row-link td > a { padding-left: 0.75rem; padding-right: 0.75rem; }
}
@container (max-width: 750px) {
  .table td.cut { max-width: 6rem; }
  .table td.cut.main { max-width: 8rem; }
  .table th, .table td { white-space: normal; }
  .table th, .table td, .table .row-link td > a { padding-left: 0.5rem; padding-right: 0.5rem; }
  .table td.amount, .table td.row-actions, .table td.phase-reached { white-space: nowrap; }  /* never «1.000,00 / €» */
}


/* ---------- Histories (Storico, Aggiornamenti) ---------- */

.activities { list-style: none; margin: 0; padding: 0; }
/* No lines between the activities: only the space around each one */
.activity { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.5rem; line-height: 1.5; }
.activity > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.activity-text { margin: 0.25rem 0 0; }
.activity-date { margin-top: 0.25rem; color: var(--grey); font-size: var(--size-label); }
/* The links in a history (the dossier, the file) and in the answers of the chat: written in the text, underlined
   under the mouse */
.activity .activity-dossier, .activity a.file-link { font-weight: 400; text-decoration: none; }
.activity a.activity-dossier:hover, .activity a.file-link:hover { text-decoration: underline; }
/* Nota, under the Storico: one line, like the field of the chat */
.note-form { margin-top: 1rem; }


/* ---------- Forms ---------- */

/* Every field: light grey, oval, no border, 37 px tall, 25 rem wide (all the width on a small screen); the fields in a
   table keep the width of their column */
.form :is(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea),
.search input[type="search"],
.login-box input,
.assistant-composer textarea {
  padding: var(--row) 1rem; border: 1px solid transparent; border-radius: var(--oval); background: var(--light);
}
/* Writing in any field (forms, login, Impostazioni, Segnala, the chat, Cerca, the note): no border nor outline, only
   the cursor (ticks and file fields keep the outline of the keyboard, :focus-visible) */
.form :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea):focus,
.login-box input:focus,
.assistant-composer textarea:focus,
.search input[type="search"]:focus { outline: none; border-color: transparent; }
:is(.form, .search, .login-box, .assistant-composer) :is(input, textarea):focus::placeholder { color: transparent; }  /* only the cursor */
.form :is(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="file"], select, textarea) { display: block; }
.form :is(input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="file"], select, textarea):not(td *) { width: 25rem; max-width: 100%; }
.form textarea { resize: vertical; }
.form input[type="date"], .form select { height: calc(1.5em + 2 * var(--row) + 2px); }  /* the browsers draw them taller */
.form.note-form input[type="text"] { width: 100%; }

/* File fields: light grey and oval, 37 px like every field; the button of the browser (Sfoglia…) a secondary button
   (29 px) */
.form input[type="file"] {
  min-width: 0; padding: calc((var(--button) - var(--button-small)) / 2); border: 0; border-radius: var(--oval);
  background: var(--light);
}
.form input[type="file"]::file-selector-button {
  margin-right: 0.75rem; padding: var(--row-small) var(--side-small); border: 1px solid var(--grey); background: var(--white);
  font: inherit; line-height: 1.5; cursor: pointer; border-radius: var(--oval);  /* like every button */
}
.form input[type="file"]::file-selector-button:hover { border-color: var(--black); }
.form input[type="file"]::file-selector-button:active { background: var(--light); }
.form.file-form .file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 0.75rem; }
.form.file-form .file-row .button { margin: 0; }

.form label { display: block; margin: 0.75rem 0 0.25rem; }
.form label.required::after, .form legend.required::after { content: " *"; }
.form fieldset { margin: 0 0 1.25rem; padding: 0; border: none; }
.form fieldset legend { margin-top: 0.75rem; }
.form fieldset > div { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.form :is(fieldset, .checkbox-list) label { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0; }
.form #id_kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem 1.25rem; max-width: 40rem; }
.form .checkbox-list > div { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 0.5rem; }
/* Ticks and dots always 1.25 rem, also next to a text on two lines (never shrunk), in the middle of its first line
   (margin not round: computed from the line) */
input[type="checkbox"], input[type="radio"] {
  flex-shrink: 0; width: 1.25rem; height: 1.25rem; margin-top: calc((1lh - 1.25rem) / 2); vertical-align: middle;
  accent-color: var(--black);
}
.request-client { margin: 0.5rem 0 0; }

/* Fields inside a table (Entrate, Prestazioni, Scadenze) */
.table td.edit-cell, .table .row-link td.edit-cell { padding: 0.5rem 1.25rem; }
.form .phases-table input[type="text"] { width: 100%; min-width: 10rem; margin: 0; }
.form .phases-table input.phase-order { width: 4rem; min-width: 0; }
.form .phases-table input[type="number"]:not(.phase-order) { width: 10rem; margin: 0; }
.form .phases-table select { width: auto; margin: 0; }
.phases-table th.wide { width: 100%; }  /* the column of the text takes the room left */
.table td.remove-cell, .table th.remove-cell { width: 8rem; text-align: center; }
/* Modifica (Entrate): Rimuovi marks a phase to take away (a hidden tick and its label, no JavaScript): the row fades,
   the button says Annulla; it goes away only with Salva */
.remove-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; }
.remove-toggle:focus-visible + .remove-button { outline: 2px solid var(--black); outline-offset: 2px; }
.remove-on, .remove-toggle:checked + .remove-button .remove-off { display: none; }
.remove-toggle:checked + .remove-button .remove-on { display: inline; }
.phases-table tr:has(.remove-toggle:checked) td:not(.remove-cell) { opacity: 0.35; text-decoration: line-through; }

/* Cerca, above a list; the button of the list (Nuova pratica, ...) on its right */
.search { margin: 0 0 1rem; }
.search input[type="search"] { width: 100%; max-width: 20rem; }  /* like the fields of the access pages */
.list-search { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 0 0 1rem; }
.list-search .search { flex: 0 1 20rem; margin: 0; }


/* ---------- The chat (Assistant) ---------- */

/* No box: the questions sent and the field to write are light grey; the answers plain text. Empty: only the field,
   in the middle; after the first question the field goes to the bottom, the messages above it. */
.assistant { display: flex; flex-direction: column; min-height: 0; margin: 0; padding: 0; }
.assistant-body { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.assistant-body:has(> .assistant-turns.is-empty) { justify-content: center; }
.with-assistant:has(> .side-panel:not(:empty)) .assistant-body { justify-content: flex-end; }
.assistant-turns { flex: 1; min-height: 0; overflow-y: auto; padding-right: 0.25rem; scrollbar-width: none; }
.assistant-turns::-webkit-scrollbar { display: none; }
.assistant-turns.is-empty { display: none; }
.assistant-turns > div { flex-shrink: 0; margin-bottom: auto; }
.assistant-turn { margin: 0 0 1rem; line-height: 1.5; overflow-wrap: anywhere; }
.assistant-turn:last-child { margin-bottom: 0; }
.assistant-turn p { margin: 0; }
.assistant-turn.role-user { margin-left: 20%; padding: var(--row) 1rem; border: 1px solid transparent; border-radius: var(--oval); background: var(--light); line-height: 1.5; }  /* 37 px and oval, like Cerca */
/* An answer: one line on top, then the items, each a little apart; an empty line a clear space */
.assistant-turn.role-assistant p.with-link { margin: 0.5rem 0; }
.assistant-turn.role-assistant p.item { margin-top: 0.25rem; padding-left: 1em; }
.assistant-turn.role-assistant p.item::before { content: "•"; display: inline-block; width: 1em; margin-left: -1em; }  /* the dot; the lines after it aligned with the text */
.assistant-turn.role-assistant p.gap { margin-top: 1rem; }
/* A link in an answer (a dossier, a document, a report, a form prepared…): a secondary button (button small), so it
   reads as something to press; a long name cut with «…» (whole on hover) */
.answer-link { max-width: 16rem; overflow: hidden; vertical-align: middle; text-overflow: ellipsis; }

/* Under the messages: the reminders (yellow) and the pages (buttons), on one line when they fit; then the field */
.assistant-prompt { margin-top: 2.5rem; }
.assistant-body:has(> .assistant-turns.is-empty) .assistant-prompt { margin-top: 0; }
.assistant-prompt[inert] { opacity: 0.5; }  /* while Claude answers */
.assistant-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.assistant-suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.assistant-row > .assistant-suggestions { flex: 0 0 auto; max-width: 100%; }
.assistant-reminders:empty { display: none; }
.assistant-composer { margin-top: 0.5rem; }
/* The question grows with its text up to 10 lines, then scrolls (older browsers: one line that scrolls) */
.assistant-composer textarea { display: block; width: 100%; resize: none; field-sizing: content; min-height: var(--button); max-height: calc(10lh + 2 * var(--row) + 2px); }
.assistant-note { margin: 0.5rem 0 0; color: var(--grey); }

/* The messages of waiting, the same everywhere: «Sto pensando» (the chat), «Sto leggendo il documento / il bonifico»
   (Nuova pratica, Bonifico, Uscita): dark grey text, three dots that come and go (CSS only) */
.assistant-thinking { display: inline-block; margin: 0.5rem 0 0; padding: var(--row) 0; color: var(--grey); }
.assistant-thinking::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: assistant-dots 1.2s steps(4) infinite; }
@keyframes assistant-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.assistant-thinking.htmx-indicator { display: none; }
.assistant-thinking.htmx-indicator.htmx-request { display: inline-block; }


/* ---------- Preventivo: the parts as in the fac-simile ---------- */

.quote-parts { margin: 0; }
.quote-parts dt { margin-top: 1rem; font-weight: 700; }
.quote-parts dt:first-child { margin-top: 0; }
.quote-parts dd { margin: 0.25rem 0 0; }
.quote-parts ul, .quote-parts ol { margin: 0; padding-left: 1.25rem; }
.quote-parts .messages { margin: 0.5rem 0 0; }


/* ---------- Login ---------- */

.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
/* The pages of access, more compact than the forms (20 rem): Accedi, Codice, Accesso bloccato, the error pages */
.login-page { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; width: 100%; max-width: 20rem; }
.login-box { width: 100%; max-width: 20rem; padding: 1.5rem 0; }  /* also alone (Accesso bloccato, errors) */
.login-box input { width: 100%; }
.login-box .button { display: block; margin: 1rem auto 0; }
.login-box form > p:last-of-type { margin-bottom: 0; }
/* Codice, the first time: the QR code of the authenticator app in the middle; under it, small and grey, the key for
   an app that does not read the QR code (a hint, like a label) */
.qr-code svg { display: block; width: 200px; height: 200px; margin: 1rem auto; }
.qr-key { font-size: var(--size-label); color: var(--grey); text-align: center; }
.qr-key span { white-space: nowrap; }  /* the key never broken */


/* ---------- Tablet and phone: one column ---------- */

/* Up to a tablet held upright: the page open on top (Chiudi brings back the chat), the chat under it; the whole page
   scrolls, not its parts */
@media (max-width: 960px) {  /* under the chat (15 rem) + the page (40 rem) + the spaces */
  .with-assistant { grid-template-columns: minmax(0, 1fr); }
  .with-assistant .assistant-column, .with-assistant .side-panel { height: auto; margin-top: 0; padding-right: 0; }
  .with-assistant > .side-panel:not(:empty) { order: -1; }
  .assistant-turns { max-height: 60vh; }
  .scroll-box, .scroll-box.below-search, .scroll-box.table-scroll { max-height: none; }
  .form #id_kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A phone: less space around, every field all the width, a long table scrolls sideways by itself */
@media (max-width: 600px) {
  :root { --gap: 1rem; }
  .card.data-box { padding: 0.75rem 1rem; }
  .side-panel .tile { flex: 1 1 40%; }  /* the numbers two by two */
  .table { display: block; overflow-x: auto; }
  .details { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .details dd { margin-bottom: 0.5rem; }
  .assistant-turn.role-user { margin-left: 10%; }
  .list-search { flex-wrap: wrap; }
}
