/* A card of the Marketplace's window: one link, the whole of it (wireframe marketplace n. 2). */
.g-lib__entry {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.g-lib__owner {
  display: block;
  margin-top: var(--s1);
  color: var(--ink-muted);
  font-weight: var(--fw-regular);
}

/* The forms a content agent declares for its next run, on its page (`agenti/ingressi.js`): parts
   of `.g-contenuti` this page alone draws — the saved ones above the form, when it was last
   saved in its summary — and the cadence's rows. */
/* The saved briefs and the brief's form: two accordions, a step apart, not one double border. */
.g-contenuti__ingresso {
  display: grid;
  gap: var(--s2);
  margin: 0 0 var(--s4);
}

.g-contenuti__ingresso > .g-disclose {
  margin-top: 0;
}

/* When the brief was last saved, in its own summary: at the far end, or on the next line. */
.g-contenuti__ultimo {
  margin-inline-start: auto;
  font-weight: var(--fw-regular);
}

.g-contenuti__campi-salvati dt {
  margin-top: var(--s3);
  font-weight: var(--fw-strong);
}

.g-contenuti__campi-salvati dd {
  margin: var(--s1) 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.g-contenuti__salvati button {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.g-contenuti__salvati {
  gap: 0;
}

.g-contenuti__salvati > .g-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  padding: var(--s2) 0;
  border: 0;
  border-bottom: 1px solid var(--bordo);
  border-radius: 0;
  background: transparent;
}

.g-contenuti__salvati .g-meta {
  margin: 0;
}

.g-contenuti__salvati button[aria-pressed="true"] {
  font-weight: var(--fw-strong);
  text-decoration: underline;
}

/* The brief's summary carries when it was last saved: on the same line, or on the next. */
.g-contenuti__ingresso > :where(.g-disclose) > summary {
  flex-wrap: wrap;
}

/* ADR-0206 §1: a cadence is rows — channel, posts a week, weekdays. */
.g-cadenza {
  border: 0;
  padding: 0;
  min-width: 0;
}

.g-cadenza__riga {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s2);
}

.g-cadenza__riga input[type="number"] {
  width: 4rem;
}

.g-cadenza__giorni {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* Agente catalogue and configuration workspace. Shared controls stay in ui.css. */

.g-lib-panel {
  container: agent / inline-size;
}

.g-lib-detail__salute {
  margin: var(--s3) 0 0;
  font-size: var(--fs-14);
  color: var(--ink-muted);
}

.g-lib-detail__atto .g-actions {
  margin-top: 0;
}

.g-lib-pin .g-actions {
  margin-top: var(--s3);
}

.g-disclose.g-lib-percorso {
  margin-top: var(--s4);
}

.g-lib-percorso .g-kicker {
  margin: 0;
}

.g-lib {
  list-style: none;
  margin: var(--s4) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: var(--s4);
}

.g-lib > li {
  margin: 0;
  padding: 0;
  min-height: 0;
}

.g-lib__card {
  border: 1px solid var(--bordo);
  border-radius: var(--r-card);
  padding: var(--s4);
  background: var(--foglio);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--s3);
  box-shadow: none;
  min-height: 0;
  color: inherit;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

@media (hover: hover) {
  .g-lib__card:hover {
    border-color: var(--bordo-input);
    box-shadow: var(--shadow-pop);
  }
}

.g-lib__brand {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}

.g-lib__titoli {
  display: grid;
  justify-items: start;
  gap: var(--s1);
  min-width: 0;
}

/* The category is a word under the name, not a state (wireframe marketplace n. 2). */
.g-lib__categoria {
  margin: 0;
  font-size: var(--fs-14);
  color: var(--ink-muted);
}

/* The foot of a card: its state, next step and actions. */
.g-lib__piede {
  display: grid;
  justify-items: start;
  gap: var(--s2);
  padding-top: var(--s3);
  border-top: 1px solid var(--bordo);
}

.g-lib__mark {
  color: var(--ink);
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.g-lib__name {
  font-size: var(--fs-17);
  font-weight: var(--fw-strong);
  margin: 0;
  line-height: 1.25;
}

.g-lib__next {
  margin: 0;
  font-size: var(--fs-14);
  color: var(--verde);
}

.g-lib__summary {
  font-size: var(--fs-14);
  color: var(--ink-muted);
  margin: 0;
  flex: 1;
  line-height: 1.5;
}

.g-lib__facts {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-14);
  color: var(--ink);
}

.g-lib__facts li {
  margin-bottom: var(--s2);
}

:where(.g-lib__facts) li:last-child {
  margin-bottom: 0;
}

.g-lib__facts strong {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
  display: block;
  margin-bottom: var(--s1);
}

.g-lib-detail__identity {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.g-lib-detail__brand {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}

.g-lib-detail__mark-slot {
  flex-shrink: 0;
}

.g-lib-detail__mark-slot .g-lib__mark,
.g-lib-detail__mark {
  width: 3rem;
  height: 3rem;
  color: var(--verde);
}

.g-lib-detail__who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  min-height: 3rem;
}

.g-lib-detail__kicker {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  margin: 0;
  color: var(--ink-muted);
}

/* Il nome dell’agente è il titolo della pagina: la scala è quella del titolo,
   non quella di una riga di servizio. */
.g-lib-detail__name {
  margin: 0;
  font-size: var(--fs-21);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tr-titolo);
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

/* The heading is a navigation focus target, not an interactive control. */
.g-lib-detail__name[tabindex="-1"]:focus {
  outline: none;
}

.g-lib-detail__identity .g-lede {
  margin: 0;
}

.g-lib-detail__id-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  margin: 0;
  padding: 0;
  font-size: var(--fs-14);
}

.g-lib-detail__id-facts li {
  margin: 0;
}

.g-lib-detail__id-facts strong {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
  display: block;
  margin-bottom: var(--s1);
}

.g-lib-detail__s14 {
  margin: 0 0 var(--s5);
}

/* Il kicker sta dentro un `summary` adesso: `block` lo tiene sopra la frase invece che di
   fianco al marker, e il `<p>` che era prima è diventato uno `<span>`. */
.g-lib-detail__not-kicker {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  display: block;
  margin: 0 0 var(--s1);
  color: var(--ink-muted);
}

.g-lib-detail__not {
  margin: var(--s3) 0 0;
  font-size: var(--fs-16);
  line-height: 1.5;
}

/* La prima frase, quella che resta leggibile a blocco chiuso. Stessa misura del testo pieno:
   non è un riassunto di seconda classe, è la promessa. */
.g-lib-detail__not-breve {
  display: block;
  font-size: var(--fs-16);
  line-height: 1.5;
  font-weight: var(--fw-medium);
}

/* Il blocco della promessa è il foglio della scheda di mandato: il riquadro tenue
   (`.g-card--tenue`) lo distingue dai fatti tecnici a fianco, che sono filetti e basta. */
details.g-lib-detail__s14 {
  margin-top: 0;
}

details.g-lib-detail__s14 > summary {
  padding: 0;
}

details.g-lib-detail__s14[open] > summary {
  border-bottom: 1px solid var(--bordo);
  margin-bottom: var(--s3);
}

/* Una sola barra per l'atto: azione primaria e collegamenti sulla stessa riga,
   nell'ordine in cui si leggono — non due file senza una ragione. Stato e attesa
   la precedono; il percorso di attivazione resta fuori. La distanza dal blocco successivo
   la porta l'ambito, qualunque dei due manchi. */
.g-lib-detail__atto {
  margin: 0;
}

.g-lib-detail__scope {
  margin-top: var(--s5);
}

.g-lib-detail__pending {
  margin-top: var(--s3);
}

.g-tabs.g-lib-schede {
  margin-top: 0;
}

.g-lib-vista {
  margin-top: var(--s4);
}

.g-lib-detail {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--s5);
  align-items: start;
  margin-top: 0;
}

.g-lib-detail__main,
.g-lib-detail__aside {
  min-width: 0;
}

.g-lib-detail__aside .g-disclose--quiet:first-child {
  margin-top: 0;
}

.g-lib-detail .g-lib__facts {
  margin-bottom: 0;
}

/* Nelle card del catalogo l'etichetta è un micro-titolo mono e sta bene: in
   scheda i fatti si leggono, non si scansionano — stessa lingua del testo
   che affiancano, non un secondo registro tipografico. */
.g-lib-detail .g-lib__facts strong {
  font-family: var(--sans);
  font-size: var(--fs-14);
  font-weight: var(--fw-strong);
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
}

.g-lib-detail__sentences {
  list-style: none;
  margin: 0;
  padding: 0;
}

.g-lib-detail__sentences li {
  margin: 0 0 var(--s2);
  padding: 0;
  font-size: var(--fs-14);
  line-height: 1.5;
}

:where(.g-lib-detail__sentences li:last-child) {
  margin-bottom: 0;
}

.g-callout.g-lib-esito:not([hidden]) {
  margin-top: var(--s4);
}

.g-lib-detail__prepares {
  list-style: none;
  margin: 0 0 var(--s5);
  padding: 0;
}

/* `.g-lib__facts li` spaces facts; among chips it made the last one taller than the rest. */
.g-lib-detail__chips li {
  margin-bottom: 0;
}

.g-lib-detail__prepares li {
  padding: var(--s3) 0;
  border-top: 1px solid var(--bordo);
  font-size: var(--fs-16);
}

.g-lib-detail__prepares li:last-child {
  border-bottom: 1px solid var(--bordo);
}

/* Un nome tecnico del config (chiave del manifesto): resta in monospace,
   ma da solo, con un bordo — non una riga unita che nessuno sapeva leggere. */
.g-lib-detail__chips {
  list-style: none;
  margin: var(--s2) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* I flag di una voce («esce dall'azienda», «irreversibile»): la riga di meta
   diventa una fila di chip — si vedono prima, non sembrano prosa. */
.g-lib-detail__flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s2);
}

.g-chip--flag {
  font-family: var(--sans);
  color: var(--ink-muted);
}

.g-lib-detail__group-title {
  margin: var(--s4) 0 0;
  font-size: var(--fs-14);
  font-weight: var(--fw-strong);
}

.g-lib-detail__group-title:first-child {
  margin-top: 0;
}

.g-lib-detail__next {
  margin: 0 0 var(--s4);
  font-size: var(--fs-14);
  color: var(--ink-muted);
  line-height: 1.5;
}

.g-lib-scope-form select[multiple] {
  min-height: 9rem;
}

/* Configura is a full-width inner view: the 28rem form column was the mandate's leftover. */
.g-lib-vista--config .g-form--config {
  max-width: none;
}

.g-lib-vista--config
  .g-field:not(.g-field--porte)
  input:not(.g-field__input--breve),
.g-lib-vista--config .g-field:not(.g-field--porte) select,
.g-lib-vista--config .g-field:not(.g-field--porte) textarea {
  max-width: 36rem;
}

.g-config-guidance {
  margin: 0 0 var(--s4);
}

.g-config-state {
  margin: var(--s4) 0;
}

.g-lib-panel :is(.g-sezione, input, select, textarea, button, summary, a) {
  scroll-margin-block-start: calc(var(--h-topbar) + var(--s4));
  scroll-margin-block-end: calc(var(--touch-min) + var(--s7));
}

.g-field--porte {
  gap: var(--s3);
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
}

.g-field--porte > legend {
  padding: 0;
  color: var(--ink-muted);
  font-weight: var(--fw-medium);
  font-size: var(--fs-14);
}

.g-porte-righe {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

/* The box is `.g-card--tenue`; here only the two fields side by side. */
.g-porte-riga {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s3);
  min-width: 0;
}

.g-porte-riga .g-field {
  min-width: 0;
}

:where(.g-porte-riga .g-field:nth-child(3)) {
  grid-column: 1 / -1;
}

.g-porte-rimuovi,
.g-porte-aggiungi {
  justify-self: start;
}

.g-porte-rimuovi {
  grid-column: 1 / -1;
}

/* Keep the action in the form's flow: a sticky bottom bar covered focused fields
   before the end of a long form, especially with enlarged text. */
.g-lib-config__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-block-start: var(--s4);
  padding-block: var(--s4);
  padding-bottom: max(var(--s4), env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bordo);
}

@media (max-width: 859px) {
  .g-lib-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .g-lib {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .g-lib-config__cta .g-btn {
    flex: 1 1 0;
  }

  /* Management commands follow the state and remain in the reading flow. */
  .g-lib-detail__atto .g-actions .g-btn {
    width: 100%;
  }

  .g-porte-riga {
    grid-template-columns: 1fr;
  }
}

.g-lib-detail__piano .g-btn {
  margin-top: var(--s2);
}

/* The window's bar: the categories as one framed group on the left, the search on the right. */
.g-lib-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-block: var(--s4);
}

.g-lib-filters__cerca {
  flex: 0 1 18rem;
  min-width: 0;
}

.g-lib-filters__campo {
  width: 100%;
}

/* The Marketplace's search is a field like any other: the touch floor under 860 (it measured
   21px in mobile-journeys @tablet). */
@media (max-width: 859px) {
  .g-lib-filters__campo {
    min-height: var(--touch-min);
  }
}

/* The editable agent and organisation-owned settings have distinct reading columns. */
.g-lib-workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(26rem, 1fr);
  align-items: start;
  gap: var(--s6);
  margin-top: var(--s4);
}

.g-lib-workspace__main,
.g-lib-workspace__shared {
  min-width: 0;
  overflow-wrap: break-word;
}

.g-lib-workspace__shared {
  border-inline-start: 1px solid var(--bordo);
  padding-inline-start: var(--s5);
}

.g-lib-workspace .g-lib-detail {
  grid-template-columns: minmax(0, 1fr);
}

.g-lib-workspace .g-lib-vista {
  margin-top: 0;
}

/* A narrow support column needs complete values, not a ten-rem label track. */
.g-lib-workspace__shared .g-dl {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s1);
}

.g-lib-workspace__shared .g-dl dt:not(:first-child) {
  margin-block-start: var(--s3);
}

.g-lib-workspace__shared .g-callout {
  margin-block: var(--s4);
}

.g-actions.g-lib-sezioni:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--s2);
  margin-block: var(--s4);
}

.g-lib-sezioni .g-btn {
  display: grid;
  align-content: start;
  gap: var(--s1);
  text-align: start;
  white-space: normal;
  border: 1px solid var(--bordo);
  min-width: 0;
}

.g-lib-sezioni .g-field__hint {
  font-weight: var(--fw-regular);
}

/* Switch on available panel width, including enlarged text and the sidebar. The checklist lives in
   the side column: two columns on an 800 px panel left it 107 px of text (audit A011), and with the
   data measure (ADR-0242 Am. 3) a 64rem threshold left it 190. Side by side only where a third of
   the panel still holds 26rem; below, the column sits below (ADR-0238 §4). */
@container agent (max-width: 80rem) {
  .g-lib-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .g-lib-workspace__shared {
    border-inline-start: 0;
    border-top: 1px solid var(--bordo);
    padding-inline-start: 0;
    padding-top: var(--s5);
  }
}

/* Each destination is an individual choice, including long customer hostnames. */
.g-lib-vista--config .g-empty-state__body > a {
  display: block;
  overflow-wrap: anywhere;
  margin-block: var(--s2);
}

/* The page of a package or an agent: the greeting at its head (wireframe agente n. 1), and
   «Cosa faccio da solo» with its switches at the foot. */
.g-pagina-agente__saluto {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  margin-block: var(--s5) var(--s4);
  text-align: center;
}

.g-pagina-agente__ciao {
  margin: 0;
  font-size: var(--fs-21);
  font-weight: var(--fw-bold);
}

.g-pagina-agente__saluto > p {
  max-width: var(--w-lettura);
  margin: 0;
}

.g-pagina-agente__da-solo {
  container: automazioni / inline-size;
  margin-top: var(--s4);
}

/* Give state and authority copy the full row when zoom leaves little room. */
@container automazioni (max-width: 14rem) {
  .g-interruttore {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s1);
  }

  .g-interruttore__testo {
    padding-block-start: 0;
    overflow-wrap: anywhere;
  }
}
