:root {
  /* Suite NETORANGE: stessa palette e componenti di NETdesk e NETworkCatalogue */
  --bg-body: #f8fafc;
  --bg-panel: #ffffff;
  --bg-soft: #f1f5f9;
  --text-main: #1f2937;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --border-dark: #cbd5e1;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-light: #ffedd5;
  --primary-border: #fdba74;
  --primary-text: #c2410c;
  --primary-soft: #fed7aa;
  --secondary: #e2e8f0;
  --secondary-hover: #cbd5e1;
  --secondary-text: #1f2937;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --ok: #16a34a;
  --ok-light: #dcfce7;
  --warn: #ca8a04;
  --warn-light: #fef9c3;
  --info: #2563eb;
  --info-light: #dbeafe;
  --note-bg: #fffbeb;
  --note-border: #fcd34d;
  --out-bg: #fff7ed;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-panel: #1e293b;
  --bg-soft: #172033;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-light: #334155;
  --border-dark: #475569;
  --primary: #ea580c;
  --primary-hover: #f97316;
  --primary-light: #431407;
  --primary-border: #9a3412;
  --primary-text: #fdba74;
  --primary-soft: #7c2d12;
  --secondary: #334155;
  --secondary-hover: #475569;
  --secondary-text: #f1f5f9;
  --danger-light: #450a0a;
  --danger-border: #7f1d1d;
  --danger-hover: #ef4444;
  --ok-light: #052e16;
  --warn-light: #3a2e05;
  --info-light: #172554;
  --note-bg: #2a2106;
  --note-border: #854d0e;
  --out-bg: #2a1708;
  --shadow: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg-body); color: var(--text-main); font-size: 14px; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--text-main); }
a { color: var(--primary-text); }
.hidden { display: none !important; }
.hint { color: var(--text-muted); font-size: 12px; }
.muted { color: var(--text-muted); }
.icon { width: 18px; height: 18px; fill: currentColor; vertical-align: middle; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mono { font-family: Consolas, "Courier New", monospace; }

/* ---------- pulsanti e campi (come il catalogo) ---------- */
.btn { padding: 8px 14px; border: none; border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer; font-size: 13px; font-weight: 500; transition: background .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--secondary); color: var(--secondary-text); }
.btn.secondary:hover { background: var(--secondary-hover); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-light); }
.btn.ghost:hover { background: var(--bg-soft); color: var(--text-main); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.linklike { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--primary-border); border-radius: 6px; background: var(--primary-light); color: var(--primary-text); cursor: pointer; font-size: 12px; font-weight: 500; }
.linklike:hover { background: var(--primary-soft); }
.linklike.danger { background: var(--danger-light); border-color: var(--danger-border); color: var(--danger-hover); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .lbl { font-size: 12px; color: var(--text-muted); }
.field input, .field select, .field textarea, .inp { width: 100%; padding: 8px 10px; border: 1px solid var(--border-dark); border-radius: 8px; font-size: 13px; background: var(--bg-panel); transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.chk { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.chk input { width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card h2 { font-size: 16px; margin-bottom: 10px; }
.card h3 { font-size: 13px; margin: 14px 0 8px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- login ---------- */
.login-fullscreen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, var(--bg-body), var(--primary-light)); }
.login-card { background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 16px; padding: 32px 28px; width: min(380px, 100%); text-align: center; box-shadow: 0 20px 50px rgba(15,23,42,.12); }
.login-logo { max-width: 160px; max-height: 60px; margin-bottom: 10px; }
.login-title { font-size: 24px; margin-bottom: 4px; }
.login-sub { color: var(--text-muted); margin-bottom: 18px; }
.login-error { color: var(--danger); background: var(--danger-light); border: 1px solid var(--danger-border); border-radius: 8px; padding: 10px; margin-bottom: 16px; font-size: 13px; }
.login-m365 { display: inline-flex; gap: 10px; align-items: center; justify-content: center; width: 100%; text-decoration: none; padding: 11px; }
.dev-login { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--border-dark); }
.dev-login .row { justify-content: center; margin-top: 8px; }

/* ---------- struttura ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 250px; flex: 0 0 250px; background: var(--bg-panel); border-right: 1px solid var(--border-light); display: flex; flex-direction: column; overflow-y: auto; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.side-logo { max-height: 28px; max-width: 110px; }
.side-name { font-weight: 700; font-size: 16px; color: var(--primary-text); }
.new-ticket { margin: 4px 12px 10px; }
.side-views { padding: 4px 8px; }
.side-view { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; color: var(--text-main); }
.side-view:hover { background: var(--bg-soft); }
.side-view.active { background: var(--primary-light); color: var(--primary-text); font-weight: 600; }
.side-view .cnt { margin-left: auto; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.side-view .unr { background: var(--primary); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.side-view .del { display: none; margin-left: 4px; color: var(--text-muted); font-size: 12px; }
.side-view:hover .del { display: inline; }
.side-view .del:hover { color: var(--primary-text); }
.side-view.add-view { color: var(--text-muted); font-size: 12px; }
.side-view.add-view:hover { color: var(--primary-text); }
.side-section { padding: 6px 8px; margin-top: 8px; border-top: 1px solid var(--border-light); }
.side-section h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 10px 10px 6px; }
.side-link { display: block; width: 100%; text-align: left; padding: 7px 10px; border: none; background: none; border-radius: 8px; cursor: pointer; font-size: 13px; }
.side-link:hover { background: var(--bg-soft); }
.side-link.active { background: var(--primary-light); color: var(--primary-text); }
.side-foot { margin-top: auto; padding: 10px 14px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border-light); }
.side-foot .mail-ok { color: var(--ok); }
.side-foot .mail-err { color: var(--danger); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: var(--bg-panel); border-bottom: 1px solid var(--border-light); }
.hamburger { display: none; border: none; background: none; font-size: 20px; cursor: pointer; }
.search-wrap { flex: 1; max-width: 640px; }
.search-wrap input { width: 100%; padding: 9px 12px; border: 1px solid var(--border-dark); border-radius: 8px; background: var(--bg-body); }
.search-wrap input:focus { outline: none; border-color: var(--primary); background: var(--bg-panel); }
.timer-chip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; background: var(--primary-light); color: var(--primary-text); border: 1px solid var(--primary-border); font-weight: 600; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.timer-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.views { flex: 1; overflow: auto; }
.view-pad { padding: 16px 20px; max-width: 1400px; }

.dropdown-container { position: relative; margin-left: auto; }
.user-menu-btn { width: 38px; height: 38px; border: 1px solid var(--border-light); border-radius: 50%; background: var(--bg-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dropdown-menu { display: none; position: absolute; top: 44px; right: 0; background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 10px; min-width: 230px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 40; padding: 6px; }
.dropdown-menu.show { display: block; }
.dropdown-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: 6px; cursor: pointer; font-size: 13px; }
.dropdown-menu button:hover { background: var(--bg-soft); }
.dropdown-menu button.danger { color: var(--danger); }
.user-info { padding: 8px 10px 10px; border-bottom: 1px solid var(--border-light); margin-bottom: 4px; font-size: 13px; }
.user-info small { display: block; color: var(--text-muted); }

/* ---------- elenco ticket ---------- */
.list-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.list-head h1 { font-size: 20px; margin-right: 6px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filters select { padding: 6px 8px; border: 1px solid var(--border-dark); border-radius: 8px; background: var(--bg-panel); font-size: 12px; max-width: 170px; }
.tlist { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-panel); border: 1px solid var(--border-light); border-radius: 12px; overflow: hidden; }
.tlist th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 9px 10px; background: var(--bg-soft); border-bottom: 1px solid var(--border-light); font-weight: 600; white-space: nowrap; }
.tlist td { padding: 9px 10px; border-bottom: 1px solid var(--border-light); vertical-align: middle; font-size: 13px; }
.tlist tr:last-child td { border-bottom: none; }
.tlist tbody tr { cursor: pointer; }
.tlist tbody tr:hover td { background: var(--bg-soft); }
.tlist tr.unread .subj { font-weight: 700; }
.tlist .subj { display: block; max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlist .sub2 { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.tlist .num { font-family: Consolas, monospace; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.prio { display: inline-block; width: 4px; height: 30px; border-radius: 2px; background: transparent; }
.prio-urgent { background: var(--danger); } .prio-high { background: var(--primary); } .prio-low { background: var(--border-dark); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.empty { padding: 40px; text-align: center; color: var(--text-muted); background: var(--bg-panel); border: 1px dashed var(--border-dark); border-radius: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--secondary); color: var(--secondary-text); }
.st-new { background: var(--info-light); color: var(--info); }
.st-open { background: var(--primary-light); color: var(--primary-text); }
.st-pending, .st-waiting { background: var(--warn-light); color: var(--warn); }
.st-closed { background: var(--ok-light); color: var(--ok); }
.st-merged { background: var(--secondary); color: var(--text-muted); }
.lv { background: transparent; border: 1px solid var(--border-dark); color: var(--text-muted); }
.lv-2 { border-color: var(--warn); color: var(--warn); }
.lv-3, .lv-4, .lv-5 { border-color: var(--danger); color: var(--danger); }
.b-triage { background: var(--danger-light); color: var(--danger); }
.b-report { background: var(--warn-light); color: var(--warn); }
.b-msp { background: var(--info-light); color: var(--info); }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 12px; }
.modal-box { background: var(--bg-panel); border-radius: 12px; padding: 18px; width: min(640px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.modal-box.wide { width: min(900px, 100%); }
.modal-box h3 { margin-bottom: 14px; font-size: 17px; }
.modal-box .grid2, .modal-box .field { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(16px); opacity: 0; background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 100; pointer-events: none; transition: .25s; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 14px; border: none; border-radius: 8px; background: var(--bg-panel); border: 1px solid var(--border-light); cursor: pointer; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.score-bar { height: 6px; background: var(--primary); border-radius: 3px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
pre.log-box { background: var(--bg-soft); padding: 10px; border-radius: 8px; font-size: 12px; max-height: 360px; overflow: auto; white-space: pre-wrap; }

@media (max-width: 800px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  .hamburger { display: block; }
  .view-pad, .tk-main { padding: 12px; }
  .tlist .hide-m { display: none; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tlist .subj, .tlist .sub2 { max-width: 60vw; }
}

/* ======================================================================
   NETAssist: componenti specifici (stesso linguaggio visivo della suite)
   ====================================================================== */
a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.ok { background: var(--ok); }
.side-new { margin: 4px 12px 10px; width: calc(100% - 24px); padding: 10px 14px; font-size: 14px; }
.side-link { display: flex; align-items: center; gap: 8px; color: var(--text-main); text-decoration: none; }
.side-link .cnt { margin-left: auto; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.side-link.active { font-weight: 600; }
.topbar .title-mini { font-weight: 600; color: var(--text-muted); }
.stats .card + .card { margin-top: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-muted); font-size: 12px; }
.sess { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.sess + .sess { margin-top: 10px; }
.sess .t { font-weight: 650; font-size: 14px; }
.sess .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-top: 4px; align-items: center; }
.sess .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.code { font-family: Consolas, "Courier New", monospace; font-weight: 700; letter-spacing: .1em; color: var(--text-main); }
.on-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-dark); flex: none; }
.on-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-light); }
.b-ok { background: var(--ok-light); color: var(--ok); }
.b-warn { background: var(--warn-light); color: var(--warn); }
.b-bad { background: var(--danger-light); color: var(--danger); }
.b-info { background: var(--info-light); color: var(--info); }
.b-brand { background: var(--primary-light); color: var(--primary-text); }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--bg-soft); border: 1px dashed var(--border-dark); padding: 8px 10px; border-radius: 8px; font-family: Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.tlist.static tbody tr { cursor: default; }
.tlist .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.sub2s { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.perm-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-grid th, .perm-grid td { padding: 7px 8px; border-bottom: 1px solid var(--border-light); text-align: center; }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; }
.perm-grid .grp td { background: var(--bg-soft); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.err-box { color: var(--danger); background: var(--danger-light); border: 1px solid var(--danger-border); border-radius: 8px; padding: 10px; font-size: 13px; }
.note-box { background: var(--note-bg); border: 1px solid var(--note-border); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.more-sel { padding: 5px 8px; border: 1px solid var(--border-dark); border-radius: 8px; background: var(--bg-panel); font-size: 12px; }
video.rec { width: 100%; max-height: 70vh; background: #000; border-radius: 8px; }
@media (max-width: 800px) {
  .stats { grid-template-columns: 1fr; }
  .sess { grid-template-columns: 1fr; }
  .sess .acts { justify-content: flex-start; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- pagine per il cliente ---------- */
.cust { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
.cust-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.cust-head img { max-height: 40px; }
.cust-head .by { color: var(--text-muted); font-size: 13px; }
.cust h1 { font-size: clamp(24px, 5vw, 30px); line-height: 1.2; margin-bottom: 8px; }
.cust .lead { color: var(--text-muted); font-size: 16px; margin-bottom: 20px; }
.cust .card { padding: 20px; }
.steps { list-style: none; display: grid; gap: 16px; }
.step { display: grid; grid-template-columns: 38px 1fr; gap: 14px; }
.step .num { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-light); color: var(--primary-text); font-weight: 700; }
.step h2 { font-size: 17px; margin: 6px 0 4px; }
.step p { color: var(--text-muted); font-size: 14px; }
.btn.big { padding: 13px 22px; font-size: 16px; font-weight: 600; border-radius: 10px; margin: 12px 0 6px; }
.other { font-size: 13px; color: var(--text-muted); }
.other a { margin-right: 10px; }
.status { display: flex; gap: 12px; align-items: center; margin: 18px 0 4px; padding: 12px 14px; border-radius: 10px; background: var(--warn-light); font-size: 14px; }
.status.ok { background: var(--ok-light); }
.status .pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); flex: none; animation: pulse 1.6s infinite; }
.status.ok .pdot { background: var(--ok); animation: none; }
.cust details { margin-top: 16px; }
.cust summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.cust form.inline { display: grid; gap: 10px; margin-top: 12px; }
.codeinput { font-size: 26px !important; text-transform: uppercase; letter-spacing: .25em; text-align: center; font-family: Consolas, monospace; }
.msg { font-size: 13px; min-height: 1.3em; }
.msg.err { color: var(--danger); } .msg.ok { color: var(--ok); }
.cust-foot { margin-top: 24px; font-size: 13px; color: var(--text-muted); }
.cust-foot p { margin: 4px 0; }
@media (max-width: 520px) { .btn.big { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .status .pdot, .timer-chip::before { animation: none; } }
