/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── CSS Variables ─────────────────────────────────────────────────────── */
:root {
  color-scheme: dark; /* UI nativa del browser (date picker, scrollbar, autofill) */
  --control-h:    38px;
  --control-h-sm: 30px;
  --bg-base:    #1e1e1e;
  --bg-surface: #252526;
  --bg-raised:  #2d2d2d;
  --bg-hover:   #3e3e42;
  --border:     rgba(255,255,255,.08);
  --border-md:  rgba(255,255,255,.14);
  --text-1:     #d4d4d4;
  --text-2:     #9d9d9d;
  --text-3:     #8a8a8a; /* min 4.5:1 su --bg-base (WCAG AA testo piccolo) */
  --accent:        #007acc;
  --accent-dim:    rgba(0,122,204,.15);
  --accent-border: rgba(0,122,204,.4);
  --green:         #4ec9b0;
  --green-dim:     rgba(78,201,176,.15);
  --red:           #f44747;
  --red-dim:       rgba(244,71,71,.15);
  --red-border:    rgba(244,71,71,.4);
  --yellow:     #dcdcaa;
  --cyan:       #9cdcfe;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.6);
  /* Foglio stampabile (verbale di intervento): carta bianca e inchiostro scuro su OGNI skin,
     perché va stampato/esportato in PDF. Unico posto con colori chiari fissi. */
  --paper-bg:      #fff;
  --paper-ink:     #1a1a1a;
  --paper-ink-2:   #444;
  --paper-ink-3:   #888;
  --paper-rule:    #222;
  --paper-line:    #ddd;
  --paper-head-bg: #f2f2f2;
  --paper-field:   #ccc;
  --paper-sign:    #999;
  --paper-shadow:  0 1px 4px rgba(0,0,0,.18);
  /* Tinte fisse usate da componenti specifici (valori invariati, ora centralizzati qui). */
  --on-accent:          #fff;     /* testo/icona su fondo pieno accent/red */
  --shadow-color:       #000;     /* base di ombre e overlay (via color-mix) */
  --amber:              #f59e0b;  /* toast warning, menzioni */
  --offline:            #E24C3B;  /* badge servizio offline */
  --online:             #16a34a;  /* pallino presenza online */
  --danger-strong:      #dc2626;
  --danger-deep:        #b91c1c;
  --rose:               #f43f5e;
  --violet:             #7c6ef7;
  --cyan-500:           #06b6d4;
  --emerald-500:        #10b981;
  --emerald-400:        #34d399;
  --blue-400:           #60a5fa;
  --blue-600:           #2563eb;  /* KPI "In arrivo" in dashboard */
  --red-400:            #f87171;
  --slate-500:          #64748b;
  --mention-on-accent:  #cfe8ff;
  /* sidebar chat operatori (palette propria, fissa su tutte le skin) */
  --chat-bg:            #23272e;
  --chat-muted:         #9aa3af;
  --chat-text:          #b8bfc9;
  --chat-text-2:        #c8cfd7;
  --chat-hint:          #6b7280;
  --chat-input-bg:      #1b1f24;
  --chat-input-border:  #3a4048;
  --chat-input-text:    #e5e9ee;
  /* scontrino (anteprima carta termica) */
  --receipt-ink:        #111;
  --receipt-ink-2:      #555;
  --receipt-ink-4:      #aaa;
  --receipt-rule:       #bbb;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-raised); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ─── Login Page ────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, color-mix(in srgb, var(--violet) 25%, transparent) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%,  color-mix(in srgb, var(--cyan-500) 10%, transparent)   0%, transparent 50%);
}
.login-box {
  width: 100%;
  max-width: 400px;
  padding: 0 20px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-mark {
  display: inline-block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: url('../img/logo.png') center/contain no-repeat;
  margin-bottom: 14px;
}
.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.3px;
}
.login-logo p {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.login-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}
.login-card .login-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 24px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 6px;
}
.form-group .input-wrap {
  position: relative;
}
.form-group .input-wrap .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
}
.form-group input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input::placeholder { color: var(--text-3); }
/* toggle "mostra password" dentro .input-wrap (login) */
.form-group input.has-toggle { padding-right: 38px; }
.form-group .input-wrap .input-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  padding: 0; background: transparent; border: none; border-radius: var(--radius-sm);
  color: var(--text-3); font-size: 13px; cursor: pointer; transition: color .15s, background .15s;
}
.form-group .input-wrap .input-toggle:hover { color: var(--text-1); background: var(--bg-hover); }
.form-group .input-wrap .input-toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-border); }
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 20%, transparent);
}
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--red-dim);
  border: 1px solid color-mix(in srgb, var(--rose) 30%, transparent);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 12px;
  margin-bottom: 16px;
}

/* ─── Controlli HTML nativi ─────────────────────────────────────────────────
   Baseline di skin per ogni elemento di form/testo nativo: nessun controllo
   deve mai rendere con l'aspetto di default del browser. Solo CSS var di skin
   (nessun colore letterale) → valgono su tutte le skin senza override.
   Le regole più specifiche (.form-group input, .filter-bar input/select, …)
   restano vincenti dove già presenti.                                        */

/* Testo, numeri, date, textarea, select nativa.
   `:where(...)` = specificità 0: qualunque regola di classe già presente
   (.form-group input, .filter-bar input/select, .uk-select-search input, …)
   resta vincente indipendentemente dall'ordine nel file.
   Selezione per ESCLUSIONE, non per elenco di `type`: un `<input>` senza
   attributo `type` (default text) o con `type` interpolato a runtime
   (`ng-attr-type`) non matcherebbe `input[type="text"]` e resterebbe nudo. */
:where(textarea,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]):not([type="hidden"]),
select) {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
/* controlli a riga singola: altezza fissa e uniforme (vedi CLAUDE.md, "Altezza controlli form") */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]):not([type="hidden"]),
select) {
  height: var(--control-h);
  padding-top: 0;
  padding-bottom: 0;
}
:where(textarea) {
  resize: vertical;
  min-height: 80px;
  display: block;
}
:where(select) {
  cursor: pointer;
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
:where(select) option, :where(select) optgroup { background: var(--bg-raised); color: var(--text-1); }
:where(textarea, input)::placeholder { color: var(--text-3); }
:where(textarea, select,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="reset"]):not([type="button"]):not([type="image"]):not([type="hidden"])):focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
:where(input, textarea, select):disabled {
  opacity: .55;
  cursor: not-allowed;
}
:where(input:read-only:not([type="checkbox"]):not([type="radio"]), textarea[readonly]) {
  color: var(--text-2);
  background: var(--bg-surface);
}
/* icone native dei picker (date/time/search) leggibili su fondo scuro */
::-webkit-calendar-picker-indicator,
::-webkit-search-cancel-button { filter: invert(.7); cursor: pointer; }
/* autofill: il browser forzerebbe un fondo bianco */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-1);
  caret-color: var(--text-1);
  box-shadow: 0 0 0 1000px var(--bg-raised) inset;
  transition: background-color 9999s ease-out 0s;
}

/* Checkbox e radio — riga .form-check (label cliccabile a fianco) */
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.form-check label {
  display: inline;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-1);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.form-check-group { display: flex; flex-direction: column; gap: 2px; }
.form-check-inline { flex-direction: row; flex-wrap: wrap; gap: 16px; }

/* Range */
input[type="range"] {
  width: 100%;
  height: 4px;
  padding: 0;
  border: none;
  border-radius: 99px;
  background: var(--bg-hover);
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--bg-surface);
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* File */
input[type="file"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px dashed var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 6px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent-border); color: var(--accent); }

/* Color */
input[type="color"] {
  width: 44px;
  height: 32px;
  padding: 2px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Fieldset / legend (raggruppamento campi) */
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}
legend {
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .7px;
}

/* Button nativo: eredita il font, resta a .btn/.btn-* la parte visiva */
button, input[type="submit"], input[type="reset"] {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}
button:disabled, input[type="submit"]:disabled { cursor: not-allowed; }

/* Progress / meter */
progress, meter {
  width: 100%;
  height: 6px;
  border: none;
  border-radius: 99px;
  background: var(--bg-hover);
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--bg-hover); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

/* Details / summary (accordion nativo) */
details {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
}
summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 8px;
  color: var(--text-3);
  transition: transform .15s;
}
details[open] > summary::before { transform: rotate(90deg); }

/* Separatore */
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Codice / testo monospazio */
.mono, code, kbd, samp, pre { font-family: 'Consolas', 'Courier New', monospace; }
code, kbd, samp {
  padding: 1px 5px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--cyan);
  font-size: 12px;
}
pre {
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
}
pre code { padding: 0; border: none; background: none; color: inherit; font-size: inherit; }
/* editor JSON (pagina di test API): textarea monospazio */
.json-editor {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
}
.json-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Immagini */
img { max-width: 100%; height: auto; display: block; }

/* Testo libero (.prose): l'unico posto dove usare p/ul/ol/a/blockquote nudi */
.prose { color: var(--text-1); font-size: 13px; line-height: 1.6; }
.prose p { margin-bottom: 10px; }
.prose ul, .prose ol { padding-left: 20px; margin-bottom: 10px; }
.prose li { margin-bottom: 4px; }
.prose a, a.link { color: var(--accent); text-decoration: none; }
.prose a:hover, a.link:hover { text-decoration: underline; }
.prose blockquote {
  padding: 8px 14px;
  border-left: 3px solid var(--accent-border);
  background: var(--accent-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
  margin-bottom: 10px;
}
.prose h3, .prose h4 { color: var(--text-1); margin-bottom: 6px; }
.prose small, small { font-size: 11px; color: var(--text-3); }
/* testo secondario (note, placeholder di contenuto): evita `style="color:…"` */
.muted { color: var(--text-2); }
.muted-2 { color: var(--text-3); }
mark { background: var(--accent-dim); color: var(--text-1); padding: 0 3px; border-radius: 3px; }
abbr[title] { text-decoration: underline dotted var(--text-3); cursor: help; }

/* ─── App Layout ────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.main-area > div:last-child {
  flex: 1;
  overflow-y: auto;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--accent);
}
.sidebar-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -.2px;
}
.sidebar-brand-sub {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.sidebar-nav { flex: 1; padding: 10px 8px; }
.sidebar-nav-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 8px 4px;
}
.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, color .12s;
  margin-bottom: 1px;
}
.sidebar-nav a:hover { background: var(--bg-raised); color: var(--text-1); }
.sidebar-nav a.active { background: var(--accent-dim); color: var(--accent); }
.sidebar-nav a .nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 8px;
}
.sidebar-user { border-radius: var(--radius-sm); position: relative; }
.sidebar-user-clickable {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sidebar-user-clickable:hover { background: var(--bg-hover); }
.status-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 25%, transparent);
  padding: 4px;
  z-index: 50;
}
.status-popup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.status-popup-item:hover { background: var(--bg-hover); color: var(--text-1); }
.status-popup-item.active { color: var(--accent); font-weight: 600; background: var(--accent-dim); }
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid color-mix(in srgb, var(--violet) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  position: relative;
}
.status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; flex: 0 0 9px;
  border: 1.5px solid var(--bg-raised);
}
.sidebar-avatar .status-dot { position: absolute; right: -2px; bottom: -2px; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 10px; color: var(--text-3); }
.sidebar-user-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.rating-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  border: 1px solid transparent;
}
.rating-badge i { font-size: 9px; }
.rating-good { background: var(--green-dim); color: var(--green); border-color: color-mix(in srgb, var(--emerald-500) 40%, transparent); }
.rating-warn { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-border); }
.sidebar-version {
  text-align: center;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.rating-bad  { background: var(--red-dim); color: var(--red); border-color: var(--red-border); }

/* ─── Main content ──────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 52px;
  min-height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
/* Barra ridotta quando il servizio è montato in Uakari.Suite.Services: la topbar del portale sta
   già sopra, qui restano i soli pulsanti chat e changelog. Bassa, senza fondo e allineata a destra
   per non sembrare una seconda barra di navigazione. Questa regola vale solo in embedded, dove la
   shell inietta il nostro css/app.css (elencato in manifest.Styles). */
.topbar-embedded {
  height: 36px;
  min-height: 36px;
  background: transparent;
  border-bottom: none;
  justify-content: flex-end;
  padding: 0 8px;
  gap: 8px;
}
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
}
/* Senza titolo: il primo badge spinge sé stesso e il bottone Esci a destra */
.topbar-badge-first { margin-left: auto; }
.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--green-dim);
  border: 1px solid color-mix(in srgb, var(--emerald-500) 25%, transparent);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}
.topbar-badge.is-offline {
  background: color-mix(in srgb, var(--offline) 12%, transparent);
  border-color: color-mix(in srgb, var(--offline) 30%, transparent);
  color: var(--offline);
}
.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--red-dim);
  border: 1px solid color-mix(in srgb, var(--rose) 25%, transparent);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.topbar-btn:hover { background: color-mix(in srgb, var(--rose) 25%, transparent); }
.topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.topbar-icon-btn:hover { background: var(--bg-surface); color: var(--text-1); }
.topbar-icon-btn.active { color: var(--accent); }

/* Selettore globale owner (Sferas/Uakari). Evidenziato quando filtra, per non dimenticarlo acceso. */
.topbar-owner { display: block; width: 120px; }
.topbar-owner .uk-select-toggle {
  height: 32px;
  padding: 0 8px;
  border-color: var(--border);
  font-size: 12px;
  font-weight: 600;
}
.topbar-owner.is-active .uk-select-toggle {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ─── Page header ───────────────────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 700; color: var(--text-1); letter-spacing: -.3px; }
.page-header p  { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ─── Filter bar ────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.filter-bar label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-right: -4px;
}
.filter-bar input,
.filter-bar select {
  padding: 6px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 12px;
  font-family: inherit;
}
.filter-bar input:focus,
.filter-bar select:focus { outline: none; border-color: var(--accent); }
.filter-bar select option { background: var(--bg-raised); }
.filter-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-vdivider {
  width: 1px;
  height: 22px;
  background: var(--border-md);
  flex-shrink: 0;
}
.filter-periods {
  display: flex;
  gap: 6px;
}
.filter-periods .chip { font-size: 11px; padding: 3px 12px; min-width: 88px; flex: 1; text-align: center; }
.filter-reload-chip { padding: 2px 7px; }
.filter-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.filter-shops-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.filter-shops-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-right: 2px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
/* slot <uk-card-actions>: azioni a destra del titolo; vuoto = nessuno spazio occupato */
.card-header-actions, .card-header-actions uk-card-actions { display: flex; align-items: center; gap: 6px; }
.card-header-actions { margin-left: auto; margin-right: 8px; }
.card-header-actions:empty { display: none; }
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.card-subtitle { font-size: 11px; color: var(--text-3); margin-top: 2px; }
/* card chiusa: l'header è l'unico figlio (ng-if toglie il contenuto), niente spazio vuoto sotto il titolo */
.card-header:last-child { margin-bottom: 0; }
.card-header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.card-header.collapsible { cursor: pointer; user-select: none; }
.card-header.collapsible .fa-chevron-right,
.card-header.collapsible .fa-chevron-down { color: var(--text-3); font-size: 12px; }

/* ─── KPI Grid ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s;
}
.kpi-card:hover { border-color: var(--border-md); }
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-accent, var(--accent));
  opacity: .7;
}
.kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
  letter-spacing: -.5px;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 99px;
}
.kpi-delta.positive { background: var(--green-dim); color: var(--green); }
.kpi-delta.negative { background: var(--red-dim);   color: var(--red); }

/* ─── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border-md);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 9px 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-raised); color: var(--text-1); }
.data-table tfoot td {
  padding: 9px 12px;
  color: var(--text-1);
  border-top: 1px solid var(--border-md);
}
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .mono { font-family: 'Consolas', monospace; font-size: 11px; }

.activity-type-badge { display: inline-flex; align-items: center; gap: 8px; }
.activity-type-icon {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}

/* ─── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-yellow { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--yellow); }

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity .12s, filter .12s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary  { background: var(--accent);    color: var(--on-accent); width: 100%; justify-content: center; padding: 11px; font-size: 13px; }
.btn-secondary{ background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.btn-danger   { background: var(--red); color: var(--on-accent); }
.btn-danger:hover { opacity: .88; }
.btn-ghost    { background: transparent; color: var(--text-2); border: 1px solid var(--border-md); }
.btn-ghost:hover { background: var(--bg-raised); color: var(--text-1); }

/* ─── Alerts (uk-alert) ─────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 14px;
}
.alert-error   { background: var(--red-dim); border: 1px solid var(--red-border); color: var(--red); }
.alert-info    { background: var(--accent-dim); border: 1px solid var(--accent-border); color: var(--accent); }
.alert-warning { background: color-mix(in srgb, var(--yellow) 12%, transparent); border: 1px solid color-mix(in srgb, var(--yellow) 35%, transparent); color: var(--yellow); }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.uk-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.uk-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-md);
  background: var(--bg-raised);
  color: var(--text-1);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
  animation: uk-toast-in .18s ease-out;
}
.uk-toast-icon  { margin-top: 1px; flex: 0 0 auto; }
.uk-toast-msg   { flex: 1 1 auto; }
.uk-toast-close { flex: 0 0 auto; margin-top: 1px; opacity: .5; font-size: 12px; }
.uk-toast:hover .uk-toast-close { opacity: 1; }
.uk-toast-error   { border-color: var(--red-border); }
.uk-toast-error   .uk-toast-icon { color: var(--red); }
.uk-toast-success { border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.uk-toast-success .uk-toast-icon { color: var(--green); }
.uk-toast-warning { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.uk-toast-warning .uk-toast-icon { color: var(--amber); }
.uk-toast-info    { border-color: var(--accent-border); }
.uk-toast-info    .uk-toast-icon { color: var(--accent); }
@keyframes uk-toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (max-width: 640px) {
  .uk-toast-stack { left: 16px; right: 16px; max-width: none; }
}

/* ─── Loading / Empty ───────────────────────────────────────────────────── */
.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 13px;
  gap: 8px;
}
.state-box .state-icon { font-size: 28px; opacity: .35; }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── User profile card ─────────────────────────────────────────────────── */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid color-mix(in srgb, var(--violet) 35%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.profile-name  { font-size: 16px; font-weight: 700; color: var(--text-1); }
.profile-email { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.profile-meta  { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Positive / Negative ───────────────────────────────────────────────── */
.positive { color: var(--green); }
.negative { color: var(--red); }

/* ─── Chart wrap ────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; height: 220px; }

/* ─── Section grid (table + chart side by side) ─────────────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 768px) {
  .section-grid { grid-template-columns: 1fr; }
}

/* ─── Filter chips ──────────────────────────────────────────────────────── */
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chip {
  padding: 4px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-md);
  background: var(--bg-surface);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--bg-raised); color: var(--text-1); }
.chip.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* ─── Clickable table row ───────────────────────────────────────────────── */
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--bg-raised); }

/* ─── Receipt row type colours ──────────────────────────────────────────── */
.row-payment td { color: var(--text-2); font-style: italic; }
.row-vat     td { color: var(--text-3); font-size: 12px; }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--shadow-color) 60%, transparent);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color .12s, background .12s;
}
.modal-close:hover { color: var(--text-1); background: var(--bg-raised); }
.changelog-empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 20px 0; }
.changelog-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.changelog-entry:last-child { border-bottom: none; }
.changelog-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.changelog-version { font-size: 12px; font-weight: 700; color: var(--accent); }
.changelog-date { font-size: 11px; color: var(--text-3); }
.changelog-audience { margin-right: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 999px; color: var(--text-2); background: var(--border-md); }
.changelog-message { font-size: 13px; color: var(--text-1); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
/* Tendina uk-select aperta in un modale: il pannello (position:absolute) non va tagliato dallo scroll del corpo. */
.modal-box:has(.uk-select.open),
.modal-box:has(.uk-select.open) .modal-body { overflow: visible; }

/* ─── Modale rapporto giornaliero (tickets.view) ─────────────────────────── */
.dr-box { max-width: 520px; }
.form-grid.dr-form { grid-template-columns: 1fr; } /* .form-grid è definita più in basso: serve la specificità doppia */
.dr-form .dr-count { font-size: 13px; color: var(--text-1); text-transform: none; letter-spacing: 0; }
.dr-form textarea { min-height: 8em; }
.dr-form small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ─── Verbale di intervento: modale + foglio stampabile (ticket-detail.view) ── */
.report-overlay { align-items: flex-start; overflow: auto; }
.report-box { max-width: 960px; max-height: calc(100vh - 40px); margin: auto; }
.report-head { flex-wrap: wrap; gap: 8px; position: sticky; top: 0; background: var(--bg-surface); }
.report-head-actions { display: flex; align-items: center; gap: 6px; }
.report-send { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; }
.report-send input { flex: 1; min-width: 180px; }

.report-sheet { background: var(--paper-bg); color: var(--paper-ink); max-width: 900px; margin: 0 auto;
                padding: 28px 32px; border-radius: 8px; box-shadow: var(--paper-shadow); }
.report-sheet .rs-brand { text-align: right; font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.report-sheet .rs-brand em { font-style: normal; color: var(--accent); }
.report-sheet .rs-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
                          color: var(--paper-ink-2); margin: 18px 0 6px; border-bottom: 1px solid var(--paper-line); padding-bottom: 4px; }
.report-sheet hr { border: none; border-top: 2px solid var(--paper-rule); margin: 10px 0 18px; }
.report-sheet .rs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 24px; }
.report-sheet .rs-grid > div { display: flex; flex-direction: column; gap: 1px; }
.report-sheet .rs-grid label { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; color: var(--paper-ink-3); }
.report-sheet .rs-grid span  { font-size: 13px; color: var(--paper-ink); }
.report-sheet .rs-desc { white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
.report-sheet table.rs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-sheet table.rs-table th { text-align: left; background: var(--paper-head-bg); color: var(--paper-ink-2); font-weight: 600;
                                  padding: 6px 8px; border: 1px solid var(--paper-line); }
.report-sheet table.rs-table td { padding: 6px 8px; border: 1px solid var(--paper-line); vertical-align: top; }
/* Campi editabili del verbale: sul foglio bianco, non con la baseline scura della skin */
.report-sheet input, .report-sheet textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 12px; color: var(--paper-ink);
  background: var(--paper-bg); border: 1px solid var(--paper-field); border-radius: 4px; padding: 5px 7px; }
.report-sheet textarea { resize: vertical; min-height: 46px; }
.report-sheet table.rs-form { width: 100%; border-collapse: collapse; font-size: 11px; }
.report-sheet table.rs-form th { background: var(--paper-head-bg); color: var(--paper-ink-2); font-weight: 600; text-align: center;
                                 padding: 4px 5px; border: 1px solid var(--paper-line); font-size: 10px; text-transform: uppercase; }
.report-sheet table.rs-form td { padding: 4px; border: 1px solid var(--paper-line); }
.report-sheet .rs-total { text-align: right; font-weight: 700; font-size: 13px; margin-top: 8px; }
.report-sheet .rs-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 6px; }
.report-sheet .rs-signs .rs-sign-label { font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.report-sheet .rs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.report-sheet .rs-logo { max-height: 64px; max-width: 220px; }
/* stesse classi anche in DOC_CSS di verbale-html.service.js (HTML email standalone) */
.report-sheet .rs-empty { color: var(--paper-ink-3); font-size: 12px; }
.report-sheet .rs-w-10 { width: 10%; }
.report-sheet .rs-w-15 { width: 15%; }
.report-sheet .rs-w-18 { width: 18%; }
.report-sheet .rs-mt { margin-top: 8px; }

/* uk-signature (firma su canvas) */
.uk-sign { display: block; }
.uk-sign-canvas { width: 100%; height: 120px; border: 1px solid var(--paper-sign); border-radius: 4px;
                  background: var(--paper-bg); touch-action: none; display: block; cursor: crosshair; }
.uk-sign-actions { margin-top: 4px; }

@media (max-width: 640px) {
  .report-overlay { padding: 0; }
  .report-box { max-width: none; min-height: 100vh; max-height: none; border-radius: 0; }
  .report-sheet { padding: 16px; }
  .report-sheet .rs-grid { grid-template-columns: 1fr; }
  .report-sheet .rs-signs { grid-template-columns: 1fr; }
  .report-sheet table.rs-form { display: block; overflow-x: auto; white-space: nowrap; }
  .report-sheet .rs-head { flex-direction: column; align-items: center; }
  .report-sheet .rs-brand { text-align: center; }
}
@media print {
  body * { visibility: hidden !important; }
  .report-sheet, .report-sheet * { visibility: visible !important; }
  .report-overlay, .report-box, .report-body {
    position: static !important; overflow: visible !important; background: none !important; border: none !important;
    box-shadow: none !important; max-height: none !important; padding: 0 !important; display: block !important; }
  .report-head { display: none !important; }
  .report-sheet { position: absolute; top: 0; left: 0; width: 100%; max-width: none;
                  box-shadow: none; border-radius: 0; padding: 0; }
  .no-print, .uk-sign-actions { display: none !important; }
  /* In stampa i campi diventano linee, niente box */
  .report-sheet input, .report-sheet textarea { border: none; border-bottom: 1px solid var(--paper-sign); border-radius: 0; padding: 2px 0; }
  .report-sheet input::placeholder, .report-sheet textarea::placeholder { color: transparent !important; opacity: 0 !important; }
  .uk-sign-canvas { border: 1px solid var(--paper-field); }
}

/* ─── Confirm dialog ─────────────────────────────────────────────────────── */
.confirm-box { max-width: 420px; }
.confirm-title { font-weight: 600; font-size: 15px; color: var(--text-1); }
.confirm-message { padding: 16px 20px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); }
.confirm-actions .btn { width: auto; }

/* ─── Blocco rapporto giornaliero (login gate) ───────────────────────────── */
.drb-overlay { z-index: 2000; } /* sopra chat/confirm: blocco non dismissibile */
.drb-box { max-width: 460px; padding: 20px; gap: 12px; display: flex; flex-direction: column; }
.drb-msg { color: var(--text-2); font-size: 14px; line-height: 1.5; margin: 0; }
.drb-msg-sm { color: var(--text-3); font-size: 12px; margin: 0 0 6px; }
.drb-notes { width: 100%; resize: vertical; }
.drb-exemption { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.drb-pending { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
/* .btn-danger: definizione unica nella sezione bottoni (era duplicata qui con stessa
   specificità: vinceva questa e la variante "dim" non veniva mai resa). */

/* Skin Uakari: definita SOLO in skin-uakari.css (Ember Ledger). Il vecchio blocco
   chiaro "VS Code" che viveva qui è stato rimosso: caricato prima di skin-uakari.css
   perdeva quasi tutte le proprietà ma lasciava trapelare quelle non ridefinite
   (es. ombre light su tema scuro). */

/* ─── Skin: Gray ────────────────────────────────────────────────────────── */
body.skin-gray {
  --bg-base:    #c8c8c8;
  --bg-surface: #d8d8d8;
  --bg-raised:  #e4e4e4;
  --bg-hover:   #bebebe;
  --border:     rgba(0,0,0,.13);
  --border-md:  rgba(0,0,0,.22);
  --text-1:     #1a1a1a;
  --text-2:     #3a3a3a;
  --text-3:     #707070;
  --accent:        #444444;
  --accent-dim:    rgba(68,68,68,.12);
  --accent-border: rgba(68,68,68,.35);
  --green:      #3a7c5a;
  --green-dim:  rgba(58,124,90,.12);
  --red:        #b03030;
  --red-dim:    rgba(176,48,48,.12);
  --red-border: rgba(176,48,48,.35);
  --yellow:     #8a6a00;
  --cyan:       #206080;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.12);
  --shadow-md:  0 4px 16px rgba(0,0,0,.15);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.22);
  background: var(--bg-base);
  color: var(--text-1);
}

/* ─── Skin switcher ─────────────────────────────────────────────────────── */
.skin-switcher {
  display: flex;
  gap: 6px;
  padding: 8px 10px 0;
}
/* login: switcher fisso in basso a destra, sopra la safe-area dei device con notch */
.skin-switcher.skin-switcher-login { position: fixed; bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 10px)); right: 18px; }
.sidebar-brand-mark img { width: 22px; height: 22px; object-fit: contain; display: inline; }
.topbar-badge-dot { font-size: 7px; }
.skin-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-md);
  background: var(--bg-raised);
  color: var(--text-3);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, color .12s, border-color .12s;
}
.skin-btn:hover { color: var(--text-1); background: var(--bg-hover); }
.skin-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
@media (max-width: 768px) {
  .skin-btn { min-height: 44px; min-width: 44px; padding: 10px 14px; font-size: 14px; }
}

/* Hamburger + sidebar-overlay rimossi: la nav mobile è la .bottom-nav. */

/* ─── Bottom Nav ────────────────────────────────────────────────────────── */
.bottom-nav { display: none; }

/* ─── Mobile responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }

  .content { padding: 12px; padding-bottom: 72px; }

  .topbar { padding: 0 12px; gap: 8px; }

  .topbar-badge { display: none; }

  .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .kpi-value { font-size: 18px; }

  .kpi-card { padding: 12px 14px; }

  .filter-bar { padding: 10px 12px; gap: 8px; }

  .filter-top-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-vdivider { display: none; }

  .filter-periods { width: 100%; }
  .filter-date-row { width: 100%; flex-wrap: wrap; }
  .filter-date-row input[type="date"] { flex: 1; min-width: 0; }
  .filter-apply-btn { width: 100%; justify-content: center; }

  .filter-periods .chip { padding: 10px 8px; font-size: 13px; min-height: 44px; min-width: 0; }
  .filter-shops-row .chip { min-height: 44px; padding: 10px 14px; }
  .filter-reload-chip { min-height: 44px; min-width: 44px; padding: 10px; }
  .filter-bar input[type="date"] { min-height: 44px; font-size: 16px; }

  .card { padding: 14px; }

  .page-header { margin-bottom: 14px; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-md);
    z-index: 300;
    justify-content: space-around;
    align-items: stretch;
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    transition: color .12s;
    padding: 8px 2px;
  }
  .bottom-nav a i { font-size: 18px; }
  .bottom-nav a.active { color: var(--accent); }
  /* Badge non lette (Email) sull'icona della barra mobile. */
  .bottom-nav a { position: relative; }
  .bottom-nav a .chat-badge { top: 2px; right: calc(50% - 22px); }
  .bottom-nav a:hover { color: var(--text-1); }
}

/* ─── Corrispettivi — KPI grid (webapp style) ───────────────────────────── */
.ck-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-bottom:20px; }
@media (max-width:600px) {
  .ck-grid { grid-template-columns:1fr 1fr; }
  .ck-grid .ck:last-child { grid-column:1/-1; }
}
.ck-grid.ck-grid-2 { grid-template-columns:1fr 1fr; }
@media (max-width:600px) {
  .ck-grid.ck-grid-2 { grid-template-columns:1fr; }
  .ck-grid.ck-grid-2 .ck:last-child { grid-column:auto; }
}
.ck { background:var(--bg-surface); border:1px solid var(--border); border-radius:13px; padding:12px 13px; }
.ck.full { grid-column:1/-1; background:color-mix(in srgb, var(--blue-400) 12%, transparent); border-color:color-mix(in srgb, var(--blue-400) 40%, transparent); }
.ck.t    { background:color-mix(in srgb, var(--emerald-400) 7%, transparent);  border-color:color-mix(in srgb, var(--emerald-400) 30%, transparent); }
.ck.b    { background:color-mix(in srgb, var(--amber) 7%, transparent);  border-color:color-mix(in srgb, var(--amber) 30%, transparent); }
.ck.r    { background:color-mix(in srgb, var(--red-400) 7%, transparent); border-color:color-mix(in srgb, var(--red-400) 30%, transparent); }
.ck-l { font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--text-3); margin-bottom:4px; }
.ck-v { font-size:20px; font-weight:700; color:var(--text-1); line-height:1.1; }
.ck-s { font-size:10px; color:var(--text-3); margin-top:3px; }
.ck-d { display:inline-flex; font-size:10px; font-weight:700; padding:2px 7px; border-radius:99px; margin-top:4px; }
.ck-d.up { color:var(--green); background:var(--green-dim); }
.ck-d.dn { color:var(--red);   background:var(--red-dim); }

/* ─── Corrispettivi — section label ─────────────────────────────────────── */
.stl { font-size:11px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:.8px; padding:9px 0 3px; }
.sc-search {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.sc-search:focus { outline: none; border-color: var(--accent); }

/* ─── Scontrini — receipt cards ─────────────────────────────────────────── */
.sct { background:var(--bg-surface); border:1px solid var(--border); border-radius:13px; margin-bottom:7px; overflow:hidden; }
.sct-hd { display:flex; align-items:center; gap:8px; padding:11px 13px; cursor:pointer; }
.sct-hd:hover { background:var(--bg-raised); }
.sc-section-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.6px; color:var(--text-3); margin-bottom:6px; }

/* ─── Scontrini — receipt preview overlay ────────────────────────────────── */
.rcpt-ov { position:fixed; inset:0; z-index:2000; background:color-mix(in srgb, var(--shadow-color) 75%, transparent); display:none; align-items:flex-end; justify-content:center; }
.rcpt-ov.on { display:flex; }
.rcpt-sh { width:100%; max-width:430px; max-height:93vh; background:var(--bg-surface); border-radius:22px 22px 0 0; display:flex; flex-direction:column; overflow:hidden; }
.rcpt-tb { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border-bottom:1px solid var(--border); flex-shrink:0; }
.rcpt-sc { overflow-y:auto; padding:16px 14px 28px; flex:1; }
.rcpt-btn-c { height:34px; padding:0 14px; border-radius:8px; font-size:12px; font-weight:700; cursor:pointer; border:none; background:var(--bg-raised); color:var(--text-2); }
.receipt { background:var(--paper-bg); color:var(--receipt-ink); font-family:'Courier New',Courier,monospace; font-size:12px; padding:20px 16px; border-radius:4px; max-width:300px; margin:0 auto; box-shadow:0 4px 28px color-mix(in srgb, var(--shadow-color) 25%, transparent); }
.r-biz { text-align:center; font-size:13px; font-weight:700; text-transform:uppercase; }
.r-addr { text-align:center; font-size:10px; color:var(--receipt-ink-2); line-height:1.5; margin-top:2px; }
.r-div { border-top:1px dashed var(--receipt-rule); margin:8px 0; }
.r-div2 { border-top:2px solid var(--receipt-ink); margin:8px 0; }
.r-c { text-align:center; }
.r-meta { display:flex; justify-content:space-between; font-size:10px; color:var(--receipt-ink-2); margin:2px 0; }
.r-tbl { width:100%; border-collapse:collapse; margin:6px 0; }
.r-tbl th { font-size:9px; text-transform:uppercase; color:var(--paper-ink-3); padding:2px 0; border-bottom:1px solid var(--paper-line); font-weight:600; background:transparent; }
.r-tbl td { font-size:11px; padding:3px 0; vertical-align:top; background:transparent; color:var(--receipt-ink); }
.r-isub td { font-size:9px; color:var(--receipt-ink-4); padding:0 0 3px 8px; }
.r-sub { width:100%; font-size:11px; }
.r-sub td { padding:2px 0; }
.r-sub .v { text-align:right; font-weight:600; }
.r-tot { display:flex; justify-content:space-between; align-items:baseline; margin:7px 0 4px; }
.r-tot-l { font-size:13px; font-weight:700; text-transform:uppercase; }
.r-tot-v { font-size:20px; font-weight:700; }
.r-pay { display:flex; justify-content:space-between; font-size:12px; margin:3px 0; }
.r-iva { width:100%; border-collapse:collapse; font-size:10px; margin:4px 0; }
.r-iva th { font-size:9px; text-transform:uppercase; color:var(--paper-ink-3); padding:2px 0; border-bottom:1px solid var(--paper-line); font-weight:600; }
.r-iva td { padding:2px 0; color:var(--receipt-ink-2); }
.r-iva .r { text-align:right; }
.r-bc { text-align:center; font-size:7px; letter-spacing:2px; margin:6px 0 2px; color:var(--receipt-ink-2); }
.r-ft { text-align:center; font-size:9px; color:var(--paper-sign); line-height:1.6; margin-top:4px; }

/* ─── Corrispettivi — payment list rows ─────────────────────────────────── */
.pr { display:flex; align-items:center; gap:9px; padding:8px 0; border-bottom:1px solid var(--border); }
.pr:last-child { border:none; }
.pi { width:30px; height:30px; border-radius:8px; display:flex; align-items:center; justify-content:center; font-size:14px; flex-shrink:0; }
.pb { flex:1; height:3px; background:var(--bg-raised); border-radius:2px; overflow:hidden; }
.pb-f { height:100%; border-radius:2px; }

/* ─── Articoli — filter pills + ranking rows ───────────────────────────── */
.art-pill {
  display:inline-flex; align-items:center; gap:6px;
  padding:7px 14px; font-size:12px; font-weight:600;
  background:var(--bg-surface); color:var(--text-2);
  border:1px solid var(--border); border-radius:99px;
  cursor:pointer; transition:background .15s,color .15s,border-color .15s;
}
.art-pill:hover { background:var(--bg-raised); color:var(--text-1); }
.art-pill.active { background:var(--accent); color:var(--on-accent); border-color:var(--accent); }
.art-pill i { font-size:11px; }

.art-row { display:flex; align-items:center; gap:10px; padding:10px 12px; }
.art-rank {
  width:24px; height:24px; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; color:var(--on-accent);
  flex-shrink:0;
}

/* ── Tickets: layout dettaglio / form / azioni ───────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 720px) { .detail-grid { grid-template-columns: repeat(2, 1fr); } }
.detail-grid > div { display: flex; flex-direction: column; gap: 3px; }
.detail-grid label,
.detail-desc label,
.form-grid label > span,
.form-grid > label,
.form-grid > div > label {
  font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
}
.detail-grid span { font-size: 13px; color: var(--text-1); }
.detail-desc { margin-bottom: 14px; min-width: 0; }
.detail-desc p { margin: 4px 0 0; font-size: 13px; color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Card affiancate (dettaglio ticket): stessa altezza per riga; a colonna sotto i 720px. */
.detail-cards-row { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.detail-cards-row > uk-card { display: flex; flex: 1 1 320px; min-width: 0; }
.detail-cards-row > uk-card > .card { flex: 1; width: 100%; }
/* In mezza larghezza la griglia meta sta su 2 colonne, non 4. */
.detail-cards-row .detail-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 0; }
/* Card "Contratti attivi": un blocco per contratto, separati da una riga. */
.contract-item + .contract-item { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Scheda cliente (dettaglio ticket): icon-led, leggibile. */
.customer-card { display: flex; flex-direction: column; gap: 12px; }
.customer-card .cc-head { display: flex; flex-direction: column; gap: 2px; }
.customer-card .cc-name { font-size: 18px; font-weight: 700; color: var(--text-1); }
.customer-card .cc-cf   { font-size: 13px; color: var(--text-2); }
.customer-card .cc-lic  { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.customer-card .cc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.customer-card .cc-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-1); }
.customer-card .cc-list li i { width: 16px; text-align: center; color: var(--accent); }
.customer-card .cc-list a { color: var(--accent); text-decoration: none; }
.customer-card .cc-list a:hover { text-decoration: underline; }
.customer-card .cc-actions { display: flex; gap: 8px; margin-top: 4px; }
.customer-card .cc-actions .btn-primary { width: auto; }
.customer-card .cc-assign-picker { align-items: center; }
.customer-card .cc-assign-picker uk-select { flex: 1; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.form-grid > label,
.form-grid > div > label { display: flex; flex-direction: column; gap: 4px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 7px 10px; background: var(--bg-raised);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  color: var(--text-1); font-size: 13px; width: 100%; box-sizing: border-box;
}
.form-grid textarea { resize: vertical; min-height: 60px; font-family: inherit; }
/* riga checkbox dentro la griglia: niente stile "etichetta di campo" né altezza/padding degli input */
.form-grid > .form-check { flex-direction: row; justify-content: flex-start; align-self: end; margin-bottom: 0; }
.form-grid > .form-check > label { display: inline; font-size: 13px; font-weight: 400; color: var(--text-1); text-transform: none; letter-spacing: 0; }
.form-grid .form-check input { width: 16px; height: 16px; padding: 0; }
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 10px; }
/* Solo la barra di navigazione del wizard: non tocca .form-actions del form di modifica
   ticket (dettaglio), che resta con lo stile pieno-larghezza invariato. */
.wizard-actions { justify-content: center; }
.wizard-actions .btn-primary { width: auto; padding: 8px 20px; }

.action-grid { display: flex; flex-direction: column; gap: 12px; }
.action-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.action-row input,
.action-row select,
.action-row textarea {
  padding: 7px 10px; background: var(--bg-raised);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  color: var(--text-1); font-size: 13px; min-width: 160px;
}
.action-row input:focus,
.action-row select:focus,
.action-row textarea:focus { outline: none; border-color: var(--accent); }
.action-row textarea.action-note {
  flex: 1 1 100%; min-width: 240px; resize: vertical;
  font-family: inherit; line-height: 1.45;
}

/* ── uk-select (select filtrabile) ───────────────────────────────────── */
.uk-select { position: relative; width: 100%; }
.action-row .uk-select { min-width: 160px; flex: 1; }
/* select + comando (icona) su riga propria a tutta larghezza, come la textarea. */
.action-line { display: flex; gap: 10px; align-items: center; flex: 1 1 100%; }
/* il flex item è l'host <uk-select> (tag), non il div interno .uk-select: serve il grow sul tag. */
.action-line > uk-select { flex: 1 1 auto; min-width: 0; }
.uk-select-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; background: var(--bg-raised);
  border: 1px solid var(--border-md); border-radius: var(--radius-sm);
  color: var(--text-1); font-size: 13px; text-align: left; cursor: pointer;
  line-height: 1.5; /* stessa altezza di input/select adiacenti: il :where() nativi non copre <button> */
}
.uk-select-toggle:hover { border-color: var(--accent-border); }
.uk-select.open .uk-select-toggle { border-color: var(--accent); }
.uk-select.disabled .uk-select-toggle { opacity: .55; cursor: not-allowed; }
.uk-select-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uk-select-value.placeholder { color: var(--text-3); }
.uk-select-caret { font-size: 10px; color: var(--text-3); transition: transform .15s; }
.uk-select.open .uk-select-caret { transform: rotate(180deg); }

.uk-select-panel {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; right: auto;
  min-width: 100%; width: max-content; max-width: min(360px, 92vw);
  background: var(--bg-surface); border: 1px solid var(--border-md);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 35%, transparent);
  overflow: hidden;
}
.uk-select-search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.uk-select-search i { font-size: 11px; color: var(--text-3); }
.uk-select-search input {
  flex: 1; border: none; background: transparent; outline: none;
  color: var(--text-1); font-size: 13px;
}
.uk-select-search input::placeholder { color: var(--text-3); }
/* A11y: gli input search hanno outline:none — il focus visibile lo dà il contenitore. */
.uk-select-search:focus-within { border-bottom-color: var(--accent); box-shadow: 0 1px 0 0 var(--accent); }
.ws-search:focus-within,
.tk-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.uk-select-list { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; }
.uk-select-option {
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text-1); cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
/* .active = navigazione tastiera; :hover = mouse. Hover via CSS così non resta
   appiccicato all'uscita del mouse (niente stato JS da resettare). */
.uk-select-option.active,
.uk-select-option:hover { background: var(--bg-hover); }
.uk-select-option.selected { color: var(--accent); font-weight: 600; }
.uk-select-empty { color: var(--text-3); font-style: italic; }
.uk-select-check { width: 14px; color: var(--text-3); }
.uk-select-option.selected .uk-select-check { color: var(--accent); }
.uk-select-all { font-weight: 600; border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 2px; }
.uk-select-noresults { padding: 10px; font-size: 12px; color: var(--text-3); text-align: center; }
.uk-select-footer { padding: 6px; border-top: 1px solid var(--border-md); text-align: right; }
.uk-select-done {
  background: var(--accent); color: var(--on-accent); border: none; border-radius: var(--radius-sm);
  padding: 5px 14px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.uk-select-done:hover { filter: brightness(1.08); }

.table-footer { margin-top: 12px; font-size: 12px; color: var(--text-3); }

/* ── Report: griglia KPI ─────────────────────────────────────────────── */
.dash-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-header h2 { flex: 1 1 auto; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 860px) {
  .dashboard-charts { grid-template-columns: 1fr; }
}

/* ─── Ticket workspace (master-detail) ─────────────────────────────────── */
.ws { display: grid; grid-template-columns: 440px 1fr; gap: 16px; align-items: start; }
.ws-list { display: flex; flex-direction: column; gap: 10px; }
.ws-list-head { display: flex; align-items: center; justify-content: space-between; }
.ws-list-head h2 { margin: 0; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* Barra filtri: ricerca (espandibile, prende tutto lo spazio) + chip SLA/Chiusi compatti a destra */
.ws-filterbar { display: flex; align-items: center; gap: 8px; }
.ws-filterbar .ws-search { flex: 1 1 auto; min-width: 0; }
.ws-filterbar .ws-chips { flex: 0 0 auto; gap: 6px; }
.ws-filterbar .chip { padding: 6px 12px; font-size: 12px; }
.ws-filterbar .chip-count { padding: 0 5px; }

.ws-search { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); }
.ws-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text-1); outline: none; }

/* Tab segmentati: contenitore unico arrotondato, attivo "rialzato" */
.ws-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 12px; }
.ws-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 6px;
  background: transparent; border: 0; border-radius: 9px; cursor: pointer;
  color: var(--text-2); font-size: 13px; transition: background .12s, color .12s; }
.ws-tab:hover { color: var(--text-1); }
.ws-tab.active { background: var(--bg-raised); color: var(--text-1); box-shadow: 0 1px 3px color-mix(in srgb, var(--shadow-color) 35%, transparent); }
.ws-tab-count { font-weight: 700; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--border-md); color: var(--text-2); }
.ws-tab.active .ws-tab-count { background: var(--accent-dim); color: var(--accent); }

/* Tab coda ticket: card individuali (icona + label + badge conteggio), tutte su un'unica riga */
.tk-tabs { display: flex; gap: 6px; flex-wrap: nowrap; }
.tk-tab { position: relative; flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 9px 4px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; color: var(--text-2); font-size: 12px; transition: border-color .12s, color .12s; }
.tk-tab i { font-size: 12px; flex: 0 0 auto; }
.tk-tab span:not(.tk-tab-count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tk-tab:hover { color: var(--text-1); border-color: var(--accent); }
.tk-tab.active { color: var(--text-1); border-color: var(--accent); background: var(--bg-raised); }
.tk-tab-count { position: absolute; top: -7px; right: -7px; font-weight: 700; font-size: 10px; padding: 1px 6px;
  border-radius: 999px; background: var(--accent); color: var(--on-accent); border: 1px solid var(--bg-surface); }

/* Ricerca testo (server) + filtro alias (client) sempre sulla stessa riga, 2/3 + 1/3. */
.tk-searchbar { display: flex; align-items: center; gap: 8px; }
.tk-search { flex: 2 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); }
.tk-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text-1); outline: none; }
.tk-search.tk-search-alias { flex: 1 1 0; padding: 8px 10px; }
.tk-search-clear { flex: 0 0 auto; border: 0; background: transparent; padding: 0 2px; color: var(--text-2); cursor: pointer; }
.tk-search-clear:hover { color: var(--text-1); }
/* Bottone "Ricerca avanzata" nell'header della lista (btn-icon), badge = filtri applicati. */
.tk-filter-btn { position: relative; }
.tk-filter-btn.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Ricerca avanzata: pannello a comparsa sotto la searchbar + striscia "filtri attivi" */
.tk-adv-panel { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 6px; }
.form-grid.tk-adv-form { grid-template-columns: 1fr 1fr; gap: 10px; } /* specificità doppia: .form-grid è definita più in basso */
.tk-adv-form > .form-check { align-items: center; gap: 8px; cursor: pointer; }
.tk-adv-form > .form-check span { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 400; color: var(--text-1); }
.tk-adv-actions { display: flex; gap: 8px; }
.tk-adv-actions .btn { flex: 1; justify-content: center; padding: 10px; font-size: 13px; }
.tk-adv-banner { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; font-size: 13px;
  color: var(--accent); background: var(--accent-dim); border: 1px solid var(--accent-border); border-radius: 6px; }
.tk-adv-banner > span { flex: 1 1 auto; min-width: 0; }
@media (max-width: 480px) { .form-grid.tk-adv-form { grid-template-columns: 1fr; } }

.ws-rows { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 230px); overflow-y: auto; }
.ws-empty-msg { color: var(--text-2); padding: 8px 2px; }
.ws-row { display: flex; align-items: stretch; gap: 0; padding: 10px 0 10px 12px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 11px; cursor: pointer; transition: border-color .12s, background .12s; }
.ws-row:hover { border-color: var(--accent); }
.ws-row.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Corpo ticket su 2 righe: riga1 #id + ragione sociale, riga2 priorità + stato + avatar */
.ws-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px;
  justify-content: center; padding-right: 12px; }
.ws-row-line1 { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ws-row-line2 { display: flex; align-items: center; gap: 12px; min-width: 0; }

.ws-row-id { color: var(--text-2); font-size: 12px; flex: 0 0 auto; }
.ws-row-name { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 13px; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Alias negozio (servizio Licenses), sotto la ragione sociale */
.ws-row-alias { margin-top: -3px; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Badge pratica: ticket collegato a una pratica sospesa */
.ws-practice-badge { flex: 0 0 auto; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 8px; background: var(--accent-dim); color: var(--accent); }
/* Ticket Prioritario (tipo con icona, es. busta): icona in elenco, badge nel dettaglio. */
.ws-row-type-icon { flex: 0 0 auto; font-size: 12px; color: var(--amber); }
.ws-priority-mail-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 8px; background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--yellow); }

/* Priorità: pallino colorato + etichetta */
.ws-row-prio-group { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.ws-row-prio-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.ws-row-prio-label { font-weight: 600; font-size: 12px; color: var(--text-2); }
.ws-row-status { flex: 0 0 auto; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.ws-row-date { flex: 0 0 auto; font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Icona ripush ARCA: ticket chiuso non ancora sincronizzato. Pending = neutro, Error = rosso. */
.ws-row-sync { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer; color: var(--text-2); font-size: 12px; }
.ws-row-sync:hover { background: var(--accent-dim); color: var(--accent); }
.ws-row-sync.error { color: var(--red); }
.ws-row-sync.error:hover { background: color-mix(in srgb, var(--red) 15%, transparent); }
.ws-row-sync.pushing { cursor: default; color: var(--text-2); background: none; }

/* Badge positivo: ticket chiuso e sincronizzato con ARCA (non cliccabile). */
.ws-row-synced { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; color: var(--green); font-size: 12px; cursor: default; }
.ws-synced-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--green-dim); color: var(--green); font-size: 12px; font-weight: 600; cursor: default; }

.ws-pending-confirm-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--yellow); font-size: 12px; font-weight: 600; cursor: default; }
.ws-row-pending-confirm { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; color: var(--yellow); font-size: 12px; cursor: default; }

/* Avatar assegnatario (iniziali) o segnaposto cliccabile per la presa in carico — a fine riga2 */
.ws-row-avatar { margin-left: auto; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; background: var(--bg-raised); color: var(--text-1);
  font-size: 11px; font-weight: 700; }
.ws-row-avatar.unassigned { color: var(--text-2); }
.ws-row-avatar.unassigned .fa-user { opacity: .7; }
.ws-row-avatar.clickable { cursor: pointer; }
.ws-row-avatar.clickable:hover { background: var(--accent-dim); color: var(--accent); }

/* Semaforo SLA: cella a destra full-height, livello attivo acceso */
.ws-row-sla { flex: 0 0 auto; align-self: stretch; padding: 0 13px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-left: 1px solid var(--border); }
.ws-row-sla .dot { display: block; width: 9px; height: 9px; border-radius: 50%; opacity: .22; }
.ws-row-sla .dot.dot-ok { background: var(--green); }
.ws-row-sla .dot.dot-warn { background: var(--yellow); }
.ws-row-sla .dot.dot-danger { background: var(--red); }
.ws-row-sla .dot.on { opacity: 1; }

.sla { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 7px; white-space: nowrap; }
.sla-ok { background: color-mix(in srgb, var(--slate-500) 15%, transparent); color: var(--text-2); }
/* Colori via variabili tema: gli hex chiari (#b45309/#b91c1c) erano illeggibili sui temi scuri. */
.sla-warn { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--yellow); }
.sla-danger { background: var(--red-dim); color: var(--red); }

.ws-back-mobile { display: none; }
.ws-detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px; color: var(--text-2); text-align: center; }
.ws-detail-empty i { font-size: 40px; opacity: .4; }

@media (max-width: 900px) {
  .ws { grid-template-columns: 1fr; }
  .ws-detail { display: none; }
  .ws-detail-open .ws-list { display: none; }
  .ws-detail-open .ws-detail { display: block; }
  /* Mobile: elenco e dettaglio come schermate separate. Tasto "Elenco" nel dettaglio, niente selettore colonne. */
  .ws .ws-back-mobile { display: inline-flex; align-items: center; gap: 6px; width: auto; flex: 0 0 auto; }
  .ws .view-seg { display: none; }
  .ws .detail-header { flex-wrap: wrap; }
  .ws-rows { max-height: none; }
}

/* ─── Thread interno per-ticket ────────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 10px; }
.thread-msgs { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
.thread-empty { color: var(--text-2); font-size: 13px; }
.thread-msg { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; max-width: 85%; }
.thread-msg.mine { align-self: flex-end; align-items: flex-end; }
.thread-meta { font-size: 11px; color: var(--text-2); }
.thread-bubble { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.thread-msg.mine .thread-bubble { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.thread-input { display: flex; gap: 8px; align-items: flex-end; }
.thread-input textarea { flex: 1; min-width: 0; resize: vertical; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; background: var(--bg-surface); color: var(--text-1); font-family: inherit; }
/* annulla il width:100% di .btn-primary dentro la barra di invio */
.thread-input .btn { width: auto; flex: 0 0 auto; align-self: stretch; }

/* ─── Chat operatori ───────────────────────────────────────────────────── */
.chat-msgs { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--online); flex: 0 0 9px; display: inline-block; }
.ws-head-actions { display: flex; align-items: center; gap: 6px; }
.chat-toggle { position: relative; }
/* Selettore vista colonne (segmented): solo elenco / affiancate / solo dettaglio. */
.view-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; }
.view-seg .btn-icon { border: 0; width: 26px; height: 26px; border-radius: 6px; }
.view-seg .btn-icon.active { background: var(--accent); color: var(--on-accent); }
/* Vista solo elenco / solo dettaglio: colonna unica (solo desktop; su mobile vale la logica ws-detail-open). */
@media (min-width: 901px) {
  .ws.ws-view-list   { grid-template-columns: 1fr; }
  .ws.ws-view-list   .ws-detail { display: none; }
  .ws.ws-view-detail { grid-template-columns: 1fr; }
  .ws.ws-view-detail .ws-list   { display: none; }
}
.chat-badge { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger-strong); color: var(--on-accent); font-size: 10px; font-weight: 700;
  line-height: 17px; text-align: center; }

/* directive uk-operator-chat */
.opchat-names { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opchat-msgs { flex: 1; min-height: 200px; background: var(--bg-raised); border-radius: 10px; padding: 10px 12px; }

/* drawer nel workspace ticket */
.ws-chat { position: fixed; top: 64px; right: 16px; bottom: 16px; width: 640px; z-index: 50;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--shadow-color) 25%, transparent); display: flex; flex-direction: column; padding: 12px; gap: 8px; }
.ws-chat-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.ws-chat-head-actions { display: flex; gap: 2px; }
.ws-chat uk-operator-chat { display: flex; flex: 1; min-height: 0; }
.ws-chat uk-chat-sidebar { display: flex; }
.ws-chat .opchat-msgs { height: auto; }

/* Composer principale: box unico bordato, textarea sopra + toolbar azioni sotto (stile Slack). */
.opchat-composer { display: flex; flex-direction: column; gap: 6px; position: relative; flex: 0 0 auto; }
.composer-box { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-surface); padding: 8px 10px; transition: border-color .12s; }
.composer-box:focus-within { border-color: var(--accent); }
.composer-input { border: none; background: transparent; resize: vertical; padding: 0; color: var(--text-1);
  font: inherit; min-height: 20px; }
.composer-input:focus { outline: none; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; }
.composer-toolbar-left { display: flex; align-items: center; gap: 2px; }
.composer-toolbar-left .attach-pick { padding: 4px 6px; }
.composer-send { width: auto; flex: 0 0 auto; }
@media (max-width: 900px) { .ws-chat { left: 12px; right: 12px; width: auto; } }

/* Minimizzata: solo la barra del titolo, ancorata in basso a destra, niente corpo/altezza forzata. */
.ws-chat.minimized { top: auto; height: auto; padding-bottom: 12px; cursor: pointer; }
.ws-chat.minimized .ws-chat-head { cursor: pointer; }
.ws-chat.minimized .chat-badge { position: static; margin-left: 6px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
/* ─── Utilità condivise dalle view (niente style="" inline) ─────────────── */
.text-sm { font-size: .85em; }
.mt-sm { margin-top: 6px; }
.mt-md { margin-top: 12px; }
.ws-tabs-compact { max-width: 560px; margin-bottom: 12px; }
.cell-note { color: var(--text-2); font-size: .85em; margin-top: 4px; }
.field-hint { margin: 2px 0 0; color: var(--text-3); font-size: .8em; }
.cell-actions { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.cell-actions-row { display: flex; gap: 6px; }
.detail-desc-head { display: flex; align-items: center; justify-content: space-between; }
.detail-grid.detail-grid-3 { grid-template-columns: repeat(3, 1fr); }
.practice-chain-item { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-accent { color: var(--accent); }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--accent);
  transition: background .12s, color .12s;
}
/* Header dettaglio: titolo a sinistra, azioni (icone) a destra. */
.detail-header { display: flex; align-items: center; gap: 8px; }
.detail-header h2 { flex: 1; min-width: 0; }
.detail-header .dh-spacer { flex: 1; }
.btn-icon:hover { background: var(--accent); color: var(--on-accent); }

/* ─── Chip filtro "SLA scaduti" ────────────────────────────────────────── */
.ws-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-sla-chip { display: flex; }
.ws-sla-chip .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.ws-sla-chip .chip i { color: var(--danger-strong); }
.ws-sla-chip .chip.active { background: color-mix(in srgb, var(--danger-strong) 16%, transparent); color: var(--danger-deep); border-color: color-mix(in srgb, var(--danger-strong) 45%, transparent); }
.ws-sla-chip .chip.active i { color: var(--danger-deep); }
.chip-count { font-weight: 700; padding: 0 6px; border-radius: 8px; background: var(--red-dim); color: var(--red); font-size: 11px; }

/* Chip "Chiusi" — tema verde skin (positivo/completato) */
.ws-closed-chip { display: flex; }
.ws-closed-chip .chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.ws-closed-chip .chip i { color: var(--green); }
.ws-closed-chip .chip.active { background: var(--green-dim); color: var(--green); border-color: color-mix(in srgb, var(--emerald-500) 45%, transparent); }
.ws-closed-chip .chip-count { background: var(--green-dim); color: var(--green); }

/* segnala una menzione non letta sul toggle chat */
.chat-toggle.mention { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 50%, transparent); }
.chat-toggle.mention .chat-badge { background: var(--amber); }

/* ─── @menzioni (thread + chat) ────────────────────────────────────────── */
.mention { color: var(--accent); font-weight: 600; }
.thread-msg.mine .mention { color: var(--mention-on-accent); }
.mention-me { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--yellow); border-radius: 5px; padding: 0 3px; }
.thread-msg.mine .mention-me { background: color-mix(in srgb, var(--on-accent) 28%, transparent); color: var(--on-accent); }
.thread-input { position: relative; }
.mention-pop { position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 20; display: flex; flex-direction: column;
  min-width: 160px; background: var(--bg-surface); border: 1px solid var(--border-md); border-radius: 10px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--shadow-color) 25%, transparent); overflow: hidden; }
.mention-pop button { text-align: left; padding: 7px 12px; background: transparent; border: none; cursor: pointer;
  color: var(--text-1); font-size: 13px; width: auto; }
.mention-pop button:hover { background: var(--accent-dim); color: var(--accent); }

/* ─── Allegati ticket ──────────────────────────────────────────────────── */
.attach { display: flex; flex-direction: column; gap: 10px; }
.attach-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attach-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 10px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.attach-list li i { color: var(--text-2); }
.attach-name { font-weight: 600; color: var(--accent); text-decoration: none; word-break: break-all; }
.attach-name:hover { text-decoration: underline; }
.attach-meta { color: var(--text-2); font-size: 11px; margin-left: auto; white-space: nowrap; }
.attach-list li .attach-delete:hover:not(:disabled) i { color: var(--red); }
.attach-upload { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.attach-uploading { color: var(--text-2); font-size: 12px; }
/* Selezione file: area cliccabile a tutta larghezza + icona (come action-line). */
.attach-file-input { display: none; }
.attach-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: var(--radius-sm); color: var(--text-3); font-size: 13px; cursor: pointer; text-align: left; }
.attach-pick:hover { border-color: var(--accent-border); }
.attach-pick i { color: var(--text-2); }
/* Nel composer chat il pulsante clip è icon-only: non deve espandersi come nell'upload ticket. */
.thread-input .attach-pick { flex: 0 0 auto; width: auto; padding: 4px 8px; background: transparent; border: none; }

.emoji-picker { position: relative; display: inline-flex; }
.emoji-toggle { background: transparent; border: none; cursor: pointer; color: var(--text-2); font-size: 16px; padding: 4px 6px; }
.emoji-toggle:hover { color: var(--accent); }
.emoji-pop { position: absolute; bottom: calc(100% + 4px); right: 0; z-index: 30; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 6px 20px color-mix(in srgb, var(--shadow-color) 18%, transparent); padding: 8px; max-width: 260px; }
.emoji-group-label { font-size: 11px; color: var(--text-2); margin: 4px 0 2px; }
.emoji-flat { display: flex; flex-wrap: wrap; gap: 2px; }
.emoji-flat button { background: transparent; border: none; cursor: pointer; font-size: 18px; padding: 4px; border-radius: 6px; }
.emoji-flat button:hover { background: var(--accent-dim); }

/* Sidebar chat stile Slack: pannello scuro dedicato, uguale in tutte le skin. */
.chat-sidebar { display: flex; flex-direction: column; gap: 10px; width: 200px; flex: 0 0 auto;
  overflow-y: auto; background: var(--chat-bg); border-radius: 10px; padding: 10px 8px; }
.chat-sidebar-head { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .4px;
  font-weight: 700; color: var(--chat-muted); text-transform: uppercase; margin-bottom: 4px; cursor: pointer; user-select: none; }
.chat-sidebar-head span { flex: 1; min-width: 0; }
.chat-sidebar-head .btn-icon { color: var(--chat-muted); }
.chat-sidebar-head .btn-icon:hover { color: var(--on-accent); }
.sect-caret { transition: transform .15s; flex: 0 0 auto; }
.sect-caret.collapsed { transform: rotate(-90deg); }
.chat-sidebar-new { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.chat-sidebar-new input { min-width: 0; border: 1px solid var(--chat-input-border); background: var(--chat-input-bg); color: var(--chat-input-text);
  border-radius: 6px; padding: 4px 8px; }
.group-member-pick { list-style: none; margin: 0; padding: 4px 2px; max-height: 140px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; }
.group-member-pick label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--chat-text-2);
  cursor: pointer; font-weight: 400; }
.chat-conv-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-conv-list li { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--chat-text); }
.chat-conv-list li i { flex: 0 0 auto; font-size: 11px; opacity: .8; }
.chat-conv-list li:hover { background: color-mix(in srgb, var(--on-accent) 7%, transparent); color: var(--on-accent); }
.chat-conv-list li.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chat-conv-list li.unread { color: var(--on-accent); font-weight: 700; }
.chat-conv-list li.mention .conv-name { color: var(--amber); }
.conv-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-badge { flex: 0 0 auto; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--danger-strong); color: var(--on-accent); font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }
.chat-empty-hint { color: var(--chat-hint); font-size: 12px; cursor: default; }
.chat-empty-hint:hover { background: transparent; color: var(--chat-hint); }
.chat-conv-list li.mine { cursor: default; font-style: italic; }
.chat-conv-list li.mine:hover { background: transparent; color: var(--chat-text); }

.chat-thread { position: absolute; top: 0; right: 0; bottom: 0; width: 320px; background: var(--bg-surface);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; padding: 10px; gap: 8px; z-index: 25; }
.chat-thread-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.thread-msg.root { border-bottom: 1px dashed var(--border); padding-bottom: 8px; margin-bottom: 4px; }

.opchat { display: flex; width: 100%; height: 100%; position: relative; gap: 12px; }
.opchat-main { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.opchat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-weight: 700; font-size: 15px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.opchat-title { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.opchat-title i { font-size: 12px; color: var(--text-2); }
.opchat-head-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.opchat-rename { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.opchat-rename-input { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; padding: 3px 6px;
  border: 1px solid var(--accent); border-radius: 4px; background: var(--bg-surface); color: var(--text-1); }
.member-count { font-size: 12px; font-weight: 400; color: var(--text-2); }
.opchat-head .btn-icon.active { color: var(--accent); }
/* Ricerca nella conversazione */
.opchat-search { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.opchat-search-form { display: flex; align-items: center; gap: 6px; }
.opchat-search-form input { flex: 1; min-width: 0; }
.opchat-search-empty { margin: 0; font-size: 12px; }
.opchat-search-results { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised); }
.opchat-search-results li { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.opchat-search-results li:last-child { border-bottom: none; }
.opchat-search-results li:hover { background: var(--accent-dim); }
.opchat-search-meta { font-size: 12px; }
.opchat-search-snippet { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opchat-older { text-align: center; font-size: 12px; margin: 4px 0; }
.thread-bubble.deleted { color: var(--text-2); font-style: italic; }
.msg-reactions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.msg-reactions button { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 7px; font-size: 12px; cursor: pointer; }
.msg-reactions button.mine { border-color: var(--accent); background: var(--accent-dim); }
.msg-actions { display: flex; gap: 10px; font-size: 11px; color: var(--text-2); }
.msg-actions button { background: transparent; border: none; cursor: pointer; color: inherit; padding: 0; }
.msg-actions button:hover { color: var(--accent); }

/* ── Messaggi stile Slack: righe piene, raggruppate per autore, azioni su hover ── */
.slack-day { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; }
.slack-day::before, .slack-day::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.slack-day span { font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.slack-msg { position: relative; display: flex; gap: 8px; padding: 2px 6px; border-radius: 6px; }
.slack-msg.first { margin-top: 8px; }
.slack-msg:hover { background: var(--accent-dim); }
.slack-msg.hit { background: color-mix(in srgb, var(--yellow) 18%, transparent); transition: background .3s; }
.slack-avatar { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 7px; background: var(--accent);
  color: var(--on-accent); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.slack-gutter { flex: 0 0 28px; text-align: right; }
.slack-hover-time { visibility: hidden; font-size: 10px; color: var(--text-3); }
.slack-msg:hover .slack-hover-time { visibility: visible; }
.slack-body { flex: 1; min-width: 0; }
.slack-meta { font-size: 12px; }
.slack-meta b { font-size: 13px; }
.slack-time, .slack-edited { color: var(--text-2); font-size: 11px; margin-left: 4px; }
.slack-text { font-size: 13px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.slack-text.deleted { color: var(--text-2); font-style: italic; }
.slack-thread-link { background: transparent; border: none; cursor: pointer; color: var(--accent);
  font-size: 11px; font-weight: 600; padding: 2px 0 0; }
.slack-thread-link:hover { text-decoration: underline; }
.msg-hover-actions { position: absolute; top: -12px; right: 8px; display: none; align-items: center; gap: 2px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 1px 4px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--shadow-color) 12%, transparent); z-index: 5; }
.slack-msg:hover .msg-hover-actions { display: flex; }
.msg-hover-actions button { background: transparent; border: none; cursor: pointer; color: var(--text-2);
  font-size: 12px; padding: 4px 5px; border-radius: 5px; }
.msg-hover-actions button:hover { color: var(--accent); background: var(--accent-dim); }

/* Pannello gestione membri gruppo (Admin/System) */
.group-members-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface);
  padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.gmp-head { font-weight: 700; font-size: 12px; text-transform: uppercase; color: var(--text-2); }
.group-members-panel ul { list-style: none; margin: 0; padding: 0; max-height: 160px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; }
.group-members-panel li { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; padding: 3px 4px; }
.gmp-add { display: flex; gap: 6px; }
.gmp-add > uk-select { flex: 1; min-width: 0; }
.gmp-add > .btn { width: auto; flex: none; } /* .btn-primary è width:100%: schiaccerebbe la select */

/* Drawer espanso: overlay quasi-fullscreen, stesse aree più larghe. */
.ws-chat.expanded { top: 4vh; right: 4vw; bottom: 4vh; left: 4vw; width: auto;
  box-shadow: 0 12px 48px color-mix(in srgb, var(--shadow-color) 35%, transparent); }
.ws-chat.expanded .chat-sidebar { width: 240px; }
.ws-chat.expanded .chat-thread { width: 380px; }

/* Operazioni ARCA in Impostazioni: 4 voci su griglia 2x2 (collassa a 1 colonna su schermi stretti). */
/* ─── Impostazioni (settings.view) ─────────────────────────────────────── */
.settings-intro { margin-bottom: 12px; }
.settings-hint { margin-top: 8px; font-size: 12px; }
.settings-log { margin-top: 6px; padding-left: 18px; color: var(--text-3); font-size: 12px; }
.settings-narrow { max-width: 420px; margin-bottom: 8px; }
.settings-block { margin-top: 8px; }
.settings-subbox { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-top: 8px; }
.settings-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.settings-grow { flex: 1; min-width: 200px; }
.settings-code-input { width: 140px; }
.settings-icon-input { max-width: 220px; }
.pick-list { margin-top: 8px; max-height: 180px; overflow: auto; list-style: none; padding: 0; }
.pick-list li { padding: 6px 8px; cursor: pointer; border-bottom: 1px solid var(--border); }
.pick-list li:hover { background: var(--bg-hover); }
/* editor appsettings.json: una riga per campo, gruppi annidati con filetto a sinistra */
.cfg-field { display: flex; align-items: center; gap: 8px; margin: 6px 0 6px 12px; }
.cfg-field-name { min-width: 220px; font-size: 13px; color: var(--text-2); }
.cfg-field .form-check { margin-bottom: 0; }
.cfg-input { max-width: 360px; }
.cfg-input-num { max-width: 160px; }
.cfg-group { margin: 10px 0; padding-left: 8px; border-left: 2px solid var(--border); }
.cfg-group .cfg-group { margin-left: 16px; }
/* albero classificazione */
.class-tree { list-style: none; margin: 10px 0 0; padding: 0; }
.class-tree li { margin: 2px 0; }
.class-tree-children { margin: 0 0 0 20px; }
.form-grid.class-form { grid-template-columns: 1fr; margin-top: 8px; }

.arca-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.arca-grid > uk-card { display: block; }
.arca-grid .card { margin-bottom: 0; height: 100%; }
@media (max-width: 760px) { .arca-grid { grid-template-columns: 1fr; } }

/* Statistiche operatori: id ticket cliccabile + riga di dettaglio espandibile (toggle). */
.ws-stat-tlink { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 600; white-space: nowrap; }
.ws-stat-tlink:hover { text-decoration: underline; }
.ws-stat-tlink i { width: 10px; }
.ws-stat-row-open > td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ws-stat-detail-row > td { padding: 0; background: color-mix(in srgb, var(--accent) 4%, transparent); border-top: 0; }
.ws-stat-detail { padding: 8px 14px 10px; }
.ws-stat-detail-err { color: var(--red); font-size: 12px; margin: 0; }
/* Meta compatta: voci inline separate da puntini. */
.ws-stat-meta { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.ws-stat-meta > span:not(:last-child)::after { content: '·'; margin-left: 6px; color: var(--text-3, var(--border)); }
.ws-stat-meta b { color: var(--text-1); }
.ws-stat-desc { margin: 6px 0 0; font-size: 12px; color: var(--text-1); white-space: pre-wrap; }
/* Statistiche operatori: filtri impilati nella colonna sinistra */
.ws-filterbar.ws-filterbar-stack { flex-direction: column; align-items: stretch; gap: 10px; }
.stats-range { display: flex; gap: 8px; }
.stats-field { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.ws-tabs.stats-toggle-all { padding: 0 12px 8px; }
.stats-toggle-all .ws-tab { flex: 1; }
.ws-row-main.ws-row-main-inline { flex-direction: row; align-items: center; gap: 10px; }
.stats-check-icon { color: var(--accent); font-size: 16px; }
.stats-detail { padding: 16px; }
.ws-stat-acts { margin-top: 8px; }
.ws-stat-acts-title { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3, var(--text-2)); margin-bottom: 3px; }
.ws-stat-acts-empty { font-size: 12px; color: var(--text-2); margin: 0; }
.ws-stat-acts-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ws-stat-acts-table td { padding: 2px 8px 2px 0; vertical-align: top; border-top: 1px solid var(--border); color: var(--text-1); }
.ws-stat-acts-table tr:first-child td { border-top: 0; }
.ws-stat-acts-table .nowrap { white-space: nowrap; color: var(--text-2); }
.ws-stat-acts-notes { color: var(--text-2); }
/* Statistiche operatori (Operatività): riga di gruppo per operatore, cliccabile. */
.ws-stat-group { cursor: pointer; }
.ws-stat-group > td { background: var(--bg-raised); }
.ws-stat-group:hover > td { background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised)); }
.ws-stat-group-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ws-stat-group-head .ws-row-avatar { margin-left: 0; }
.ws-stat-group-caret { width: 10px; color: var(--accent); }
.ws-stat-group-name { font-weight: 600; color: var(--text-1); margin-right: auto; }
.ws-stat-group-head .badge { text-transform: none; font-size: 11px; }
/* Dettaglio per operatore: riga di gruppo come pulsante, poi ticket (sinistra) e mail (destra). */
.ws-stat-op + .ws-stat-op { margin-top: 8px; }
.ws-stat-group-btn {
  display: block; width: 100%; text-align: left; border: 0; font: inherit; color: inherit;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-raised);
}
.ws-stat-group-btn:hover { background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised)); }
.ws-stat-group-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-stat-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 10px 0 4px; }
.ws-stat-col { min-width: 0; }
.ws-stat-col .data-table th, .ws-stat-col .data-table td { padding-left: 8px; padding-right: 8px; }
.ws-stat-nowrap { white-space: nowrap; }
.ws-stat-mail-from { font-size: 12px; margin-top: 2px; }
.ws-stat-col-title { font-weight: 600; color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .ws-stat-cols { grid-template-columns: minmax(0, 1fr); } }
/* Impostazioni: anteprima voce di menu Email e popup template risposta automatica. */
.email-menu-preview { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.email-tpl-box { width: min(720px, calc(100vw - 32px)); }
.email-menu-row { align-items: flex-end; }
.email-detail-read a, .ws-stat-col a { color: var(--accent); }
.email-menu-row label { flex: 1 1 200px; }
.email-menu-row .btn { flex: 0 0 auto; width: auto; }
.email-cfg-inline .form-check { display: inline-flex; margin-right: 4px; }

/* ─── Wizard classificazione ticket (nuovo ticket) ──────────────────────── */
.cw-wizard { display: flex; flex-direction: column; gap: 14px; }
.cw-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 12px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cw-breadcrumb-icon { color: var(--text-3); font-size: 12px; margin-right: 6px; }
.cw-crumb { color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.cw-crumb:hover { text-decoration: underline; }
.cw-crumb.current { color: var(--text-1); cursor: default; }
.cw-crumb.current:hover { text-decoration: none; }
.cw-breadcrumb-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.cw-crumb + .cw-crumb::before { content: '\276F'; margin-right: 4px; color: var(--text-3); font-size: 10px; }
.cw-step { display: flex; flex-direction: column; gap: 8px; }
.cw-step-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.cw-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cw-option { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--bg-surface); border: 1px solid var(--border); border-left: 4px solid var(--border-md);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); font-size: 13px; text-align: left;
  transition: border-color .12s, background .12s, transform .12s, box-shadow .12s; }
.cw-option:hover { color: var(--text-1); border-color: var(--accent); background: var(--bg-raised);
  transform: translateY(-1px); box-shadow: 0 2px 8px color-mix(in srgb, var(--shadow-color) 12%, transparent); }
.cw-option.selected { color: var(--text-1); border-color: var(--accent); background: var(--bg-raised); }
.cw-option-label { flex: 1; }
.cw-option i { color: var(--text-3); font-size: 12px; flex: 0 0 auto; }
.cw-option:hover i, .cw-option.selected i { color: var(--accent); }
.cw-option i.fa-check { color: var(--green); }
.cw-text label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.cw-text-badge { padding: 1px 8px; border-radius: 999px; font-size: 10px; font-weight: 600;
  text-transform: none; letter-spacing: normal; background: var(--bg-raised); color: var(--text-3); }
.cw-text-badge.required { background: var(--accent-dim); color: var(--accent); }
.cw-text textarea { width: 100%; margin-top: 4px; box-sizing: border-box; resize: vertical; }
.cw-empty { color: var(--text-2); }

/* ─── Wizard "Nuovo ticket" (barra di avanzamento + promemoria negozio) ─────── */
.wizard-steps { display: flex; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.wizard-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; cursor: default; }
.wizard-step.clickable { cursor: pointer; }
.wizard-step + .wizard-step::before {
  content: ''; position: absolute; top: 16px; left: calc(-50% + 16px); right: calc(50% + 16px);
  height: 2px; background: var(--border); z-index: 0;
}
.wizard-step.done + .wizard-step::before,
.wizard-step.active + .wizard-step::before { background: var(--accent); }
.wizard-step-bubble { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg-surface); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold; color: var(--text-2); z-index: 1; position: relative;
  transition: background .2s, border-color .2s, color .2s; }
.wizard-step.done .wizard-step-bubble { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.wizard-step.active .wizard-step-bubble { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.wizard-step-label { margin-top: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); font-weight: 500; text-align: center; }
.wizard-step.active .wizard-step-label { color: var(--accent); font-weight: 700; }
.wizard-step.done .wizard-step-label { color: var(--text-2); }
.wizard-store-summary { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin-bottom: 14px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 13px; }

/* ─── Classificazione ticket: albero + toolbar + pannello dettaglio ────── */
.class-editor { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.2fr); gap: 20px; margin-top: 10px; }
.class-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
/* variante distruttiva (elimina, pulizia): stesso bottone, colore --red */
.btn-icon-danger { color: var(--red); }
.btn-icon-danger:hover { background: var(--red); color: var(--bg-base); }
.btn-icon[disabled] { opacity: .35; cursor: default; }
.btn-icon[disabled]:hover { background: transparent; color: var(--accent); }
.class-node { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.class-node:hover { background: var(--bg-raised); }
.class-node.selected { background: var(--bg-raised); box-shadow: inset 2px 0 0 var(--accent); }
.class-node-toggle { width: 16px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3); }
.class-node-toggle-empty { cursor: default; }
.class-node-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* dettaglio sempre visibile mentre si scorre un albero lungo */
.class-detail-col { border-left: 1px solid var(--border); padding-left: 20px; min-width: 0;
  position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; }
.class-detail-view { margin: 10px 0 0; }
.class-detail-view dt { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; margin-top: 8px; }
.class-detail-view dd { margin: 2px 0 0; color: var(--text-1); overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .class-editor { grid-template-columns: minmax(0, 1fr); }
  .class-detail-col { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px;
    position: static; max-height: none; overflow: visible; }
}

/* ─── Riclassificazione dal dettaglio ticket (profili Global) ─────────────── */
.tc-edit { margin-left: 6px; padding: 2px 6px; font-size: 11px; vertical-align: middle; }

/* ─── Suggerimenti per sottocategoria (dettaglio ticket, profili Global) ──── */
.detail-cards-row > uk-ticket-suggestions { display: flex; flex: 1 1 100%; min-width: 0; }
.detail-cards-row > uk-ticket-suggestions > .card { flex: 1; width: 100%; }
.sg-card .card-header { margin-bottom: 12px; }
.sg-body { display: flex; flex-direction: column; gap: 16px; }
.sg-empty { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--text-3); font-size: 13px; }
.sg-section { display: flex; flex-direction: column; gap: 6px; }
.sg-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.sg-bar { display: grid; grid-template-columns: minmax(140px, 260px) 1fr 32px; align-items: center; gap: 10px; font-size: 13px; }
.sg-bar-label { color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-bar-track { height: 8px; background: var(--bg-raised); border-radius: 4px; overflow: hidden; }
.sg-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.sg-bar-count { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sg-label { display: block; margin-top: 4px; font-size: 11px; color: var(--text-3); }
.sg-text { margin: 2px 0 0; font-size: 13px; color: var(--text-1); white-space: pre-line; }
.sg-refs a { margin-right: 8px; font-size: 13px; }
.sg-recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sg-recent-head { font-size: 12px; color: var(--text-2); }
@media (max-width: 720px) { .sg-bar { grid-template-columns: 1fr 60px 28px; } }

/* ─── Editor albero: indicatore playbook e sezione playbook della foglia ──── */
.class-node-pb { color: var(--accent); font-size: 11px; margin-left: 4px; }
.class-playbook { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.class-playbook-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.class-playbook textarea { width: 100%; box-sizing: border-box; resize: vertical; }

/* ── Calendario turni ─────────────────────────────── */
.calendar-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.calendar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.calendar-team-select { min-width: 260px; }
.calendar-host { background: var(--bg-surface, #fff); border-radius: 8px; padding: 12px; }
/* FullCalendar sui colori della skin (Dark, Gray, Uakari): variabili --fc-* + testi. */
.calendar-host.fc {
  font-size: 13px; color: var(--text-1);
  --fc-page-bg-color: var(--bg-surface);
  --fc-neutral-bg-color: var(--bg-raised);
  --fc-neutral-text-color: var(--text-2);
  --fc-border-color: var(--border-md);
  --fc-today-bg-color: var(--accent-dim);
  --fc-now-indicator-color: var(--accent);
  --fc-highlight-color: var(--accent-dim);
  --fc-list-event-hover-bg-color: var(--bg-hover);
  --fc-button-text-color: var(--text-1);
  --fc-button-bg-color: var(--bg-raised);
  --fc-button-border-color: var(--border-md);
  --fc-button-hover-bg-color: var(--bg-hover);
  --fc-button-hover-border-color: var(--accent-border);
  --fc-button-active-bg-color: var(--accent);
  --fc-button-active-border-color: var(--accent);
}
.calendar-host.fc .fc-button { box-shadow: none; }
.calendar-host.fc .fc-button:focus-visible { box-shadow: 0 0 0 2px var(--accent-border); }
.calendar-host.fc .fc-button-primary:not(:disabled).fc-button-active,
.calendar-host.fc .fc-button-primary:not(:disabled):active { color: #fff; }
.calendar-host.fc .fc-button-primary:disabled { color: var(--text-3); background: var(--bg-raised); border-color: var(--border-md); opacity: 1; }
.calendar-host.fc .fc-toolbar-title { color: var(--text-1); font-size: 18px; font-weight: 600; text-transform: capitalize; }
.calendar-host.fc .fc-col-header-cell-cushion,
.calendar-host.fc .fc-daygrid-day-number,
.calendar-host.fc .fc-list-day-text,
.calendar-host.fc .fc-list-day-side-text { color: var(--text-2); text-decoration: none; }
.calendar-host.fc .fc-day-today .fc-daygrid-day-number { color: var(--accent); font-weight: 600; }
.calendar-host.fc .fc-timegrid-slot-label-cushion,
.calendar-host.fc .fc-timegrid-axis-cushion,
.calendar-host.fc .fc-list-event-time,
.calendar-host.fc .fc-daygrid-more-link { color: var(--text-2); }
.calendar-host.fc .fc-day-other .fc-daygrid-day-top { opacity: .45; }
.calendar-host.fc .fc-list-empty { background: var(--bg-surface); color: var(--text-3); }
/* Promemoria: colori dalle variabili della skin (scuro, Gray, Uakari), tinta tenue + filetto a sinistra.
   In vista mese gli eventi a orario sono "dot event": il pallino prende il colore del testo. */
.calendar-host .reminder-ev { cursor: pointer; border: 1px solid transparent; border-left-width: 3px; }
.calendar-host .reminder-ev.is-pending { background: var(--accent-dim); border-color: var(--accent); color: var(--text-1); }
.calendar-host .reminder-ev.is-pending .fc-event-title::before { color: var(--accent); }
.calendar-host .reminder-ev.is-overdue { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.calendar-host .reminder-ev.is-done { background: transparent; border-color: var(--border-md); color: var(--text-3); text-decoration: line-through; }
.calendar-host .reminder-ev .fc-event-title, .calendar-host .reminder-ev .fc-event-time, .calendar-host .reminder-ev .fc-event-main { color: inherit; }
.calendar-host .reminder-ev .fc-daygrid-event-dot { border-color: currentColor; }
.calendar-host .reminder-ev .fc-event-title::before {
  content: "\f0f3"; /* fa-bell, come campanella topbar e pulsante del ticket */
  font-family: "Font Awesome 7 Free"; font-weight: 900; font-style: normal;
  display: inline-block; margin-right: 4px; text-decoration: none;
}
.calendar-host .reminder-ev:hover { filter: brightness(1.1); }
.calendar-host .shift-ev-absence { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px); }
.shift-detail { max-width: 420px; }
.shift-detail-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 16px 16px; }
.shift-detail-list dt { color: var(--text-2, #64748b); }
.shift-detail-list dd { margin: 0; }

/* ── Pianificazione turni ─────────────────────────── */
.sp-tabs { margin-bottom: 12px; }
.sp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.sp-range { margin: 0 8px; }
.sp-spacer { flex: 1; }
.sp-layout { display: flex; gap: 16px; align-items: flex-start; }
.sp-grid-wrap { flex: 1; min-width: 0; overflow-x: auto; }
.sp-grid { border-collapse: collapse; width: 100%; font-size: 12px; user-select: none; }
.sp-grid th, .sp-grid td { border: 1px solid var(--border, #e2e8f0); padding: 4px; vertical-align: top; min-width: 84px; }
.sp-grid.sp-month th, .sp-grid.sp-month td { min-width: 52px; }
.sp-grid thead th { background: var(--bg-raised, #f8fafc); position: sticky; top: 0; z-index: 1; }
.sp-user-col { min-width: 150px; white-space: nowrap; font-weight: 600; position: sticky; left: 0; background: var(--bg-surface, #fff); z-index: 2; }
.sp-hours-col { text-align: right; white-space: nowrap; }
.sp-day-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.sp-day-btn { border: 0; background: transparent; cursor: pointer; opacity: .55; padding: 0 2px; }
.sp-day-btn:hover { opacity: 1; }
.sp-weekend { background: var(--bg-raised, #f8fafc); }
.sp-today { box-shadow: inset 0 -2px 0 var(--accent, #2563eb); }
.sp-copy-src { outline: 2px dashed var(--accent, #2563eb); outline-offset: -2px; }
.sp-cell { cursor: cell; height: 34px; }
.sp-cell.sp-selected { background: var(--accent-dim); outline: 2px solid var(--accent, #2563eb); outline-offset: -2px; }
.sp-chip { display: inline-block; border: 1px solid #64748b; border-radius: 4px; padding: 1px 4px; margin: 1px; white-space: nowrap; font-size: 11px; }
.sp-chip-pending { border-style: dashed; }
.sp-chip-absence { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.06) 0 4px, transparent 4px 8px); }
.sp-chip-btn { cursor: pointer; background: var(--bg-surface, #fff); font-size: 12px; padding: 4px 8px; }
.sp-not-schedulable .sp-user-col { color: var(--text-2, #64748b); font-style: italic; }
.sp-total td, .sp-band td { text-align: center; font-weight: 600; }
.sp-band td { font-weight: 400; color: var(--text-2, #64748b); }
.sp-warn { color: var(--red, #dc2626); }
.sp-legend { margin-top: 6px; font-size: 12px; }
.sp-editor { width: 300px; flex-shrink: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 12px; background: var(--bg-surface, #fff); }
.sp-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sp-editor-label { display: block; margin: 12px 0 4px; font-size: 12px; }
.sp-editor-item { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
@media (max-width: 900px) { .sp-layout { flex-direction: column; } .sp-editor { width: 100%; } }
.sp-tab-body { margin-top: 4px; }
.sp-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.sp-table th, .sp-table td { border-bottom: 1px solid var(--border, #e2e8f0); padding: 6px 8px; text-align: left; }
.sp-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
.sp-type-form { margin-top: 12px; }
.sp-user-toggle { display: block; margin: 4px 0; }
.sp-filter-user { min-width: 220px; }

/* ─── Impostazioni · Caselle email ───────────────────────────────────────── */
.email-cfg-actions { white-space: nowrap; }
.email-cfg-actions .btn-icon + .btn-icon { margin-left: 4px; }
.email-cfg-error { margin-top: 4px; max-width: 360px; }
.email-cfg-error .alert { margin-bottom: 0; padding: 6px 10px; }
.email-cfg-test { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-raised); font-size: 13px; }
.email-cfg-order { width: 80px; }
.email-cfg-group { min-width: 180px; }
.email-cfg-addr .form-check, .email-cfg-addr-new .form-check { margin-bottom: 0; }
.email-cfg-addr-new { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* ─── Sezione Email: 3 colonne (albero, thread, dettaglio), impilate su mobile ─ */
.email-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(240px, 340px) minmax(0, 1fr);
  gap: 14px; align-items: start; }
.email-col { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px; min-width: 0; max-height: calc(100vh - 150px); overflow-y: auto; }
.email-col-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); margin-bottom: 8px; overflow-wrap: anywhere; }
.email-placeholder { margin: 8px 0; font-size: 13px; }

/* colonna sinistra */
.email-mailbox-select { display: flex; flex-direction: column; gap: 4px; max-width: 420px; margin-bottom: 12px; }
.email-mailbox-name { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; font-size: 13px; overflow-wrap: anywhere; }
.email-mailbox-sync { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; margin-bottom: 8px; }
.email-tree .alert { margin-bottom: 10px; padding: 8px 10px; overflow-wrap: anywhere; }
.email-group + .email-group { margin-top: 6px; }
.email-group-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 4px; border: 0;
  background: transparent; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.email-group-head:hover { color: var(--text-1); background: var(--bg-raised); }
.email-group-head i { width: 12px; color: var(--text-3); }
.email-address-list { list-style: none; margin: 0; padding: 0 0 0 10px; }
.email-address { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-1); font: inherit; font-size: 13px;
  text-align: left; cursor: pointer; transition: background .12s; }
.email-address:hover { background: var(--bg-raised); }
.email-address.active { background: var(--accent-dim); box-shadow: inset 2px 0 0 var(--accent); }
.email-address.inactive { color: var(--text-3); }
.email-address-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.email-address-name, .email-address-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-address-mail { font-size: 11px; color: var(--text-3); }
.email-empty-small { padding: 4px 8px; font-size: 12px; }

/* colonna centrale */
.email-tabs { margin-bottom: 10px; }
.email-thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.email-thread-item { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 8px 10px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-1); font: inherit; text-align: left;
  cursor: pointer; transition: background .12s; }
.email-thread-item:hover { background: var(--bg-raised); }
.email-thread-item.active { background: var(--accent-dim); box-shadow: inset 2px 0 0 var(--accent); }
.email-thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.email-thread-subject { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-thread-item.unread .email-thread-subject { font-weight: 700; }
.email-thread-meta { font-size: 11px; color: var(--text-3); }
.email-thread-meta .badge { margin-left: 4px; }
.email-unread-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.email-more { display: flex; justify-content: center; margin-top: 10px; }

/* colonna destra */
.email-detail-head { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.email-detail-subject { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--text-1); overflow-wrap: anywhere; }
.email-detail-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.email-detail-status .btn { margin-left: auto; }
.email-detail-read { margin-top: 6px; font-size: 12px; }

.email-msg { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-base);
  margin-bottom: 10px; overflow: hidden; }
.email-msg-out { border-left: 3px solid var(--accent); }
.email-msg-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0;
  background: var(--bg-raised); color: var(--text-1); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.email-msg-head:hover { background: var(--bg-hover); }
.email-msg.collapsed .email-msg-head { background: transparent; }
.email-msg-dir { flex: 0 0 auto; color: var(--text-3); }
.email-msg-out .email-msg-dir { color: var(--accent); }
.email-msg-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-msg-date { flex: 0 0 auto; font-size: 12px; }
.email-msg-recipients { padding: 6px 12px; font-size: 12px; overflow-wrap: anywhere; border-bottom: 1px solid var(--border); }
/* corpo HTML: sandbox senza allow-same-origin, altezza non misurabile -> contenitore ridimensionabile */
.email-html { height: 360px; min-height: 120px; resize: vertical; overflow: hidden; background: var(--paper-bg); }
.email-html iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--paper-bg); }
.email-text { margin: 0; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit;
  font-size: 13px; color: var(--text-1); max-height: 480px; overflow-y: auto; }
.email-attachments { list-style: none; margin: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; border-top: 1px solid var(--border); }
.email-attachments li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.email-attachments i { color: var(--text-3); }
.email-msg-actions { display: flex; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); }
.email-notes { padding: 8px 12px 0; border-top: 1px solid var(--border); }
.email-note { padding: 8px 10px; margin-bottom: 8px; border-radius: var(--radius-sm); font-size: 13px;
  background: color-mix(in srgb, var(--amber) 8%, var(--bg-surface)); border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); }
.email-note-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; margin-bottom: 4px; }
.email-note-actions { margin-left: auto; display: inline-flex; gap: 4px; }
.email-note-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-1); }
.email-editor { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; }
.email-note .email-editor { padding: 4px 0 0; }
.email-editor-label { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.email-editor textarea { width: 100%; box-sizing: border-box; resize: vertical; font-family: inherit; }
.email-thread-notes { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.email-thread-notes .email-editor { padding: 4px 0 0; }

@media (max-width: 768px) {
  .email-layout { grid-template-columns: minmax(0, 1fr); }
  .email-col { max-height: none; overflow: visible; }
  .email-html { height: 300px; }
  .email-msg-head { flex-wrap: wrap; }
  .email-msg-date { width: 100%; padding-left: 22px; }
}

/* ─── Promemoria (main.view: icona topbar, popup avvisi, editor, elenco in ritardo) ── */
.reminder-toggle { position: relative; color: var(--red); }
.reminder-box { max-width: 520px; }
.reminder-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 12px; font-size: 12px; color: var(--text-2); }
.reminder-meta a { color: var(--accent); }
.reminder-form a { color: var(--accent); }
.reminder-done { color: var(--green); }
.reminder-state { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 0; font-size: 13px; color: var(--text-2); }
.reminder-state--error { color: var(--red); }
.reminder-form { grid-template-columns: 1fr; margin-bottom: 4px; }
.reminder-editor-actions { flex-wrap: wrap; }
.reminder-editor-actions__delete { margin-right: auto; }
.reminder-popup .modal-header { border-top: 3px solid var(--accent); }
.reminder-popup--due .modal-header { border-top-color: var(--red); }
.reminder-popup__when { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--text-1); }
.reminder-popup--due .reminder-popup__when { color: var(--red); }
.reminder-popup__date { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--text-3); }
.reminder-popup__note { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: var(--text-1); }
.reminder-list { list-style: none; margin: 0; padding: 0; }
.reminder-list__item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.reminder-list__item:last-child { border-bottom: none; }
.reminder-list__head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.reminder-list__title { font-size: 13px; font-weight: 600; color: var(--text-1); overflow-wrap: anywhere; }
.reminder-list__due { font-size: 12px; color: var(--red); }
.reminder-list__item .reminder-meta { margin-bottom: 6px; }
.reminder-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reminder-postpone { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-raised); }
.reminder-postpone__choices { display: flex; flex-wrap: wrap; gap: 6px; }
.reminder-postpone__choices .btn.is-active { color: var(--accent); border-color: var(--accent-border); }
.reminder-postpone__modes { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-1); }
.reminder-postpone__modes label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.reminder-postpone__row { display: flex; flex-direction: column; gap: 8px; }
.reminder-postpone__row .btn { align-self: flex-start; }

@media (min-width: 576px) {
  .reminder-list__head { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; }
  .reminder-list__due { flex-shrink: 0; }
  .reminder-postpone__row { flex-direction: row; align-items: center; }
  .reminder-postpone__row input { flex: 1; min-width: 0; }
  .reminder-postpone__row .btn { align-self: auto; flex-shrink: 0; }
}
