/* Il Guardiano del Foro: namespace rigorosamente isolato. */
#lfc-custode-root,
#lfc-custode-root * { box-sizing: border-box; }
#lfc-custode-root {
  --lfc-navy: #102b42;
  --lfc-navy-2: #173a54;
  --lfc-gold: #a88758;
  --lfc-cream: #fcfaf6;
  --lfc-fg: #233345;
  --lfc-muted: #63707d;
  --lfc-line: #e8e5de;
  position: fixed !important;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--lfc-fg);
  text-align: left;
}
#lfc-custode-root.lfc-visible { pointer-events: none; }
#lfc-custode-root button,
#lfc-custode-root a,
#lfc-custode-root input { font: inherit; letter-spacing: normal; text-transform: none; }
#lfc-custode-root button { cursor: pointer; border: 0; border-radius: 0; outline-offset: 3px; }
#lfc-custode-root [hidden] { display: none !important; }
#lfc-custode-root .lfc-launcher {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-left: auto;
  width: 74px;
  height: 74px;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid #e1cba8;
  background: var(--lfc-navy);
  box-shadow: 0 10px 28px #071b2b4d, 0 0 0 4px #ffffffb8;
  transition: transform .18s ease, box-shadow .18s ease;
}
#lfc-custode-root .lfc-launcher:hover { transform: translateY(-3px); box-shadow: 0 15px 30px #071b2b5c; }
#lfc-custode-root .lfc-launcher img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; border-radius: 50%; }
#lfc-custode-root .lfc-launcher-dot { position: absolute; bottom: 3px; right: 2px; width: 14px; height: 14px; border: 2px solid white; background: #6a9b7a; border-radius: 50%; }
#lfc-custode-root .lfc-launcher-label {
  position: absolute; right: 83px; bottom: 17px;
  width: max-content; max-width: 164px;
  background: white; color: var(--lfc-navy);
  border-radius: 11px; padding: 8px 11px;
  box-shadow: 0 5px 23px #173a5426;
  font-size: 12px; font-weight: 600;
}
#lfc-custode-root .lfc-panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: min(396px, calc(100vw - 26px));
  height: min(618px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  background: var(--lfc-cream);
  border: 1px solid #d8d0c4;
  border-radius: 19px;
  overflow: hidden;
  box-shadow: 0 22px 68px #0b223c4a, 0 3px 15px #0b223c17;
  animation: lfc-in .26s ease-out;
}
@keyframes lfc-in { from { transform: translateY(12px) scale(.987); opacity: .4; } to { transform: none; opacity: 1; } }
#lfc-custode-root .lfc-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: 82px;
  background: linear-gradient(115deg, #153953 0%, #102b42 85%);
  color: white;
  padding: 12px 12px 12px 15px;
  gap: 10px;
}
#lfc-custode-root .lfc-head-avatar {
  flex: 0 0 auto; width: 55px; height: 55px;
  border-radius: 50%; border: 1.5px solid #c4a776;
  object-fit: cover; object-position: center top;
  background: #17344c;
  animation: lfc-gentle 5s ease-in-out infinite;
}
@keyframes lfc-gentle { 0%, 80%, 100% { transform: rotate(0deg); } 86% { transform: rotate(-3deg); } 92% { transform: rotate(2deg); } }
#lfc-custode-root .lfc-head-titles { min-width: 0; flex: 1 1 auto; }
#lfc-custode-root .lfc-head-titles strong {
  display: block; margin: 0; font-family: Georgia, Cambria, "Times New Roman", serif;
  font-size: 20px; line-height: 1.19; font-weight: 500;
  color: #fff;
}
#lfc-custode-root .lfc-head-titles span { display: block; font-size: 10.5px; letter-spacing: .02em; color: #d9d0c5; margin-top: 5px; }
#lfc-custode-root .lfc-head-actions { display: flex; gap: 1px; align-self: flex-start; padding-top: 3px; }
#lfc-custode-root .lfc-head-actions button {
  display: grid; place-items: center; width: 26px; height: 28px;
  background: transparent; color: #f5f3ef; border-radius: 7px;
}
#lfc-custode-root .lfc-head-actions button:hover { background: #ffffff27; }
#lfc-custode-root .lfc-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 14px; scrollbar-width: thin; scrollbar-color: #d8cfbf transparent; background: #fdfcf9; }
#lfc-custode-root .lfc-message { display: flex; margin: 0 0 12px; }
#lfc-custode-root .lfc-message-assistant { justify-content: flex-start; }
#lfc-custode-root .lfc-message-user { justify-content: flex-end; }
#lfc-custode-root .lfc-bubble { max-width: 95%; line-height: 1.53; padding: 12px 14px; border-radius: 13px; font-size: 13px; white-space: pre-line; }
#lfc-custode-root .lfc-message-assistant .lfc-bubble { background: #f3f0ea; border: 1px solid #e8e2d9; color: #2d3945; border-top-left-radius: 3px; }
#lfc-custode-root .lfc-message-user .lfc-bubble { background: #e9eff2; border: 1px solid #d4dfe5; color: #16384e; border-top-right-radius: 3px; }
#lfc-custode-root .lfc-topics { margin: 13px 0 5px; }
#lfc-custode-root .lfc-topics-label, #lfc-custode-root .lfc-resource-heading { font-size: 12px; font-weight: 700; margin: 0 0 9px; color: var(--lfc-navy); }
#lfc-custode-root .lfc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#lfc-custode-root .lfc-topic {
  min-height: 60px; display: flex; align-items: center; text-align: left; gap: 7px;
  padding: 9px; border: 1px solid #dedad1; border-radius: 10px;
  background: #fff; color: var(--lfc-navy); box-shadow: 0 1px 2px #00102008;
  font-size: 11.5px; font-weight: 580; line-height: 1.28;
  transition: border-color .17s, background-color .17s;
}
#lfc-custode-root .lfc-topic:hover { background: #f6f1e9; border-color: #ac956f; }
#lfc-custode-root .lfc-topic-icon { flex: 0 0 auto; display: grid; place-items: center; width: 27px; color: #a78959; }
#lfc-custode-root .lfc-topic-label { display: inline; }
#lfc-custode-root .lfc-resource-wrap { background: #fff; border: 1px solid #e8e3d9; padding: 12px; border-radius: 13px; margin: 0 0 18px; }
#lfc-custode-root .lfc-resource { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid #f0eee8; color: #14354d; text-decoration: none; transition: background-color .17s; }
#lfc-custode-root .lfc-resource:hover { color: #826439; background: #faf7f1; }
#lfc-custode-root .lfc-resource-icon { flex: 0 0 24px; color: #a68a5f; display: grid; place-items: center; }
#lfc-custode-root .lfc-resource-copy { flex: 1 1 auto; min-width: 0; }
#lfc-custode-root .lfc-resource-kind { display: block; color: #82858b; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
#lfc-custode-root .lfc-resource-copy strong { font-size: 12px; font-weight: 650; display: block; line-height: 1.45; margin-top: 2px; }
#lfc-custode-root .lfc-resource-arrow { color: var(--lfc-gold); }
#lfc-custode-root .lfc-resource-divider { height: 1px; margin: 8px 0 10px; background: #e6e0d6; }
#lfc-custode-root .lfc-contact-prompt { font-size: 12px; color: #526270; margin: 0 0 9px; }
#lfc-custode-root .lfc-cta { display: inline-flex; gap: 12px; align-items: center; padding: 9px 14px; border-radius: 8px; background: var(--lfc-navy); color: #fff; font-size: 12px; font-weight: 650; text-decoration: none; }
#lfc-custode-root .lfc-cta:hover { background: #23506c; color: #fff; }
#lfc-custode-root .lfc-input-wrap { flex: 0 0 auto; background: #fbf9f5; padding: 11px 14px 7px; border-top: 1px solid #e8e1d6; }
#lfc-custode-root .lfc-input-label { display: block; color: #37495b; font-size: 11px; font-weight: 600; margin: 0 0 7px; }
#lfc-custode-root .lfc-form { display: flex; align-items: stretch; width: 100%; height: 42px; border: 1px solid #dcd7cf; background: white; border-radius: 10px; overflow: hidden; margin: 0; }
#lfc-custode-root .lfc-form:focus-within { outline: 2px solid #cbb894; outline-offset: 1px; }
#lfc-custode-root .lfc-form input { padding: 0 10px; flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent; box-shadow: none; font-size: 12px; color: #2b3642; height: 100%; }
#lfc-custode-root .lfc-form input::placeholder { color: #92959b; opacity: 1; }
#lfc-custode-root .lfc-form button { display: grid; place-items: center; background: var(--lfc-navy); color: #fff; flex: 0 0 43px; border-radius: 0; }
#lfc-custode-root .lfc-form button:hover { background: #244b66; }
#lfc-custode-root .lfc-privacy { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 10px; color: #757983; }
#lfc-custode-root .lfc-foot { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; padding: 10px 16px; border-top: 1px solid #eee9df; background: #f7f3eb; }
#lfc-custode-root .lfc-foot button, #lfc-custode-root .lfc-foot a { display: flex; align-items: center; gap: 5px; background: transparent; color: #28465d; font-size: 11px; text-decoration: none; border: 0; padding: 0; }
#lfc-custode-root .lfc-foot a:hover, #lfc-custode-root .lfc-foot button:hover { color: #9a773e; }
.lfc-custode-shortcut { border: 1px solid #a88758; color: #122f46; padding: 8px 12px; border-radius: 7px; background: white; cursor: pointer; }
@media(max-width: 767px) {
  #lfc-custode-root { bottom: max(12px, env(safe-area-inset-bottom)); right: 12px; }
  #lfc-custode-root .lfc-launcher { width: 65px; height: 65px; }
  #lfc-custode-root .lfc-panel { width: calc(100vw - 24px); height: min(570px, calc(100dvh - 24px)); border-radius: 15px; }
  #lfc-custode-root .lfc-head { min-height: 73px; }
  #lfc-custode-root .lfc-head-avatar { width: 46px; height: 46px; }
  #lfc-custode-root .lfc-head-titles strong { font-size: 19px; }
  #lfc-custode-root .lfc-body { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  #lfc-custode-root *, #lfc-custode-root *::before, #lfc-custode-root *::after { animation: none !important; transition: none !important; }
}
@media print { #lfc-custode-root { display: none !important; } }
/* Migliorie v1.1: finestra realmente laterale e percorsi compatti. */
#lfc-custode-root {
  bottom: var(--lfc-floating-offset, 22px);
}
#lfc-custode-root .lfc-panel {
  width: min(372px, calc(100vw - 26px));
  height: min(568px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
}
#lfc-custode-root .lfc-head {
  min-height: 76px;
}
#lfc-custode-root .lfc-head-titles strong {font-size: 19px;}
#lfc-custode-root .lfc-body {padding: 14px 14px 8px;}
#lfc-custode-root .lfc-bubble {font-size: 12.5px;}
#lfc-custode-root .lfc-topic {min-height: 56px;}
#lfc-custode-root .lfc-resource-wrap {padding: 12px 11px;}
#lfc-custode-root .lfc-resource {padding: 9px 3px;}
#lfc-custode-root .lfc-menu-back {
  display: inline-flex;align-items:center;gap:7px;margin:12px 0 0;
  border:0;background:transparent;color:var(--lfc-navy);font-size:11px;
  text-align:left;padding:6px 2px;border-radius:4px;
}
#lfc-custode-root .lfc-menu-back .lfc-topic-icon {width:19px;}
#lfc-custode-root .lfc-menu-back:hover {color:#8b704c;text-decoration:underline;}
#lfc-custode-root .lfc-more-links {margin:7px 0 0;}
#lfc-custode-root .lfc-more-links a {font-size:11px;color:#536675;text-decoration:underline;text-underline-offset:2px;}
#lfc-custode-root .lfc-urgent {
  display:flex;align-items:flex-start;gap:7px;background:#faf3e7;color:#594127;
  border:1px solid #e9d2ad;padding:9px 10px;border-radius:9px;
  font-size:11px;line-height:1.5;margin:0 0 12px;
}
#lfc-custode-root .lfc-urgent svg {flex-shrink:0;margin-top:1px;}
#lfc-custode-root .lfc-privacy {font-size:9.6px;line-height:1.35;}
#lfc-custode-root .lfc-launcher {width:66px;height:66px;}
#lfc-custode-root .lfc-launcher-label {right:76px;}
#lfc-custode-root button:focus-visible,
#lfc-custode-root a:focus-visible,
#lfc-custode-root input:focus-visible {outline:2px solid #94703a;outline-offset:2px;}
@media(max-width:767px){
  #lfc-custode-root {bottom:max(var(--lfc-floating-offset,12px), env(safe-area-inset-bottom));}
  #lfc-custode-root .lfc-panel {width:calc(100vw - 24px);height:min(565px,calc(100dvh - 24px));}
  #lfc-custode-root .lfc-head {min-height:70px;}
  #lfc-custode-root .lfc-launcher {width:60px;height:60px;}
  #lfc-custode-root .lfc-launcher-label {right:70px;bottom:12px;}
}

#lfc-custode-root .lfc-again {
  display:inline-flex;align-items:center;gap:5px;
  margin:0 0 14px;padding:6px 3px;border:0;background:none;
  color:var(--lfc-navy);font-size:11px;text-decoration:underline;text-underline-offset:2px;
}
#lfc-custode-root .lfc-again .lfc-topic-icon {display:inline-grid;width:18px;}

/* v1.2: tasti nei percorsi di chiarimento e coerenza con le altre azioni. */
#lfc-custode-root .lfc-resource-wrap + .lfc-again {margin-top:0;}
#lfc-custode-root .lfc-topics-label {line-height:1.45;}
#lfc-custode-root .lfc-resource:focus-visible {background:#f2ece1;}
#lfc-custode-root .lfc-bubble {overflow-wrap:anywhere;}

/* v2.1: separazione dei rimandi secondari e migliore leggibilità mobile. */
#lfc-custode-root .lfc-more-links { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 5px; }
#lfc-custode-root .lfc-more-links a { display: inline-block; }
#lfc-custode-root .lfc-contact-prompt { line-height: 1.48; }
@media (max-width: 380px) { #lfc-custode-root .lfc-head-titles strong { font-size: 17px; } }

/* v2.3 — percorsi di approfondimento brevi, non invasivi. */
#lfc-custode-root .lfc-refine {display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:3px 0 11px;}
#lfc-custode-root .lfc-refine-title {grid-column:1/-1;margin:0 0 2px;color:#34485a;font-size:11.5px;font-weight:650;}
#lfc-custode-root .lfc-refine-btn {display:flex;align-items:center;gap:4px;padding:9px 8px;min-height:43px;text-align:left;background:#f8f5ee;border:1px solid #ded5c5;border-radius:9px;color:#15374f;font-size:11.5px;line-height:1.3;}
#lfc-custode-root .lfc-refine-btn:hover,#lfc-custode-root .lfc-refine-btn:focus-visible {background:#f3ebde;border-color:#a99269;}
#lfc-custode-root .lfc-reset {border:0;background:transparent;color:#203e56;padding:7px 5px;font-size:11px;font-weight:600;cursor:pointer;}
#lfc-custode-root .lfc-reset:focus-visible {outline:2px solid #b39867;outline-offset:3px;}
@media(max-width:380px){#lfc-custode-root .lfc-refine {grid-template-columns:1fr;}}
