:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
  --bg: #f4f6f8; --surface: #fff; --text: #17202a; --muted: #627080; --border: #dce2e8;
  --primary: #172b4d; --soft: #edf2f7; --danger: #9f2d2d; --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; }
button, .button { border: 0; border-radius: 11px; padding: 11px 17px; font: inherit; font-weight: 800; cursor: pointer; background: var(--primary); color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:disabled { opacity: .45; cursor: not-allowed; }
.button.ghost, button.ghost { background: var(--soft); color: var(--text); border: 1px solid var(--border); }
.button.danger, button.danger { color: var(--danger); }
.button.small, button.small { padding: 7px 10px; font-size: .85rem; }
.full { width: 100%; }
.topbar { min-height: 68px; padding: 0 max(20px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 900; letter-spacing: -.035em; font-size: 1.4rem; }
.brand.standalone { display: inline-block; margin: 0 auto 16px; text-decoration: none; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 42px auto; display: grid; gap: 20px; }
.two-col { grid-template-columns: 1.05fr .95fr; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: 0 12px 36px rgba(20,30,40,.05); }
h1 { margin: .25rem 0 .75rem; font-size: clamp(2rem,4.4vw,3.5rem); letter-spacing: -.045em; line-height: 1.02; }
h2, h3 { margin-top: 0; }
.lead { font-size: 1.12rem; line-height: 1.6; color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 900; color: #64748b; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
label { display: grid; gap: 7px; margin-bottom: 14px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 11px 12px; border: 1px solid #b8c2cc; border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
textarea { min-height: 88px; resize: vertical; }
.check { grid-template-columns: auto 1fr; align-items: start; font-weight: 500; }
.check input { width: auto; margin-top: 3px; }
.check em { color: var(--muted); }
.status, .privacy-box, .warning { padding: 12px 14px; border-radius: 11px; background: var(--soft); }
.status.compact { padding: 8px 12px; font-size: .86rem; }
.privacy-box { margin-top: 18px; }
.result { display: block; margin-top: 14px; font-weight: 700; min-height: 1.4em; }
.auth-bg { min-height: 100vh; display: grid; place-items: center; }
.auth-shell { width: min(480px, calc(100% - 32px)); text-align: center; }
.auth-card { text-align: left; }
.auth-card h1 { font-size: 2.15rem; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.identity-chip { background: var(--soft); border: 1px solid var(--border); padding: 8px 12px; border-radius: 999px; font-weight: 800; font-size: .88rem; }
.admin-body { display: grid; grid-template-columns: 260px minmax(0,1fr); min-height: 100vh; }
.sidebar { background: #111827; color: #fff; padding: 24px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.admin-brand { padding: 0 10px; }
.sidebar-caption { color: #9ca3af; font-size: .76rem; padding: 0 10px 16px; }
.nav-item { width: 100%; background: transparent; justify-content: flex-start; color: #cbd5e1; margin: 2px 0; }
.nav-item.active, .nav-item:hover { background: #243047; color: #fff; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; padding: 10px; color: #cbd5e1; font-size: .85rem; }
.admin-main { padding: 30px; min-width: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h1 { font-size: 2.2rem; }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: grid; gap: 8px; }
.metric-value { font-size: 2rem; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font-size: .85rem; }
.section-toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.stack { display: grid; gap: 14px; }
.registration-card h3 { margin-bottom: 2px; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; }
.detail-grid dt { color: var(--muted); font-size: .84rem; }
.detail-grid dd { margin: 0; font-weight: 650; }
.registration-actions { display: grid; grid-template-columns: 1fr .8fr 1fr auto auto; gap: 10px; margin-top: 18px; align-items: end; }
.inline-form { display: grid; grid-template-columns: 180px 1fr auto; gap: 12px; align-items: end; }
.inline-form label { margin-bottom: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .91rem; }
.data-table th, .data-table td { text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small-text { font-size: .78rem; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.switch-label { display: flex; grid-template-columns: none; flex-direction: row; gap: 8px; align-items: center; margin: 0; }
.switch-label { cursor: pointer; user-select: none; }
.switch-label input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand-accent,var(--primary)); cursor: pointer; }
.switch-label input:disabled { cursor: not-allowed; }
.settings-save-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.settings-save-bar .small-text { transition: color .15s ease; }
.settings-stack.settings-dirty, #registrationSettingsForm.settings-dirty { border-left: 3px solid var(--brand-accent,var(--primary)); padding-left: 12px; }
.settings-stack.settings-dirty .settings-save-bar .small-text, #registrationSettingsForm.settings-dirty .settings-save-bar .small-text { color: var(--brand-accent,var(--primary)); font-weight: 800; }
dialog.modal { width: min(620px, calc(100% - 30px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(15,23,42,.58); }
dialog.modal form { padding: 26px; }
.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 10px; }
.detail-list dt { color: var(--muted); }.detail-list dd { margin: 0; font-weight: 800; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.identity-details { margin: 16px 0; padding: 16px; background: var(--soft); border-radius: 12px; }
@media (max-width: 1000px) { .metric-grid { grid-template-columns: repeat(2,1fr); } .two-col { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .admin-body { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .sidebar nav { display: flex; overflow-x: auto; } .nav-item { width: auto; white-space: nowrap; } .sidebar-bottom { display: none; } .admin-main { padding: 18px; } .grid, .inline-form, .registration-actions { grid-template-columns: 1fr; } .metric-grid { grid-template-columns: 1fr 1fr; } .data-table { display: block; overflow-x: auto; } .section-toolbar { align-items: flex-start; } }
@media (max-width: 480px) { .metric-grid { grid-template-columns: 1fr; } .shell { margin: 22px auto; } .card { padding: 20px; } }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ViViSoChat v0.6.1 - layout chat definitivo cittadino/moderatore */
.sr-only { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.chat-body { height:100vh; height:100dvh; overflow:hidden; background:#e9edf2; }
.chat-app-shell { height:100%; display:grid; grid-template-columns:236px minmax(0,1fr); min-width:0; }
.chat-sidebar { min-width:0; background:#f8fafc; border-right:1px solid var(--border); display:flex; flex-direction:column; z-index:40; }
.chat-sidebar-brand { min-height:72px; padding:12px 14px; display:flex; align-items:center; gap:10px; border-bottom:1px solid var(--border); background:#fff; }
.chat-sidebar-brand > div:last-child { min-width:0; display:grid; gap:2px; }
.chat-sidebar-brand strong { font-size:1rem; letter-spacing:-.02em; }
.app-mark { width:38px; height:38px; flex:0 0 auto; border-radius:12px; display:grid; place-items:center; background:var(--primary); color:#fff; font-weight:900; letter-spacing:-.05em; box-shadow:0 5px 16px rgba(23,43,77,.16); }
.app-mark.small { width:36px; height:36px; border-radius:11px; }
.connection-state { color:var(--muted); font-size:.72rem; font-weight:800; }
.connection-state.online { color:#1f6f4a; }
.conversation-list { padding:9px; display:grid; gap:5px; overflow:auto; overscroll-behavior:contain; }
.conversation-item { width:100%; min-width:0; text-align:left; justify-content:flex-start; align-items:flex-start; display:grid; gap:3px; background:transparent; color:var(--text); border:1px solid transparent; padding:10px 11px; border-radius:12px; }
.conversation-item strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.conversation-item:hover, .conversation-item.active { background:#fff; border-color:var(--border); }
.conversation-item.active { box-shadow:0 4px 14px rgba(20,30,40,.05); }
.conversation-meta { color:var(--muted); font-size:.72rem; font-weight:650; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-panel { min-width:0; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr) auto; background:var(--bg); position:relative; }
.chat-sticky-header { position:relative; z-index:25; min-height:64px; padding:9px clamp(10px,2vw,18px); display:flex; align-items:center; justify-content:space-between; gap:12px; background:rgba(255,255,255,.97); border-bottom:1px solid var(--border); box-shadow:0 2px 8px rgba(15,23,42,.035); }
.chat-header-left, .chat-header-right { display:flex; align-items:center; gap:10px; min-width:0; }
.chat-heading { min-width:0; }
.chat-kicker { color:var(--muted); font-size:.7rem; font-weight:800; line-height:1.1; }
.chat-title { margin:1px 0 0; font-size:1.08rem; line-height:1.2; letter-spacing:-.025em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.room-role { color:var(--muted); font-size:.75rem; font-weight:800; white-space:nowrap; }
.icon-button { width:40px; height:40px; padding:0; display:inline-grid; place-items:center; border-radius:12px; background:transparent; color:var(--text); border:1px solid transparent; font-size:1.35rem; line-height:1; }
.icon-button:hover, .icon-button:focus-visible { background:var(--soft); border-color:var(--border); outline:none; }
.sidebar-toggle { display:none; font-size:1rem; }
.message-viewport { min-height:0; overflow-y:auto; padding:12px clamp(10px,3vw,30px) 20px; overscroll-behavior:contain; scrollbar-gutter:stable; }
.message-list { width:min(900px,100%); margin:0 auto; display:flex; flex-direction:column; gap:7px; }
.load-older { display:flex; margin:2px auto 14px; }
.day-separator { align-self:center; width:max-content; max-width:100%; display:flex; align-items:center; justify-content:center; margin:0; padding:10px 0 7px; min-height:34px; position:sticky; top:0; z-index:3; pointer-events:none; background:transparent; isolation:isolate; }
.day-separator span { background:rgba(237,242,247,.96); color:var(--muted); border:1px solid var(--border); border-radius:999px; padding:5px 11px; font-size:.72rem; font-weight:800; box-shadow:0 2px 8px rgba(20,30,40,.04); }
.message-row { --swipe-x:0px; display:flex; flex-direction:column; width:min(78%,680px); align-self:flex-start; touch-action:pan-y; transform:translateX(var(--swipe-x)); transition:transform .12s ease; position:relative; }
.message-row.swiping { transition:none; }
.message-row.own { align-self:flex-end; align-items:flex-end; }
.message-row.other { align-items:flex-start; }
.message-bubble { padding:10px 13px; border-radius:17px 17px 17px 5px; background:#fff; border:1px solid var(--border); white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.42; box-shadow:0 2px 7px rgba(20,30,40,.04); user-select:text; }
.message-row.own .message-bubble { background:#dfeaf8; border-color:#cad9eb; border-radius:17px 17px 5px 17px; }
.message-row.deleted .message-bubble { color:var(--muted); font-style:italic; background:#f1f3f5; }
.message-meta { display:flex; gap:7px; align-items:center; padding:3px 5px 0; color:var(--muted); font-size:.68rem; }
.message-meta .mono { font-size:inherit; }
.reply-quote { max-width:100%; margin:0 0 3px; padding:6px 9px; display:grid; text-align:left; gap:2px; border-left:3px solid #7b8fa7; background:rgba(255,255,255,.78); color:var(--text); border-radius:7px; font-size:.72rem; }
.reply-quote span { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:420px; }
.chat-compose-area { z-index:20; background:#fff; border-top:1px solid var(--border); padding-bottom:env(safe-area-inset-bottom,0); }
.reply-bar { background:#f8fafc; padding:8px max(12px,calc((100% - 900px)/2)); display:flex; justify-content:space-between; align-items:center; gap:12px; border-bottom:1px solid var(--border); }
.reply-bar-content { min-width:0; display:grid; gap:2px; border-left:3px solid var(--primary); padding-left:9px; }
.reply-caption { color:var(--text); font-size:.78rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reply-text { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:min(70vw,700px); font-size:.76rem; }
.reply-cancel { width:32px; height:32px; font-size:1.35rem; }
.composer { padding:9px max(10px,calc((100% - 900px)/2)); display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:end; background:#fff; }
.composer textarea { min-height:44px; max-height:132px; resize:none; margin:0; border-radius:18px; padding:11px 13px; line-height:1.35; }
.send-button { min-height:44px; border-radius:16px; padding:10px 16px; }
.composer-status { min-height:0; padding:0 max(10px,calc((100% - 900px)/2)); background:#fff; color:var(--danger); font-size:.75rem; }
.composer-status:not(:empty) { padding-top:2px; padding-bottom:7px; }
.empty-chat { width:min(900px,100%); margin:24px auto; text-align:center; color:var(--muted); }
.popup-menu[hidden], .sidebar-backdrop[hidden] { display:none!important; }
.popup-menu [hidden], [hidden].icon-button { display:none!important; }
.popup-menu { position:fixed; z-index:1000; min-width:205px; max-width:min(310px,calc(100vw - 16px)); padding:6px; background:#fff; border:1px solid var(--border); border-radius:13px; box-shadow:0 18px 50px rgba(15,23,42,.18); }
.popup-menu button, .popup-menu a { width:100%; min-height:38px; border:0; border-radius:9px; padding:8px 10px; display:flex; justify-content:flex-start; align-items:center; background:transparent; color:var(--text); text-decoration:none; font:inherit; font-weight:700; font-size:.86rem; text-align:left; }
.popup-menu button:hover, .popup-menu a:hover { background:var(--soft); }
.popup-menu .danger-item { color:var(--danger); }
.menu-separator { height:1px; background:var(--border); margin:5px 3px; }
.top-menu { right:10px; top:58px; }
.context-menu { left:8px; top:8px; }
.sidebar-backdrop { position:fixed; inset:0; z-index:35; background:rgba(15,23,42,.34); }
.moderation-modal { width:min(980px,calc(100% - 28px))!important; }
.moderation-table-wrap { max-height:58vh; overflow:auto; border:1px solid var(--border); border-radius:12px; margin-top:14px; }
.moderation-table { margin:0; background:#fff; }
.moderation-table th { position:sticky; top:0; background:#fff; z-index:1; }
.moderation-actions { min-width:340px; }
.moderation-actions .status { display:inline-flex; align-items:center; }

@media (max-width:760px) {
  .chat-app-shell { grid-template-columns:1fr; }
  .chat-sidebar { position:fixed; inset:0 auto 0 0; width:min(82vw,290px); transform:translateX(-102%); transition:transform .18s ease; box-shadow:12px 0 36px rgba(15,23,42,.16); }
  .chat-sidebar.open { transform:translateX(0); }
  .sidebar-toggle { display:inline-grid; }
  .chat-sticky-header { min-height:58px; padding:7px 8px; padding-top:max(7px,env(safe-area-inset-top)); }
  .chat-sticky-header .app-mark.small { width:33px; height:33px; border-radius:10px; }
  .chat-title { font-size:1rem; }
  .chat-kicker { font-size:.66rem; }
  .room-role { display:none; }
  .message-viewport { padding:8px 7px 14px; }
  .message-row { width:89%; }
  .message-bubble { padding:9px 11px; }
  .composer { padding:7px; }
  .send-button { padding:9px 12px; }
  .reply-bar { padding:7px 9px; }
  .moderation-table-wrap { max-height:65vh; }
  .moderation-actions { min-width:260px; }
  .moderation-table .button { padding:6px 8px; font-size:.75rem; }
}

@media (max-width:420px) {
  .chat-header-left { gap:6px; }
  .chat-sticky-header .app-mark.small { display:none; }
  .message-row { width:93%; }
  .message-meta { font-size:.64rem; }
}

/* ViViSoChat v0.5.1 — credenziali provvisorie */
.credential-value { font-size:1.05rem; word-break:break-all; user-select:all; background:var(--soft); padding:8px 10px; border-radius:8px; }


/* ViViSoChat v0.5.2 — visualizzazione credenziali senza dipendenza da <dialog> */
.credential-overlay[hidden] { display:none!important; }
.credential-overlay { position:fixed; inset:0; z-index:10000; display:flex; align-items:center; justify-content:center; padding:18px; background:rgba(15,23,42,.64); }
.credential-overlay-card { width:min(620px,100%); max-height:calc(100vh - 36px); overflow:auto; background:var(--surface); border:1px solid var(--border); border-radius:18px; padding:26px; box-shadow:0 30px 80px rgba(0,0,0,.30); }
.credential-overlay-card h2 { margin-top:0; }
.credential-overlay-card .credential-value { font-size:1.12rem; }

.table-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }

/* ViViSoChat v0.6.0 - login/recovery */
.auth-help { display:inline-block; margin-top:14px; color:var(--primary); font-weight:700; }
.admin-login-bg .auth-card { border-top:4px solid var(--primary); }

/* ViViSoChat v0.6.3 - citizen/moderator chat usability patch */
.current-user-name { max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.82rem; font-weight:800; color:var(--text); }
.chat-sidebar-status { margin-top:auto; padding:11px 14px calc(11px + env(safe-area-inset-bottom,0)); border-top:1px solid var(--border); background:#fff; color:var(--muted); font-size:.78rem; font-weight:800; }
.history-loader { width:max-content; max-width:90%; margin:2px auto 10px; padding:5px 10px; border-radius:999px; background:rgba(255,255,255,.9); border:1px solid var(--border); color:var(--muted); font-size:.72rem; box-shadow:0 2px 8px rgba(15,23,42,.04); }
.history-loader[hidden], .reply-bar[hidden], .app-modal-backdrop[hidden] { display:none!important; }
.app-modal-backdrop { position:fixed; inset:0; z-index:1500; display:grid; place-items:center; padding:18px; background:rgba(15,23,42,.56); backdrop-filter:blur(2px); }
.app-modal { width:min(520px,100%); max-height:min(82vh,700px); overflow:auto; background:#fff; border:1px solid var(--border); border-radius:18px; box-shadow:0 30px 80px rgba(15,23,42,.28); padding:20px; }
.app-modal-header { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.app-modal-header h2 { margin:2px 0 0; font-size:1.2rem; }
.app-modal-message { margin:12px 0; color:var(--muted); line-height:1.5; white-space:pre-line; }
.app-modal-fields { display:grid; gap:12px; margin-top:12px; }
.app-modal-fields label { display:grid; gap:6px; font-weight:800; font-size:.82rem; }
.app-modal-fields input, .app-modal-fields textarea, .app-modal-fields select { width:100%; margin:0; }
.app-modal-fields textarea { min-height:86px; resize:vertical; }
.app-modal-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:18px; }
.app-modal-confirm-danger { background:var(--danger)!important; border-color:var(--danger)!important; color:#fff!important; }
@media (max-width:760px) {
  .current-user-name { max-width:120px; font-size:.74rem; }
  .chat-sidebar-status { padding-bottom:max(11px,env(safe-area-inset-bottom)); }
  .app-modal-backdrop { align-items:end; padding:0; }
  .app-modal { width:100%; max-height:86vh; border-radius:18px 18px 0 0; padding:18px 16px max(18px,env(safe-area-inset-bottom)); }
}
@media (max-width:420px) {
  .current-user-name { max-width:88px; }
  .room-role:not(:empty) { display:none; }
}
.modal-open { overflow:hidden!important; }

/* ViViSoChat v0.6.4 - correzioni menu cittadino/data/colloquio privato */
.chat-kicker.private-chat-kicker { color:var(--primary); font-weight:900; letter-spacing:.045em; text-transform:uppercase; }
.day-separator + .day-separator { margin-top:0; }

/* ViViSoChat v0.6.5 - pagina moderatore, messaggi importanti e invio con Enter */
.chat-user-identity { min-width:0; display:grid; gap:1px; justify-items:end; line-height:1.08; }
.chat-user-identity .room-role { display:block!important; font-size:.64rem; letter-spacing:.055em; font-weight:900; color:var(--primary); }
.chat-user-identity .current-user-name { display:block; }

.important-message-bubble { width:min(100%,620px); padding:0!important; overflow:hidden; border-width:1px; }
.important-message-title { padding:8px 12px; font-size:.75rem; font-weight:950; letter-spacing:.045em; text-transform:uppercase; }
.important-message-static { padding:10px 12px 0; font-weight:750; line-height:1.4; white-space:pre-wrap; }
.important-message-text { padding:10px 12px 12px; white-space:pre-wrap; line-height:1.45; }
.important-message-bubble.important-communication { border-color:#9db5d5; background:#f5f9ff; }
.important-message-bubble.important-communication .important-message-title { background:#e5eef9; color:#183b69; }
.important-message-bubble.important-notice { border-color:#d6b96f; background:#fffaf0; }
.important-message-bubble.important-notice .important-message-title { background:#f8e9bd; color:#674c08; }

@media (max-width:760px) {
  .chat-user-identity { max-width:132px; }
  .chat-user-identity .room-role { display:block!important; font-size:.58rem; }
}
@media (max-width:420px) {
  .chat-user-identity { max-width:94px; }
  .chat-user-identity .room-role { display:block!important; }
}

/* ViViSoChat v0.6.5 - Control Center: template e archivio colloqui */
.important-template-edit { gap:12px; }
.compact-card { padding:16px; }
.archive-message-list { display:grid; gap:10px; margin-top:14px; }
.archive-message { padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:var(--soft); }
.archive-message-body { margin-top:5px; white-space:pre-wrap; overflow-wrap:anywhere; }

/* LAB only: directory identita temporanea nel Control Center. */
.lab-only-card { border-style: dashed; }
.lab-only-card > .section-toolbar { align-items: flex-start; }
.lab-only-card #labIdentityDirectory { overflow-x: auto; margin-top: 12px; }

/* ViViSoChat v0.7.0 - registrazione pubblica vincolata */
.registration-form-card { min-width: 0; }
.phone-field { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: stretch; }
.phone-prefix { display: grid; place-items: center; min-width: 58px; padding: 0 12px; border: 1px solid #b8c2cc; border-right: 0; border-radius: 10px 0 0 10px; background: var(--soft); color: var(--text); font-weight: 900; }
.phone-field input { border-radius: 0 10px 10px 0; }
.field-error { min-height: 1.05em; color: var(--danger); font-size: .78rem; font-weight: 750; }
.form-hint { margin: -6px 0 12px; font-size: .82rem; }
.compact-check { margin-top: 8px; margin-bottom: 14px; }
.autocomplete-list { position: relative; z-index: 8; display: grid; gap: 4px; margin: -8px 0 12px; padding: 6px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: 0 12px 30px rgba(20,30,40,.12); }
.autocomplete-list[hidden] { display: none!important; }
.autocomplete-item { width: 100%; justify-content: flex-start; text-align: left; border: 0; border-radius: 8px; padding: 10px 11px; background: #fff; color: var(--text); font-weight: 700; }
.autocomplete-item:hover, .autocomplete-item:focus-visible { background: var(--soft); }
.registration-review-warning { margin: 12px 0 16px; border: 1px solid #e2c67a; background: #fff9e8; color: #6f5410; }
@media (max-width: 1000px) { .registration-shell { grid-template-columns: 1fr; } }

/* Registrazione H6: indirizzo automatico e manuale sono mutuamente esclusivi. */
.registration-address-block {
  border: 1px solid var(--border, #d7dce3);
  border-radius: 14px;
  padding: 1rem;
  margin: 1rem 0;
}
.registration-address-block legend {
  font-weight: 700;
  padding: 0 .4rem;
}
.manual-address-toggle { margin-top: 1rem; }
.manual-address-panel {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px dashed var(--border, #d7dce3);
  border-radius: 14px;
}
.manual-address-panel[hidden] { display: none !important; }
.manual-address-panel h3 { margin-top: 0; }


/* Registrazione H7: stato visivo chiaro per la modalita indirizzo inattiva. */
.registration-address-block:disabled { opacity: .58; }
.registration-address-block:disabled input,
.registration-address-block:disabled select { cursor: not-allowed; }

/* Registrazione H9: consenso privacy visivamente separato dalla compilazione indirizzo. */
.privacy-consent-block {
  margin: 1.65rem 0 1rem;
  padding: 1.15rem 1rem 1rem;
  border-top: 2px solid var(--border, #d7dce3);
  background: var(--soft);
  border-radius: 12px;
}
.privacy-consent-block h3 { margin: 0 0 .45rem; }
.privacy-consent-hint { margin: 0 0 .85rem; }
.privacy-consent-check { margin: 0; }

/* v0.8.0 lifecycle / return matching */
.registration-return-warning,
.registration-duplicate-warning { margin: 12px 0 16px; display: grid; gap: 6px; border: 1px solid #d7b35f; }
.registration-return-warning strong,
.registration-duplicate-warning strong { letter-spacing: .02em; }
.registration-return-warning p,
.registration-duplicate-warning p { margin: 0; }
.withdrawal-notice { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.withdrawal-notice:last-child { border-bottom: 0; }
@media (max-width: 760px) { .withdrawal-notice { flex-direction: column; gap: 4px; } }

/* v0.9.0 lifecycle quartieri */
.message-viewport { position:relative; }
.message-viewport.district-unavailable { overflow:hidden; background:var(--soft); }
.message-viewport.district-unavailable .message-list,
.message-viewport.district-unavailable .empty-chat,
.message-viewport.district-unavailable .history-loader { opacity:.12; filter:blur(8px); pointer-events:none; user-select:none; }
.district-unavailable-overlay { position:absolute; inset:0; z-index:20; display:grid; place-items:center; padding:24px; background:rgba(244,247,250,.72); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
.district-unavailable-overlay[hidden] { display:none!important; }
.district-unavailable-card { width:min(520px,100%); display:grid; gap:8px; padding:20px; border:1px solid var(--border); border-radius:16px; background:rgba(255,255,255,.94); box-shadow:0 18px 50px rgba(15,23,42,.10); text-align:center; }
.district-unavailable-card strong { font-size:1.05rem; }
.district-unavailable-card span { color:var(--muted); line-height:1.45; }
.conversation-item .district-state-badge { display:inline-flex; width:max-content; margin-top:2px; padding:2px 7px; border-radius:999px; font-size:.68rem; font-weight:800; letter-spacing:.04em; background:var(--soft); color:var(--muted); }
.conversation-item .district-state-badge.disabled { background:#fff3cd; color:#795a00; }
.conversation-item .district-state-badge.archived { background:#eceff3; color:#4b5563; }
.table-actions .compact-select { width:auto; min-width:150px; min-height:34px; margin:0; padding:6px 8px; border-radius:9px; font-size:.8rem; }

/* v0.10.0 - allegati sicuri */
.settings-stack { display:grid; gap:12px; }
.settings-stack > label:not(.check-row) { display:grid; gap:6px; max-width:420px; }
.format-fieldset { border:1px solid var(--border); border-radius:12px; padding:12px; }
.format-fieldset legend { padding:0 6px; font-weight:800; }
.format-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:8px 14px; }
.format-grid label,.check-row { display:flex; gap:8px; align-items:center; font-weight:700; }
.format-grid input,.check-row input { width:auto; margin:0; }

.composer.has-attachments { grid-template-columns:auto minmax(0,1fr) auto; }
.attach-button { width:44px; height:44px; border:1px solid var(--border); border-radius:50%; background:var(--soft); color:var(--text); font-size:1.55rem; line-height:1; padding:0; display:grid; place-items:center; }
.attach-button:hover { background:#e9eef5; }
.attach-button[hidden] { display:none!important; }
.attachment-menu { z-index:1100; min-width:190px; }

.message-bubble.attachment-bubble { padding:8px; width:min(100%,520px); overflow:hidden; white-space:normal; }
.attachment-image { display:block; width:100%; max-height:420px; object-fit:contain; border-radius:12px; background:#eef1f4; user-select:none; -webkit-user-drag:none; }
.attachment-image-button { display:block; width:100%; border:0; padding:0; margin:0; background:transparent; cursor:zoom-in; }
.document-card { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; align-items:center; min-width:min(360px,78vw); }
.document-icon { width:40px; height:40px; border-radius:10px; background:var(--soft); display:grid; place-items:center; font-weight:900; font-size:.72rem; }
.document-info { min-width:0; display:grid; gap:2px; }
.document-name { font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.document-meta { color:var(--muted); font-size:.78rem; }
.document-actions { display:flex; gap:6px; }
.document-actions .button { min-height:34px; padding:6px 9px; font-size:.78rem; }
.attachment-forwarded { display:inline-block; margin-top:5px; color:var(--muted); font-size:.72rem; font-weight:700; }

.attachment-viewer-backdrop { position:fixed; inset:0; z-index:1800; background:rgba(6,12,20,.92); display:grid; place-items:center; padding:18px; }
.attachment-viewer-backdrop[hidden] { display:none!important; }
.attachment-viewer { position:relative; width:min(1100px,100%); height:min(820px,92vh); display:grid; place-items:center; }
.attachment-viewer img { max-width:100%; max-height:100%; object-fit:contain; user-select:none; -webkit-user-drag:none; }
.attachment-viewer-close { position:absolute; top:0; right:0; z-index:2; background:#fff; }

@media (max-width:700px) {
  .document-card { min-width:min(280px,76vw); }
  .attachment-image { max-height:52vh; }
}

/* v0.11.0 - capability moderatori */
.capability-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:10px 16px; }
.media-archive-modal { width:min(920px,94vw); }
.media-archive-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:12px; margin-top:14px; max-height:62vh; overflow:auto; padding-right:4px; }
.media-archive-item { display:grid; gap:8px; align-content:start; border:1px solid var(--border); border-radius:12px; padding:10px; background:var(--card,#fff); min-width:0; }
.media-archive-item img { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:10px; background:var(--soft); cursor:zoom-in; user-select:none; -webkit-user-drag:none; }
.media-document-icon { min-height:110px; display:grid; place-items:center; border-radius:10px; background:var(--soft); font-weight:900; letter-spacing:.05em; }
.media-archive-item strong,.media-archive-item span { min-width:0; overflow-wrap:anywhere; }

/* ViViSoChat v0.12.0 - comunicazioni globali ADMIN pinnate */
.chat-panel { grid-template-rows:auto auto minmax(0,1fr) auto; }
.global-important-panel { z-index:24; display:grid; gap:7px; padding:8px max(10px,calc((100% - 900px)/2)); background:#fff; border-bottom:1px solid var(--border); box-shadow:0 3px 10px rgba(15,23,42,.04); }
.global-important-panel[hidden] { display:none!important; }
.bot-warning-panel { z-index:25; display:grid; gap:8px; padding:9px max(10px,calc((100% - 900px)/2)); background:#fff8dc; border-bottom:1px solid #e2bd49; }
.bot-warning-panel[hidden] { display:none!important; }
.bot-warning-card { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border:1px solid #d8ae32; border-radius:12px; color:#5f4700; background:#fff3b8; box-shadow:0 5px 16px rgba(146,103,0,.12); }
.bot-warning-sticker { flex:0 0 auto; font-size:1.8rem; line-height:1; }
.bot-warning-copy { display:grid; gap:3px; min-width:0; }
.bot-warning-copy strong { font-size:.86rem; }
.bot-warning-copy span { font-size:.78rem; line-height:1.35; }
.bot-warning-card.ban { border-color:#c76755; color:#6d2116; background:#ffe0d9; }
.global-important-card { overflow:hidden; border:1px solid #c7a34a; border-radius:14px; background:#fff9e9; box-shadow:0 3px 12px rgba(70,52,9,.08); }
.global-important-card.communication { border-color:#91aaca; background:#f5f9ff; }
.global-important-card-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:7px 11px; background:#f7e4aa; color:#5a4309; }
.global-important-card.communication .global-important-card-header { background:#e4eef9; color:#183b69; }
.global-important-card-header strong { font-size:.72rem; letter-spacing:.055em; text-transform:uppercase; }
.global-important-expiry { font-size:.68rem; font-weight:750; opacity:.82; white-space:nowrap; }
.global-important-content { padding:9px 11px 11px; display:grid; gap:5px; }
.global-important-title { font-weight:950; font-size:.9rem; }
.global-important-static { font-weight:750; white-space:pre-wrap; }
.global-important-text { white-space:pre-wrap; line-height:1.42; }
.global-important-admin-preview { border:1px dashed var(--border); border-radius:12px; padding:12px; background:var(--soft); }
.global-important-history-card { padding:12px 0; border-bottom:1px solid var(--border); display:grid; gap:6px; }
.global-important-history-card:last-child { border-bottom:0; }
.global-important-history-meta { display:flex; flex-wrap:wrap; gap:7px 14px; color:var(--muted); font-size:.78rem; }
.global-important-status { display:inline-flex; align-items:center; width:max-content; border-radius:999px; padding:3px 8px; font-size:.68rem; font-weight:900; letter-spacing:.035em; }
.global-important-status.PUBLISHED { background:#e8f5ed; color:#23633f; }
.global-important-status.EXPIRED { background:#eef1f4; color:#59636e; }
.global-important-status.CANCELLED { background:#fbecec; color:#8b2f2f; }
@media (max-width:760px) {
  .global-important-panel { padding:6px 7px; }
  .global-important-card-header { align-items:flex-start; flex-direction:column; gap:3px; }
}

/* ViViSoChat v0.13.0 - Control Center Revolution I / branding configurabile */
:root {
  --brand-accent:#2563eb;
  --admin-sidebar:#111827;
  --on-primary:#fff;
  --on-sidebar:#fff;
  --on-sidebar-muted:#cbd5e1;
  --sidebar-active:#2563eb;
  --on-sidebar-active:#fff;
  --chat-bg:#e9edf2;
  --bubble-own:#dbeafe;
  --bubble-other:#fff;
  --on-bubble-own:#17202a;
  --on-bubble-other:#17202a;
  --message-radius:14px;
}
button, .button { color:var(--on-primary,#fff); }
.app-mark.has-logo, .branding-logo-preview.has-logo { padding:3px; background:var(--surface); border:1px solid var(--border); overflow:hidden; }
.app-mark img, .branding-logo-preview img { width:100%; height:100%; object-fit:contain; border-radius:inherit; display:block; }

/* Control Center: gerarchia, navigazione e pagine configurazione */
.admin-revolution { grid-template-columns:284px minmax(0,1fr); background:#eef2f6; }
.admin-sidebar-shell { width:284px; padding:18px 14px; background:var(--admin-sidebar); color:var(--on-sidebar); overflow-y:auto; }
.admin-sidebar-head { display:flex; gap:11px; align-items:center; padding:4px 8px 18px; border-bottom:1px solid rgba(148,163,184,.22); margin-bottom:10px; }
.admin-logo-mark { width:44px; height:44px; border-radius:13px; flex:0 0 auto; }
.admin-brand-copy { min-width:0; }
.admin-brand { padding:0; color:var(--on-sidebar); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-sidebar-shell .sidebar-caption { padding:2px 0 0; margin:0; color:var(--on-sidebar-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-nav { display:grid; gap:9px; }
.nav-group { display:grid; gap:2px; }
.nav-group-label { padding:8px 10px 3px; color:var(--on-sidebar-muted); font-size:.67rem; text-transform:uppercase; letter-spacing:.13em; font-weight:900; }
.admin-sidebar-shell .nav-item { color:var(--on-sidebar-muted); border:1px solid transparent; border-radius:10px; min-height:40px; padding:9px 11px; }
.admin-sidebar-shell .nav-item:hover { color:var(--on-sidebar); background:rgba(148,163,184,.13); }
.admin-sidebar-shell .nav-item.active { color:var(--on-sidebar-active,#fff); background:var(--sidebar-active); box-shadow:0 6px 18px rgba(15,23,42,.18); }
.super-chat-link { margin-top:7px; border-color:rgba(148,163,184,.28)!important; }
.admin-sidebar-shell .sidebar-bottom { color:var(--on-sidebar-muted); border-top:1px solid rgba(148,163,184,.22); margin-top:14px; padding-top:16px; }
.admin-sidebar-shell .sidebar-bottom .button.ghost { background:rgba(255,255,255,.08); color:var(--on-sidebar); border-color:rgba(148,163,184,.28); }
.admin-main { max-width:1600px; width:100%; margin:0 auto; padding:30px clamp(20px,3vw,46px) 60px; }
.admin-header-revolution { position:sticky; top:0; z-index:20; margin:-30px calc(-1 * clamp(20px,3vw,46px)) 24px; padding:22px clamp(20px,3vw,46px) 18px; background:rgba(238,242,246,.94); backdrop-filter:blur(12px); border-bottom:1px solid rgba(203,213,225,.75); }
.admin-view-subtitle { margin:5px 0 0; color:var(--muted); font-size:.9rem; }
.config-page-intro { margin-bottom:16px; }
.config-page-intro h2 { margin:.15rem 0 .4rem; font-size:1.55rem; }
.settings-stack { display:grid; gap:16px; }
.settings-section-title h3 { margin-bottom:4px; }
.branding-layout { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr); gap:20px; align-items:start; }
.branding-color-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 18px; }
.branding-color-grid label { grid-template-columns:1fr 54px; align-items:center; margin:0; }
.branding-color-grid input[type="color"] { width:54px; height:38px; padding:3px; cursor:pointer; }
.branding-logo-row { display:flex; gap:14px; align-items:center; }
.branding-logo-preview { width:72px; height:72px; border-radius:18px; display:grid; place-items:center; background:var(--primary); color:var(--on-primary); font-size:1.3rem; font-weight:900; flex:0 0 auto; }
.branding-preview-card { position:sticky; top:120px; }
.branding-preview { border:1px solid var(--border); border-radius:18px; overflow:hidden; background:var(--preview-bg,#e9edf2); }
.branding-preview-header { padding:14px 16px; display:grid; gap:2px; background:var(--preview-surface,#fff); border-bottom:1px solid rgba(148,163,184,.35); }
.branding-preview-header span { color:var(--muted); font-size:.76rem; }
.branding-preview-chat { min-height:300px; padding:26px 18px; display:flex; flex-direction:column; gap:12px; background-color:var(--preview-bg,#e9edf2); }
.branding-preview[data-pattern="dots"] .branding-preview-chat { background-image:radial-gradient(rgba(100,116,139,.18) 1px,transparent 1px); background-size:18px 18px; }
.branding-preview[data-pattern="grid"] .branding-preview-chat { background-image:linear-gradient(rgba(100,116,139,.10) 1px,transparent 1px),linear-gradient(90deg,rgba(100,116,139,.10) 1px,transparent 1px); background-size:24px 24px; }
.branding-preview[data-pattern="diagonal"] .branding-preview-chat { background-image:repeating-linear-gradient(135deg,rgba(100,116,139,.08) 0,rgba(100,116,139,.08) 1px,transparent 1px,transparent 16px); }
.branding-preview-bubble { max-width:82%; padding:10px 13px; border:1px solid rgba(148,163,184,.45); box-shadow:0 2px 7px rgba(20,30,40,.04); line-height:1.4; }
.branding-preview-bubble.other { align-self:flex-start; background:var(--preview-other,#fff); color:var(--preview-on-other,#17202a); border-radius:var(--preview-radius,14px) var(--preview-radius,14px) var(--preview-radius,14px) 5px; }
.branding-preview-bubble.own { align-self:flex-end; background:var(--preview-own,#dbeafe); color:var(--preview-on-own,#17202a); border-radius:var(--preview-radius,14px) var(--preview-radius,14px) 5px var(--preview-radius,14px); }
.system-metrics .metric-value, .system-metric-value { font-size:1.25rem; overflow-wrap:anywhere; }

/* Branding applicato alle chat senza alterarne struttura e comportamenti. */
.chat-body { background:var(--chat-bg); }
.chat-sidebar-brand, .chat-sticky-header, .chat-compose-area, .composer, .composer-status { background:var(--surface); }
.message-viewport { background-color:var(--chat-bg); }
:root[data-chat-pattern="dots"] .message-viewport { background-image:radial-gradient(rgba(100,116,139,.16) 1px,transparent 1px); background-size:18px 18px; }
:root[data-chat-pattern="grid"] .message-viewport { background-image:linear-gradient(rgba(100,116,139,.09) 1px,transparent 1px),linear-gradient(90deg,rgba(100,116,139,.09) 1px,transparent 1px); background-size:24px 24px; }
:root[data-chat-pattern="diagonal"] .message-viewport { background-image:repeating-linear-gradient(135deg,rgba(100,116,139,.075) 0,rgba(100,116,139,.075) 1px,transparent 1px,transparent 16px); }
.message-bubble { background:var(--bubble-other); color:var(--on-bubble-other,#17202a); border-radius:var(--message-radius) var(--message-radius) var(--message-radius) 5px; }
.message-row.own .message-bubble { background:var(--bubble-own); color:var(--on-bubble-own,#17202a); border-radius:var(--message-radius) var(--message-radius) 5px var(--message-radius); }

@media (max-width:1100px) {
  .branding-layout { grid-template-columns:1fr; }
  .branding-preview-card { position:static; }
}
@media (max-width:760px) {
  .admin-revolution { grid-template-columns:1fr; }
  .admin-sidebar-shell { position:static; width:100%; height:auto; max-height:none; overflow:visible; padding:12px; }
  .admin-sidebar-head { padding-bottom:10px; }
  .admin-nav { display:flex; overflow-x:auto; gap:6px; padding-bottom:4px; }
  .nav-group { display:flex; gap:4px; }
  .nav-group-label { display:none; }
  .admin-sidebar-shell .nav-item { width:auto; white-space:nowrap; }
  .admin-header-revolution { position:static; margin:-18px -18px 18px; padding:18px; backdrop-filter:none; }
  .branding-color-grid { grid-template-columns:1fr; }
}

/* ViViSoChat v0.15.0 - Control Center Revolution II */
.admin-chat-console { display:grid; grid-template-columns:minmax(250px,340px) minmax(0,1fr); gap:16px; min-height:620px; }
.admin-chat-list-card,.admin-chat-thread-card { min-height:0; }
.admin-chat-list { display:grid; gap:7px; max-height:680px; overflow:auto; padding-right:3px; }
.admin-chat-list-item { width:100%; display:grid; gap:4px; text-align:left; padding:11px 12px; border:1px solid var(--border); border-radius:12px; background:var(--surface,#fff); color:var(--text); cursor:pointer; }
.admin-chat-list-item:hover { border-color:var(--brand-accent,var(--primary)); background:var(--soft); }
.admin-chat-list-item.active { border-color:var(--brand-accent,var(--primary)); box-shadow:0 0 0 2px color-mix(in srgb,var(--brand-accent,var(--primary)) 15%,transparent); }
.admin-chat-list-item strong { overflow-wrap:anywhere; }
.admin-chat-list-meta { display:flex; flex-wrap:wrap; gap:5px 10px; color:var(--muted); font-size:.74rem; }
.admin-chat-state { width:max-content; padding:2px 7px; border-radius:999px; font-size:.66rem; font-weight:900; letter-spacing:.03em; }
.admin-chat-state.ACTIVE { background:#e8f5ed; color:#23633f; }
.admin-chat-state.DISABLED { background:#fff3cd; color:#745600; }
.admin-chat-state.ARCHIVED { background:#eef1f4; color:#59636e; }
.admin-chat-thread-card { display:grid; grid-template-rows:auto minmax(0,1fr) auto; overflow:hidden; }
.admin-chat-thread-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding-bottom:11px; border-bottom:1px solid var(--border); }
.admin-chat-thread-head h3 { margin:0 0 3px; }
.admin-chat-messages { min-height:360px; max-height:590px; overflow:auto; display:flex; flex-direction:column; gap:9px; padding:14px 6px 14px 2px; background:var(--chat-bg,#e9edf2); border-radius:12px; margin:10px 0; }
.admin-chat-message { align-self:flex-start; max-width:min(80%,760px); padding:9px 11px; background:var(--bubble-other,#fff); color:var(--on-bubble-other,#17202a); border:1px solid rgba(148,163,184,.35); border-radius:12px 12px 12px 4px; box-shadow:0 2px 7px rgba(20,30,40,.04); overflow-wrap:anywhere; }
.admin-chat-message.own-admin { align-self:flex-end; background:var(--bubble-own,#dbeafe); color:var(--on-bubble-own,#17202a); border-radius:12px 12px 4px 12px; }
.admin-chat-message-meta { display:flex; flex-wrap:wrap; gap:5px 9px; color:var(--muted); font-size:.7rem; margin-bottom:4px; }
.admin-chat-message-text { white-space:pre-wrap; line-height:1.4; }
.admin-chat-message img { display:block; max-width:min(100%,440px); max-height:420px; object-fit:contain; border-radius:10px; margin-top:6px; background:var(--soft); }
.admin-chat-document { display:inline-flex; align-items:center; gap:7px; margin-top:6px; padding:7px 9px; border:1px solid var(--border); border-radius:9px; background:var(--surface,#fff); }
.admin-chat-compose { display:flex; gap:9px; align-items:flex-end; border-top:1px solid var(--border); padding-top:11px; }
.admin-chat-compose textarea { flex:1; min-height:44px; max-height:140px; resize:vertical; }
.admin-chat-empty { color:var(--muted); text-align:center; padding:36px 16px; }

.reference-status-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.reference-dataset-card,.reference-source-card,.blacklist-import-card { border:1px solid var(--border); border-radius:12px; padding:12px; background:var(--surface,#fff); display:grid; gap:7px; }
.reference-source-card + .reference-source-card,.blacklist-import-card + .blacklist-import-card { margin-top:9px; }
.reference-source-meta,.blacklist-import-meta { display:flex; flex-wrap:wrap; gap:6px 12px; color:var(--muted); font-size:.76rem; }
.reference-preview { margin-top:12px; padding:12px; border:1px dashed var(--border); border-radius:12px; background:var(--soft); display:grid; gap:8px; }
.reference-preview[hidden] { display:none!important; }
.reference-preview-stats { display:flex; flex-wrap:wrap; gap:7px; }
.reference-preview-stat { padding:4px 8px; border-radius:999px; background:var(--surface,#fff); border:1px solid var(--border); font-size:.75rem; }
.reference-sample { max-height:210px; overflow:auto; border:1px solid var(--border); border-radius:9px; background:var(--surface,#fff); }
.reference-sample table { margin:0; }

.blacklist-import-card { grid-template-columns:minmax(0,1fr) auto; align-items:center; }
.blacklist-import-main { min-width:0; }
.blacklist-import-main strong { overflow-wrap:anywhere; }

.audit-filter-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px 14px; align-items:end; }
.audit-filter-grid label { margin:0; }
.audit-search { grid-column:span 2; }
.audit-filter-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:12px; }
.audit-export-actions { margin-left:auto; display:flex; gap:8px; flex-wrap:wrap; }
.audit-table-wrap { overflow:auto; }
.audit-table td { vertical-align:top; }
.audit-event-code { display:block; color:var(--muted); font-size:.69rem; margin-top:2px; }

@media (max-width:1050px) {
  .admin-chat-console { grid-template-columns:1fr; }
  .admin-chat-list { max-height:300px; }
  .audit-filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .audit-search { grid-column:span 2; }
}
@media (max-width:700px) {
  .admin-chat-thread-head,.admin-chat-compose { flex-direction:column; align-items:stretch; }
  .admin-chat-message { max-width:94%; }
  .reference-status-grid,.audit-filter-grid { grid-template-columns:1fr; }
  .audit-search { grid-column:auto; }
  .audit-export-actions { margin-left:0; width:100%; }
  .blacklist-import-card { grid-template-columns:1fr; }
}
.admin-chat-composer { display:flex; gap:9px; align-items:flex-end; border-top:1px solid var(--border); padding-top:11px; }
.admin-chat-composer textarea { flex:1; min-height:44px; max-height:140px; resize:vertical; }
@media (max-width:700px) { .admin-chat-composer { flex-direction:column; align-items:stretch; } }

/* ViViSoChat v0.15.1 — chat UI refresh, ispirata ai client moderni */
.chat-body {
  --chat-accent: var(--brand-accent, #2aabee);
  --chat-accent-dark: #1887b8;
  --chat-sidebar-bg: #f8fbfe;
  --chat-line: #dce8f1;
  --chat-wallpaper: #e8f2f8;
  background: var(--chat-wallpaper);
}
.chat-body .chat-app-shell { grid-template-columns: minmax(270px, 320px) minmax(0, 1fr); }
.chat-body .chat-sidebar {
  background: var(--chat-sidebar-bg);
  border-right-color: var(--chat-line);
  box-shadow: 4px 0 18px rgba(35, 74, 102, .035);
}
.chat-body .chat-sidebar-brand {
  min-height: 80px;
  padding: 15px 18px;
  background: linear-gradient(145deg, var(--chat-accent), #4388d7);
  border-bottom: 0;
  color: #fff;
}
.chat-body .chat-sidebar-brand strong { color: #fff; font-size: 1.05rem; }
.chat-body .chat-sidebar-brand .connection-state { color: rgba(255,255,255,.78); }
.chat-body .chat-sidebar-brand .connection-state::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}
.chat-body .chat-sidebar-brand .connection-state.online { color: #caffdf; }
.chat-body .app-mark {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.18);
  box-shadow: 0 5px 16px rgba(10,54,93,.18);
}
.chat-body .conversation-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 12px 12px 6px;
  padding: 0;
  border: 1px solid #d8e5ef;
  border-radius: 12px;
  background: #edf4f9;
  color: #6f8798;
}
.chat-body .conversation-search:focus-within {
  border-color: var(--chat-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(42,171,238,.13);
}
.conversation-search-icon {
  width: 36px;
  flex: 0 0 36px;
  text-align: center;
  font-size: 1.35rem;
  line-height: 1;
  transform: rotate(-18deg);
}
.chat-body .conversation-search input {
  min-width: 0;
  height: 38px;
  margin: 0;
  padding: 7px 10px 7px 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  font-size: .84rem;
}
.chat-body .conversation-search input:focus { outline: 0; }
.chat-body .conversation-list { padding: 7px 9px 11px; gap: 3px; }
.chat-body .conversation-item {
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 11px;
  min-height: 66px;
  padding: 10px 9px;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.chat-body .conversation-item:hover { background: #eef6fc; border-color: transparent; transform: translateX(1px); }
.chat-body .conversation-item.active {
  background: #e1f1fb;
  border-color: #c9e5f5;
  box-shadow: none;
}
.conversation-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  align-self: center;
  border-radius: 50%;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .025em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.1), 0 3px 8px rgba(38,74,103,.12);
}
.conversation-avatar.tone-blue { background: linear-gradient(145deg,#4db5e8,#228dca); }
.conversation-avatar.tone-violet { background: linear-gradient(145deg,#9b7de3,#6d50bd); }
.conversation-avatar.tone-teal { background: linear-gradient(145deg,#43c8b4,#199b8c); }
.conversation-avatar.tone-orange { background: linear-gradient(145deg,#f5ac62,#e67d2e); }
.conversation-avatar.tone-rose { background: linear-gradient(145deg,#e788a1,#c95779); }
.conversation-avatar.tone-indigo { background: linear-gradient(145deg,#728ce5,#425fc2); }
.conversation-item-copy { min-width: 0; display: grid; align-content: center; gap: 3px; }
.chat-body .conversation-item strong { font-size: .9rem; letter-spacing: -.01em; }
.chat-body .conversation-meta { font-size: .73rem; color: #7890a0; }
.conversation-empty { padding: 24px 12px; color: #8094a3; text-align: center; font-size: .8rem; }
.chat-body .conversation-item-copy .district-state-badge { margin-top: 2px; }
.chat-body .chat-sidebar-status {
  padding: 12px 17px calc(12px + env(safe-area-inset-bottom,0));
  background: rgba(255,255,255,.74);
  border-top-color: var(--chat-line);
  color: #79909f;
  font-size: .72rem;
}
.chat-body .chat-sidebar-status::before {
  content: '●';
  margin-right: 5px;
  color: #45bd86;
  font-size: .65rem;
}
.chat-body .chat-panel { background: var(--chat-wallpaper); }
.chat-body .chat-sticky-header {
  min-height: 72px;
  padding: 10px clamp(15px, 2.6vw, 28px);
  background: rgba(255,255,255,.96);
  border-bottom-color: var(--chat-line);
  box-shadow: 0 2px 12px rgba(35,74,102,.06);
}
.chat-body .chat-sticky-header .app-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(145deg, var(--chat-accent), #4388d7);
}
.chat-body .chat-heading { display: grid; gap: 2px; }
.chat-body .chat-kicker { color: #7890a0; font-size: .67rem; letter-spacing: .035em; text-transform: uppercase; }
.chat-body .chat-title { font-size: 1.03rem; }
.chat-body .chat-user-identity { padding-right: 3px; }
.chat-body .chat-user-identity .room-role { color: var(--chat-accent-dark); }
.chat-body .chat-user-identity .current-user-name { color: #587080; font-size: .75rem; }
.chat-body .icon-button:hover, .chat-body .icon-button:focus-visible { background: #edf5fa; border-color: #d8e7f0; color: var(--chat-accent-dark); }
.chat-body .message-viewport {
  padding: 17px clamp(13px, 4vw, 48px) 24px;
  background-color: var(--chat-wallpaper);
  background-image: radial-gradient(rgba(79,130,160,.115) 1px, transparent 1px), linear-gradient(145deg, rgba(255,255,255,.22), transparent 45%);
  background-size: 21px 21px, 100% 100%;
}
.chat-body .message-list { width: min(980px,100%); gap: 6px; }
.chat-body .day-separator { padding: 12px 0 9px; }
.chat-body .day-separator span {
  padding: 5px 12px;
  color: #6e8796;
  background: rgba(244,250,253,.9);
  border-color: #d7e7ef;
  box-shadow: 0 2px 8px rgba(35,74,102,.06);
}
.chat-body .message-row {
  width: min(76%, 720px);
  min-width: 90px;
  padding-bottom: 2px;
}
.chat-body .message-row.other { padding-left: 42px; }
.chat-body .message-row.other::before {
  content: attr(data-avatar);
  position: absolute;
  left: 0;
  bottom: 23px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg,#5aafdc,#2c88bd);
  font-size: .63rem;
  font-weight: 900;
  box-shadow: 0 3px 7px rgba(33,90,125,.18);
}

.chat-body .message-row.other.has-role-avatar::before{content:"";background-image:var(--message-avatar-image)!important;background-size:cover;background-position:center;background-repeat:no-repeat;}
.chat-body .message-row.other[data-avatar-tone="tone-violet"]::before { background: linear-gradient(145deg,#9b7de3,#6d50bd); }
.chat-body .message-row.other[data-avatar-tone="tone-teal"]::before { background: linear-gradient(145deg,#43c8b4,#199b8c); }
.chat-body .message-row.other[data-avatar-tone="tone-orange"]::before { background: linear-gradient(145deg,#f5ac62,#e67d2e); }
.chat-body .message-row.other[data-avatar-tone="tone-rose"]::before { background: linear-gradient(145deg,#e788a1,#c95779); }
.chat-body .message-row.other[data-avatar-tone="tone-indigo"]::before { background: linear-gradient(145deg,#728ce5,#425fc2); }
.chat-body .message-bubble {
  position: relative;
  padding: 10px 13px;
  border: 1px solid rgba(167,194,210,.48);
  border-radius: 16px 16px 16px 5px;
  box-shadow: 0 2px 5px rgba(35,74,102,.08);
  line-height: 1.45;
}
.chat-body .message-row.own .message-bubble {
  border-color: rgba(112,184,215,.48);
  border-radius: 16px 16px 5px 16px;
  box-shadow: 0 2px 5px rgba(33,113,151,.1);
}
.chat-body .message-meta { padding: 4px 7px 0; color: #79909f; font-size: .65rem; }
.chat-body .message-row.own .message-meta { justify-content: flex-end; }
.chat-body .reply-quote { border-left-color: var(--chat-accent); background: rgba(255,255,255,.7); }
.chat-body .empty-chat { color: #718997; }
.chat-body .chat-compose-area {
  background: rgba(255,255,255,.97);
  border-top-color: var(--chat-line);
  box-shadow: 0 -3px 12px rgba(35,74,102,.045);
}
.chat-body .reply-bar { background: #f2f8fc; border-bottom-color: var(--chat-line); }
.chat-body .reply-bar-content { border-left-color: var(--chat-accent); }
.chat-body .composer {
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 8px;
  padding: 10px max(13px,calc((100% - 980px)/2));
}
.chat-body .composer textarea {
  min-height: 45px;
  padding: 11px 15px;
  border-color: #d4e3ec;
  border-radius: 22px;
  background: #f4f8fb;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.chat-body .composer textarea:focus {
  border-color: var(--chat-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(42,171,238,.12);
  outline: 0;
}
.chat-body .attach-button, .chat-body .send-button {
  width: 45px;
  min-height: 45px;
  padding: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
}
.chat-body .attach-button { background: transparent; color: #718b9c; font-size: 1.55rem; }
.chat-body .attach-button:hover { background: #edf5fa; color: var(--chat-accent-dark); }
.chat-body .send-button {
  background: linear-gradient(145deg, var(--chat-accent), #238fc2);
  box-shadow: 0 5px 12px rgba(33,137,184,.23);
  font-size: 1.15rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.chat-body .send-button:hover { transform: translateY(-1px); box-shadow: 0 7px 15px rgba(33,137,184,.28); }
.chat-body .send-icon { display: inline-block; transform: translate(-1px, 1px) rotate(-8deg); }
.chat-body .send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-body .composer-status { padding-left: max(13px,calc((100% - 980px)/2)); padding-right: max(13px,calc((100% - 980px)/2)); }

@media (max-width:760px) {
  .chat-body .chat-app-shell { grid-template-columns: 1fr; }
  .chat-body .chat-sidebar { width: min(88vw, 340px); }
  .chat-body .chat-sticky-header { min-height: 62px; padding: 8px 9px; }
  .chat-body .chat-sticky-header .app-mark.small { width: 37px; height: 37px; }
  .chat-body .message-viewport { padding: 10px 7px 16px; }
  .chat-body .message-row { width: 90%; }
  .chat-body .message-row.other { padding-left: 36px; }
  .chat-body .message-row.other::before { width: 28px; height: 28px; bottom: 23px; font-size: .57rem; }
  .chat-body .message-bubble { padding: 9px 11px; }
  .chat-body .composer { padding: 7px 8px max(7px,env(safe-area-inset-bottom)); }
  .chat-body .attach-button, .chat-body .send-button { width: 42px; min-height: 42px; }
}
@media (max-width:420px) {
  .chat-body .chat-sidebar-brand { min-height: 70px; padding: 12px 14px; }
  .chat-body .conversation-search { margin: 9px 9px 5px; }
  .chat-body .conversation-item { min-height: 62px; }
  .chat-body .conversation-avatar { width: 40px; height: 40px; }
  .chat-body .message-row { width: 94%; }
  .chat-body .message-row.other { padding-left: 32px; }
  .chat-body .message-row.other::before { width: 25px; height: 25px; }
  .chat-body .chat-user-identity { max-width: 100px; }
}

/* ViViSoChat v0.15.1 - Control Center dashboard visual refresh. */
.dashboard-hero {
  position:relative;
  isolation:isolate;
  display:grid;
  grid-template-columns:minmax(0,1fr) 250px;
  align-items:center;
  min-height:238px;
  margin-bottom:27px;
  padding:30px clamp(24px,4vw,46px);
  overflow:hidden;
  border:1px solid rgba(77,137,193,.22);
  border-radius:24px;
  background:linear-gradient(126deg,#0c2347 0%,#123b70 53%,#146879 100%);
  color:#fff;
  box-shadow:0 18px 45px rgba(15,45,84,.20);
}
.dashboard-hero::before {
  content:"";
  position:absolute;
  z-index:-1;
  width:470px;
  height:470px;
  right:-130px;
  top:-150px;
  border:1px solid rgba(255,255,255,.11);
  border-radius:50%;
  box-shadow:0 0 0 32px rgba(255,255,255,.025),0 0 0 66px rgba(255,255,255,.018);
}
.dashboard-hero::after {
  content:"";
  position:absolute;
  z-index:-1;
  inset:0;
  opacity:.27;
  background-image:linear-gradient(115deg,transparent 0 48%,rgba(255,255,255,.09) 48.2%,transparent 48.5%),linear-gradient(25deg,transparent 0 72%,rgba(255,255,255,.06) 72.2%,transparent 72.6%);
  pointer-events:none;
}
.dashboard-hero-copy { position:relative; z-index:2; max-width:650px; }
.dashboard-kicker { display:flex; align-items:center; gap:8px; color:#a9d8ea; font-size:.68rem; font-weight:900; letter-spacing:.16em; }
.dashboard-live-dot { width:8px; height:8px; flex:0 0 auto; border-radius:50%; background:#65e6b1; box-shadow:0 0 0 4px rgba(101,230,177,.16),0 0 14px rgba(101,230,177,.8); }
.dashboard-hero h2 { margin:15px 0 9px; color:#fff; font-size:clamp(1.7rem,3vw,2.55rem); letter-spacing:-.045em; line-height:1.05; }
.dashboard-hero p { max-width:570px; margin:0; color:#c5d9ee; line-height:1.55; }
.dashboard-hero-actions { display:flex; flex-wrap:wrap; gap:9px; margin-top:23px; }
.dashboard-action { min-height:39px; padding:9px 14px; border:1px solid transparent; border-radius:10px; font-size:.82rem; font-weight:850; transition:transform .16s ease,box-shadow .16s ease,background .16s ease; }
.dashboard-action:hover { transform:translateY(-1px); }
.dashboard-action-primary { background:#fff; color:#11335f; box-shadow:0 7px 18px rgba(4,20,49,.22); }
.dashboard-action-primary:hover { background:#eaf6ff; box-shadow:0 10px 24px rgba(4,20,49,.30); }
.dashboard-action-primary span { margin-left:7px; font-size:1.05rem; line-height:0; }
.dashboard-action-light { background:rgba(255,255,255,.10); border-color:rgba(255,255,255,.30); color:#fff; }
.dashboard-action-light:hover { background:rgba(255,255,255,.18); }
.dashboard-hero-visual { position:relative; display:grid; place-items:center; width:220px; height:190px; justify-self:end; }
.dashboard-hero-core { position:relative; z-index:2; display:grid; place-items:center; width:82px; height:82px; border:1px solid rgba(255,255,255,.48); border-radius:26px; background:linear-gradient(145deg,rgba(255,255,255,.23),rgba(255,255,255,.07)); color:#fff; font-size:2.4rem; font-weight:950; letter-spacing:-.08em; box-shadow:0 18px 34px rgba(3,18,46,.22),inset 0 1px 0 rgba(255,255,255,.25); }
.dashboard-orbit { position:absolute; border:1px solid rgba(175,232,245,.32); border-radius:50%; transform:rotate(-28deg); }
.dashboard-orbit-one { width:176px; height:90px; }
.dashboard-orbit-two { width:206px; height:126px; transform:rotate(52deg); border-color:rgba(255,255,255,.18); }
.dashboard-section-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; margin:0 0 14px; }
.dashboard-section-heading .eyebrow { margin:0 0 4px; color:#56708c; }
.dashboard-section-heading h2 { margin:0 0 4px; font-size:1.28rem; letter-spacing:-.03em; }
.dashboard-section-heading p { margin:0; font-size:.82rem; }
.dashboard-refresh-wrap { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.dashboard-last-update { color:var(--muted); font-size:.74rem; font-weight:750; white-space:nowrap; }
.dashboard-metric-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:13px; margin-bottom:20px; }
.dashboard-metric-card { position:relative; min-height:132px; padding:17px 18px; overflow:hidden; border-color:rgba(176,190,207,.62); box-shadow:0 9px 25px rgba(15,33,55,.045); transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease; }
.dashboard-metric-card::after { content:""; position:absolute; right:-26px; bottom:-42px; width:110px; height:110px; border-radius:50%; background:var(--metric-tint,rgba(37,99,235,.08)); pointer-events:none; }
.dashboard-metric-card:hover { transform:translateY(-2px); border-color:rgba(94,128,164,.58); box-shadow:0 14px 30px rgba(15,33,55,.09); }
.metric-card-top { position:relative; z-index:1; display:flex; align-items:center; gap:9px; min-width:0; }
.metric-icon { display:grid; place-items:center; width:30px; height:30px; flex:0 0 auto; border-radius:10px; background:var(--metric-tint,rgba(37,99,235,.10)); color:var(--metric-color,#2563eb); font-size:.96rem; font-weight:950; }
.dashboard-metric-card .metric-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:800; }
.dashboard-metric-card .metric-value { position:relative; z-index:1; margin-top:11px; color:#122743; font-size:2.18rem; font-weight:900; line-height:1; }
.metric-tone-blue { --metric-color:#2563eb; --metric-tint:rgba(37,99,235,.11); }
.metric-tone-green { --metric-color:#178356; --metric-tint:rgba(23,131,86,.11); }
.metric-tone-violet { --metric-color:#7658c7; --metric-tint:rgba(118,88,199,.12); }
.metric-tone-amber { --metric-color:#b17b12; --metric-tint:rgba(177,123,18,.13); }
.metric-tone-teal { --metric-color:#0f8c94; --metric-tint:rgba(15,140,148,.11); }
.metric-tone-orange { --metric-color:#c66b1c; --metric-tint:rgba(198,107,28,.12); }
.metric-tone-slate { --metric-color:#5d7189; --metric-tint:rgba(93,113,137,.12); }
.dashboard-insight-grid { display:grid; grid-template-columns:minmax(0,1.12fr) minmax(300px,.88fr); gap:16px; margin-bottom:16px; }
.dashboard-health-card,.dashboard-snapshot-card { padding:21px 22px; box-shadow:0 9px 25px rgba(15,33,55,.045); }
.dashboard-card-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:13px; }
.dashboard-card-heading .eyebrow { margin:0 0 4px; }
.dashboard-card-heading h2 { margin:0; font-size:1.17rem; letter-spacing:-.025em; }
.dashboard-health-badge { display:inline-flex; align-items:center; width:max-content; padding:5px 9px; border-radius:999px; font-size:.67rem; font-weight:900; white-space:nowrap; }
.dashboard-health-badge.is-ok { background:#e4f6ed; color:#1f754d; }
.dashboard-health-badge.is-attention { background:#fff3d8; color:#8a5b09; }
.dashboard-health-badge.is-warn { background:#fde9e9; color:#943636; }
.dashboard-health-list { display:grid; gap:8px; margin-top:17px; }
.dashboard-health-row { display:grid; grid-template-columns:32px minmax(0,1fr) auto; align-items:center; gap:10px; min-height:53px; padding:8px 10px; border:1px solid var(--border); border-radius:12px; background:#fbfcfd; }
.dashboard-health-icon { display:grid; place-items:center; width:29px; height:29px; border-radius:9px; font-weight:950; }
.dashboard-health-ok .dashboard-health-icon { background:#e5f6ed; color:#1f8055; }
.dashboard-health-attention .dashboard-health-icon { background:#fff1d1; color:#99660a; }
.dashboard-health-warn .dashboard-health-icon { background:#fde8e8; color:#a33d3d; }
.dashboard-health-copy { display:grid; gap:2px; min-width:0; }
.dashboard-health-copy strong { font-size:.82rem; }
.dashboard-health-copy span { overflow:hidden; color:var(--muted); font-size:.74rem; text-overflow:ellipsis; white-space:nowrap; }
.dashboard-health-state { color:var(--muted); font-size:.67rem; font-weight:900; white-space:nowrap; }
.dashboard-health-ok .dashboard-health-state { color:#23764f; }
.dashboard-health-attention .dashboard-health-state { color:#98620a; }
.dashboard-health-warn .dashboard-health-state { color:#a03a3a; }
.dashboard-card-glyph { display:grid; place-items:center; width:32px; height:32px; border-radius:10px; background:#e7f1ff; color:#286cc2; font-size:1.05rem; font-weight:900; }
.dashboard-card-glyph-warm { background:#fff0ce; color:#9b6b0b; }
.dashboard-snapshot-list { display:grid; gap:0; margin-top:13px; }
.dashboard-snapshot-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; align-items:center; padding:12px 0; border-bottom:1px solid var(--border); }
.dashboard-snapshot-row:last-child { border-bottom:0; }
.dashboard-snapshot-row strong { font-size:.81rem; }
.dashboard-snapshot-row small { grid-column:1; color:var(--muted); font-size:.72rem; }
.dashboard-snapshot-value { grid-column:2; grid-row:1 / span 2; color:#163a67; font-size:1.55rem; font-weight:900; }
.dashboard-withdrawals-card { margin-bottom:16px; padding:21px 22px; border-color:#e7d2a0; background:linear-gradient(180deg,#fffdf8,#fff); }
.dashboard-withdrawals-card .dashboard-card-heading { margin-bottom:14px; }
.dashboard-withdrawals-card .muted { margin:.35rem 0 0; font-size:.82rem; }
.dashboard-privacy-note { display:flex; align-items:flex-start; gap:12px; padding:15px 17px; border:1px solid #cfe0ef; border-radius:14px; background:linear-gradient(100deg,#f3f8fd,#f8fbfd); color:#23415f; }
.dashboard-privacy-icon { display:grid; place-items:center; width:27px; height:27px; flex:0 0 auto; border-radius:9px; background:#d9edf0; color:#17737a; font-weight:950; }
.dashboard-privacy-note strong { font-size:.82rem; }
.dashboard-privacy-note p { margin:3px 0 0; color:#587089; font-size:.76rem; line-height:1.45; }

@media (max-width:1100px) {
  .dashboard-metric-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .dashboard-insight-grid { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  .dashboard-hero { grid-template-columns:1fr; min-height:0; padding:25px 21px; border-radius:19px; }
  .dashboard-hero-visual { position:absolute; right:-37px; bottom:-27px; width:165px; height:155px; opacity:.72; transform:scale(.82); transform-origin:bottom right; }
  .dashboard-section-heading { align-items:flex-start; flex-direction:column; gap:11px; }
  .dashboard-refresh-wrap { justify-content:flex-start; }
  .dashboard-metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-health-row { grid-template-columns:32px minmax(0,1fr); }
  .dashboard-health-state { grid-column:2; }
}
@media (max-width:480px) {
  .dashboard-hero-actions { display:grid; }
  .dashboard-action { width:100%; }
  .dashboard-metric-grid { grid-template-columns:1fr; }
  .dashboard-metric-card { min-height:110px; }
  .dashboard-health-card,.dashboard-snapshot-card,.dashboard-withdrawals-card { padding:17px 15px; }
  .dashboard-card-heading { align-items:flex-start; }
  .dashboard-health-badge { max-width:132px; text-align:right; white-space:normal; }
}

/* ViViSoChat v0.15.2 — chat interaction polish.
   This layer only refines the existing chat contracts: no endpoint, role or
   moderation behaviour is coupled to these presentation rules. */
.chat-body {
  --chat-ink: #173047;
  --chat-muted: #70899a;
  --chat-accent-soft: #e1f3fb;
  --chat-surface-soft: #f4f9fc;
  --chat-shadow: 0 12px 30px rgba(23, 67, 95, .08);
  color: var(--chat-ink);
}
.chat-body .chat-app-shell { isolation:isolate; }
.chat-body .chat-sidebar {
  background:linear-gradient(180deg,#fafdff 0%,#f4f9fc 100%);
  box-shadow:6px 0 24px rgba(28,75,104,.045);
}
.chat-body .chat-sidebar-brand {
  position:relative;
  overflow:hidden;
  box-shadow:0 4px 17px rgba(28,93,132,.10);
}
.chat-body .chat-sidebar-brand::after {
  content:"";
  position:absolute;
  width:170px;
  height:170px;
  right:-62px;
  top:-96px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:50%;
  box-shadow:0 0 0 16px rgba(255,255,255,.06),0 0 0 34px rgba(255,255,255,.035);
  pointer-events:none;
}
.chat-body .chat-sidebar-brand > * { position:relative; z-index:1; }
.chat-body .conversation-list {
  scrollbar-width:thin;
  scrollbar-color:#c1d8e6 transparent;
}
.chat-body .conversation-list::-webkit-scrollbar,
.chat-body .message-viewport::-webkit-scrollbar { width:8px; }
.chat-body .conversation-list::-webkit-scrollbar-thumb,
.chat-body .message-viewport::-webkit-scrollbar-thumb { background:#c1d8e6; border:2px solid transparent; border-radius:999px; background-clip:padding-box; }
.chat-body .conversation-item {
  position:relative;
  overflow:hidden;
  transition:background .16s ease,border-color .16s ease,transform .16s ease,box-shadow .16s ease;
}
.chat-body .conversation-item::before {
  content:"";
  position:absolute;
  left:0;
  top:13px;
  bottom:13px;
  width:3px;
  border-radius:0 4px 4px 0;
  background:var(--chat-accent);
  opacity:0;
  transform:translateX(-5px);
  transition:opacity .16s ease,transform .16s ease;
}
.chat-body .conversation-item.active::before { opacity:1; transform:translateX(0); }
.chat-body .conversation-item:focus-visible,
.chat-body .conversation-item.active { outline:0; box-shadow:0 5px 16px rgba(27,101,139,.10); }
.chat-body .conversation-item:focus-visible { border-color:rgba(42,171,238,.72); }
.chat-body .conversation-item-copy { min-width:0; }
.conversation-item-meta {
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.chat-body .conversation-meta { min-width:0; }
.conversation-last-activity {
  flex:0 0 auto;
  color:#8da3b1;
  font-size:.66rem;
  font-weight:800;
  white-space:nowrap;
}
.chat-body .conversation-item.active .conversation-last-activity { color:#4e93b4; }
.chat-body .chat-sticky-header {
  box-shadow:0 4px 17px rgba(26,75,104,.075);
}
.chat-title-line { min-width:0; display:flex; align-items:center; gap:8px; }
.chat-title-line .chat-title { min-width:0; }
.chat-presence-badge {
  display:inline-flex;
  align-items:center;
  gap:5px;
  flex:0 0 auto;
  padding:4px 8px;
  border:1px solid #cfe5ef;
  border-radius:999px;
  background:#f3fafd;
  color:#56849a;
  font-size:.64rem;
  font-weight:850;
  white-space:nowrap;
}
.chat-presence-badge::before {
  content:"";
  width:6px;
  height:6px;
  border-radius:50%;
  background:#8ba7b5;
}
.chat-presence-badge.is-active { color:#277b58; border-color:#c6e9d7; background:#effaf4; }
.chat-presence-badge.is-active::before { background:#31b779; box-shadow:0 0 0 3px rgba(49,183,121,.13); }
.chat-body .message-viewport {
  scrollbar-color:#b8d1df transparent;
  scrollbar-width:thin;
}
.chat-body .message-list { padding-bottom:8px; }
.chat-body .message-row.other .message-bubble,
.chat-body .message-row.own .message-bubble {
  position:relative;
  transition:box-shadow .16s ease,transform .16s ease;
}
.chat-body .message-row:hover .message-bubble { box-shadow:0 5px 15px rgba(35,91,119,.12); }
.chat-body .message-row.other .message-bubble:not(.attachment-bubble):not(.important-message-bubble)::after,
.chat-body .message-row.own .message-bubble:not(.attachment-bubble):not(.important-message-bubble)::after {
  content:"";
  position:absolute;
  bottom:-1px;
  width:10px;
  height:11px;
  background:inherit;
  clip-path:polygon(0 0,100% 100%,0 100%);
}
.chat-body .message-row.other .message-bubble:not(.attachment-bubble):not(.important-message-bubble)::after { left:-5px; }
.chat-body .message-row.own .message-bubble:not(.attachment-bubble):not(.important-message-bubble)::after { right:-5px; transform:scaleX(-1); }
.chat-body .message-row.deleted .message-bubble::after { opacity:.55; }
.chat-body .message-meta {
  min-height:16px;
  align-items:center;
  gap:6px;
  color:#7b95a4;
  font-variant-numeric:tabular-nums;
}
.chat-body .message-meta .mono { font-weight:750; }
.chat-body .message-meta time { letter-spacing:.01em; }
.chat-body .reply-quote {
  box-shadow:0 2px 8px rgba(42,91,115,.055);
  transition:background .15s ease,border-color .15s ease;
}
.chat-body .reply-quote:hover,
.chat-body .reply-quote:focus-visible { background:#fff; border-left-color:var(--chat-accent-dark); outline:0; }
.chat-body .empty-chat {
  width:min(410px,100%);
  margin:clamp(30px,12vh,120px) auto;
  padding:17px 20px;
  border:1px solid rgba(177,207,221,.62);
  border-radius:16px;
  background:rgba(255,255,255,.66);
  box-shadow:var(--chat-shadow);
}
.floating-chat-action {
  position:absolute;
  right:clamp(13px,3vw,30px);
  bottom:20px;
  z-index:23;
  width:42px;
  height:42px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid #cae2ed;
  border-radius:50%;
  background:rgba(255,255,255,.96);
  color:var(--chat-accent-dark);
  box-shadow:0 7px 18px rgba(29,83,112,.16);
  font-size:1.35rem;
  line-height:1;
  transition:transform .15s ease,box-shadow .15s ease,background .15s ease;
}
.floating-chat-action:hover,
.floating-chat-action:focus-visible { background:#fff; transform:translateY(-2px); box-shadow:0 10px 22px rgba(29,83,112,.21); outline:0; }
.floating-chat-action span { transform:translateY(-1px); }
.floating-chat-action[hidden] { display:none!important; }
.chat-body .chat-compose-area {
  position:relative;
  box-shadow:0 -5px 20px rgba(29,80,105,.065);
}
.chat-body .composer {
  position:relative;
  z-index:1;
}
.chat-body .composer textarea { color:var(--chat-ink); }
.chat-body .composer textarea::placeholder { color:#8ba1ae; }
.chat-body .attach-button:focus-visible,
.chat-body .send-button:focus-visible { outline:3px solid rgba(42,171,238,.26); outline-offset:2px; }
.composer-hint {
  min-height:18px;
  padding:0 max(13px,calc((100% - 980px)/2));
  color:#91a4af;
  font-size:.64rem;
  font-weight:700;
  letter-spacing:.01em;
}
.chat-body .composer-status:empty + * { }
.chat-body .global-important-card,
.chat-body .district-unavailable-card,
.chat-body .app-modal {
  box-shadow:0 18px 45px rgba(25,77,104,.14);
}
@media (prefers-reduced-motion:reduce) {
  .chat-body .conversation-item,
  .floating-chat-action,
  .chat-body .message-bubble { animation:none!important; transition:none!important; }
}
@media (max-width:760px) {
  .chat-title-line { gap:5px; }
  .chat-presence-badge { padding:3px 6px; font-size:.58rem; }
  .conversation-last-activity { font-size:.61rem; }
  .composer-hint { display:none; }
  .floating-chat-action { right:13px; bottom:16px; width:40px; height:40px; }
  .chat-body .message-row:hover .message-bubble { box-shadow:0 2px 7px rgba(35,74,102,.08); }
}
@media (max-width:420px) {
  .chat-presence-badge { display:none!important; }
  .conversation-item-meta { gap:4px; }
  .chat-body .conversation-meta { font-size:.68rem; }
}

/* ViViSoChat v0.15.3 — chat shell polish and per-user dark theme.
   The theme is local to the browser profile (chat.js/localStorage); the
   Super Admin branding endpoint continues to provide the logo and accent. */
:root[data-chat-theme="light"] { color-scheme: light; }
:root[data-chat-theme="dark"] { color-scheme: dark; }

/* Telegram-like desktop framing: the timeline and composer share one wide
   content column, while the panel keeps a soft rounded outer edge. */
@media (min-width:761px) {
  .chat-body .chat-app-shell {
    gap: 10px;
    padding: 10px;
    background: var(--chat-wallpaper, #e8f2f8);
  }
  .chat-body .chat-sidebar,
  .chat-body .chat-panel {
    overflow: hidden;
    border: 1px solid var(--chat-line, #dce8f1);
    border-radius: 20px;
  }
  .chat-body .chat-sidebar { box-shadow: 4px 0 18px rgba(35,74,102,.06); }
  .chat-body .chat-panel { box-shadow: 0 7px 24px rgba(35,74,102,.09); }
  .chat-body .chat-compose-area {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-left: max(14px, calc((100% - 1120px) / 2));
    padding-right: max(14px, calc((100% - 1120px) / 2));
  }
  .chat-body .chat-compose-area > .reply-bar,
  .chat-body .chat-compose-area > .composer,
  .chat-body .chat-compose-area > .composer-hint,
  .chat-body .chat-compose-area > .composer-status { width: 100%; }
  .chat-body .chat-compose-area > .reply-bar,
  .chat-body .chat-compose-area > .composer,
  .chat-body .chat-compose-area > .composer-status,
  .chat-body .chat-compose-area > .composer-hint { padding-left: 0; padding-right: 0; }
}

.chat-body .chat-compose-area { border-radius: 20px 20px 0 0; }
.chat-body .composer { width: 100%; }
.chat-body .composer textarea { min-width: 0; }

/* Dark palette. Explicit colors from the light Telegram-like refresh are
   overridden here so a custom branding profile cannot leave white islands in
   a user's dark conversation. */
:root[data-chat-theme="dark"] body.chat-body {
  background: #0e1921;
  color: #e7f0f5;
}
:root[data-chat-theme="dark"] .chat-body .chat-app-shell { background: #0b141a; }
:root[data-chat-theme="dark"] .chat-body .chat-sidebar {
  background: #111b21;
  border-color: #26353e;
  box-shadow: 4px 0 18px rgba(0,0,0,.25);
}
:root[data-chat-theme="dark"] .chat-body .chat-sidebar-brand {
  background: linear-gradient(145deg, #1d4f73, #193b56);
  border-bottom-color: #26353e;
}
:root[data-chat-theme="dark"] .chat-body .conversation-search {
  background: #1a2830;
  border-color: #2d414d;
  color: #a8bac4;
}
:root[data-chat-theme="dark"] .chat-body .conversation-search:focus-within { background: #20323d; }
:root[data-chat-theme="dark"] .chat-body .conversation-search input { color: #e7f0f5; }
:root[data-chat-theme="dark"] .chat-body .conversation-item { color: #e7f0f5; }
:root[data-chat-theme="dark"] .chat-body .conversation-item:hover { background: #1a2a33; }
:root[data-chat-theme="dark"] .chat-body .conversation-item.active {
  background: #203845;
  border-color: #315365;
}
:root[data-chat-theme="dark"] .chat-body .conversation-meta,
:root[data-chat-theme="dark"] .chat-body .conversation-last-activity { color: #9aadb8; }
:root[data-chat-theme="dark"] .chat-body .conversation-item.active .conversation-last-activity { color: #a9d5ea; }
:root[data-chat-theme="dark"] .chat-body .chat-sidebar-status {
  background: rgba(17,27,33,.92);
  border-top-color: #26353e;
  color: #9aadb8;
}
:root[data-chat-theme="dark"] .chat-body .chat-panel {
  background: #0e1921;
  border-color: #26353e;
  box-shadow: 0 7px 24px rgba(0,0,0,.28);
}
:root[data-chat-theme="dark"] .chat-body .chat-sticky-header {
  background: rgba(17,27,33,.97);
  border-bottom-color: #26353e;
  box-shadow: 0 4px 17px rgba(0,0,0,.2);
}
:root[data-chat-theme="dark"] .chat-body .chat-kicker,
:root[data-chat-theme="dark"] .chat-body .chat-user-identity .current-user-name,
:root[data-chat-theme="dark"] .chat-body .room-role { color: #9aadb8; }
:root[data-chat-theme="dark"] .chat-body .chat-title,
:root[data-chat-theme="dark"] .chat-body .icon-button { color: #e7f0f5; }
:root[data-chat-theme="dark"] .chat-body .icon-button:hover,
:root[data-chat-theme="dark"] .chat-body .icon-button:focus-visible { background: #20323d; border-color: #315365; }
:root[data-chat-theme="dark"] .chat-body .message-viewport {
  background-color: #0e1921;
  background-image: radial-gradient(rgba(120,173,198,.12) 1px, transparent 1px), linear-gradient(145deg, rgba(255,255,255,.025), transparent 45%);
  scrollbar-color: #426174 transparent;
}
:root[data-chat-theme="dark"] .chat-body .day-separator span {
  background: rgba(33,49,59,.94);
  border-color: #344a57;
  color: #a4b8c2;
}
:root[data-chat-theme="dark"] .chat-body .message-bubble {
  background: #18262f;
  border-color: #2e414c;
  color: #e7f0f5;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
}
:root[data-chat-theme="dark"] .chat-body .message-row.own .message-bubble {
  background: #2b5278;
  border-color: #3b6e99;
  color: #eff8ff;
}
:root[data-chat-theme="dark"] .chat-body .message-meta { color: #91a7b3; }
:root[data-chat-theme="dark"] .chat-body .reply-quote {
  background: rgba(28,45,55,.88);
  color: #e7f0f5;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
}
:root[data-chat-theme="dark"] .chat-body .reply-quote span { color: #9aadb8; }
:root[data-chat-theme="dark"] .chat-body .reply-quote:hover,
:root[data-chat-theme="dark"] .chat-body .reply-quote:focus-visible { background: #243b48; }
:root[data-chat-theme="dark"] .chat-body .empty-chat {
  background: rgba(29,45,55,.82);
  border-color: #344a57;
  color: #a4b8c2;
}
:root[data-chat-theme="dark"] .chat-body .chat-compose-area {
  background: rgba(17,27,33,.98);
  border-top-color: #26353e;
  box-shadow: 0 -5px 20px rgba(0,0,0,.22);
}
:root[data-chat-theme="dark"] .chat-body .reply-bar { background: #15232b; border-bottom-color: #26353e; }
:root[data-chat-theme="dark"] .chat-body .reply-caption { color: #e7f0f5; }
:root[data-chat-theme="dark"] .chat-body .reply-text,
:root[data-chat-theme="dark"] .chat-body .composer-hint { color: #91a7b3; }
:root[data-chat-theme="dark"] .chat-body .composer textarea {
  background: #1d2b33;
  border-color: #344b57;
  color: #e7f0f5;
}
:root[data-chat-theme="dark"] .chat-body .composer textarea:focus { background: #22353f; }
:root[data-chat-theme="dark"] .chat-body .composer textarea::placeholder { color: #91a7b3; }
:root[data-chat-theme="dark"] .chat-body .attach-button { color: #a4bac6; }
:root[data-chat-theme="dark"] .chat-body .attach-button:hover { background: #20323d; color: #c4e9fb; }
:root[data-chat-theme="dark"] .chat-body .popup-menu {
  background: #18262f;
  border-color: #344a57;
  box-shadow: 0 18px 50px rgba(0,0,0,.42);
}
:root[data-chat-theme="dark"] .chat-body .popup-menu button,
:root[data-chat-theme="dark"] .chat-body .popup-menu a { color: #e7f0f5; }
:root[data-chat-theme="dark"] .chat-body .popup-menu button:hover,
:root[data-chat-theme="dark"] .chat-body .popup-menu a:hover { background: #243b48; }
:root[data-chat-theme="dark"] .chat-body .menu-separator { background: #344a57; }
:root[data-chat-theme="dark"] .chat-body .chat-presence-badge {
  background: #1c342a;
  border-color: #2d644a;
  color: #9fe1be;
}
:root[data-chat-theme="dark"] .chat-body .chat-presence-badge.is-active { background: #1c342a; color: #9fe1be; }
:root[data-chat-theme="dark"] .chat-body .floating-chat-action {
  background: rgba(28,43,52,.96);
  border-color: #3b5664;
  color: #b9ddec;
  box-shadow: 0 7px 18px rgba(0,0,0,.32);
}
:root[data-chat-theme="dark"] .chat-body .floating-chat-action:hover,
:root[data-chat-theme="dark"] .chat-body .floating-chat-action:focus-visible { background: #243b48; }
:root[data-chat-theme="dark"] .chat-body .app-modal,
:root[data-chat-theme="dark"] .chat-body .district-unavailable-card,
:root[data-chat-theme="dark"] .chat-body .moderation-table,
:root[data-chat-theme="dark"] .chat-body .media-archive-modal {
  background: #17232c;
  color: #e7f0f5;
  border-color: #344a57;
}

@media (max-width:760px) {
  .chat-body .chat-compose-area { border-radius: 18px 18px 0 0; }
  .chat-body .chat-app-shell { padding: 0; }
}

/* v0.15.4 — floating Telegram-style composer. The composer is removed from
   the grid's sizing calculation so the message viewport owns all remaining
   height. Only the compact rounded bar floats above the timeline. */
.chat-body .chat-panel {
  display: flex;
  flex-direction: column;
  grid-template-rows: none;
}
.chat-body .chat-sticky-header,
.chat-body .global-important-panel { flex: 0 0 auto; }
.chat-body .message-viewport {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 132px;
}
.chat-body .chat-compose-area {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 0 14px max(10px, env(safe-area-inset-bottom));
  background: transparent !important;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}
.chat-body .chat-compose-area > * { pointer-events: auto; }
.chat-body .chat-compose-area > .reply-bar,
.chat-body .chat-compose-area > .composer,
.chat-body .chat-compose-area > .composer-status { width: min(100%, 1120px); margin-left: auto; margin-right: auto; }
.chat-body .chat-compose-area > .reply-bar {
  margin-bottom: 6px;
  padding: 8px 12px;
  border: 1px solid var(--chat-line, #dce8f1);
  border-radius: 17px;
  background: var(--surface) !important;
  box-shadow: 0 8px 24px rgba(29,80,105,.12);
}
.chat-body .chat-compose-area > .composer {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--chat-line, #dce8f1);
  border-radius: 24px;
  background: var(--surface) !important;
  box-shadow: 0 8px 24px rgba(29,80,105,.16);
}
.chat-body .chat-compose-area > .composer.has-attachments { grid-template-columns: auto minmax(0,1fr) auto; }
.chat-body .chat-compose-area > .composer-hint { display: none !important; }
.chat-body .chat-compose-area > .composer-status {
  order: -1;
  min-height: 0;
  padding: 0 12px 4px;
  border-radius: 12px;
  background: transparent !important;
}
.chat-body .chat-compose-area > .composer-status:empty { display: none; }
.chat-body .chat-compose-area .composer textarea { width: 100%; }

/* Online count remains in the sidebar footer; avoid duplicating it beside
   the conversation title in the header. */
.chat-body .chat-presence-badge { display: none !important; }

:root[data-chat-theme="dark"] .chat-body .chat-compose-area > .reply-bar,
:root[data-chat-theme="dark"] .chat-body .chat-compose-area > .composer {
  border-color: #344a57;
  box-shadow: 0 8px 24px rgba(0,0,0,.38);
}
:root[data-chat-theme="dark"] .chat-body .chat-compose-area > .composer-status { color: #ffb4b4; }

@media (max-width:760px) {
  .chat-body .message-viewport { padding-bottom: 108px; }
  .chat-body .chat-compose-area {
    padding: 0 7px max(7px, env(safe-area-inset-bottom));
    border-radius: 0;
  }
  .chat-body .chat-compose-area > .composer {
    width: 100%;
    padding: 6px 7px;
    border-radius: 22px;
  }
  .chat-body .chat-compose-area > .reply-bar { width: 100%; }
}

/* v18 lab — registrazione pubblica essenziale e brandizzata */
.public-registration-body { min-height:100vh; background:radial-gradient(circle at 20% 0%,rgba(37,99,235,.09),transparent 34rem),linear-gradient(180deg,#f8fafc 0%,var(--bg) 100%); }
.public-registration-shell { width:min(760px,calc(100% - 28px)); margin:0 auto; padding:48px 0 64px; }
.public-registration-card { background:var(--surface); border:1px solid var(--border); border-radius:24px; box-shadow:0 24px 70px rgba(15,23,42,.10); padding:clamp(22px,4vw,40px); }
.public-registration-brand { display:flex; align-items:center; gap:18px; margin-bottom:20px; }
.public-registration-logo { width:76px; height:76px; flex:0 0 76px; display:grid; place-items:center; border-radius:20px; background:var(--primary); color:var(--on-primary,#fff); font-size:1.7rem; font-weight:950; overflow:hidden; box-shadow:0 12px 30px rgba(15,23,42,.14); }
.public-registration-logo img { width:100%; height:100%; object-fit:contain; background:#fff; }
.public-registration-brand h1 { margin:2px 0 5px; font-size:clamp(1.75rem,4vw,2.45rem); }
.public-registration-brand .eyebrow { margin:0; }
.public-registration-municipality { margin:0; color:var(--muted); font-weight:750; }
.registration-system-status { margin:0 0 22px; padding:9px 12px; border-radius:10px; background:var(--soft); color:var(--muted); font-size:.86rem; font-weight:750; }
.public-registration-form { display:grid; gap:3px; }
.public-registration-form label { font-size:.9rem; }
.public-registration-form input { min-height:46px; }
.optional-label { color:var(--muted); font-weight:550; font-size:.78rem; }
.registration-address-simple { margin:8px 0 2px; padding:20px; border:1px solid var(--border); border-radius:16px; background:color-mix(in srgb,var(--surface) 92%,var(--soft)); }
.registration-address-simple h2 { font-size:1.05rem; margin:0 0 14px; }
.registration-manual-toggle { margin:6px 0 0; font-size:.84rem!important; color:var(--muted); }
.compact-manual-panel { margin:12px 0 0; padding:14px; }
.privacy-consent-compact { margin-top:12px; padding-top:16px; border-top:1px solid var(--border); }
.privacy-consent-compact details { margin-bottom:14px; border:1px solid var(--border); border-radius:12px; background:var(--soft); }
.privacy-consent-compact summary { cursor:pointer; padding:12px 14px; font-weight:800; }
.privacy-notice-body { max-height:240px; overflow:auto; padding:0 14px 14px; color:var(--muted); font-size:.85rem; line-height:1.5; }
.privacy-notice-body p { margin:.55em 0; }
.privacy-consent-check { margin:0; font-size:.86rem!important; }
.public-registration-submit { width:100%; min-height:50px; margin-top:12px; font-size:1rem; }
.registration-result { text-align:center; }
.public-registration-footer { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:12px 18px; margin-top:20px; padding-top:18px; border-top:1px solid var(--border); }
.registration-app-download { min-height:42px; }
.registration-login-link { font-weight:800; color:var(--primary); text-decoration:none; }
.public-registration-card .autocomplete-list { margin-top:-8px; }
@media(max-width:620px){
  .public-registration-shell { padding:18px 0 32px; }
  .public-registration-card { border-radius:18px; }
  .public-registration-brand { align-items:flex-start; }
  .public-registration-logo { width:60px; height:60px; flex-basis:60px; border-radius:16px; }
  .registration-name-grid,.registration-contact-grid { grid-template-columns:1fr; gap:0; }
  .registration-address-simple { padding:15px; }
}
