/* HelpDesk – stile ispirato a Odoo */
:root {
  --primary: #714B67;
  --primary-dark: #5b3c53;
  --primary-soft: #f3edf2;
  --accent: #017E84;
  --accent-soft: #e6f2f3;
  --bg: #f2f3f5;
  --surface: #ffffff;
  --border: #dee2e6;
  --border-soft: #eceef0;
  --text: #212529;
  --muted: #6c757d;
  --danger: #d44c59;
  --warning: #e9a23b;
  --success: #28a745;
  --info: #3b82c4;
  --radius: 4px;
  --nav-h: 46px;
  --font: "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Navbar ---------- */
.navbar { height: var(--nav-h); background: var(--primary); color: #fff; display: flex; align-items: center; padding: 0 12px; gap: 4px; position: sticky; top: 0; z-index: 50; }
.navbar a, .navbar button { color: rgba(255,255,255,.92); }
.navbar .brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 500; margin-right: 14px; color: #fff; }
.navbar .brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: #fff; color: var(--primary); display: grid; place-items: center; font-size: 15px; }
.nav-menu { display: flex; height: 100%; }
.nav-menu > a, .nav-menu > .dropdown > button { display: flex; align-items: center; height: var(--nav-h); padding: 0 12px; font-size: 14px; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav-menu > a:hover, .nav-menu > .dropdown > button:hover, .nav-menu > a.active { background: rgba(0,0,0,.14); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 4px; height: 100%; }
.nav-icon { position: relative; background: none; border: 0; height: var(--nav-h); padding: 0 10px; cursor: pointer; font-size: 17px; display: flex; align-items: center; }
.nav-icon:hover { background: rgba(0,0,0,.14); }
.nav-badge { position: absolute; top: 7px; right: 3px; background: var(--accent); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; font-weight: 500; }
.nav-user { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 0 8px; height: var(--nav-h); font-family: inherit; font-size: 13px; }
.nav-user:hover { background: rgba(0,0,0,.14); }
.nav-toggle { display: none; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; height: 100%; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 2px); left: 0; min-width: 210px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(33,37,41,.14); padding: 4px 0; z-index: 60; }
.dropdown.right .dropdown-menu { left: auto; right: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button.item { display: block; width: 100%; text-align: left; padding: 7px 16px; color: var(--text) !important; background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button.item:hover { background: var(--bg); text-decoration: none; }
.dropdown-menu .divider { height: 1px; background: var(--border-soft); margin: 4px 0; }
.dropdown-header { padding: 8px 16px; font-size: 12px; color: var(--muted); }

.notif-menu { width: 360px; padding: 0; }
.notif-menu .notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); font-weight: 500; }
.notif-menu .notif-head button { background: none; border: 0; color: var(--accent) !important; cursor: pointer; font-size: 12px; }
.notif-item { display: flex !important; gap: 10px; padding: 10px 14px !important; border-bottom: 1px solid var(--border-soft); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .t { font-weight: 500; font-size: 13px; }
.notif-item .m { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-empty { padding: 26px; text-align: center; color: var(--muted); }
.notif-foot { display: block; text-align: center; padding: 9px; font-size: 13px; }

/* ---------- Avatar ---------- */
.avatar { width: 26px; height: 26px; border-radius: 4px; color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 500; flex: none; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; border-radius: 3px; }
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.avatar.empty { background: var(--border) !important; color: var(--muted); }

/* ---------- Control panel ---------- */
.control-panel { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 8px; }
.cp-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cp-row + .cp-row { margin-top: 8px; }
.breadcrumb { font-size: 18px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.breadcrumb a { color: var(--accent); }
.breadcrumb .sep { color: var(--muted); font-size: 14px; }
.breadcrumb .current { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-actions { display: flex; gap: 6px; align-items: center; }
.searchbox { flex: 1; min-width: 240px; max-width: 640px; margin-left: auto; display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 2px 6px; gap: 4px; flex-wrap: wrap; }
.searchbox:focus-within { border-color: var(--accent); }
.searchbox input { border: 0; outline: 0; flex: 1; min-width: 120px; padding: 5px 4px; font: inherit; background: transparent; }
.searchbox .bi-search { color: var(--muted); }
.facet { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); border-radius: 3px; font-size: 12px; padding: 2px 4px 2px 6px; }
.facet .k { background: var(--primary); color: #fff; padding: 0 5px; border-radius: 2px; }
.facet a { color: var(--muted); padding: 0 2px; }
.facet a:hover { color: var(--danger); text-decoration: none; }
.cp-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 12.5px; }
.chip:hover { border-color: var(--primary); text-decoration: none; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.cp-filters select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 14px; font: inherit; font-size: 12.5px; background: #fff; }
.view-switch { display: flex; margin-left: auto; }
.view-switch a { border: 1px solid var(--border); padding: 4px 10px; color: var(--muted); background: #fff; }
.view-switch a:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-switch a:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.view-switch a.on { background: var(--primary-soft); color: var(--primary); }
.pager { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pager a { border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 8px; background: #fff; color: var(--text); }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius); border: 1px solid transparent; font: inherit; font-weight: 500; font-size: 13.5px; cursor: pointer; line-height: 1.3; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e7e9ed; color: var(--text) !important; }
.btn-secondary:hover { background: #d9dce1; }
.btn-light { background: #fff; border-color: var(--border); color: var(--text) !important; }
.btn-light:hover { background: var(--bg); }
.btn-link { background: none; color: var(--accent) !important; padding: 6px 6px; }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-sm { padding: 3px 9px; font-size: 12.5px; }

.field { margin-bottom: 14px; }
.field label, .label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; }
.input, select.input, textarea.input { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: #fff; color: var(--text); }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(1,126,132,.12); }
textarea.input { min-height: 120px; resize: vertical; }
.input-line { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 4px 2px; width: 100%; font: inherit; background: transparent; }
.input-line:focus { outline: 0; border-bottom-color: var(--accent); }
.title-input { font-size: 26px; font-weight: 500; }
.validation, .field-validation-error { color: var(--danger); font-size: 12.5px; }
.validation-summary-errors ul { margin: 0 0 12px; padding: 10px 14px 10px 30px; background: #fdecee; border: 1px solid #f5c2c7; border-radius: var(--radius); color: #842029; }
.validation-summary-valid { display: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Pagina / sheet (form view) ---------- */
.page { padding: 16px; }
.form-wrap { display: flex; gap: 0; align-items: flex-start; }
.sheet-area { flex: 1; min-width: 0; padding: 16px; }
.sheet { background: var(--surface); border: 1px solid var(--border); max-width: 1040px; margin: 0 auto; padding: 24px 32px 28px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.sheet.narrow { max-width: 780px; }
.sheet-head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; }
.sheet-ref { color: var(--muted); font-size: 13px; }
.sheet-title { font-size: 26px; font-weight: 500; margin: 2px 0 18px; word-break: break-word; }
.ribbon { position: absolute; top: 18px; right: -34px; transform: rotate(45deg); background: var(--success); color: #fff; padding: 3px 40px; font-size: 12px; font-weight: 500; }
.sheet { position: relative; overflow: hidden; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center; margin-bottom: 4px; }
.kv > .k { font-weight: 500; font-size: 13px; }
.kv > .v { min-height: 24px; display: flex; align-items: center; gap: 6px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-top: 20px; gap: 2px; }
.tab { padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; background: none; font: inherit; cursor: pointer; color: var(--muted); margin-bottom: -1px; border-radius: var(--radius) var(--radius) 0 0; }
.tab.on { border-color: var(--border); background: #fff; color: var(--text); font-weight: 500; }
.tab-pane { display: none; padding-top: 16px; }
.tab-pane.on { display: block; }
.description { white-space: pre-wrap; word-break: break-word; line-height: 1.6; }

/* Statusbar a frecce (firma di Odoo) */
.form-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 6px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statusbar { display: flex; margin: 0 0 0 auto; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.statusbar > button, .statusbar > span { position: relative; background: #fff; border: 0; font: inherit; font-size: 12.5px; padding: 5px 18px 5px 26px; color: var(--muted); cursor: default; white-space: nowrap; }
.statusbar > :first-child { padding-left: 14px; }
.statusbar > button:not(:disabled) { cursor: pointer; }
.statusbar > button:not(:disabled):hover { background: var(--bg); color: var(--text); }
.statusbar > * + *::before { content: ""; position: absolute; left: 0; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%) rotate(45deg);
  border-top: 1px solid var(--border); border-right: 1px solid var(--border); background: var(--prev-bg, #fff); }
.statusbar > .current { background: var(--primary); color: #fff; font-weight: 500; }
.statusbar > .current + *::before { background: var(--primary); border-color: var(--primary); }

/* ---------- Chatter ---------- */
.chatter { width: 420px; flex: none; border-left: 1px solid var(--border); background: var(--surface); min-height: calc(100vh - var(--nav-h) - 48px); padding: 14px 16px 30px; }
.chatter-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chatter-actions .right { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; gap: 10px; }
.composer { display: none; margin-top: 12px; gap: 10px; }
.composer.on { display: flex; }
.composer .box { flex: 1; }
.composer textarea { min-height: 80px; }
.composer.note textarea { background: #fffbea; }
.composer-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.file-pick { color: var(--muted); cursor: pointer; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; }
.file-pick:hover { color: var(--accent); }
.file-pick input { display: none; }
.file-list { font-size: 12px; color: var(--muted); }
.day-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 18px 0 8px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.msg { display: flex; gap: 10px; padding: 8px 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg-head .author { font-weight: 500; }
.msg-head .when { color: var(--muted); font-size: 12px; }
.msg-text { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.bubble { background: var(--bg); border-radius: 0 8px 8px 8px; padding: 8px 11px; margin-top: 4px; display: inline-block; max-width: 100%; }
.msg.internal .bubble { background: #fff7d6; }
.tag-note { font-size: 11px; background: #f5e7a8; color: #7a5d00; border-radius: 3px; padding: 0 5px; }
.tag-worklog { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 5px; }
.tracking { font-size: 13px; color: var(--text); margin-top: 2px; }
.tracking .old { color: var(--muted); }
.tracking .arrow { color: var(--accent); margin: 0 4px; }
.tracking .new { font-weight: 500; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px 6px 6px; background: #fff; font-size: 12px; color: var(--text); max-width: 240px; }
.att:hover { border-color: var(--accent); text-decoration: none; }
.att .ic { width: 32px; height: 32px; display: grid; place-items: center; background: var(--bg); border-radius: 3px; font-size: 16px; color: var(--primary); flex: none; }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-img { display: block; width: 120px; height: 90px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-img:hover { border-color: var(--accent); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; padding: 14px 16px; overflow-x: auto; align-items: flex-start; min-height: calc(100vh - 140px); }
.k-col { flex: 0 0 300px; display: flex; flex-direction: column; }
.k-col-head { padding: 4px 4px 8px; }
.k-col-title { display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: 15px; }
.k-col-title .cnt { color: var(--muted); font-size: 13px; font-weight: 400; }
.k-progress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 7px; display: flex; overflow: hidden; }
.k-progress span { display: block; height: 100%; }
.k-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: var(--radius); padding: 2px; transition: background .15s; }
.k-cards.drop { background: var(--primary-soft); }
.k-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid transparent; border-radius: var(--radius); padding: 10px 12px; color: var(--text); display: block; cursor: grab; }
.k-card:hover { text-decoration: none; box-shadow: 0 3px 10px rgba(33,37,41,.10); }
.k-card.dragging { opacity: .5; }
.k-card.edge-prio-urgent { border-left-color: var(--danger); }
.k-card.edge-prio-high { border-left-color: var(--warning); }
.k-card .ttl { font-weight: 500; margin-bottom: 2px; word-break: break-word; }
.k-card .sub { font-size: 12.5px; color: var(--muted); }
.k-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.k-card .left { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.k-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 0; border: 1px dashed var(--border); border-radius: var(--radius); }

.stars { color: #c9ccd1; letter-spacing: -1px; font-size: 13px; }
.stars .on { color: #f3cc00; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.stage-new { background: #e7eefb; color: #2f5fa7; }
.stage-progress { background: #fdf0dc; color: #9a5b00; }
.stage-waiting { background: #f3e8f7; color: #7b3f8f; }
.stage-solved { background: #e3f4e7; color: #1e7a35; }
.stage-closed { background: #eceef0; color: #5a6168; }
.prio-low { color: #6c757d; } .prio-normal { color: #3b82c4; } .prio-high { color: #c87a00; } .prio-urgent { color: var(--danger); }
.badge.type { background: var(--bg); color: var(--muted); }
.badge.role { background: var(--primary-soft); color: var(--primary); }
.badge.off { background: #fdecee; color: #a52834; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- List view ---------- */
.list-wrap { padding: 0; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13.5px; }
table.list th { text-align: left; font-weight: 500; padding: 9px 12px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; color: #495057; position: sticky; top: var(--nav-h); }
table.list td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.list tr.row-link { cursor: pointer; }
table.list tr.row-link:hover td { background: #f6f7f9; }
table.list .num { text-align: right; }
.list-card { background: var(--surface); border: 1px solid var(--border); }
.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state .ic { font-size: 46px; color: var(--primary); opacity: .55; }
.empty-state h3 { color: var(--text); margin: 10px 0 6px; font-size: 18px; }

/* ---------- Dashboard ---------- */
.dash { padding: 16px; display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.panel-body { padding: 14px 16px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; }
.stage-strip { display: grid; grid-template-columns: repeat(5, 1fr); }
.stage-cell { padding: 16px 18px; border-right: 1px solid var(--border-soft); color: var(--text); display: block; }
.stage-cell:last-child { border-right: 0; }
.stage-cell:hover { background: #fafbfc; text-decoration: none; }
.stage-cell .n { font-size: 28px; font-weight: 300; }
.stage-cell .l { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); }
.kpi { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.kpi:nth-child(odd) { border-right: 1px solid var(--border-soft); }
.kpi .n { font-size: 22px; font-weight: 500; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi.alert .n { color: var(--danger); }
.mini-list a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.mini-list a:hover { background: #fafbfc; text-decoration: none; }
.mini-list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .ref { color: var(--muted); font-size: 12px; width: 76px; flex: none; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 210px; padding-top: 8px; }
.chart .day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; gap: 2px; align-items: flex-end; height: 180px; }
.chart .bar { width: 9px; border-radius: 2px 2px 0 0; min-height: 2px; }
.chart .bar.c { background: var(--primary); }
.chart .bar.k { background: var(--accent); }
.chart .lbl { font-size: 10px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
.hbar { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.hbar .nm { width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--primary); border-radius: 4px; }
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.welcome h2 { font-size: 20px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 32px 30px; box-shadow: 0 8px 30px rgba(113,75,103,.10); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo .brand-mark { width: 40px; height: 40px; font-size: 22px; background: var(--primary); color: #fff; border-radius: 9px; }
.login-logo .nm { font-size: 22px; font-weight: 500; }
.login-card .btn { width: 100%; justify-content: center; padding: 9px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 20px; }

/* Login a due colonne: immagine a sinistra, form a destra, logo in fondo */
.login-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); background: var(--surface); }
.login-hero { position: relative; background-color: var(--primary); background-size: cover; background-position: center; overflow: hidden; }
.login-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(43,26,39,.65), rgba(43,26,39,0) 45%); }
.login-hero-text { position: absolute; left: 48px; right: 48px; bottom: 48px; z-index: 1; color: #fff; max-width: 460px; }
.login-hero-text h2 { font-size: 28px; font-weight: 500; line-height: 1.2; margin-bottom: 10px; }
.login-hero-text p { font-size: 15px; opacity: .85; }
.login-side { display: flex; flex-direction: column; min-height: 100vh; padding: 32px 24px 24px; }
.login-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 360px; margin: 0 auto; }
.login-head { margin-bottom: 26px; }
.login-head h1 { font-size: 26px; font-weight: 500; margin-bottom: 4px; }
.login-form-wrap .btn { width: 100%; justify-content: center; padding: 9px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 28px; }
.login-brand img { width: 200px; max-width: 70%; height: auto; }
.login-brand .copy { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .login-split { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 16px; top: calc(var(--nav-h) + 12px); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--success); padding: 10px 14px; border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.12); min-width: 260px; max-width: 380px; font-size: 13.5px; animation: toastIn .25s ease-out; }
.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Dropzone ---------- */
.dropzone { border: 1.5px dashed var(--border); border-radius: 6px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; background: #fcfcfd; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.dz-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dz-files span { background: var(--bg); border-radius: 3px; padding: 2px 8px; font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .form-wrap { flex-direction: column; }
  .chatter { width: 100%; border-left: 0; border-top: 1px solid var(--border); min-height: 0; }
}
@media (max-width: 900px) {
  .span-8, .span-6, .span-4 { grid-column: span 12; }
  .stage-strip { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-menu { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--primary-dark); flex-direction: column; height: auto; }
  .nav-menu.open { display: flex; }
  .nav-menu > a, .nav-menu > .dropdown > button { height: 42px; }
  .nav-user .nm { display: none; }
  .searchbox { min-width: 100%; margin-left: 0; }
  .sheet { padding: 18px 16px; }
  .sheet-area { padding: 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv > .v { margin-bottom: 8px; }
  .statusbar { margin-left: 0; width: 100%; overflow-x: auto; }
  .k-col { flex-basis: 85vw; }
  .notif-menu { width: calc(100vw - 24px); position: fixed; right: 12px; top: var(--nav-h); }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.notif-item .t, .notif-item .m { display: block; }
.tabs { overflow-x: auto; scrollbar-width: thin; }
.tab { white-space: nowrap; }
.form-wrap > * { min-width: 0; max-width: 100%; }
.attachments, .msg-body { min-width: 0; }
@media (max-width: 760px) { body { overflow-x: hidden; } .form-wrap { align-items: stretch; } .chatter { width: auto; } }
::placeholder { color: #adb5bd; opacity: 1; }

/* ---------- v1.1: destinatari, dossier, tempo reale, trascinamento ---------- */
.section-title { font-size: 16px; font-weight: 500; margin: 26px 0 6px; display: flex; gap: 8px; align-items: center; color: var(--primary); }
.recipients { border-top: 1px solid var(--border-soft); margin-top: 20px; }
.recipient-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.recipient { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; cursor: pointer; background: #fff; }
.recipient:hover { border-color: var(--primary); }
.recipient.on, .recipient:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.recipient input { margin: 0; accent-color: var(--primary); }
.r-text { display: flex; flex-direction: column; min-width: 0; }
.r-name { font-weight: 500; }
.r-mail { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-stack { display: inline-flex; margin-right: 6px; vertical-align: middle; }
.avatar-stack .avatar { margin-left: -4px; box-shadow: 0 0 0 2px #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Trascinamento file ed email */
.drop-active { outline: 2px dashed var(--accent); outline-offset: 4px; background: var(--accent-soft) !important; }
.composer.drop-active { border-radius: 6px; }
.dz-files span.email { background: #e7eefb; color: #2f5fa7; }
.dz-files span i { margin-right: 4px; }

/* Aggiornamento in tempo reale */
@keyframes liveFlash { from { background: #fff3c4; } to { background: transparent; } }
.live-new { animation: liveFlash 2.4s ease-out; border-radius: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; display: inline-block; margin-right: 2px; }
.live-dot.on { background: #30c381; box-shadow: 0 0 0 3px rgba(48,195,129,.18); }
.toast a { color: var(--accent); font-weight: 500; }

/* Attività: visibilità */
.vis { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.vis.pub { background: #e3f4e7; color: #1e7a35; }
.vis.int { background: #fff7d6; color: #7a5d00; }
.vis-toggle { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; padding: 2px 4px; }
.vis-toggle:hover { text-decoration: underline; }
.chatter-actions .right { align-items: center; }

/* ---------- Incidenti NIS2 ---------- */
:root { --nis: #8f1d2c; --nis-soft: #fbeef0; }
.nis-mark { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--nis-soft); color: var(--nis); white-space: nowrap; }
.nis-status { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.nis-status.s0 { background: #fff3c4; color: #7a5d00; }
.nis-status.s1 { background: var(--nis-soft); color: var(--nis); }
.nis-status.s2 { background: #e6f2f3; color: var(--accent); }
.nis-status.s3 { background: #e3f4e7; color: #1e7a35; }
.nis-status.s4 { background: var(--bg); color: var(--muted); }
.nis-alert { display: flex; gap: 12px; align-items: flex-start; background: var(--nis-soft); border: 1px solid #efc4cb; color: #5c1420; border-radius: 6px; padding: 12px 14px; margin-bottom: 16px; }
.nis-alert > .bi { font-size: 20px; color: var(--nis); line-height: 1.1; }
.nis-alert.info { background: #eef5fb; border-color: #cfe0f1; color: #1d3f63; }
.nis-alert.info > .bi { color: var(--info); }
.nis-alert b { font-weight: 600; }
.deadlines { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 4px 0 6px; }
.dl { border: 1px solid var(--border); border-top: 4px solid var(--warning); border-radius: 6px; padding: 11px 13px 12px; background: #fff; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dl.done { border-top-color: var(--success); }
.dl.late { border-top-color: var(--nis); background: #fffafa; }
.dl.soon { border-top-color: #e8590c; }
.dl.nodate { border-top-color: #adb5bd; }
.dl .dl-k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.dl .dl-l { font-weight: 500; font-size: 14.5px; }
.dl .dl-t { font-size: 20px; font-weight: 500; line-height: 1.2; }
.dl.late .dl-t { color: var(--nis); }
.dl.soon .dl-t { color: #c2410c; }
.dl.done .dl-t { color: #1e7a35; font-size: 15px; }
.dl .dl-due { font-size: 12.5px; color: var(--muted); }
.dl .dl-note { font-size: 12px; color: var(--muted); }
.dl .btn { align-self: flex-start; margin-top: 6px; }
.dl-countdown[data-due] { font-variant-numeric: tabular-nums; }
.nis-form fieldset { border: 1px solid var(--border-soft); border-radius: 6px; padding: 14px 16px 4px; margin: 0 0 16px; }
.nis-form legend { font-weight: 500; padding: 0 6px; color: var(--primary); }
.tri { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tri label { margin: 0; padding: 5px 12px; font-weight: 400; font-size: 13px; cursor: pointer; border-left: 1px solid var(--border); background: #fff; }
.tri label:first-child { border-left: 0; }
.tri input { position: absolute; opacity: 0; pointer-events: none; }
.tri label:has(input:checked) { background: var(--primary); color: #fff; }
.tri label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.cat-list { display: grid; gap: 6px; }
.cat-list .check { align-items: flex-start; }
.cat-list .check.disabled { opacity: .5; cursor: not-allowed; }
textarea.input.draft { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; line-height: 1.55; min-height: 380px; white-space: pre-wrap; }
.report-text { white-space: pre-wrap; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; background: var(--bg); border-radius: 4px; padding: 10px 12px; margin: 8px 0 0; max-height: 320px; overflow: auto; }
.hash { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; color: var(--muted); word-break: break-all; }
.diary { list-style: none; margin: 0; padding: 0; }
.diary li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.diary .when { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.diary .who { font-size: 12px; color: var(--muted); }
.diary li.manual .txt { font-weight: 500; }
.dash .nis-panel { border-color: #efc4cb; }
.dash .nis-panel .panel-head { color: var(--nis); }
@media (max-width: 760px) { .diary li { grid-template-columns: 1fr; gap: 2px; } .deadlines { grid-template-columns: 1fr; } }

/* ---------- Email in ingresso ---------- */
.mbx-card { border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.mbx-card h3 { margin: 0; font-size: 15px; font-weight: 500; }
.mbx-card .btn { align-self: flex-start; }
.mbx-form:has(select[name="Mailbox.Provider"] option[value="Imap"]:checked) .only-graph,
.mbx-form:has(select[name="Mailbox.Provider"] option[value="Microsoft365"]:checked) .only-imap { display: none; }
.mbx-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.mbx-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #adb5bd; }
.mbx-status.ok .dot { background: var(--success); }
.mbx-status.err .dot { background: #c92a2a; }
.nav-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 9px; background: #e8590c; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.steps-help { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.steps-help li { margin-bottom: 3px; }
