/* ===========================================================================
   CRM Carfer — UI v2 "quiet luxury" (Apple / Jony Ive)
   Materiali + luce reale · precisione · spazio · tipografia · un accento.
   Tema: <html data-theme="dark|light"> (default: dark)
   =========================================================================== */

/* ---------- DARK (elegante, non neon) ---------- */
:root {
  --ux-font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --ux-font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --ux-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ux-bg: #0c0d10;
  --ux-bg-grad: radial-gradient(1400px 700px at 50% -20%, rgba(255, 255, 255, 0.035), transparent 70%);
  --ux-surface: #16171b;
  --ux-surface-2: #1c1e23;
  --ux-paper: #1a1c20;
  --ux-paper-deep: #24262c;
  --ux-table-head: #141519;

  --ux-ink: #f2f3f5;
  --ux-ink-soft: #b7bcc6;
  --ux-ink-muted: #7d828d;
  --ux-line: rgba(255, 255, 255, 0.07);
  --ux-line-soft: rgba(255, 255, 255, 0.045);
  --ux-line-strong: rgba(255, 255, 255, 0.13);

  --ux-side: #0e0f12;
  --ux-side-text: #f2f3f5;
  --ux-side-muted: #7d828d;

  --ux-accent: #7b88ff;
  --ux-accent-hover: #96a0ff;
  --ux-accent-strong: linear-gradient(180deg, #828dff 0%, #6a72f5 100%);
  --ux-accent-soft: rgba(123, 136, 255, 0.13);
  --ux-accent-border: rgba(123, 136, 255, 0.28);
  --ux-accent-ring: rgba(123, 136, 255, 0.35);
  --ux-on-accent: #ffffff;

  --ux-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --ux-shadow-md: 0 4px 14px -4px rgba(0, 0, 0, 0.55), 0 2px 5px -3px rgba(0, 0, 0, 0.5);
  --ux-shadow-lg: 0 28px 64px -24px rgba(0, 0, 0, 0.75);
  --ux-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --ux-cta-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 22px -10px rgba(123, 136, 255, 0.55);
  --ux-elev-1: var(--ux-line);

  --ux-text-xl: 2rem;
  --ux-text-lg: 1.6rem;
  --ux-text-md: 1.0625rem;
  --ux-text-sm: 0.8125rem;

  --ux-ok: #57cc79;
  --ux-ok-soft: rgba(63, 185, 80, 0.14);
  --ux-warn: #e3b341;
  --ux-warn-soft: rgba(214, 165, 20, 0.14);
  --ux-err: #ff6f67;
  --ux-err-soft: rgba(248, 81, 73, 0.14);
  --ux-ship: #7bb6ff;
  --ux-ship-soft: rgba(88, 166, 255, 0.14);

  --ux-unread: rgba(123, 136, 255, 0.085);
  --ux-unread-hover: rgba(123, 136, 255, 0.14);
  --ux-unread-border: var(--ux-accent);

  --ux-msg-in-bg: #1c1e23;
  --ux-msg-in-border: rgba(255, 255, 255, 0.08);
  --ux-msg-out-bg: rgba(123, 136, 255, 0.15);
  --ux-msg-out-border: rgba(123, 136, 255, 0.3);

  --ux-surface-solid: var(--ux-surface);
  --ux-radius: 14px;
  --ux-radius-sm: 10px;
  --ux-radius-lg: 20px;
  --ux-side-w: 16.5rem;
  --ux-side-w-collapsed: 4.5rem;
  --ux-focus: 0 0 0 4px var(--ux-accent-ring);
  --ux-ease: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: dark;
}

/* ---------- LIGHT (Apple: arioso, chiaro, preciso) ---------- */
:root[data-theme='light'] {
  --ux-bg: #f4f5f7;
  --ux-bg-grad: radial-gradient(1400px 700px at 50% -20%, rgba(0, 0, 0, 0.018), transparent 70%);
  --ux-surface: #ffffff;
  --ux-surface-2: #ffffff;
  --ux-paper: #f6f7f9;
  --ux-paper-deep: #eceef2;
  --ux-table-head: #fafbfc;

  --ux-ink: #1d1d1f;
  --ux-ink-soft: #4a4e57;
  --ux-ink-muted: #86868b;
  --ux-line: #e9eaee;
  --ux-line-soft: #f0f1f4;
  --ux-line-strong: #d8dae0;

  --ux-side: #fbfbfd;
  --ux-side-text: #1d1d1f;
  --ux-side-muted: #86868b;

  --ux-accent: #5a57e6;
  --ux-accent-hover: #4744d6;
  --ux-accent-strong: linear-gradient(180deg, #6663ee 0%, #524edf 100%);
  --ux-accent-soft: #eeeefe;
  --ux-accent-border: #d2d1fb;
  --ux-accent-ring: rgba(90, 87, 230, 0.28);
  --ux-on-accent: #ffffff;

  --ux-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --ux-shadow-md: 0 4px 16px -6px rgba(16, 24, 40, 0.14), 0 2px 5px -3px rgba(16, 24, 40, 0.08);
  --ux-shadow-lg: 0 30px 64px -28px rgba(16, 24, 40, 0.22);
  --ux-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --ux-cta-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 10px 22px -12px rgba(90, 87, 230, 0.5);

  --ux-ok: #1a9e4b;
  --ux-ok-soft: #ecfaf1;
  --ux-warn: #b7820a;
  --ux-warn-soft: #fdf6e3;
  --ux-err: #d92d20;
  --ux-err-soft: #fef3f2;
  --ux-ship: #2563eb;
  --ux-ship-soft: #eef4ff;

  --ux-unread: #f3f3fe;
  --ux-unread-hover: #eaeafd;
  --ux-unread-border: var(--ux-accent);

  --ux-msg-in-bg: #f2f3f5;
  --ux-msg-in-border: #e8e9ed;
  --ux-msg-out-bg: #edecfe;
  --ux-msg-out-border: #d8d7fb;

  --ux-surface-solid: #ffffff;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

}

body.ux-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ux-font);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ux-ink);
  background: var(--ux-bg);
  -webkit-font-smoothing: antialiased;
}

.ux-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ux-skip:focus {
  position: fixed;
  z-index: 200;
  left: 1rem;
  top: 1rem;
  padding: 0.6rem 1rem;
  background: var(--ux-surface);
  color: var(--ux-accent);
  font-weight: 600;
  border-radius: var(--ux-radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  text-decoration: none;
}

/* ——— App shell (sidebar) ——— */
.ux-app {
  display: grid;
  grid-template-columns: var(--ux-side-w) 1fr;
  min-height: 100vh;
}

.ux-side {
  display: flex;
  flex-direction: column;
  background: var(--ux-side);
  color: var(--ux-side-text);
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--ux-line);
}

.ux-side__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.65rem 1.5rem;
  font-family: var(--ux-font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ux-side-text);
}

.ux-side__logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.ux-side__logo-svg {
  display: block;
  width: 2rem;
  height: 2rem;
}

.ux-side__nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.ux-side__nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--ux-radius-sm);
  color: var(--ux-side-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.ux-side__nav a:hover {
  background: var(--ux-paper);
  color: var(--ux-side-text);
}

.ux-side__nav a:focus-visible {
  outline: none;
  box-shadow: var(--ux-focus);
}

.ux-side__nav a[aria-current='page'] {
  background: var(--ux-accent-soft);
  color: var(--ux-accent);
  font-weight: 600;
}

.ux-side__nav a[aria-current='page']::before {
  display: none;
}

.ux-side__badge {
  margin-left: auto;
  min-width: 1.35rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: center;
  border-radius: 999px;
  background: var(--ux-accent);
  color: #fff;
}

.ux-side__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.65rem 0;
  margin-top: auto;
  border-top: 1px solid var(--ux-line);
}

.ux-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--ux-paper);
  color: var(--ux-ink-soft);
  border: 1px solid var(--ux-line);
}

.ux-side__who {
  min-width: 0;
  flex: 1;
}

.ux-side__name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ux-side-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ux-side__role {
  font-size: 0.75rem;
  color: var(--ux-side-muted);
}

.ux-side__logout {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ux-side-muted);
  text-decoration: none;
}

.ux-side__logout:hover {
  text-decoration: underline;
}

.ux-side__collapse {
  display: none;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0.35rem 0 0.5rem;
  padding: 0.5rem 0.7rem;
  border: none;
  border-radius: var(--ux-radius-sm);
  background: transparent;
  color: var(--ux-side-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.ux-side__collapse:hover {
  background: var(--ux-paper);
  color: var(--ux-side-text);
}

.ux-side__collapse:focus-visible {
  outline: none;
  box-shadow: var(--ux-focus);
}

.ux-side__collapse svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ux-side__logout {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.ux-side__logout-ico {
  display: none;
}

.ux-side__toggle {
  display: none;
}

@media (min-width: 861px) {
  .ux-side__collapse {
    display: inline-flex;
  }

  html.ux-side-collapsed-pref .ux-app,
  .ux-app.ux-app--side-collapsed {
    --ux-side-w: var(--ux-side-w-collapsed);
  }

  html.ux-side-collapsed-pref .ux-side,
  .ux-app.ux-app--side-collapsed .ux-side {
    padding: 1.15rem 0.45rem;
    align-items: stretch;
  }

  html.ux-side-collapsed-pref .ux-side__brand,
  .ux-app.ux-app--side-collapsed .ux-side__brand {
    justify-content: center;
    padding: 0 0.25rem 1.15rem;
  }

  html.ux-side-collapsed-pref .ux-side__brand-text,
  html.ux-side-collapsed-pref .ux-side__nav a > span,
  html.ux-side-collapsed-pref .ux-side__who,
  html.ux-side-collapsed-pref .ux-side__collapse-text,
  html.ux-side-collapsed-pref .ux-side__theme-text,
  .ux-app.ux-app--side-collapsed .ux-side__brand-text,
  .ux-app.ux-app--side-collapsed .ux-side__nav a > span,
  .ux-app.ux-app--side-collapsed .ux-side__who,
  .ux-app.ux-app--side-collapsed .ux-side__collapse-text,
  .ux-app.ux-app--side-collapsed .ux-side__theme-text {
    display: none;
  }

  html.ux-side-collapsed-pref .ux-side__nav a,
  .ux-app.ux-app--side-collapsed .ux-side__nav a {
    justify-content: center;
    padding: 0.6rem;
    position: relative;
  }

  html.ux-side-collapsed-pref .ux-side__badge,
  .ux-app.ux-app--side-collapsed .ux-side__badge {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    min-width: 0.45rem;
    width: 0.45rem;
    height: 0.45rem;
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    border-radius: 50%;
  }

  html.ux-side-collapsed-pref .ux-side__user,
  .ux-app.ux-app--side-collapsed .ux-side__user {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 0.25rem 0;
  }

  html.ux-side-collapsed-pref .ux-side__logout span,
  .ux-app.ux-app--side-collapsed .ux-side__logout span {
    display: none;
  }

  html.ux-side-collapsed-pref .ux-side__logout-ico,
  .ux-app.ux-app--side-collapsed .ux-side__logout-ico {
    display: block;
  }

  html.ux-side-collapsed-pref .ux-side__logout,
  .ux-app.ux-app--side-collapsed .ux-side__logout {
    justify-content: center;
    padding: 0.35rem;
    border-radius: var(--ux-radius-sm);
  }

  html.ux-side-collapsed-pref .ux-side__theme,
  .ux-app.ux-app--side-collapsed .ux-side__theme {
    justify-content: center;
    padding: 0.55rem;
  }

  html.ux-side-collapsed-pref .ux-side__collapse,
  .ux-app.ux-app--side-collapsed .ux-side__collapse {
    justify-content: center;
    padding: 0.55rem;
  }

  html.ux-side-collapsed-pref .ux-side__collapse svg,
  .ux-app.ux-app--side-collapsed .ux-side__collapse svg {
    transform: rotate(180deg);
  }
}

.ux-work {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.ux-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 2rem;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ux-line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.ux-topbar__menu {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--ux-line-strong);
  border-radius: var(--ux-radius-sm);
  background: var(--ux-surface);
  cursor: pointer;
}

.ux-topbar__title {
  margin: 0;
  font-family: var(--ux-font-display);
  font-size: var(--ux-text-md);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ux-ink);
}

.ux-topbar--compact {
  padding: 0.65rem 2rem;
}

.ux-topbar__app {
  font-size: var(--ux-text-sm);
  font-weight: 600;
  color: var(--ux-ink-muted);
  letter-spacing: -0.01em;
}

.ux-main {
  flex: 1;
  padding: 1.75rem 2rem 3rem;
  max-width: 100rem;
  width: 100%;
}

@media (max-width: 860px) {
  .ux-app {
    grid-template-columns: 1fr;
  }

  .ux-side {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    width: min(var(--ux-side-w), 88vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.2);
  }

  .ux-app.ux-app--menu-open .ux-side {
    transform: translateX(0);
  }

  .ux-side__toggle {
    display: none;
  }

  .ux-app.ux-app--menu-open .ux-side__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 1rem;
    right: 0.85rem;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: var(--ux-radius-sm);
    background: var(--ux-surface);
    color: var(--ux-ink);
    border: 1px solid var(--ux-line);
    box-shadow: var(--ux-shadow-md);
    cursor: pointer;
    z-index: 1;
  }

  .ux-topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .ux-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(30, 41, 59, 0.35);
  }

  .ux-app--menu-open .ux-overlay {
    display: block;
  }
}

/* ——— Auth (standalone) ——— */
.ux-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.ux-auth__card {
  width: 100%;
  max-width: 26rem;
  padding: 2.5rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-lg);
  box-shadow: var(--ux-shadow-md);
}

.ux-auth__card h1 {
  margin: 0 0 0.35rem;
  font-family: var(--ux-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ux-ink);
}

.ux-auth__intro {
  margin: 0 0 1.75rem;
  color: var(--ux-ink-muted);
  font-size: 0.9375rem;
}

.ux-auth__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ux-ink);
}

/* ——— Page header (titolo nel contenuto) ——— */
.ux-page-head {
  margin-bottom: 1.25rem;
}

.ux-page-head__title {
  margin: 0;
  font-size: var(--ux-text-lg);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ux-ink);
}

.ux-page-head__sub {
  margin: 0.35rem 0 0;
  font-size: var(--ux-text-sm);
  color: var(--ux-ink-muted);
}

.ux-page-head--detail .ux-detail-meta {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.ux-cron-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-md);
}

.ux-cron-bar__msg {
  margin: 0;
  flex: 1 1 auto;
  font-size: var(--ux-text-sm);
}

.ux-cron-status--inline {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex: 1 1 auto;
  min-width: min(100%, 16rem);
}

.ux-cron-bar .ux-att-filter {
  flex: 0 1 auto;
  margin-left: auto;
}

.ux-page-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin-bottom: 0.85rem;
}

.ux-page-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  min-width: 0;
}

.ux-page-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.ux-page-toolbar__actions-end {
  margin-left: 0;
}

.ux-page-toolbar .ux-seg a {
  padding: 0.34rem 0.62rem;
  font-size: 0.75rem;
}

.ux-page-toolbar .ux-btn {
  padding: 0.34rem 0.62rem;
  font-size: 0.75rem;
}

.ux-mark-read-form {
  display: flex;
  align-items: center;
  margin: 0;
}

.ux-att-filter {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem 0.38rem;
  padding: 0.18rem 0.4rem;
  background: var(--ux-paper);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-sm);
  margin: 0;
  white-space: nowrap;
}

.ux-att-filter__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ux-ink-muted);
}

.ux-att-filter__date {
  width: 8.5rem;
  min-width: 8.5rem;
  padding: 0.3rem 0.38rem;
  font-size: 0.75rem;
}

.ux-att-filter__sep {
  color: var(--ux-ink-muted);
  font-size: 0.75rem;
}

.ux-att-filter__btn {
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
}

.ux-page-toolbar .ux-toggle {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 0.34rem 0.62rem;
}

.ux-att-filter__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ux-ink-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s var(--ux-ease), color 0.15s var(--ux-ease);
}

.ux-att-filter__clear:hover {
  color: var(--ux-ink);
  background: var(--ux-surface);
}

.ux-col-select {
  width: 2.25rem;
  max-width: 2.25rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  text-align: center;
  vertical-align: middle;
}

.ux-ticket-select {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.ux-ticket-select__input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--ux-accent);
  cursor: pointer;
}

.ux-table--tickets thead .ux-col-select {
  vertical-align: middle;
}

.ux-cron-status {
  --list-style: none;
  --margin: 0 0 1rem;
  --padding: 0.65rem 0.85rem;
  --display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  background: var(--ux-surface);
  --border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-md);
  font-size: var(--ux-text-sm);
}

.ux-cron-status__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: min(100%, 14rem);
}

.ux-cron-status__label {
  font-weight: 600;
  color: var(--ux-ink);
}

.ux-cron-status__value {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: var(--ux-ink-muted);
}

.ux-cron-status__trigger {
  font-size: 0.8125rem;
  color: var(--ux-ink-muted);
}

.ux-cron-status__value .ux-chip {
  font-size: 0.6875rem;
  padding: 0.1rem 0.45rem;
}

@media (max-width: 640px) {
  .ux-cron-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
  }

  .ux-cron-bar .ux-att-filter {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .ux-page-toolbar__row {
    gap: 0.3rem 0.35rem;
  }

  .ux-page-toolbar__actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }

  .ux-page-toolbar__actions .ux-mark-read-form {
    flex: 1;
  }

  .ux-page-toolbar__actions .ux-mark-read-form .ux-btn {
    width: 100%;
  }

  .ux-page-toolbar__actions .ux-toggle {
    flex: 1;
    justify-content: center;
  }

  .ux-page-toolbar .ux-seg {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .ux-page-toolbar .ux-seg::-webkit-scrollbar {
    display: none;
  }

  .ux-page-toolbar .ux-seg a {
    flex: 0 0 auto;
  }

  .ux-att-filter__date {
    width: 7.5rem;
    min-width: 7.5rem;
  }
}

/* ——— Typography & prose ——— */
.ux-display {
  margin: 0 0 0.5rem;
  font-family: var(--ux-font-display);
  font-size: clamp(1.625rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--ux-ink);
}

.ux-lead {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--ux-ink-soft);
  max-width: 36rem;
}

.ux-muted {
  color: var(--ux-ink-muted);
  font-size: 0.875rem;
}

.ux-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ux-ink-muted);
  text-decoration: none;
}

.ux-back:hover {
  color: var(--ux-accent);
}

/* ——— Home dashboard ——— */
.ux-hero {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius);
}

.ux-hero--home {
  border: none;
  background: transparent;
  padding: 0 0 0.5rem;
}

.ux-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.65rem 1.15rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: #fff;
  background: var(--ux-accent);
  border-radius: var(--ux-radius-sm);
  text-decoration: none;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.ux-hero__cta:hover {
  background: var(--ux-accent-hover);
}

.ux-hero__cta:focus-visible {
  outline: none;
  box-shadow: var(--ux-focus);
}

.ux-hero__note {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: var(--ux-ink-muted);
}

.ux-hero__note strong {
  color: var(--ux-accent);
}

.ux-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
}

.ux-tile {
  padding: 1.35rem 1.5rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.ux-tile:hover {
  border-color: var(--ux-line-strong);
  background: var(--ux-paper);
}

.ux-tile__label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ux-ink-muted);
}

.ux-tile__title {
  display: block;
  margin-top: 0.4rem;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

/* ——— Segmented filters ——— */
.ux-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ux-search {
  flex: 1 1 14rem;
  max-width: 22rem;
  position: relative;
}

.ux-search input {
  width: 100%;
  padding: 0.55rem 1rem 0.55rem 2.35rem;
  font: inherit;
  font-size: 0.875rem;
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-sm);
  background: var(--ux-surface-solid);
  color: var(--ux-ink);
  box-shadow: var(--ux-shadow);
}

.ux-search input:focus {
  outline: none;
  border-color: var(--ux-accent);
  box-shadow: var(--ux-focus);
}

.ux-search::before {
  content: '⌕';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ux-ink-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.ux-seg {
  display: inline-flex;
  padding: 0.15rem;
  background: var(--ux-paper);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-sm);
  gap: 0.1rem;
}

.ux-seg a {
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ux-ink-muted);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.12s ease, color 0.12s ease;
}

.ux-seg a:hover {
  color: var(--ux-ink);
}

.ux-seg a[aria-current='page'],
.ux-seg a[aria-current='true'] {
  background: var(--ux-surface);
  color: var(--ux-accent);
  box-shadow: var(--ux-shadow);
}

.ux-filter-count {
  font-size: 0.8125rem;
  color: var(--ux-ink-muted);
  margin-left: auto;
}

/* ——— Datatable ——— */
.ux-dt {
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius);
  overflow: hidden;
}

.ux-dt__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--ux-surface-solid);
  border-bottom: 1px solid var(--ux-line);
}

.ux-dt__search {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 22rem;
}

.ux-dt__info {
  flex: 1 1 auto;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ux-ink-muted);
  text-align: right;
}

.ux-dt__scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ux-dt__footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 1rem;
  background: var(--ux-paper);
  border-top: 1px solid var(--ux-line);
}

.ux-dt__pager {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ux-dt__pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  font-family: inherit;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--ux-ink);
  background: var(--ux-surface-solid);
  border: 1px solid var(--ux-line-strong);
  border-radius: var(--ux-radius-sm);
  cursor: pointer;
}

.ux-dt__pager button:hover:not(:disabled) {
  background: var(--ux-accent-soft);
  border-color: var(--ux-accent);
  color: var(--ux-accent);
}

.ux-dt__pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ux-dt__pageinfo {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ux-ink-muted);
  min-width: 7.5rem;
  text-align: center;
}

.ux-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: transparent;
}

.ux-table caption {
  padding: 0.5rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  color: var(--ux-ink-muted);
  caption-side: top;
}

.ux-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ux-ink-muted);
  background: var(--ux-table-head);
  border-bottom: 1px solid var(--ux-line);
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
}

.ux-table thead th[data-sort-type] {
  cursor: pointer;
  user-select: none;
  color: var(--ux-ink-soft);
}

.ux-table thead th[data-sort-type]:hover {
  color: var(--ux-accent);
  background: var(--ux-accent-soft);
}

.ux-table thead th[data-sort-type]::after {
  content: '⇅';
  margin-left: 0.35rem;
  opacity: 0.35;
  font-size: 0.65rem;
}

.ux-table thead th[aria-sort='ascending']::after {
  content: '↑';
  opacity: 1;
  color: var(--ux-accent);
}

.ux-table thead th[aria-sort='descending']::after {
  content: '↓';
  opacity: 1;
  color: var(--ux-accent);
}

.ux-table tbody td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--ux-line);
  vertical-align: middle;
  color: var(--ux-ink);
}

.ux-table:not(.ux-table--tickets) tbody tr:hover {
  background: var(--ux-paper);
}

.ux-table tbody tr.ux-row--unread {
  background: var(--ux-unread);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--ux-unread-border);
}

.ux-table tbody tr.ux-row--unread:hover {
  background: #e8edff;
}

.ux-table tbody tr.ux-row--off {
  opacity: 0.55;
}


.ux-table--dense thead th,
.ux-table--dense tbody td {
  padding: 0.5rem 0.65rem;
  font-size: 0.8125rem;
}

.ux-table--tickets .ux-col-oggetto {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1100px) {
  .ux-table--tickets .ux-col-oggetto {
    max-width: 28rem;
  }
}

.ux-table--tickets .ux-col-fornitore {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ux-ink-soft);
}

.ux-table--tickets .ux-col-ordine {
  font-family: var(--ux-mono);
  font-weight: 600;
  color: var(--ux-ink-soft);
  white-space: nowrap;
}

.ux-table--tickets tbody tr[data-href]:hover {
  background: var(--ux-paper);
}

.ux-table--tickets tbody tr[data-href]:hover .ux-col-oggetto {
  color: var(--ux-accent);
}

.ux-table a {
  color: var(--ux-accent);
  font-weight: 600;
  text-decoration: none;
}

.ux-table a:hover {
  text-decoration: underline;
}

.ux-table .ux-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-family: ui-monospace, monospace;
}

.ux-select {
  font: inherit;
  font-size: 0.875rem;
  min-height: 2.5rem;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border: 1px solid var(--ux-line-strong);
  border-radius: var(--ux-radius-sm);
  background: var(--ux-surface-solid)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E")
    no-repeat right 0.55rem center;
  color: var(--ux-ink);
  cursor: pointer;
  appearance: none;
}

.ux-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--ux-surface);
  border: 1px dashed var(--ux-line-strong);
  border-radius: var(--ux-radius);
}

.ux-empty__title {
  margin: 0 0 0.5rem;
  font-family: var(--ux-font-display);
  font-size: 1.25rem;
}

/* ——— Chips ——— */
.ux-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  background: var(--ux-paper-deep);
  color: var(--ux-ink-soft);
}

.ux-chip--new {
  background: var(--ux-accent);
  color: #fff;
}

.ux-chip--ok {
  background: var(--ux-ok-soft);
  color: var(--ux-ok);
}

.ux-chip--ship {
  background: #eef2ff;
  color: #4338ca;
}

.ux-chip--warn {
  background: #fef3c7;
  color: #b45309;
}

.ux-chip--err {
  background: var(--ux-err-soft);
  color: var(--ux-err);
}

.ux-chip--idle {
  background: var(--ux-paper-deep);
  color: var(--ux-ink-muted);
}

/* ——— Chat ticket ——— */
.ux-app--chat {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  width: 100%;
}

.ux-app--chat .ux-topbar {
  display: none;
}

.ux-app--chat .ux-work {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ux-main--chat {
  padding: 0;
  max-width: none;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 861px) {
  html.ux-side-collapsed-pref .ux-app--chat,
  .ux-app--chat.ux-app--side-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  html.ux-side-collapsed-pref .ux-app--chat .ux-side,
  .ux-app--chat.ux-app--side-collapsed .ux-side {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    height: 100dvh;
    width: var(--ux-side-w-collapsed);
    border-right: 1px solid var(--ux-line);
    box-shadow: 4px 0 20px rgba(15, 23, 42, 0.06);
  }

  html.ux-side-collapsed-pref .ux-app--chat .ux-work,
  .ux-app--chat.ux-app--side-collapsed .ux-work {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100vw;
    padding-left: var(--ux-side-w-collapsed);
    box-sizing: border-box;
  }

  html.ux-side-collapsed-pref .ux-app--chat .ux-main--chat,
  .ux-app--chat.ux-app--side-collapsed .ux-main--chat,
  html.ux-side-collapsed-pref .ux-app--chat .ux-chat,
  .ux-app--chat.ux-app--side-collapsed .ux-chat {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
  }
}

.ux-chat {
  flex: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
  background: #fff;
}

.ux-chat__header {
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--ux-line);
  z-index: 10;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.ux-chat__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: #54656f;
  text-decoration: none;
  flex-shrink: 0;
}

.ux-chat__back:hover {
  background: rgba(0, 0, 0, 0.06);
}

.ux-chat__head-info {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.ux-chat__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin-top: 0.5rem;
}

.ux-chat__order-att {
  margin-top: 0.55rem;
}

.ux-chat__order-att-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ux-ink-muted);
}

.ux-chat__order-files {
  margin: 0;
}

.ux-chat__action-link {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ux-accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ux-chat__action-link:hover {
  color: var(--ux-accent-hover);
}

.ux-chat__action-link[aria-expanded='true'] {
  font-weight: 600;
}

.ux-chat__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ux-chat__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ux-chat__ritiro-panel {
  margin-top: 0.65rem;
  padding: 0.75rem;
  background: var(--ux-accent-soft);
  border: 1px solid var(--ux-accent-border);
  border-radius: 8px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.ux-chat__ritiro-panel[hidden] {
  display: none !important;
}

.ux-chat__head-info > .ux-flash {
  margin-top: 0.5rem;
  max-width: 28rem;
}

.ux-chat__ritiro-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.ux-ritiro-fields {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 0.65rem 1rem;
  align-items: end;
  min-width: 0;
}

.ux-ritiro-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.ux-ritiro-field__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ux-ink-soft);
  line-height: 1.2;
}

.ux-ritiro-field__input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.ux-chat__ritiro-save {
  flex-shrink: 0;
  margin-bottom: 1px;
}

@media (max-width: 640px) {
  .ux-ritiro-fields {
    grid-template-columns: 1fr;
  }

  .ux-chat__ritiro-form {
    flex-direction: column;
    align-items: stretch;
  }

  .ux-chat__ritiro-save {
    width: 100%;
    margin-bottom: 0;
  }
}

.ux-chat__thread {
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
  background: #fff;
}

.ux-chat__empty {
  margin: auto;
  text-align: center;
  font-size: 0.875rem;
  color: #667781;
  max-width: 16rem;
}

.ux-chat__composer {
  grid-row: 3;
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding: 0.65rem 1.25rem;
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid var(--ux-line);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.ux-chat__composer .ux-flash {
  margin-bottom: 0.5rem;
}

.ux-chat__hint {
  margin: 0 0 0.35rem 0.25rem;
  font-size: 0.6875rem;
  color: #667781;
}

.ux-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.ux-chat__attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  color: #54656f;
  cursor: pointer;
  flex-shrink: 0;
}

.ux-chat__attach:hover {
  color: #111b21;
}

.ux-chat__input-wrap {
  flex: 1;
  min-width: 0;
  background: #f9fafb;
  border-radius: 1.25rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--ux-line);
}

.ux-chat__input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  max-height: 8rem;
  background: transparent;
  color: #111b21;
}

.ux-chat__send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, transform 0.12s ease;
}

.ux-chat__send:hover:not(:disabled) {
  background: #20bd5a;
}

.ux-chat__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ux-file-preview-wrap {
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--ux-accent-soft);
  border: 1px solid var(--ux-accent-border);
  border-radius: var(--ux-radius-sm);
}

.ux-file-preview__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ux-accent-hover);
}

.ux-file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ux-file-preview__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.35rem 0.35rem 0.35rem 0.55rem;
  background: #fff;
  border: 1px solid var(--ux-line);
  border-radius: 999px;
  font-size: 0.8125rem;
  line-height: 1.2;
}

.ux-file-preview__name {
  font-weight: 500;
  color: var(--ux-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.ux-file-preview__meta {
  flex-shrink: 0;
  font-size: 0.6875rem;
  color: var(--ux-ink-muted);
}

.ux-file-preview__remove {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ux-ink-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.ux-file-preview__remove:hover {
  background: var(--ux-paper-deep);
  color: var(--ux-err);
}

/* Bolle messaggio */
.ux-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  margin-bottom: 0.15rem;
}

.ux-msg--out {
  align-self: flex-end;
  align-items: flex-end;
}

.ux-msg--in {
  align-self: flex-start;
  align-items: flex-start;
}

.ux-msg__name {
  margin: 0 0 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ux-ink-muted);
}

.ux-msg__bubble {
  position: relative;
  padding: 0.5rem 0.7rem 0.4rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  word-break: break-word;
}

.ux-msg--in .ux-msg__bubble {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-top-left-radius: 0.125rem;
}

.ux-msg--out .ux-msg__bubble {
  background: #e0eaff;
  border: 1px solid #c7d7fe;
  border-top-right-radius: 0.125rem;
}

.ux-msg__subject {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #667781;
}

.ux-msg__body {
  font-size: 0.9375rem;
  line-height: 1.45;
  color: #111b21;
}

.ux-msg__body--html {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ux-msg__body--html .ux-msg__p,
.ux-msg__body--html .crm-msg__p {
  margin: 0 0 0.45em;
}

.ux-msg__body--html .ux-msg__p:last-child,
.ux-msg__body--html .crm-msg__p:last-child {
  margin-bottom: 0;
}

.ux-msg__body--html h1,
.ux-msg__body--html h2,
.ux-msg__body--html h3,
.ux-msg__body--html h4,
.ux-msg__body--html h5,
.ux-msg__body--html h6 {
  margin: 0.35em 0 0.2em;
  font-weight: 600;
  line-height: 1.3;
}

.ux-msg__body--html h1 { font-size: 1.15em; }
.ux-msg__body--html h2 { font-size: 1.1em; }
.ux-msg__body--html h3 { font-size: 1.05em; }
.ux-msg__body--html h4,
.ux-msg__body--html h5,
.ux-msg__body--html h6 { font-size: 1em; }

.ux-msg__body--html ul,
.ux-msg__body--html ol {
  margin: 0.35em 0;
  padding-left: 1.25em;
}

.ux-msg__body--html blockquote {
  margin: 0.35em 0;
  padding: 0.15em 0 0.15em 0.65em;
  border-left: 3px solid var(--ux-line);
  color: var(--ux-ink-muted);
}

.ux-msg__body--html table {
  border-collapse: collapse;
  max-width: 100%;
  margin: 0.35em 0;
  display: block;
  overflow-x: auto;
}

.ux-msg__body--html th,
.ux-msg__body--html td {
  border: 1px solid var(--ux-line-soft);
  padding: 0.25em 0.5em;
  vertical-align: top;
  text-align: left;
}

.ux-msg__body--html img {
  max-width: 100%;
  height: auto;
}

.ux-msg__body--html a {
  color: #027eb5;
}

.ux-msg--out .ux-msg__body--html a {
  color: var(--ux-accent-hover);
}

.ux-msg__time {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  color: #667781;
  text-align: right;
  line-height: 1;
}

.ux-msg__files {
  list-style: none;
  margin: 0.45rem 0 0.15rem;
  padding: 0;
  font-size: 0.8125rem;
}

.ux-msg__files a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 0.35rem;
  color: #027eb5;
  font-weight: 500;
  text-decoration: none;
}

.ux-msg__files a::before {
  content: '📎';
  font-size: 0.75rem;
}

.ux-panel {
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius);
  overflow: hidden;
}

.ux-panel__title {
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ux-ink-muted);
  border-bottom: 1px solid var(--ux-line);
  background: var(--ux-paper);
}

/* ——— Forms & buttons ——— */
.ux-field {
  margin-bottom: 1.15rem;
}

.ux-field > label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ux-ink-soft);
}

.ux-input,
.ux-field input:not([type='checkbox']):not([type='file']),
.ux-field textarea,
.ux-field select {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--ux-line-strong);
  border-radius: var(--ux-radius-sm);
  background: var(--ux-surface-solid);
  color: var(--ux-ink);
}

.ux-field textarea {
  min-height: 7rem;
  resize: vertical;
}

.ux-input:focus,
.ux-field input:focus,
.ux-field textarea:focus,
.ux-field select:focus {
  outline: none;
  border-color: var(--ux-accent);
  box-shadow: var(--ux-focus);
}

.ux-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--ux-ink-muted);
}

.ux-field--check label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.ux-field--check input {
  margin-top: 0.2rem;
  accent-color: var(--ux-accent);
}

.ux-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 0.95rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--ux-radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.ux-btn:focus-visible {
  outline: none;
  box-shadow: var(--ux-focus);
}

.ux-btn:disabled,
.ux-btn[aria-busy='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}

.ux-btn--primary {
  background: var(--ux-accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.ux-btn--primary:hover:not(:disabled) {
  background: var(--ux-accent-hover);
}

.ux-btn--soft {
  background: var(--ux-surface);
  color: var(--ux-ink-soft);
  border: 1px solid var(--ux-line);
  box-shadow: var(--ux-shadow);
}

.ux-btn--soft:hover:not(:disabled) {
  background: var(--ux-paper);
  border-color: var(--ux-line-strong);
}

.ux-btn--block {
  width: 100%;
}

.ux-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* ——— Alerts ——— */
.ux-flash {
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--ux-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.ux-flash--ok {
  background: var(--ux-ok-soft);
  color: var(--ux-ok);
  border-color: rgba(22, 101, 52, 0.2);
}

.ux-flash--err {
  background: var(--ux-err-soft);
  color: var(--ux-err);
  border-color: rgba(185, 28, 28, 0.2);
}

.ux-flash--warn {
  background: var(--ux-warn-soft);
  color: var(--ux-warn);
  border-color: rgba(161, 98, 7, 0.25);
}

/* ——— Admin user list ——— */
.ux-users {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ux-user {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius);
}

.ux-user__name {
  font-weight: 700;
  font-size: 1rem;
}

.ux-user__meta {
  grid-column: 1;
  font-size: 0.8125rem;
  color: var(--ux-ink-muted);
}

.ux-user__actions {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.ux-user--off {
  opacity: 0.65;
}

.ux-bare {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.ux-nav-ico {
  flex-shrink: 0;
  opacity: 0.7;
}

.ux-side__nav a[aria-current='page'] .ux-nav-ico {
  opacity: 1;
}

.ux-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ux-stat {
  flex: 1 1 8rem;
  padding: 0.85rem 1.1rem;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius);
}

.ux-stat--highlight {
  border-color: var(--ux-accent-border);
  background: var(--ux-accent-soft);
}

.ux-stat__n {
  display: block;
  font-family: var(--ux-font-display);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ux-ink);
}

.ux-stat--highlight .ux-stat__n {
  color: var(--ux-accent-hover);
}

.ux-stat--action {
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.ux-stat--action:hover {
  border-color: var(--ux-accent);
  background: #e0e7ff;
}

.ux-stat--action:focus-visible {
  outline: none;
  box-shadow: var(--ux-focus);
}

.ux-table--tickets tbody tr[data-href] {
  cursor: pointer;
}

.ux-table--tickets tbody tr[data-href]:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--ux-accent);
  background: var(--ux-accent-soft);
}

.ux-dt__empty {
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ux-ink-muted);
}

@media (max-width: 768px) {
  .ux-col--hide-sm {
    display: none;
  }
}

.ux-stat__l {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ux-ink-muted);
}

.ux-search__kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.15rem 0.45rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ux-ink-muted);
  background: var(--ux-paper-deep);
  border: 1px solid var(--ux-line);
  border-radius: 4px;
  pointer-events: none;
}

.ux-toggle {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--ux-radius-sm);
  border: 1px solid var(--ux-line-strong);
  background: var(--ux-surface);
  color: var(--ux-ink-soft);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ux-toggle:hover {
  border-color: var(--ux-accent);
  color: var(--ux-accent);
}

.ux-toggle[aria-pressed='true'] {
  background: var(--ux-accent);
  border-color: var(--ux-accent);
  color: #fff;
}

.ux-toggle:focus-visible {
  outline: none;
  box-shadow: var(--ux-focus);
}


.ux-field .ux-file-preview {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--ux-ink-soft);
}

.ux-field .ux-file-preview li {
  padding: 0.2rem 0;
}

.ux-flash[data-ux-autodismiss] {
  animation: ux-flash-in 0.35s ease;
}

@keyframes ux-flash-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .ux-search__kbd {
    display: none;
  }

  .ux-msg {
    max-width: 90%;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body.ux-body {
  margin: 0; min-height: 100vh;
  font-family: var(--ux-font);
  font-size: 0.9375rem; line-height: 1.55;
  color: var(--ux-ink);
  background: var(--ux-bg-grad), var(--ux-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}
::selection { background: var(--ux-accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--ux-line-strong) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--ux-line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ux-ink-muted); background-clip: padding-box; }

.ux-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- App shell (duplicate block — desktop-only per grid/sticky sidebar) ---------- */
.ux-side {
  display: flex;
  flex-direction: column;
  padding: 1.4rem 0.9rem;
  background: var(--ux-side);
  color: var(--ux-side-text);
}

@media (min-width: 861px) {
  .ux-app {
    grid-template-columns: var(--ux-side-w) 1fr;
  }

  .ux-side {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--ux-line);
  }
}
.ux-side__brand {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.4rem 0.6rem 1.6rem;
  font-family: var(--ux-font-display); font-size: 0.95rem; font-weight: 600; letter-spacing: -0.02em;
}
.ux-side__logo { flex-shrink: 0; display: flex; line-height: 0; }
.ux-side__logo-svg { display: block; width: 1.9rem; height: 1.9rem; border-radius: 10px; box-shadow: var(--ux-shadow-md); }

.ux-side__nav { display: flex; flex-direction: column; gap: 0.12rem; flex: 1; }
.ux-side__nav a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.7rem; border-radius: var(--ux-radius-sm);
  color: var(--ux-side-muted); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: background 0.18s var(--ux-ease), color 0.18s var(--ux-ease);
}
.ux-side__nav a:hover { background: var(--ux-paper); color: var(--ux-side-text); }
.ux-side__nav a:focus-visible { outline: none; box-shadow: var(--ux-focus); }
.ux-side__nav a[aria-current='page'] { background: var(--ux-accent-soft); color: var(--ux-accent); font-weight: 600; }
.ux-nav-ico { flex-shrink: 0; opacity: 0.7; }
.ux-side__nav a[aria-current='page'] .ux-nav-ico { opacity: 1; }
.ux-side__badge {
  margin-left: auto; min-width: 1.35rem; padding: 0.08rem 0.45rem; font-size: 0.6875rem; font-weight: 600;
  text-align: center; border-radius: 999px; background: var(--ux-accent); color: var(--ux-on-accent);
}

.ux-side__user { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 0.6rem 0.1rem; margin-top: auto; border-top: 1px solid var(--ux-line); }
.ux-avatar {
  flex-shrink: 0; width: 2.3rem; height: 2.3rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; background: var(--ux-accent-soft); color: var(--ux-accent); border: 1px solid var(--ux-accent-border);
}
.ux-side__who { min-width: 0; flex: 1; }
.ux-side__name { font-size: 0.8125rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-side__role { font-size: 0.75rem; color: var(--ux-side-muted); }
.ux-side__logout { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.2rem; font-size: 0.75rem; font-weight: 500; color: var(--ux-side-muted); text-decoration: none; }
.ux-side__logout:hover { color: var(--ux-ink); }

.ux-side__theme {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; margin: 0.1rem 0 0.3rem; padding: 0.55rem 0.7rem;
  border: none; border-radius: var(--ux-radius-sm); background: transparent; color: var(--ux-side-muted);
  font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: background 0.18s var(--ux-ease), color 0.18s var(--ux-ease);
}
.ux-side__theme:hover { background: var(--ux-paper); color: var(--ux-side-text); }
.ux-side__theme svg { flex-shrink: 0; }
.ux-side__theme .ux-theme-sun, .ux-theme-fab .ux-theme-sun { display: none; }
:root[data-theme='light'] .ux-side__theme .ux-theme-sun, :root[data-theme='light'] .ux-theme-fab .ux-theme-sun { display: block; }
:root[data-theme='light'] .ux-side__theme .ux-theme-moon, :root[data-theme='light'] .ux-theme-fab .ux-theme-moon { display: none; }

.ux-work { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.ux-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 2.5rem; background: color-mix(in srgb, var(--ux-bg) 70%, transparent);
  backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--ux-line);
}
.ux-topbar__app { font-size: var(--ux-text-sm); font-weight: 600; color: var(--ux-ink-muted); letter-spacing: -0.01em; }
.ux-topbar__title { margin: 0; font-family: var(--ux-font-display); font-size: var(--ux-text-md); font-weight: 600; letter-spacing: -0.02em; }

.ux-main { flex: 1; padding: 2.5rem 2.5rem 4rem; max-width: 84rem; width: 100%; }

/* ---------- Page head ---------- */
.ux-page-head { margin-bottom: 1.75rem; }
.ux-page-head__title { margin: 0; font-family: var(--ux-font-display); font-size: var(--ux-text-lg); font-weight: 600; letter-spacing: -0.035em; line-height: 1.1; }
.ux-page-head__sub { margin: 0.45rem 0 0; font-size: 0.95rem; color: var(--ux-ink-muted); }

/* ---------- Dashboard (Home) ---------- */
.ux-dash__greet { margin: 0; font-family: var(--ux-font-display); font-size: var(--ux-text-xl); font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; }
.ux-dash__sub { margin: 0.5rem 0 2rem; font-size: 1.0625rem; color: var(--ux-ink-muted); }

.ux-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 2.25rem; }
.ux-metric {
  position: relative; padding: 1.35rem 1.4rem; background: var(--ux-surface); border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius); box-shadow: var(--ux-sheen), var(--ux-shadow);
  transition: transform 0.2s var(--ux-ease), box-shadow 0.2s var(--ux-ease), border-color 0.2s var(--ux-ease);
}
a.ux-metric:hover, .ux-metric--link:hover { transform: translateY(-2px); box-shadow: var(--ux-sheen), var(--ux-shadow-md); border-color: var(--ux-line-strong); }
.ux-metric { text-decoration: none; color: inherit; display: block; }
.ux-metric__label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ux-ink-muted); }
.ux-metric__value { display: block; margin-top: 0.65rem; font-family: var(--ux-font-display); font-size: 2.1rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ux-metric__hint { display: block; margin-top: 0.55rem; font-size: 0.8125rem; color: var(--ux-ink-muted); }
.ux-metric--accent { background: linear-gradient(180deg, var(--ux-accent-soft), transparent), var(--ux-surface); border-color: var(--ux-accent-border); }
.ux-metric--accent .ux-metric__value { color: var(--ux-accent); }
.ux-metric__ico { position: absolute; top: 1.2rem; right: 1.2rem; color: var(--ux-ink-muted); opacity: 0.55; }
.ux-metric--accent .ux-metric__ico { color: var(--ux-accent); opacity: 0.7; }

.ux-section { margin-bottom: 2rem; }
.ux-section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.9rem; }
.ux-section__title { margin: 0; font-family: var(--ux-font-display); font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; }
.ux-section__link { font-size: 0.8125rem; font-weight: 500; color: var(--ux-accent); text-decoration: none; }
.ux-section__link:hover { color: var(--ux-accent-hover); }

.ux-feed { background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: var(--ux-radius); box-shadow: var(--ux-sheen), var(--ux-shadow); overflow: hidden; }
.ux-feed__item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.25rem 1rem; padding: 0.95rem 1.25rem; border-bottom: 1px solid var(--ux-line-soft); text-decoration: none; color: inherit; transition: background 0.15s var(--ux-ease); }
.ux-feed__item:last-child { border-bottom: none; }
.ux-feed__item:hover { background: var(--ux-paper); }
.ux-feed__ord { font-family: var(--ux-mono); font-size: 0.8125rem; font-weight: 600; color: var(--ux-ink-soft); font-variant-numeric: tabular-nums; }
.ux-feed__subj { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ux-feed__meta { grid-column: 2; font-size: 0.8125rem; color: var(--ux-ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ux-feed__time { font-size: 0.8125rem; color: var(--ux-ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ux-feed__item--unread .ux-feed__ord::before { content: ''; display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.4rem; border-radius: 50%; background: var(--ux-accent); vertical-align: middle; }
.ux-feed__item--unread .ux-feed__subj { color: var(--ux-ink); }

.ux-quick { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- Stats (legacy ticket header) ---------- */
.ux-stats { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.ux-stat { flex: 1 1 9rem; padding: 1.1rem 1.3rem; background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: var(--ux-radius); box-shadow: var(--ux-sheen), var(--ux-shadow); }
.ux-stat--highlight { border-color: var(--ux-accent-border); background: linear-gradient(180deg, var(--ux-accent-soft), transparent), var(--ux-surface); }
.ux-stat__n { display: block; font-family: var(--ux-font-display); font-size: 1.9rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ux-stat--highlight .ux-stat__n { color: var(--ux-accent); }
.ux-stat__l { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ux-ink-muted); }

/* ---------- Toolbar / filtri ---------- */
.ux-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.85rem; margin-bottom: 1.5rem; }
.ux-search { flex: 1 1 16rem; max-width: 26rem; position: relative; }
.ux-search input {
  width: 100%; padding: 0.65rem 2.6rem 0.65rem 2.5rem; font: inherit; font-size: 0.9rem;
  border: 1px solid var(--ux-line); border-radius: var(--ux-radius-sm); background: var(--ux-surface); color: var(--ux-ink);
  box-shadow: var(--ux-sheen); transition: border-color 0.18s var(--ux-ease), box-shadow 0.18s var(--ux-ease);
}
.ux-search input::placeholder { color: var(--ux-ink-muted); }
.ux-search input:focus { outline: none; border-color: var(--ux-accent); box-shadow: var(--ux-focus); }
.ux-search::before { content: '⌕'; position: absolute; left: 0.95rem; top: 50%; transform: translateY(-50%); color: var(--ux-ink-muted); font-size: 1.05rem; pointer-events: none; }
.ux-search__kbd { position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%); padding: 0.15rem 0.45rem; font-family: var(--ux-mono); font-size: 0.6875rem; color: var(--ux-ink-muted); background: var(--ux-paper-deep); border: 1px solid var(--ux-line); border-radius: 6px; pointer-events: none; }

.ux-seg { display: inline-flex; padding: 0.22rem; gap: 0.12rem; background: var(--ux-paper); border: 1px solid var(--ux-line); border-radius: var(--ux-radius-sm); }
.ux-seg a { padding: 0.42rem 0.85rem; font-size: 0.8125rem; font-weight: 500; color: var(--ux-ink-muted); text-decoration: none; border-radius: 7px; transition: background 0.18s var(--ux-ease), color 0.18s var(--ux-ease); }
.ux-seg a:hover { color: var(--ux-ink); }
.ux-seg a[aria-current='page'] { background: var(--ux-surface); color: var(--ux-ink); box-shadow: var(--ux-shadow); font-weight: 600; }

/* ---------- Datatable ---------- */
.ux-dt { background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: var(--ux-radius); overflow: hidden; box-shadow: var(--ux-sheen), var(--ux-shadow-md); }
.ux-dt__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--ux-line); }
.ux-dt__info { flex: 1 1 auto; font-size: 0.8125rem; font-weight: 500; color: var(--ux-ink-muted); text-align: right; }
.ux-dt__scroll { overflow-x: auto; }
.ux-dt__footer { display: flex; justify-content: flex-end; padding: 0.7rem 1.25rem; background: var(--ux-paper); border-top: 1px solid var(--ux-line); }
.ux-dt__pager { display: inline-flex; align-items: center; gap: 0.5rem; }
.ux-dt__pager button { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; min-height: 2.4rem; font-size: 1.05rem; color: var(--ux-ink); background: var(--ux-surface); border: 1px solid var(--ux-line-strong); border-radius: var(--ux-radius-sm); cursor: pointer; transition: all 0.15s var(--ux-ease); }
.ux-dt__pager button:hover:not(:disabled) { background: var(--ux-accent-soft); border-color: var(--ux-accent); color: var(--ux-accent); }
.ux-dt__pager button:disabled { opacity: 0.35; cursor: not-allowed; }
.ux-dt__pageinfo { font-size: 0.8125rem; font-weight: 500; color: var(--ux-ink-muted); min-width: 7rem; text-align: center; font-variant-numeric: tabular-nums; }

.ux-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ux-table thead th { position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 600; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ux-ink-muted); background: var(--ux-table-head); border-bottom: 1px solid var(--ux-line); padding: 0.8rem 1rem; white-space: nowrap; }
.ux-table thead th[data-sort-type] { cursor: pointer; user-select: none; }
.ux-table thead th[data-sort-type]:hover { color: var(--ux-accent); }
.ux-table thead th[data-sort-type]::after { content: '⇅'; margin-left: 0.35rem; opacity: 0.3; font-size: 0.65rem; }
.ux-table thead th[aria-sort='ascending']::after { content: '↑'; opacity: 1; color: var(--ux-accent); }
.ux-table thead th[aria-sort='descending']::after { content: '↓'; opacity: 1; color: var(--ux-accent); }
.ux-table tbody td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--ux-line-soft); vertical-align: middle; }
.ux-table tbody tr:last-child td { border-bottom: none; }
.ux-table--tickets tbody tr[data-href] { cursor: pointer; transition: background 0.15s var(--ux-ease); }
.ux-table--tickets tbody tr[data-href]:hover { background: var(--ux-paper); }
.ux-table--tickets tbody tr[data-href]:hover .ux-col-oggetto { color: var(--ux-accent); }
.ux-table tbody tr.ux-row--unread { background: var(--ux-unread); box-shadow: inset 2px 0 0 var(--ux-unread-border); }
.ux-table tbody tr.ux-row--unread:hover { background: var(--ux-unread-hover); }
.ux-table--tickets .ux-col-ordine { font-family: var(--ux-mono); font-weight: 600; color: var(--ux-ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ux-table--tickets tbody tr.ux-row--unread .ux-col-ordine::before { content: ''; display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.45rem; border-radius: 50%; background: var(--ux-accent); vertical-align: middle; }
.ux-table--tickets .ux-col-oggetto { max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.15s var(--ux-ease); }
.ux-table--tickets .ux-col-fornitore { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ux-ink-soft); }

/* ---------- Chips ---------- */
.ux-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em; border-radius: 999px; background: var(--ux-paper-deep); color: var(--ux-ink-soft); }
.ux-chip::before { content: ''; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: currentColor; }
.ux-chip--ok { background: var(--ux-ok-soft); color: var(--ux-ok); }
.ux-chip--ship { background: var(--ux-ship-soft); color: var(--ux-ship); }
.ux-chip--warn { background: #fef3c7; color: #b45309; }
.ux-chip--err { background: var(--ux-err-soft); color: var(--ux-err); }
.ux-chip--idle { background: var(--ux-paper-deep); color: var(--ux-ink-muted); }
.ux-chip--idle::before { display: none; }

/* ---------- Buttons ---------- */
.ux-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.5rem; padding: 0 1.2rem; font: inherit; font-size: 0.875rem; font-weight: 600; border-radius: var(--ux-radius-sm); border: none; cursor: pointer; text-decoration: none; transition: filter 0.18s var(--ux-ease), background 0.18s var(--ux-ease), border-color 0.18s var(--ux-ease), box-shadow 0.18s var(--ux-ease), transform 0.08s var(--ux-ease); }
.ux-btn:active { transform: translateY(0.5px); }
.ux-btn:focus-visible { outline: none; box-shadow: var(--ux-focus); }
.ux-btn--primary { background: var(--ux-accent-strong); color: var(--ux-on-accent); box-shadow: var(--ux-cta-shadow); }
.ux-btn--primary:hover { filter: brightness(1.06); }
.ux-btn--soft { background: var(--ux-surface); color: var(--ux-ink-soft); border: 1px solid var(--ux-line-strong); box-shadow: var(--ux-sheen); }
.ux-btn--soft:hover { border-color: var(--ux-ink-muted); color: var(--ux-ink); }
.ux-btn--block { width: 100%; }

/* ---------- Forms ---------- */
.ux-field { margin-bottom: 1.2rem; }
.ux-field > label { display: block; margin-bottom: 0.45rem; font-size: 0.8125rem; font-weight: 600; color: var(--ux-ink-soft); }
.ux-input, .ux-field input:not([type='checkbox']), .ux-field textarea, .ux-field select { width: 100%; font: inherit; font-size: 0.9375rem; padding: 0.75rem 0.9rem; border: 1px solid var(--ux-line-strong); border-radius: var(--ux-radius-sm); background: var(--ux-surface); color: var(--ux-ink); box-shadow: var(--ux-sheen); transition: border-color 0.18s var(--ux-ease), box-shadow 0.18s var(--ux-ease); }
.ux-input::placeholder { color: var(--ux-ink-muted); }
.ux-input:focus, .ux-field input:focus, .ux-field textarea:focus { outline: none; border-color: var(--ux-accent); box-shadow: var(--ux-focus); }

/* ---------- Flash ---------- */
.ux-flash { padding: 0.85rem 1rem; margin-bottom: 1rem; border-radius: var(--ux-radius-sm); font-size: 0.875rem; font-weight: 500; border: 1px solid transparent; }
.ux-flash--ok { background: var(--ux-ok-soft); color: var(--ux-ok); }
.ux-flash--err { background: var(--ux-err-soft); color: var(--ux-err); }
.ux-flash--warn { background: var(--ux-warn-soft); color: var(--ux-warn); }

/* ---------- Auth ---------- */
.ux-auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1.25rem; }
.ux-auth__card { width: 100%; max-width: 25rem; padding: 2.75rem 2.5rem; background: var(--ux-surface); border: 1px solid var(--ux-line); border-radius: var(--ux-radius-lg); box-shadow: var(--ux-sheen), var(--ux-shadow-lg); }
.ux-auth__brand { display: flex; align-items: center; gap: 0.7rem; padding: 0 0 1.6rem; font-size: 0.95rem; font-weight: 600; }
.ux-auth__card h1 { margin: 0 0 0.45rem; font-family: var(--ux-font-display); font-size: 1.65rem; font-weight: 600; letter-spacing: -0.03em; }
.ux-auth__intro { margin: 0 0 1.85rem; color: var(--ux-ink-muted); font-size: 0.95rem; }
.ux-theme-fab { position: fixed; top: 1.4rem; right: 1.4rem; z-index: 50; display: inline-flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; border-radius: var(--ux-radius-sm); background: var(--ux-surface); border: 1px solid var(--ux-line); color: var(--ux-ink-soft); cursor: pointer; box-shadow: var(--ux-sheen), var(--ux-shadow); transition: border-color 0.18s var(--ux-ease), color 0.18s var(--ux-ease); }
.ux-theme-fab:hover { border-color: var(--ux-line-strong); color: var(--ux-ink); }

/* ---------- Chat ---------- */
.ux-app--chat { height: 100dvh; overflow: hidden; }
.ux-app--chat .ux-topbar { display: none; }
.ux-app--chat .ux-work { height: 100%; overflow: hidden; }
.ux-main--chat { padding: 0; max-width: none; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ux-chat { flex: 1; display: grid; grid-template-rows: auto minmax(0,1fr) auto; min-height: 0; height: 100%; background: var(--ux-bg); }
.ux-chat__header { display: flex; align-items: flex-start; gap: 0.85rem; padding: 0.85rem 1.6rem; background: color-mix(in srgb, var(--ux-bg) 70%, transparent); backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%); border-bottom: 1px solid var(--ux-line); z-index: 10; }
.ux-chat__back { display: flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; color: var(--ux-ink-muted); text-decoration: none; flex-shrink: 0; transition: background 0.15s var(--ux-ease), color 0.15s var(--ux-ease); }
.ux-chat__back:hover { background: var(--ux-paper); color: var(--ux-ink); }
.ux-chat__head-info { min-width: 0; flex: 1; }
.ux-chat__title { margin: 0; font-family: var(--ux-font-display); font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-chat__subtitle { margin: 0.2rem 0 0; font-size: 0.8125rem; color: var(--ux-ink-muted); }
.ux-chat__head-actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; margin-top: 0.6rem; }
.ux-chat__action-link { margin: 0; padding: 0; border: none; background: none; font: inherit; font-size: 0.8125rem; font-weight: 500; color: var(--ux-accent); cursor: pointer; }
.ux-chat__action-link:hover { color: var(--ux-accent-hover); }
.ux-chat__thread { min-height: 0; overflow-y: auto; padding: 1.5rem 1.6rem; display: flex; flex-direction: column; gap: 0.65rem; scroll-behavior: smooth; }
.ux-msg { display: flex; flex-direction: column; max-width: 72%; }
.ux-msg--out { align-self: flex-end; align-items: flex-end; }
.ux-msg--in { align-self: flex-start; align-items: flex-start; }
.ux-msg__name { margin: 0 0 0.25rem 0.6rem; font-size: 0.75rem; font-weight: 600; color: var(--ux-ink-muted); }
.ux-msg__bubble { padding: 0.65rem 0.9rem 0.55rem; border-radius: 1.1rem; box-shadow: var(--ux-shadow); word-break: break-word; }
.ux-msg--in .ux-msg__bubble { background: var(--ux-msg-in-bg); border: 1px solid var(--ux-msg-in-border); border-top-left-radius: 0.3rem; }
.ux-msg--out .ux-msg__bubble { background: var(--ux-msg-out-bg); border: 1px solid var(--ux-msg-out-border); border-top-right-radius: 0.3rem; }
.ux-msg__subject { margin: 0 0 0.3rem; font-size: 0.75rem; font-weight: 600; color: var(--ux-ink-muted); }
.ux-msg__body { font-size: 0.9375rem; line-height: 1.5; color: var(--ux-ink); }
.ux-msg__time { display: block; margin-top: 0.35rem; font-size: 0.6875rem; color: var(--ux-ink-muted); text-align: right; font-variant-numeric: tabular-nums; }
.ux-msg__files { list-style: none; margin: 0.55rem 0 0.1rem; padding: 0; font-size: 0.8125rem; }
.ux-msg__files a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.65rem; background: var(--ux-paper-deep); border-radius: 0.6rem; color: var(--ux-accent); font-weight: 500; text-decoration: none; }
.ux-msg__files a::before { content: '📎'; font-size: 0.75rem; }
.ux-chat__composer { position: sticky; bottom: 0; z-index: 20; padding: 0.85rem 1.6rem; background: var(--ux-bg); border-top: 1px solid var(--ux-line); }
.ux-chat__form { display: flex; align-items: flex-end; gap: 0.65rem; }
.ux-chat__attach { display: flex; align-items: center; justify-content: center; width: 2.6rem; height: 2.6rem; color: var(--ux-ink-muted); cursor: pointer; flex-shrink: 0; }
.ux-chat__attach:hover { color: var(--ux-ink); }
.ux-chat__input-wrap { flex: 1; min-width: 0; background: var(--ux-surface); border-radius: 1.35rem; padding: 0.6rem 1rem; border: 1px solid var(--ux-line); box-shadow: var(--ux-sheen); }
.ux-chat__input { width: 100%; border: none; outline: none; resize: none; font: inherit; font-size: 0.9375rem; line-height: 1.4; max-height: 8rem; background: transparent; color: var(--ux-ink); }
.ux-chat__input::placeholder { color: var(--ux-ink-muted); }
.ux-chat__send { display: flex; align-items: center; justify-content: center; width: 2.85rem; height: 2.85rem; border: none; border-radius: 50%; background: var(--ux-accent-strong); color: var(--ux-on-accent); cursor: pointer; flex-shrink: 0; box-shadow: var(--ux-cta-shadow); transition: filter 0.18s var(--ux-ease), transform 0.08s var(--ux-ease); }
.ux-chat__send:hover { filter: brightness(1.08); }
.ux-chat__send:active { transform: scale(0.94); }

/* ---------- Mobile: shell + ticket list, toolbar, cron ---------- */
@media (max-width: 860px) {
  .ux-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .ux-side {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    width: min(var(--ux-side-w), 88vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--ux-line);
  }

  .ux-app.ux-app--menu-open .ux-side {
    transform: translateX(0);
  }

  .ux-side__toggle {
    display: none;
  }

  .ux-app.ux-app--menu-open .ux-side__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 1rem;
    right: 0.85rem;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: var(--ux-radius-sm);
    background: var(--ux-surface);
    color: var(--ux-ink);
    border: 1px solid var(--ux-line);
    box-shadow: var(--ux-shadow-md);
    cursor: pointer;
    z-index: 1;
  }

  .ux-topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .ux-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(30, 41, 59, 0.35);
  }

  .ux-app--menu-open .ux-overlay {
    display: block;
  }

  .ux-work {
    width: 100%;
    min-width: 0;
  }

  .ux-main {
    padding: 1rem max(0.85rem, env(safe-area-inset-right)) 2rem max(0.85rem, env(safe-area-inset-left));
    max-width: none;
    width: 100%;
    box-sizing: border-box;
  }

  .ux-topbar,
  .ux-topbar--compact {
    padding: 0.6rem max(1rem, env(safe-area-inset-right)) 0.6rem max(1rem, env(safe-area-inset-left));
  }

  .ux-page-head {
    margin-bottom: 1rem;
  }

  .ux-page-head__title {
    font-size: 1.2rem;
  }

  .ux-page-head__sub {
    font-size: 0.8125rem;
    line-height: 1.45;
  }

  .ux-stats {
    gap: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .ux-stat {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
    padding: 0.7rem 0.8rem;
  }

  .ux-stat__n {
    font-size: 1.35rem;
  }

  .ux-stat__l {
    font-size: 0.6875rem;
    line-height: 1.3;
  }

  .ux-dash__greet {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .ux-dash__sub {
    font-size: 0.9375rem;
    line-height: 1.45;
    margin-bottom: 1.25rem;
  }

  .ux-metrics {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
  }

  .ux-section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .ux-feed__item {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'ord time'
      'subj subj'
      'meta meta';
    gap: 0.2rem 0.75rem;
    padding: 0.85rem 1rem;
    align-items: start;
  }

  .ux-feed__ord {
    grid-area: ord;
  }

  .ux-feed__time {
    grid-area: time;
    justify-self: end;
  }

  .ux-feed__subj {
    grid-area: subj;
    white-space: normal;
    line-height: 1.35;
  }

  .ux-feed__meta {
    grid-area: meta;
    grid-column: auto;
    white-space: normal;
  }

  .ux-cron-status {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem 0.8rem;
    margin-bottom: 0.85rem;
  }

  .ux-cron-status__item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
  }

  .ux-cron-status__value {
    flex-wrap: wrap;
    gap: 0.3rem 0.45rem;
  }

  .ux-page-toolbar {
    gap: 0.32rem;
    margin-bottom: 0.75rem;
  }

  .ux-page-toolbar .ux-seg a,
  .ux-page-toolbar .ux-toggle,
  .ux-page-toolbar .ux-btn {
    padding: 0.36rem 0.55rem;
    font-size: 0.6875rem;
  }

  .ux-att-filter__date {
    width: 7.25rem;
    min-width: 7.25rem;
    font-size: 0.6875rem;
  }

  .ux-dt {
    border-radius: var(--ux-radius-sm);
  }

  .ux-dt__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem 0.75rem;
  }

  .ux-dt__search {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .ux-dt__search .ux-search__kbd {
    display: none;
  }

  .ux-dt__info {
    text-align: left;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .ux-dt .ux-select {
    width: 100%;
    min-height: 2.75rem;
  }

  .ux-dt__footer {
    justify-content: center;
    padding: 0.65rem 0.75rem;
    padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
  }

  .ux-dt__pageinfo {
    min-width: auto;
    font-size: 0.75rem;
  }

  /* Ticket: card layout invece di tabella stretta */
  .ux-dt__scroll {
    overflow-x: visible;
    padding: 0.35rem 0 0.5rem;
  }

  .ux-table--tickets {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
  }

  .ux-table--tickets thead {
    display: none;
  }

  .ux-table--tickets tbody {
    display: block;
  }

  .ux-table--tickets tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'ord stato'
      'subject subject'
      'forn forn'
      'act act';
    gap: 0.15rem 0.65rem;
    margin: 0 0.65rem 0.55rem;
    padding: 0.85rem 0.9rem;
    background: var(--ux-surface);
    border: 1px solid var(--ux-line);
    border-radius: var(--ux-radius-sm);
    box-shadow: var(--ux-shadow);
  }

  .ux-table--tickets tbody tr.ux-row--unread {
    border-color: var(--ux-accent-border);
    border-left-width: 3px;
    background: var(--ux-unread);
  }

  .ux-table--tickets tbody tr[data-href]:active {
    transform: scale(0.985);
  }

  .ux-table--tickets tbody tr[data-href]:hover {
    background: var(--ux-paper);
  }

  .ux-table--tickets tbody tr[data-href]:focus-visible {
    outline: none;
    box-shadow: var(--ux-focus);
  }

  .ux-table--tickets td {
    display: block;
    padding: 0;
    border: none;
    white-space: normal;
    max-width: none;
    text-align: left;
  }

  .ux-table--tickets td::before {
    display: none;
  }

  .ux-table--tickets td.ux-col-id-sm,
  .ux-table--tickets td.ux-col--hide-sm,
  .ux-table--tickets td.ux-col-risp-sm {
    display: none !important;
  }

  .ux-table--tickets .ux-ticket-card__ord {
    grid-area: ord;
    font-family: var(--ux-mono);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ux-ink-soft);
    align-self: center;
  }

  .ux-table--tickets tbody tr.ux-row--unread .ux-ticket-card__ord::before {
    content: '';
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: var(--ux-accent);
    vertical-align: middle;
  }

  .ux-table--tickets .ux-ticket-card__stato {
    grid-area: stato;
    justify-self: end;
    align-self: center;
    max-width: 100%;
  }

  .ux-table--tickets .ux-ticket-card__stato .ux-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ux-table--tickets .ux-ticket-card__subject {
    grid-area: subject;
    margin-top: 0.35rem;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--ux-ink);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .ux-table--tickets .ux-ticket-card__forn {
    grid-area: forn;
    font-size: 0.8125rem;
    color: var(--ux-ink-muted);
    margin-top: 0.15rem;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
  }

  .ux-table--tickets .ux-ticket-card__forn::before {
    content: 'Fornitore · ';
    font-weight: 600;
    color: var(--ux-ink-muted);
  }

  .ux-table--tickets .ux-ticket-card__act {
    grid-area: act;
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--ux-line-soft);
    font-size: 0.8125rem;
    color: var(--ux-ink-muted);
    text-align: right;
  }

  .ux-table--tickets .ux-ticket-card__act::before {
    content: 'Attività · ';
    font-weight: 600;
    float: left;
  }

  /* Dettaglio ticket / chat */
  .ux-app--chat {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  html.ux-side-collapsed-pref .ux-app--chat .ux-work,
  .ux-app--chat.ux-app--side-collapsed .ux-work {
    padding-left: 0;
    width: 100%;
    max-width: 100%;
  }

  .ux-main--chat,
  .ux-chat {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .ux-chat__header {
    padding: 0.6rem max(0.85rem, env(safe-area-inset-right)) 0.6rem max(0.65rem, env(safe-area-inset-left));
    gap: 0.55rem;
  }

  .ux-chat__head-info {
    max-width: 100%;
  }

  .ux-chat__title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.35;
    font-size: 0.9375rem;
    word-break: break-word;
  }

  .ux-chat__subtitle {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.35;
    word-break: break-word;
    margin-top: 0.25rem;
  }

  .ux-chat__head-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    margin-top: 0.5rem;
  }

  .ux-chat__action-link {
    text-align: left;
    padding: 0.15rem 0;
  }

  .ux-chat__reassign-body {
    max-width: none;
  }

  .ux-chat__thread {
    padding: 0.75rem max(0.85rem, env(safe-area-inset-right)) 1rem max(0.85rem, env(safe-area-inset-left));
    overflow-x: hidden;
    min-width: 0;
  }

  .ux-chat__composer {
    padding: 0.65rem max(0.85rem, env(safe-area-inset-right)) max(0.65rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
  }

  .ux-msg {
    max-width: min(92%, 100%);
  }

  .ux-msg__bubble {
    max-width: 100%;
  }

  .ux-msg__body--html {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .ux-msg__body--html table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .ux-msg__body--html img {
    max-width: 100%;
    height: auto;
  }
}
