/* ── token di design ─────────────────────────────────────────────────────── */
:root {
  --navy: #1f3a6b;          /* blu del logo Lex Iuris */
  --navy-deep: #0b2143;
  --navy-soft: #05315f;
  --sky: #578ccd;           /* azzurro del sito lexiuris.it */
  --gold: #c9a227;
  --ink: #16233a;
  --ink-2: #5b6b83;
  --line: rgba(15, 35, 70, .10);
  --surface: #f5f7fb;
  --card: #ffffff;
  --civile: #1f3a6b;
  --penale: #8b2f3c;
  --amministrativo: #1f6b5a;
  --altro: #5b6b83;
  --radius: 18px;
  --shadow: 0 10px 30px -12px rgba(11, 33, 67, .25);
  --shadow-sm: 0 4px 14px -6px rgba(11, 33, 67, .18);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--surface);
  --bs-link-color: var(--navy);
}
html, body { height: 100%; }
body { background: var(--surface); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .auth-title, .theme-title { letter-spacing: -.01em; }
.font-serif { font-family: "Cormorant Garamond", Georgia, serif; }
code { color: var(--navy); background: rgba(31,58,107,.08); padding: .1em .4em; border-radius: 6px; font-size: .9em; }
.min-w-0 { min-width: 0; }

/* ── bottoni e utility ───────────────────────────────────────────────────── */
.btn-brand { --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy); --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--navy-deep); --bs-btn-hover-border-color: var(--navy-deep); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--navy-deep); --bs-btn-active-border-color: var(--navy-deep); --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--navy); --bs-btn-disabled-border-color: var(--navy); --bs-btn-disabled-color: #fff; font-weight: 600; }
.link-brand { color: var(--navy); text-decoration: none; } .link-brand:hover { text-decoration: underline; }
.text-brand { color: var(--navy); }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sky); }
.card-soft { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; background: var(--card); }
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; color: #fff; background: var(--altro); }
.pill-civile { background: var(--civile); } .pill-penale { background: var(--penale); } .pill-amministrativo { background: var(--amministrativo); }
.form-control:focus, .form-select:focus { border-color: var(--sky); box-shadow: 0 0 0 .25rem rgba(87,140,205,.2); }
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }

/* ── navbar ──────────────────────────────────────────────────────────────── */
.topbar { background: linear-gradient(90deg, var(--navy-deep), var(--navy) 60%, #2a4d8a); box-shadow: 0 6px 24px -12px rgba(0,0,0,.5); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.brand-text { font-weight: 700; letter-spacing: .01em; } .brand-dot { color: var(--gold); }
.topbar .nav-link { color: rgba(255,255,255,.75); border-radius: 999px; padding: .4rem .9rem; font-weight: 500; }
.topbar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.topbar .nav-link.active { color: #fff; background: rgba(255,255,255,.14); }

/* ── auth ────────────────────────────────────────────────────────────────── */
.auth-body { background: radial-gradient(1200px 600px at 10% -10%, #2a4d8a 0%, transparent 60%),
  radial-gradient(900px 500px at 100% 110%, #578ccd55 0%, transparent 60%), linear-gradient(160deg, var(--navy-deep), var(--navy-soft)); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 440px; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-radius: 24px; padding: 2.5rem 2.25rem; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.4) inset; }
.auth-logo { height: 64px; }
.auth-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; font-size: 2rem; color: var(--navy); }
.auth-foot { color: rgba(255,255,255,.6); font-size: .8rem; margin-top: 1.5rem; }
.auth-foot code { color: #fff; background: rgba(255,255,255,.12); }
.flash-wrap { max-width: 720px; margin-left: auto; margin-right: auto; }
.auth-body .flash-wrap { position: absolute; top: 0; left: 0; right: 0; }

/* ── temi ────────────────────────────────────────────────────────────────── */
.hero .lead { max-width: 640px; }
.theme-card { display: flex; flex-direction: column; gap: 1rem; height: 100%; padding: 1.75rem; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; position: relative; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease; }
.theme-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--accent, var(--navy)); }
.theme-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--accent, var(--navy)); opacity: .06; transition: transform .3s ease; }
.theme-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); color: inherit; }
.theme-card:hover::after { transform: scale(1.4); }
.theme-civile { --accent: var(--civile); } .theme-penale { --accent: var(--penale); } .theme-amministrativo { --accent: var(--amministrativo); } .theme-altro { --accent: var(--altro); }
.theme-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: var(--accent, var(--navy)); box-shadow: 0 10px 20px -10px var(--accent, var(--navy)); }
.theme-title { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.9rem; font-weight: 700; margin: 0 0 .25rem; color: var(--ink); }
.theme-tag { color: var(--ink-2); margin: 0 0 .75rem; min-height: 3em; }
.theme-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .8rem; color: var(--ink-2); }
.theme-cta { margin-top: auto; font-weight: 600; color: var(--accent, var(--navy)); display: flex; align-items: center; gap: .1rem; }
.theme-cta .bi { font-size: 1.4rem; transition: transform .2s; } .theme-card:hover .theme-cta .bi { transform: translateX(4px); }
.theme-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--accent, var(--navy)); flex: none; }

.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow-sm); height: 100%; }
.stat-label { font-size: .75rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--navy); line-height: 1.15; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: .9rem; color: var(--ink-2); margin-left: .1rem; }
.stat-sub { font-size: .78rem; color: var(--ink-2); margin-top: .15rem; }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--ink-2); } .empty-state .bi { font-size: 3rem; color: var(--sky); }

/* ── chat ────────────────────────────────────────────────────────────────── */
.chat-body { overflow: hidden; }
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: calc(100vh - 62px); }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: var(--card); }
.chat-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); background: #fff; }
.back-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); }
.chat-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg-btn { padding: .3rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.btn-check:checked + .seg-btn { background: var(--navy); color: #fff; box-shadow: 0 6px 14px -8px var(--navy); }
.chat-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.5rem 1.25rem; background:
  radial-gradient(800px 300px at 50% -100px, rgba(87,140,205,.08), transparent 70%); }
.msg { display: flex; margin-bottom: 1.1rem; }
.msg-user { justify-content: flex-end; }
.msg-bubble { max-width: min(820px, 92%); padding: .9rem 1.15rem; border-radius: 18px; line-height: 1.55; }
.msg-user .msg-bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 8px 20px -12px var(--navy); }
.msg-assistant .msg-bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); width: 100%; }
.msg-system .msg-bubble { background: rgba(87,140,205,.08); border: 1px dashed rgba(87,140,205,.4); max-width: 100%; }
.msg-error .msg-bubble { background: #fff3f4; border: 1px solid #f1c0c6; color: #8b2f3c; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 .4rem; color: var(--navy); }
.md ul, .md ol { padding-left: 1.3rem; } .md table { width: 100%; font-size: .9rem; margin-bottom: .75rem; } .md th, .md td { border: 1px solid var(--line); padding: .3rem .5rem; }
.md blockquote { border-left: 3px solid var(--sky); padding-left: .8rem; color: var(--ink-2); }
.cite, .cite-demo { display: inline-block; background: rgba(201,162,39,.16); color: #7a5c00; border: 1px solid rgba(201,162,39,.4); border-radius: 6px; padding: 0 .4em; font-size: .8em; font-weight: 600; cursor: pointer; text-decoration: none; margin: 0 .05em; vertical-align: baseline; }
.cite:hover { background: rgba(201,162,39,.32); }
.msg-footer { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-top: .7rem; padding-top: .6rem; border-top: 1px dashed var(--line); font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.msg-footer strong { color: var(--ink); }
.reasoning { margin-bottom: .6rem; } .reasoning summary { font-size: .8rem; color: var(--ink-2); cursor: pointer; }
.reasoning pre { white-space: pre-wrap; font-size: .78rem; color: var(--ink-2); background: var(--surface); padding: .6rem .8rem; border-radius: 10px; margin: .4rem 0 0; max-height: 240px; overflow: auto; }
.chip { border: 1px solid rgba(87,140,205,.5); background: #fff; color: var(--navy); border-radius: 999px; padding: .15rem .7rem; font-size: .78rem; margin: .15rem .15rem 0 0; cursor: pointer; }
.chip:hover { background: var(--navy); color: #fff; }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 1.2em; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--sky); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.composer { display: flex; gap: .6rem; align-items: flex-end; padding: .9rem 1.25rem .4rem; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { resize: none; border-radius: 16px; padding: .75rem 1rem; max-height: 180px; line-height: 1.45; border-color: var(--line); background: var(--surface); }
.send-btn { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; font-size: 1.1rem; }
.composer-status { padding: 0 1.4rem .6rem; background: #fff; min-height: 1.6rem; }

.chat-side { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; background: var(--surface); }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.side-card-muted { background: transparent; box-shadow: none; }
.side-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin-bottom: .75rem; display: flex; align-items: center; }
.side-sep { height: 1px; background: var(--line); margin: 1rem 0; }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 0; }
.kpi { background: var(--surface); border-radius: 12px; padding: .55rem .7rem; }
.kpi-label { font-size: .68rem; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.25rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-sub { font-size: .7rem; color: var(--ink-2); }
.mini-table { width: 100%; font-size: .82rem; } .mini-table td { padding: .18rem 0; vertical-align: top; }
.mini-table td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.mini-table tr.sub td { color: var(--ink-2); font-weight: 400; padding-left: .8rem; font-size: .78rem; } .mini-table tr.sub td:last-child { padding-left: 0; }
.cache-bar { height: 6px; background: var(--surface); border-radius: 999px; overflow: hidden; margin-top: .6rem; }
.cache-fill { height: 100%; background: linear-gradient(90deg, var(--sky), #2fa27a); border-radius: 999px; transition: width .4s ease; }
.kpi-value.flash { animation: pop .5s ease; } @keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); color: var(--sky); } 100% { transform: scale(1); } }
.page-text { white-space: pre-wrap; font-family: "Inter", sans-serif; font-size: .9rem; line-height: 1.55; margin: 0; }

/* ── tabelle statistiche ─────────────────────────────────────────────────── */
.table-stats { font-size: .86rem; font-variant-numeric: tabular-nums; }
.table-stats th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 700; border-bottom-width: 1px; white-space: nowrap; }
.table-stats td { white-space: nowrap; }
.q-cell { white-space: normal !important; max-width: 420px; }
.collapse-row > td { border-top: 0; }
.answer-box { padding: 1rem 1.25rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); white-space: normal; }
.chart-box { position: relative; height: 240px; }

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .chat-body { overflow: auto; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-main { border-right: 0; height: calc(100vh - 62px); }
  .chat-side { border-top: 1px solid var(--line); }
  .kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 575.98px) {
  .auth-card { padding: 2rem 1.4rem; }
  .chat-head { padding: .7rem .9rem; } .chat-scroll { padding: 1rem .8rem; } .composer { padding: .7rem .8rem .3rem; }
  .msg-bubble { max-width: 96%; }
}

/* ── auth split ──────────────────────────────────────────────────────────── */
.auth-body { background: var(--surface); overflow-x: hidden; }
.auth-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 100vh; }
.auth-panel { position: relative; overflow: hidden; color: #fff; padding: clamp(1.5rem, 4vw, 4rem);
  background: linear-gradient(155deg, #071a3a 0%, var(--navy-deep) 35%, var(--navy) 75%, #2a4d8a 100%); display: flex; align-items: center; }
.auth-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; animation: drift 18s ease-in-out infinite alternate; }
.orb-1 { width: 520px; height: 520px; background: #578ccd; top: -160px; right: -120px; }
.orb-2 { width: 420px; height: 420px; background: #c9a227; bottom: -200px; left: -120px; opacity: .28; animation-duration: 24s; }
.orb-3 { width: 300px; height: 300px; background: #7fb2ff; top: 45%; left: 45%; opacity: .25; animation-duration: 30s; animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-60px, 40px) scale(1.15); } }
.auth-panel-inner { position: relative; max-width: 620px; width: 100%; margin: 0 auto; animation: rise .7s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.auth-panel-logo { height: 58px; filter: brightness(0) invert(1); opacity: .95; margin-bottom: 2.5rem; }
.auth-headline { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 1.02; letter-spacing: -.02em; margin-bottom: 1.25rem; }
.auth-headline em { font-style: italic; color: #f3d77a; background: linear-gradient(90deg, #f3d77a, #c9a227); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-sub { color: rgba(255,255,255,.72); font-size: 1.05rem; max-width: 520px; line-height: 1.6; margin-bottom: 2rem; }
.auth-themes { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 2.5rem; }
.auth-theme { display: flex; align-items: center; gap: .65rem; padding: .55rem .9rem .55rem .55rem; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(8px); animation: rise .6s ease both; transition: background .2s, transform .2s; }
.auth-theme:hover { background: rgba(255,255,255,.14); transform: translateY(-2px); }
.auth-theme span:last-child { display: flex; flex-direction: column; line-height: 1.1; } .auth-theme small { color: rgba(255,255,255,.6); font-size: .72rem; }
.auth-theme-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent, var(--sky)); font-size: 1rem; box-shadow: 0 6px 14px -6px var(--accent, var(--sky)); }
.auth-theme.theme-civile { --accent: #578ccd; } .auth-theme.theme-penale { --accent: #c9525f; } .auth-theme.theme-amministrativo { --accent: #2fa27a; }
.auth-quote { border-left: 2px solid rgba(243,215,122,.7); padding-left: 1rem; margin-bottom: 2.5rem; transition: opacity .5s ease, transform .5s ease; min-height: 3.4rem; }
.auth-quote.fade { opacity: 0; transform: translateY(6px); }
.auth-quote-text { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.5rem; font-style: italic; }
.auth-quote-src { display: block; font-size: .78rem; color: rgba(255,255,255,.55); letter-spacing: .06em; text-transform: uppercase; }
.auth-panel-foot { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; font-size: .8rem; color: rgba(255,255,255,.6); }
.auth-panel-foot code { color: #fff; background: rgba(255,255,255,.12); }

.auth-form-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.25rem;
  background: radial-gradient(700px 400px at 100% 0%, rgba(87,140,205,.12), transparent 60%), var(--surface); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 26px; padding: 2.5rem 2.25rem;
  box-shadow: 0 30px 60px -30px rgba(11,33,67,.35), 0 0 0 1px var(--line); animation: rise .7s .15s ease both; }
.auth-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; font-size: 2.2rem; color: var(--navy); }
.auth-foot { color: var(--ink-2); font-size: .78rem; margin-top: 1.5rem; }
.auth-card .form-control { border-radius: 14px; background: var(--surface); border-color: transparent; }
.auth-card .form-control:focus { background: #fff; border-color: var(--sky); }
.has-toggle { position: relative; }
.pwd-toggle { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--ink-2); padding: .4rem; border-radius: 8px; }
.pwd-toggle:hover { color: var(--navy); background: rgba(31,58,107,.08); }
.has-toggle .form-control { padding-right: 3rem; }
.btn-glow { position: relative; box-shadow: 0 14px 30px -12px var(--navy); transition: transform .15s ease, box-shadow .15s ease; }
.btn-glow:hover { transform: translateY(-1px); box-shadow: 0 18px 34px -12px var(--navy); }
.auth-body .flash-wrap { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 20; width: min(560px, 92vw); margin: 0; padding: 0; }

@media (max-width: 991.98px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-panel { min-height: auto; padding: 2.25rem 1.5rem; }
  .auth-panel-logo { height: 44px; margin-bottom: 1.5rem; }
  .auth-headline { font-size: 2.4rem; } .auth-sub { font-size: .95rem; margin-bottom: 1.25rem; }
  .auth-quote, .auth-panel-foot { display: none; } .auth-themes { margin-bottom: 0; }
  .auth-form-side { padding: 2rem 1rem 3rem; }
}

/* ── post-login: hero scuro, card sovrapposte, chat ─────────────────────── */
.temi-body { background: var(--surface); }
.hero-dark { position: relative; overflow: hidden; color: #fff; padding: 3.5rem 0 7rem;
  background: linear-gradient(155deg, #071a3a 0%, var(--navy-deep) 35%, var(--navy) 75%, #2a4d8a 100%); }
.hero-dark .orb { opacity: .4; } .hero-dark .auth-grid { mask-image: radial-gradient(ellipse at 20% 30%, #000 10%, transparent 70%); }
.hero-dark-inner { position: relative; animation: rise .6s ease both; }
.eyebrow-light { color: #f3d77a; }
.hero-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: clamp(2.4rem, 4.5vw, 3.8rem); line-height: 1.05; letter-spacing: -.02em; margin-bottom: .75rem; }
.hero-title em { font-style: italic; background: linear-gradient(90deg, #f3d77a, #c9a227); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-sub { color: rgba(255,255,255,.72); font-size: 1.05rem; max-width: 620px; margin-bottom: 1.75rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: .75rem 2.5rem; }
.hero-stats > div { display: flex; flex-direction: column; }
.hs-num { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hs-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.6); }
.cards-overlap { margin-top: -4.5rem; position: relative; z-index: 2; }
.cards-overlap .theme-card { animation: rise .6s ease both; }
.theme-kicker { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent, var(--navy)); opacity: .8; }
.theme-card .theme-title { font-size: 2.2rem; }
.stat-tile-icon { display: flex; gap: .9rem; align-items: flex-start; }
.stat-tile-icon > .bi { font-size: 1.3rem; color: var(--sky); background: rgba(87,140,205,.12); border-radius: 12px; width: 44px; height: 44px; display: grid; place-items: center; flex: none; }

/* chat: fascia colorata per materia + benvenuto */
.chat-layout.theme-civile { --accent: var(--civile); } .chat-layout.theme-penale { --accent: var(--penale); } .chat-layout.theme-amministrativo { --accent: var(--amministrativo); } .chat-layout.theme-altro { --accent: var(--altro); }
.chat-head { position: relative; }
.chat-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--accent, var(--navy)), var(--sky)); }
.welcome { position: relative; max-width: 760px; margin: 2rem auto 1.5rem; padding: 2rem 2rem 1.75rem; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; text-align: center; transition: opacity .35s ease, transform .35s ease, max-height .4s ease; animation: rise .6s ease both; }
.welcome::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: var(--accent, var(--navy)); opacity: .07; }
.welcome-gone { opacity: 0; transform: translateY(-10px); max-height: 0; margin: 0; padding: 0; border: 0; pointer-events: none; }
.welcome-icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 20px; display: grid; place-items: center; font-size: 1.8rem; color: #fff; background: var(--accent, var(--navy)); box-shadow: 0 14px 28px -14px var(--accent, var(--navy)); }
.welcome-title { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 2rem; color: var(--ink); margin-bottom: .5rem; }
.welcome-title em { font-style: italic; color: var(--accent, var(--navy)); }
.welcome-sub { color: var(--ink-2); max-width: 560px; margin: 0 auto 1.25rem; }
.welcome-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.chip-lg { padding: .45rem 1rem; font-size: .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: all .15s; }
.chip-lg:hover { background: var(--accent, var(--navy)); border-color: var(--accent, var(--navy)); color: #fff; transform: translateY(-1px); }
.msg { animation: rise .35s ease both; }
.msg-user .msg-bubble { background: linear-gradient(135deg, var(--navy), #2a4d8a); }
.side-card:first-child { background: linear-gradient(160deg, #fff, #f7f9fd); border-top: 3px solid var(--accent, var(--navy)); }
@media (max-width: 991.98px) { .hero-dark { padding: 2.5rem 0 6rem; } .welcome { margin: 1rem .25rem; padding: 1.5rem 1.25rem; } .welcome-title { font-size: 1.6rem; } }

/* ── effetti ─────────────────────────────────────────────────────────────── */
.theme-card { transition: transform .25s ease, box-shadow .25s ease; will-change: transform; }
.theme-card:hover { box-shadow: 0 30px 50px -24px rgba(11,33,67,.45); }
.theme-card::after { background: radial-gradient(circle at var(--mx, 80%) var(--my, 20%), var(--accent, var(--navy)), transparent 60%); opacity: .12; inset: 0; width: auto; height: auto; border-radius: 0; right: 0; top: 0; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2fa27a; box-shadow: 0 0 0 0 rgba(47,162,122,.6); animation: ping 1.2s infinite; vertical-align: middle; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47,162,122,.6); } 70% { box-shadow: 0 0 0 8px rgba(47,162,122,0); } 100% { box-shadow: 0 0 0 0 rgba(47,162,122,0); } }
.msg.streaming .msg-bubble { position: relative; border-color: transparent; background-clip: padding-box; }
.msg.streaming .msg-bubble::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; z-index: -1;
  background: linear-gradient(120deg, var(--sky), #f3d77a, var(--accent, var(--navy)), var(--sky)); background-size: 300% 300%; animation: sheen 2.2s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.msg.streaming .msg-bubble::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #fff; z-index: -2; }
@keyframes sheen { to { background-position: 300% 0; } }
.msg.streaming .msg-bubble { box-shadow: 0 12px 34px -16px rgba(87,140,205,.55); }
.kpi-value { transition: color .2s; }
.msg-footer { animation: rise .4s ease both; }
.chat-layout-plain { grid-template-columns: 1fr; }
.chat-layout-plain .chat-main { border-right: 0; }
.chat-layout-plain .chat-scroll, .chat-layout-plain .composer, .chat-layout-plain .chat-head { padding-left: max(1.25rem, calc((100% - 960px) / 2)); padding-right: max(1.25rem, calc((100% - 960px) / 2)); }
/* anteprima pagina */
.page-body { font-size: .97rem; line-height: 1.65; color: var(--ink); max-width: 68ch; margin: 0 auto; }
.page-body p { margin: 0 0 .9rem; text-align: justify; hyphens: auto; }
.page-caption { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); margin-bottom: .35rem; }
.page-caption + .page-caption { margin-bottom: 1.25rem; }
.page-heading { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 700; font-size: 1.25rem; color: var(--navy); margin: 1.4rem 0 .5rem; }
.page-heading:first-child { margin-top: 0; }
