:root { --side-w: 260px; --top-h: 64px; --ink: #1d3557; }
body { background: #eef2f7; font-size: .95rem; color: #2b2f36; }
a { color: var(--brand); }

/* ---- barra in alto ---- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); background: #fff; display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem 0 0; box-shadow: 0 1px 6px rgba(20,40,80,.08); z-index: 1030; }
.brand { width: var(--side-w); display: flex; align-items: center; gap: .6rem; padding-left: 1.25rem; text-decoration: none; flex-shrink: 0; }
.brand-logo { max-height: 46px; max-width: 220px; }
.brand-caf { font-family: Georgia, 'Times New Roman', serif; font-size: 2rem; font-weight: 700; color: var(--brand); letter-spacing: -1px; line-height: 1; }
.brand-txt { display: flex; flex-direction: column; border-left: 2px solid var(--brand); padding-left: .55rem; line-height: 1.1; }
.brand-city { font-size: 1.05rem; font-weight: 700; color: var(--ink); letter-spacing: .12em; }
.brand-sub { font-size: .62rem; color: #6b7686; }
.topsearch { max-width: 420px; flex: 1; border: 1px solid #dfe4ea; border-radius: .5rem; overflow: hidden; }
.topsearch .form-control { border: 0; box-shadow: none; }
.bell { position: relative; font-size: 1.35rem; color: var(--ink); }
.bell .badge { position: absolute; top: -6px; right: -10px; background: #0d6efd; font-size: .65rem; border-radius: 1rem; }
.user-menu { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .35rem; font-weight: 500; }

/* ---- menu laterale ---- */
.sidebar { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: var(--side-w); background: #fff; overflow-y: auto; padding: 1rem .75rem 2rem;
  border-right: 1px solid #e3e8ef; z-index: 1020; transition: transform .2s; }
.side-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #8a94a3; margin: 1.1rem .75rem .35rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: .45rem; color: var(--ink); text-decoration: none; font-weight: 500; }
.side-link i { font-size: 1.05rem; color: #6b7a90; width: 1.2rem; text-align: center; }
.side-link:hover { background: #f2f5fa; }
.side-link.active { background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--brand); }
.side-link.active i { color: var(--brand); }
.side-badge { margin-left: auto; background: #e8eef7; color: var(--ink); border-radius: 1rem; font-size: .72rem; padding: .05rem .5rem; font-weight: 600; }
.side-dot { width: .7rem; height: .7rem; border-radius: 50%; margin: 0 .25rem; }
.g-privati { background: #1d9a6c; } .g-immigrazione { background: #d6334a; } .g-contabilita { background: #1f4e9c; } .g-xprime { background: #12a8c9; } .g-sicurezza { background: #e07b00; }

.content { margin-left: var(--side-w); padding-left: 1.75rem !important; padding-right: 1.75rem !important; }
body.with-shell { padding-top: var(--top-h); }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  body.side-open .sidebar { transform: none; }
  .content { margin-left: 0; padding-left: 1rem !important; padding-right: 1rem !important; }
  .brand { width: auto; }
}

/* ---- elementi ---- */
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { filter: brightness(.92); color: #fff; background: var(--brand); }
.bg-brand { background: var(--brand) !important; }
.border-brand { border-color: var(--brand) !important; }
.brand-bar { background: var(--brand) !important; }
.card { border-radius: .7rem; border: 0; box-shadow: 0 1px 4px rgba(20,40,80,.06); }

.stat-card { display: flex; flex-direction: column; gap: .5rem; padding: 1.2rem 1.4rem; border-left: 4px solid var(--ink); }
.stat-card .t { color: var(--ink); font-size: 1.15rem; font-weight: 600; }
.stat-card .t small { color: #8a94a3; font-weight: 400; font-size: .8rem; }
.stat-card .v { font-size: 2rem; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: .9rem; }
.stat-card .v i { font-size: 1.7rem; color: #5d6b82; background: #eef1f6; border-radius: 50%; width: 3.2rem; height: 3.2rem; display: inline-flex; align-items: center; justify-content: center; }

.kpi { border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: transform .1s; }
.kpi:hover { transform: translateY(-2px); }
.kpi-n { font-size: 2rem; font-weight: 700; color: var(--brand); line-height: 1; }
.kpi-l { color: #5c6670; font-size: .85rem; margin-top: .35rem; }
.kpi-warn .kpi-n { color: #b8860b; }
.caf-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; vertical-align: middle; }
tr.clickable { cursor: pointer; }
.prewrap { white-space: pre-wrap; }
.chat { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.msg { padding: .5rem .7rem; border-radius: .6rem; max-width: 92%; font-size: .9rem; }
.msg-h { font-size: .72rem; color: #6c757d; margin-bottom: .15rem; }
.msg-caf { background: #eef2f5; align-self: flex-start; }
.msg-jesi { background: #e3f1ff; align-self: flex-end; }
.msg-sistema { background: transparent; align-self: center; color: #6c757d; font-size: .8rem; padding: .1rem; text-align: center; }
.tipo-card { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid #dee2e6; border-radius: .5rem; padding: .6rem .7rem; cursor: pointer; background: #fff; height: 100%; }
.tipo-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.tipo-card input { margin-top: .3rem; }
.tipo-card i { font-size: 1.2rem; }
table.bg-white { border-radius: .5rem; overflow: hidden; }
.timeline-item { display: flex; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid #f0f2f5; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .dot { width: .6rem; height: .6rem; border-radius: 50%; background: #1d9a6c; margin-top: .45rem; flex-shrink: 0; }

.money-card .v { font-size: 1.6rem; font-weight: 700; color: var(--ink); }
.money-card .l { color: #6b7686; font-size: .85rem; }
.mov-pos { color: #157a55; font-weight: 600; } .mov-neg { color: #c8233a; font-weight: 600; }
@media print { .topbar, .sidebar, footer, .no-print { display: none !important; } .content { margin: 0 !important; } body.with-shell { padding-top: 0; } }

.legend { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; margin: 0 .25rem 0 .75rem; vertical-align: middle; }
:root { --brand: #1f4e9c; }
.az-select { max-width: 320px; font-weight: 600; }
.az-nome { font-weight: 600; color: var(--ink); }
body.area-studio { --brand: #1f3b70; }
.stat { border-radius: .7rem; padding: 1rem 1.1rem; background: #fff; box-shadow: 0 1px 4px rgba(20,40,80,.06); height: 100%; }
.stat .lbl { font-size: .78rem; color: #6b7686; text-transform: uppercase; letter-spacing: .04em; }
.stat .val { font-size: 1.55rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat.rosso .val { color: #c62839; } .stat.arancio .val { color: #c96a00; } .stat.verde .val { color: #157a55; }
.badge-stato { font-weight: 600; font-size: .75rem; }
.st-pagata { background: #dff3ea; color: #157a55; } .st-dapagare { background: #e8eef7; color: #1f4e9c; }
.st-scaduta { background: #fbe3e6; color: #c62839; } .st-rateizzata, .st-ader { background: #efe7fb; color: #6b3fb5; } .st-altro { background: #eef1f5; color: #4b5563; }
.riga-urgente { background: #fff7ec; }
.progress-rate { height: .55rem; }
.login-box { max-width: 420px; margin: 8vh auto 0; }
.login-logo { display: flex; justify-content: center; align-items: center; gap: .6rem; margin-bottom: 1.5rem; text-decoration: none; }
.table td, .table th { vertical-align: middle; }
h1.panel-title { font-size: 1.45rem; }
.riga-urgente > td { background: #fff7ec !important; }
.table-danger > td { background: #fdecee !important; }
.card > .table-responsive > .table > :not(caption) > * > *:first-child, .card > .table-responsive > .table > :not(caption) > * > *:last-child { padding-left: 1rem; padding-right: 1rem; }
