/* AnonymizAI: stile "monografia stampata". Monocromo caldo: l'unico colore sono le
   illustrazioni a gradiente della home. Niente font esterni (nessuna CDN): si usano i
   sostituti indicati dallo style reference se installati, altrimenti i font di sistema. */
:root {
  /* Colori */
  --color-ink: #272421;
  --color-paper-warm: #edebe8;
  --color-paper-cool: #e3e3e2;
  --color-mist: #eeeeed;
  --color-stone: #7d7c7a;
  --color-charcoal: #333333;
  --color-white: #ffffff;
  --line: color-mix(in srgb, var(--color-ink) 16%, transparent);

  /* Caratteri */
  --font-serif: "Egyptienne F LT", "Source Serif 4", "Source Serif Pro", "PT Serif", "Noto Serif",
    Georgia, "DejaVu Serif", serif;
  --font-sans: "Diatype", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Diatype Mono", "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo,
    "DejaVu Sans Mono", monospace;

  /* Scala */
  --text-caption: 11px;
  --text-body: 15px;
  --text-subheading: 18px;
  --text-heading-sm: 24px;
  --text-heading: 32px;
  --text-heading-lg: 48px;
  --text-display: 77px;

  /* Spazi e forme */
  --page-max-width: 1200px;
  --gutter: 24px;
  --section-gap: 96px;
  --card-padding: 24px;
  --radius: 9px;
  --radius-pill: 9999px;
  --shadow-md: rgba(39, 36, 33, 0.1) 0px 4px 12px 0px;

  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--color-white); color: var(--color-ink);
  font-family: var(--font-sans); font-size: var(--text-body); line-height: 1.43; letter-spacing: 0.018em;
}
a { color: var(--color-charcoal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--color-ink); }
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
strong { font-weight: 500; }
.muted { color: var(--color-stone); }
.small { font-size: 14px; }
.grow { flex: 1; }
.row { display: flex; align-items: flex-end; gap: 16px; }
.wrap { flex-wrap: wrap; }
::selection { background: var(--color-ink); color: var(--color-white); }
:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- tipografia */
.label {
  font-family: var(--font-mono); font-size: var(--text-caption); line-height: 1.4;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--color-stone); font-weight: 400;
}
.display {
  font-family: var(--font-serif); font-size: clamp(46px, 8vw, var(--text-display));
  line-height: 0.95; letter-spacing: -0.03em; font-feature-settings: "liga";
}
.title {
  font-family: var(--font-serif); font-size: clamp(32px, 5vw, var(--text-heading-lg));
  line-height: 1.05; letter-spacing: -0.028em; overflow-wrap: anywhere;
}
.heading {
  font-family: var(--font-serif); font-size: var(--text-heading); line-height: 1.2; letter-spacing: -0.028em;
}
.feature-title {
  font-family: var(--font-serif); font-size: var(--text-heading-sm); line-height: 1.2; letter-spacing: -0.02em;
}
.lede { font-size: var(--text-subheading); line-height: 1.4; color: var(--color-stone); max-width: 640px; }
.link-mono {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.09em; text-transform: uppercase;
  text-decoration: none; color: var(--color-ink);
}
.link-mono:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- barra superiore */
.topbar { background: var(--color-white); border-bottom: 1px solid var(--color-paper-warm); }
.topbar-inner, .statusbar-inner, .footer-inner {
  max-width: var(--page-max-width); margin: 0 auto; padding: 0 var(--gutter);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--color-ink); }
.brand-mark { width: 24px; height: 24px; fill: var(--color-ink); }
.brand-word { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.brand-sup {
  font-family: var(--font-mono); font-size: var(--text-caption); letter-spacing: 0.09em;
  align-self: flex-start; margin-top: 2px; margin-left: -4px;
}
.nav { flex: 1; display: flex; justify-content: center; gap: 32px; }
.nav a {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.09em; text-transform: uppercase;
  text-decoration: none; color: var(--color-stone); padding: 6px 0; border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--color-ink); }
.nav a[aria-current="page"] { color: var(--color-ink); border-bottom-color: var(--color-ink); }
.statusbar { border-top: 1px solid var(--color-paper-warm); }
.statusbar-inner { display: flex; align-items: center; gap: 16px; min-height: 36px; flex-wrap: wrap; }

/* stato dei servizi: solo icone, niente colori */
.health { display: flex; gap: 20px; flex-wrap: wrap; }
.badge, .chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--text-caption); line-height: 1.4;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--color-ink);
}
.badge::before { font-size: 10px; }
.badge.ok::before { content: "●"; }
.badge.warn::before { content: "◐"; }
.badge.bad::before { content: "✕"; }
.badge.off::before { content: "○"; }
.badge.off { color: var(--color-stone); }
.health .badge.bad, .recent .badge.bad {
  background: var(--color-ink); color: var(--color-white); padding: 2px 8px; border-radius: var(--radius-pill);
}

/* ---------------------------------------------------------------- impaginazione */
.container { max-width: var(--page-max-width); margin: 0 auto; padding: 0 var(--gutter) 64px; }
.hero { padding: 96px 0 56px; display: flex; flex-direction: column; gap: 24px; }
.page-head { padding: 64px 0 40px; display: flex; flex-direction: column; gap: 16px; }
.page-head .lede { max-width: 760px; }
.section { margin-top: var(--section-gap); }
.section-tight { margin-bottom: 48px; }
.section-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.footer { border-top: 1px solid var(--color-paper-warm); color: var(--color-stone); font-size: 14px; }
.footer-inner { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; padding: 24px var(--gutter); }

/* ---------------------------------------------------------------- illustrazioni (unico colore) */
.art-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.art {
  position: relative; min-height: 220px; border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: flex-end; padding: 20px; isolation: isolate;
}
.art::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .35; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.art-1 {
  background:
    radial-gradient(120% 90% at 85% 10%, #ff9a3c 0%, transparent 55%),
    radial-gradient(90% 80% at 55% 55%, #d9467a 0%, transparent 60%),
    radial-gradient(120% 120% at 0% 100%, #2b1a6b 0%, #5b2bb5 45%, transparent 75%),
    #7a3fd0;
}
.art-2 {
  background:
    radial-gradient(110% 90% at 90% 0%, #ff5a4a 0%, transparent 55%),
    radial-gradient(80% 70% at 45% 40%, #f2c14e 0%, transparent 55%),
    radial-gradient(130% 120% at 0% 100%, #063f46 0%, #0f8f8a 50%, transparent 80%),
    #14a39a;
}
.art-3 {
  background:
    radial-gradient(100% 90% at 80% 15%, #ffc24a 0%, transparent 55%),
    radial-gradient(90% 80% at 40% 45%, #ff7a45 0%, transparent 55%),
    radial-gradient(130% 120% at 0% 100%, #151845 0%, #2e3a9e 50%, transparent 80%),
    #3b4bc4;
}
.art-label {
  display: flex; flex-direction: column; gap: 4px;
  color: var(--color-white); font-size: var(--text-body); font-weight: 500;
}
.art-label .label { color: rgba(255, 255, 255, .75); }

/* ---------------------------------------------------------------- pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500; line-height: 1.4;
  letter-spacing: 0.09em; text-transform: uppercase; text-decoration: none;
  padding: 10px 24px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-dark { background: var(--color-ink); color: var(--color-white); }
.btn-dark:hover { background: var(--color-charcoal); color: var(--color-white); }
.btn-ghost { background: transparent; color: var(--color-ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--color-ink); color: var(--color-ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.nav-cta { padding: 10px 20px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 24px; }

/* ---------------------------------------------------------------- superfici */
.feature {
  background: var(--color-paper-warm); border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 32px; margin: 0;
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.feature legend { float: left; width: 100%; padding: 0; margin-bottom: 4px; }
.feature legend + * { clear: both; }
.feature.section-tight { margin-bottom: 48px; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; min-height: 240px; padding: 40px 24px; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--color-ink) 35%, transparent); border-radius: var(--radius);
  background: var(--color-white); transition: background-color .15s, border-color .15s;
}
.dropzone:hover { border-color: var(--color-ink); }
.dropzone.over { background: var(--color-paper-warm); border-color: var(--color-ink); border-style: solid; }
.dropzone-title { font-family: var(--font-serif); font-size: var(--text-heading-sm); letter-spacing: -0.02em; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.file-list .chip { background: var(--color-paper-warm); }

/* segmented control a pillola */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-block; padding: 10px 20px; border-radius: var(--radius-pill); cursor: pointer;
  border: 1px solid var(--color-ink); color: var(--color-ink);
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.09em; text-transform: uppercase;
}
.pill input:checked + span { background: var(--color-ink); color: var(--color-white); }
.pill input:focus-visible + span { outline: 2px solid var(--color-ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- campi */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin: 3px 0 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-ink); width: 16px; height: 16px; flex: none; }
.field { display: flex; align-items: center; gap: 12px; }
.field input { flex: 1; min-width: 0; }
input:not([type]), input[type="text"], input[type="password"], input[type="date"], input[type="email"],
select, textarea {
  font: inherit; letter-spacing: normal; color: var(--color-ink); background: var(--color-white);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; min-height: 40px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-ink); box-shadow: 0 0 0 1px var(--color-ink); }
textarea { width: 100%; resize: vertical; margin-top: 8px; }
.readonly { background: var(--color-mist) !important; font-family: var(--font-mono); letter-spacing: 0.03em; }

/* ---------------------------------------------------------------- elenchi e tabelle */
.recent { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--color-ink); }
.recent li {
  display: grid; grid-template-columns: 1fr auto 170px; gap: 16px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--color-paper-warm);
}
.recent li.muted { display: block; }
.recent a { text-decoration: none; color: var(--color-ink); font-weight: 500; overflow-wrap: anywhere; }
.recent a:hover { text-decoration: underline; }
.recent .when { text-align: right; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 12px; background: var(--color-paper-cool);
  font-family: var(--font-mono); font-size: var(--text-caption); font-weight: 400;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--color-stone);
}
.table th:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.table th:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--color-ink) 10%, transparent); }
.table select { width: 100%; max-width: 360px; }

/* ---------------------------------------------------------------- job */
.progress { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.progress .label { color: var(--color-ink); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--color-paper-warm); border-top-color: var(--color-ink); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 8px; }
.alert.warn { background: var(--color-paper-warm); border-left: 3px solid var(--color-ink); }
.alert.error { background: var(--color-ink); color: var(--color-white); }
.alert.error::before { content: "✕  "; font-family: var(--font-mono); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips .chip { padding: 5px 12px; border-radius: var(--radius-pill); }
#meta { text-align: right; }

.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.pane { min-width: 0; }
.pane-label { margin-bottom: 8px; }
.doc {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.6; letter-spacing: 0;
  background: var(--color-white); border: 1px solid var(--color-paper-warm); border-radius: var(--radius);
  padding: 20px; max-height: 70vh; overflow: auto;
}
#answer { margin-top: 16px; }
.add-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px;
  padding: 12px 16px; background: var(--color-paper-warm); border-radius: var(--radius);
}

/* entità: distinte per trattamento tipografico, non per colore */
mark { color: inherit; background: var(--color-mist); border-radius: 3px; padding: 0 2px; cursor: pointer; }
mark:hover { outline: 1px solid var(--color-ink); }
.cat-PERSONA { background: var(--color-ink); color: var(--color-white); }
mark.cat-PERSONA { color: var(--color-white); }
.cat-INDIRIZZO, .cat-CAP { background: var(--color-paper-cool); }
.cat-LUOGO { background: var(--color-paper-warm); box-shadow: inset 0 -1px 0 var(--color-ink); }
.cat-TELEFONO, .cat-EMAIL { background: var(--color-white); box-shadow: inset 0 0 0 1px var(--color-ink); }
.cat-CODICE_FISCALE, .cat-PARTITA_IVA, .cat-IBAN, .cat-DOCUMENTO_ID {
  background: var(--color-mist); text-decoration: underline dotted var(--color-ink) 2px; text-underline-offset: 3px;
}
.cat-DATA_NASCITA { background: var(--color-paper-warm); font-style: italic; }
.cat-ALTRO { background: var(--color-mist); }

/* ---------------------------------------------------------------- profili */
.profiles-layout { display: grid; grid-template-columns: minmax(240px, 1fr) 2.2fr; gap: 32px; align-items: start; }
.profile-list { list-style: none; padding: 0; margin: 12px 0 0; border-top: 1px solid var(--color-ink); }
.profile-list li {
  display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  padding: 12px; border-bottom: 1px solid var(--color-paper-warm);
}
.profile-list li:hover { background: var(--color-mist); }
.profile-list li.active { background: var(--color-ink); color: var(--color-white); }
.profile-list li.active .muted { color: var(--color-paper-cool); }
.profile-list li.muted { cursor: default; background: none; }
.profile-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 8px; }
.profile-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: var(--text-caption); letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--color-stone);
}
.profile-form input, .profile-form select { width: 100%; text-transform: none; }
.profile-form .wide { grid-column: 1 / -1; }
.profile-form .actions { margin-top: 8px; }
#profile-msg { text-transform: none; letter-spacing: normal; font-family: var(--font-sans); }

/* ---------------------------------------------------------------- accesso e account */
.user-menu { display: flex; align-items: center; gap: 12px; }
.user-menu form { margin: 0; }
.user-name { color: var(--color-ink); }
.btn-sm { padding: 6px 14px; font-size: 11px; }
.auth { display: grid; grid-template-columns: 1.2fr 1fr; gap: 64px; align-items: center; padding: 96px 0 32px; }
.auth-intro { display: flex; flex-direction: column; gap: 24px; }
.auth-form { gap: 16px; }
.field-stack {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: var(--text-caption); letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--color-stone);
}
.field-stack input { width: 100%; text-transform: none; letter-spacing: normal; font-family: var(--font-sans); font-size: var(--text-body); }
.field-stack .small { text-transform: none; letter-spacing: normal; font-family: var(--font-sans); }
.account-grid { align-items: start; }
.account-grid .feature { gap: 16px; }
.cell-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------------------------------------------------------------- schermi stretti */
@media (max-width: 900px) {
  .panes, .feature-grid, .profiles-layout, .auth { grid-template-columns: 1fr; }
  .auth { gap: 32px; padding-top: 48px; }
  .art-grid { grid-template-columns: 1fr; }
  .art { min-height: 140px; }
  .hero { padding: 56px 0 40px; }
  .section { margin-top: 64px; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .topbar-inner { flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; min-height: 0; }
  .nav { order: 3; flex-basis: 100%; justify-content: flex-start; gap: 24px; }
  .statusbar-inner > .label { display: none; }
  .user-menu { margin-left: auto; }
  .feature { padding: 24px; }
  .recent li { grid-template-columns: 1fr auto; }
  .recent .when { grid-column: 1 / -1; text-align: left; }
  .row { align-items: flex-start; }
}
