/* ==========================================================================
   Riccio — design system
   Linguaggio visivo allineato ai gestionali che Marco usa ogni giorno
   (Sibill, Fatture in Cloud, JetHR): sidebar a sinistra, card bianche su
   fondo grigio chiaro, badge morbidi, tabelle leggere, testi in italiano.
   Nessun build step: il file e' servito cosi' com'e'.
   ========================================================================== */

:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --border-strong: #d1d5db;

    --text: #111827;
    --text-2: #4b5563;
    --text-3: #6b7280;
    --text-4: #9ca3af;

    --primary: #2f5bea;
    --primary-hover: #2449c4;
    --primary-soft: #eef2ff;
    --primary-text: #2d47b8;

    --success: #16803c;
    --success-soft: #ecfdf3;
    --success-border: #b7e4c7;
    --warning: #b45309;
    --warning-soft: #fffaeb;
    --warning-border: #fde68a;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --info: #1d4ed8;
    --info-soft: #eff6ff;
    --info-border: #bfdbfe;
    --violet: #6d28d9;
    --violet-soft: #f5f3ff;
    --violet-border: #ddd6fe;
    --neutral: #374151;
    --neutral-soft: #f3f4f6;
    --neutral-border: #e5e7eb;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);

    --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--neutral-soft); padding: .1em .4em; border-radius: 4px; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Layout: sidebar + contenuto
   -------------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 40;
}
.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.brand-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.5px;
    flex-shrink: 0;
}
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }

.nav { padding: .75rem .75rem 1rem; flex: 1; }
.nav-group { margin-top: .8rem; }
.nav-group:first-child { margin-top: .25rem; }
.nav-group-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-4);
    padding: 0 .6rem;
    margin-bottom: .35rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .42rem .6rem;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; }
.nav-item .count {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid var(--warning-border);
    border-radius: 999px;
    padding: 0 .45rem;
    min-width: 20px;
    text-align: center;
    line-height: 18px;
}
.sidebar-foot {
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-w); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.topbar .subtitle { font-size: 13px; color: var(--text-3); margin-top: .1rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.menu-btn {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    width: 38px; height: 38px;
    align-items: center; justify-content: center;
    cursor: pointer;
}
.menu-btn svg { width: 20px; height: 20px; }

.content { padding: 1.5rem 2rem 3rem; max-width: 1400px; width: 100%; }

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .hint { font-size: 12.5px; color: var(--text-3); margin-top: .1rem; }
.card-body { padding: 1.25rem; }
.card-body.flush { padding: 0; }
.card-foot { padding: .75rem 1.25rem; border-top: 1px solid var(--border); }

/* --------------------------------------------------------------------------
   KPI
   -------------------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    display: block;
    color: inherit;
}
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.kpi-label { font-size: 13px; color: var(--text-3); font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: .3rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value.danger { color: var(--danger); }
.kpi-value.success { color: var(--success); }
.kpi-value.warning { color: var(--warning); }
.kpi-sub { font-size: 12.5px; color: var(--text-3); margin-top: .35rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Badge di stato
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .1rem .6rem;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    border: 1px solid transparent;
    vertical-align: middle;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger-border); }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info-border); }
.badge-violet  { background: var(--violet-soft);  color: var(--violet);  border-color: var(--violet-border); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); border-color: var(--neutral-border); }
a.badge:hover { text-decoration: none; filter: brightness(.97); }

/* --------------------------------------------------------------------------
   Bottoni
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem .95rem;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s;
    line-height: 1.3;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger-border); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #136632; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-sm { padding: .3rem .65rem; font-size: 12.5px; }
.btn-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Form e filtri
   -------------------------------------------------------------------------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.toolbar .spacer { flex: 1; }
.input, .select, .textarea {
    height: 36px;
    padding: 0 .75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    color: var(--text);
    outline: none;
    min-width: 160px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select {
    appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .6rem center;
}
.textarea { height: auto; padding: .6rem .75rem; resize: vertical; width: 100%; }
.search { position: relative; }
.search .input { padding-left: 2.1rem; min-width: 240px; }
.search svg { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-4); }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* Segmented control (sotto-tab) */
.segmented { display: inline-flex; background: var(--neutral-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented .seg {
    padding: .35rem .9rem;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    border: none;
    background: transparent;
    white-space: nowrap;
}
.segmented .seg:hover { color: var(--text); }
.segmented .seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented .seg .n { color: var(--text-4); margin-left: .35rem; font-weight: 500; }
.segmented .seg.active .n { color: var(--text-3); }

/* --------------------------------------------------------------------------
   Tabelle
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    padding: .65rem 1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fbfbfc; }
.table tr.clickable { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .primary-cell { font-weight: 500; color: var(--text); }
.table .sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; margin-top: .1rem; }
.table.compact td { padding: .5rem .85rem; }
.table.compact th { padding: .5rem .85rem; }
.card .table-wrap:last-child .table tbody tr:last-child td { border-bottom: none; }
.card-body .table th:first-child, .card-body .table td:first-child { padding-left: 0; }
.card-body .table th:last-child, .card-body .table td:last-child { padding-right: 0; }
.card-body .table th { background: transparent; }

.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount.neg { color: var(--danger); }
.amount.pos { color: var(--success); }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; color: var(--text-2); }

.empty {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-3);
    font-size: 13.5px;
}
.empty strong { display: block; color: var(--text-2); font-weight: 600; margin-bottom: .2rem; }

/* Stato con pallino */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; background: var(--text-4); }
.dot.on { background: #22c55e; }
.dot.off { background: #ef4444; }
.dot.warn { background: #f59e0b; }

/* --------------------------------------------------------------------------
   Avvisi
   -------------------------------------------------------------------------- */
.alert {
    display: block;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: 13.5px;
    margin-bottom: 1rem;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }

/* Elenco "cosa richiede attenzione" */
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li { display: flex; align-items: center; gap: .9rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); }
.todo-list li:last-child { border-bottom: none; }
.todo-list .todo-n {
    min-width: 40px; height: 40px;
    border-radius: 10px;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    padding: 0 .5rem;
}
.todo-list .todo-n.warning { background: var(--warning-soft); color: var(--warning); }
.todo-list .todo-n.danger { background: var(--danger-soft); color: var(--danger); }
.todo-list .todo-n.info { background: var(--info-soft); color: var(--info); }
.todo-list .todo-text { flex: 1; min-width: 0; }
.todo-list .todo-text strong { display: block; font-weight: 600; }
.todo-list .todo-text span { font-size: 12.5px; color: var(--text-3); }

/* Elenco stato collegamenti / attivita' */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.list li:last-child { border-bottom: none; }
.list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Paginazione
   -------------------------------------------------------------------------- */
.pagination { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; padding: .75rem 1.25rem; border-top: 1px solid var(--border); font-size: 13px; }
.pagination .pg { min-width: 32px; height: 32px; padding: 0 .5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-2); border: 1px solid transparent; }
.pagination a.pg:hover { background: var(--neutral-soft); text-decoration: none; }
.pagination .pg.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.pagination .pg.disabled { opacity: .35; }
.pagination .pg-info { margin-left: auto; color: var(--text-3); font-size: 12.5px; }

/* --------------------------------------------------------------------------
   Allineamento (proposte di riconciliazione)
   -------------------------------------------------------------------------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.5rem 0 .6rem; flex-wrap: wrap; }
.section-title h3 { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.section-title .muted { font-size: 12.5px; }

.proposal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: .75rem;
}
.proposal.is-proven { border-left-color: var(--success); }
.proposal.is-suspect { border-left-color: var(--danger); }
.proposal-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.proposal-main { flex: 1; min-width: 280px; }
.proposal-tags { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.proposal-side { display: flex; flex-direction: column; gap: .4rem; min-width: 130px; }
.proposal .table { font-size: 13px; }
.proposal .table th { background: transparent; padding: .4rem .5rem; }
.proposal .table td { padding: .45rem .5rem; }
.proposal .table th:first-child, .proposal .table td:first-child { padding-left: 0; }
.proposal-mov { font-size: 13px; border-top: 1px dashed var(--border); padding-top: .6rem; margin-top: .5rem; color: var(--text-2); }
.proposal-mov .causale { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12.5px; }
.ai-note { font-size: 12.5px; color: var(--warning); margin: .2rem 0 .5rem; }
.ai-note.bad { color: var(--danger); }

.row-compact {
    display: flex; align-items: center; gap: .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .5rem .9rem;
    margin-bottom: .35rem;
    font-size: 13px;
    flex-wrap: wrap;
}
.row-compact .docs { flex: 1; min-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-compact .amount { min-width: 100px; text-align: right; font-weight: 500; }
.row-compact.is-applied { border-left-color: var(--success); }
.row-compact.is-applied .docs { color: var(--text-3); }
.row-compact.is-approved { border-left-color: var(--info); }
.row-compact.is-rejected { border-left-color: var(--danger); opacity: .7; }
.row-compact.is-failed { border-left-color: var(--danger); }
.tier { font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--neutral-soft); border-radius: 4px; padding: .05rem .35rem; }

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-md); padding: 2rem; }
.login-card .brand { padding: 0; border: none; margin-bottom: 1.5rem; }
.login-card label { display: block; font-size: 13px; font-weight: 500; margin: .9rem 0 .35rem; color: var(--text-2); }
.login-card .input { width: 100%; height: 40px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 1.25rem; font-size: 14px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .main { margin-left: 0; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform .18s ease;
        box-shadow: var(--shadow-md);
    }
    .sidebar.open { transform: translateX(0); }
    .backdrop { display: none; position: fixed; inset: 0; background: rgba(17, 24, 39, .35); z-index: 30; }
    .backdrop.open { display: block; }
    .menu-btn { display: inline-flex; }
    .topbar { padding: .8rem 1rem; }
    .topbar h1 { font-size: 17px; }
    .content { padding: 1rem 1rem 2.5rem; }
    .card-head, .card-body, .toolbar { padding-left: 1rem; padding-right: 1rem; }
    .table th, .table td { padding: .6rem .75rem; white-space: nowrap; }
    .search .input { min-width: 0; width: 100%; }
    .toolbar .search { width: 100%; }
    .kpi-value { font-size: 24px; }
}

/* --------------------------------------------------------------------------
   Form a campi (Operazioni, Progetti, Utenti)
   -------------------------------------------------------------------------- */
.fields { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .input, .field .select { min-width: 160px; }
.field.check { flex-direction: row; align-items: center; gap: .45rem; padding-bottom: .5rem; }
.field-error { font-size: 12.5px; color: var(--danger); margin-top: .3rem; }
.divider { border-top: 1px dashed var(--border); margin: .9rem 0; }

/* Elenco decisioni (Oggi) */
.decision { display: flex; align-items: flex-start; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); }
.decision:last-child { border-bottom: none; }
.decision-main { flex: 1; min-width: 0; }
.decision-main strong { display: block; font-weight: 600; }
.decision-main .detail { font-size: 12.5px; color: var(--text-3); margin-top: .1rem; }
.decision-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.decision-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .decision { flex-wrap: wrap; } .decision-actions { width: 100%; justify-content: flex-start; } }

/* Output testuale delle operazioni */
.output { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); padding: .9rem 1rem; white-space: pre-wrap; word-break: break-word; max-height: 24rem; overflow: auto; margin: 0; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: .8rem; padding: 1.25rem; min-height: 240px; }
.msg { max-width: 75%; padding: .6rem .9rem; border-radius: 14px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--neutral-soft); color: var(--text); border-bottom-left-radius: 4px; }
.msg-meta { font-size: 11px; color: var(--text-4); margin-top: .25rem; }
.msg.user + .msg-meta { text-align: right; }
.chat-form { display: flex; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--border); }
.chat-form .input { flex: 1; min-width: 0; }
.examples { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.examples li { background: var(--neutral-soft); border-radius: 999px; padding: .2rem .7rem; font-size: 12.5px; color: var(--text-2); }
.examples .example { all: unset; cursor: pointer; }
.examples li:hover { background: var(--info-soft); color: var(--info); }
.glossario { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: .6rem 0 0; font-size: 13.5px; }
.glossario dt { font-weight: 600; color: var(--text-1); }
.glossario dd { margin: 0; color: var(--text-2); }

/* Guida */
.prose { max-width: 760px; font-size: 14.5px; line-height: 1.65; }
.prose h3 { font-size: 15px; font-weight: 600; margin: 1.4rem 0 .4rem; }
.prose p { margin: 0 0 .7rem; color: var(--text-2); }
.prose strong { color: var(--text); }
.prose ol, .prose ul { margin: 0 0 .8rem 1.2rem; color: var(--text-2); }
.prose li { margin-bottom: .3rem; }
.rule { border-left: 3px solid var(--primary); padding: .5rem 1rem; background: var(--primary-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: .6rem; }
.rule strong { display: block; color: var(--text); }
.rule span { font-size: 13px; color: var(--text-2); }

.who { display: flex; align-items: center; gap: .55rem; font-size: 13px; color: var(--text-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 600; font-size: 12px; }

/* Solleciti: l'email del cliente non deve allargare la tabella. */
.cell-email { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Menu: i gruppi si richiudono e ricordano come li hai lasciati. */
.nav-group-title.toggle { all: unset; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; box-sizing: border-box;
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); padding: 0 .6rem; margin-bottom: .35rem; }
.nav-group-title.toggle::after { content: '▾'; font-size: 10px; opacity: .7; }
.nav-group.collapsed .nav-group-title.toggle::after { content: '▸'; }
.nav-group.collapsed .nav-item { display: none; }
/* Pagine sorelle: una barra di schede in cima. */
.sorelle { display: flex; gap: .35rem; margin-bottom: .9rem; flex-wrap: wrap; }
.sorelle a { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; color: var(--text-2); text-decoration: none; background: var(--surface); }
.sorelle a.active { background: var(--info-soft); color: var(--info); border-color: var(--info-border); font-weight: 600; }
