/* ==========================================================================
   Stile unico di tutto il pannello (5 nov 2026, sua richiesta dopo la Chat).
   Sta dopo gli altri CSS e cambia solo l'aspetto. Il colore scelto dall'admin
   (tema_personalizzato) arriva dopo questo file, quindi vince.
   ========================================================================== */
:root {
  --bg: #000000; --bg-2: #000000; --sidebar: #1c1c1e; --sidebar-2: #2c2c2e;
  --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c;
  --border: rgba(84, 84, 88, .55); --border-soft: rgba(84, 84, 88, .32);
  --text: #ffffff; --text-soft: rgba(235, 235, 245, .62); --text-faint: rgba(235, 235, 245, .4);
  --ok: #30d158; --ok-wash: rgba(48, 209, 88, .18); --warn: #ffd60a; --warn-wash: rgba(255, 214, 10, .16);
  --bad: #ff453a; --bad-wash: rgba(255, 69, 58, .18); --info: #64d2ff; --info-wash: rgba(100, 210, 255, .16);
  --shadow: none; --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  --radius: 14px; --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", InterVariable, Inter, system-ui, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f2f2f7; --bg-2: #f2f2f7; --sidebar: #ffffff; --sidebar-2: #f2f2f7;
  --surface: #ffffff; --surface-2: #f2f2f7; --surface-3: #e5e5ea;
  --border: rgba(60, 60, 67, .2); --border-soft: rgba(60, 60, 67, .1);
  --text: #000000; --text-soft: rgba(60, 60, 67, .78); --text-faint: rgba(60, 60, 67, .6);
  --ok: #34c759; --ok-wash: rgba(52, 199, 89, .14); --warn: #ff9f0a; --warn-wash: rgba(255, 159, 10, .14);
  --bad: #ff3b30; --bad-wash: rgba(255, 59, 48, .12); --info: #007aff; --info-wash: rgba(0, 122, 255, .1);
  --shadow: none;
}

html, body { font-family: var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -.008em; }
body, .content-wrapper, .wrapper { background: var(--bg) !important; background-image: none !important; }
a { transition: opacity .15s; } a:active { opacity: .55; }

/* ---- barra in alto: vetro ---- */
.main-header, .main-header .navbar, .main-header .logo {
  background: color-mix(in srgb, var(--bg) 72%, transparent) !important;
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  border-bottom: .5px solid var(--border) !important; box-shadow: none !important;
}

/* ---- barra laterale: elenco a righe ---- */
.main-sidebar { background: var(--sidebar) !important; border-right: .5px solid var(--border) !important; box-shadow: none !important; }
.sidebar-menu > li > a, .sidebar-menu .treeview-menu > li > a { border-radius: 10px !important; margin: 1px 8px; color: var(--text); font-weight: 500; }
.sidebar-menu > li.active > a, .sidebar-menu > li > a:hover, .sidebar-menu .treeview-menu > li.active > a {
  background: var(--accent) !important; color: var(--accent-ink) !important; box-shadow: none !important; }
.sidebar-menu > li.active > a::before, .sidebar-menu > li.active > a::after { display: none !important; }
.sidebar-menu > li.active > a .fa, .sidebar-menu > li > a:hover .fa { color: var(--accent-ink) !important; }
.sidebar-menu > li:hover > a { background: var(--surface-2) !important; color: var(--text) !important; }
.sidebar-menu > li.active:hover > a { background: var(--accent) !important; color: var(--accent-ink) !important; }
.sidebar-menu > li:hover > a .fa { color: inherit !important; }
.sidebar-menu > li.header { color: var(--text-soft); text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; }
.sidebar-menu .label-success, #menu-chat-nonletti { background: #ff3b30 !important; color: #fff !important; border: 0 !important; border-radius: 999px; }

/* ---- titolo grande ---- */
.content-header > h1 { font-size: 32px; font-weight: 700; letter-spacing: -.022em; }
.content-header > h1 > .fa { display: none; }
.content-header > h1 > small { display: block; margin: 3px 0 0; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--text-soft); }
.content-header .breadcrumb { display: none; }

/* ---- riquadri: gruppi arrotondati ---- */
.box, .fg-scheda, .chat-lista, .chat-conv, .pc-scheda, .small-box, .info-box {
  border: 0 !important; border-radius: var(--radius) !important; box-shadow: none !important; background: var(--surface) !important; transform: none !important; }
.box::before, .box::after, .small-box::before, .small-box::after { display: none !important; }
.box-header { border-bottom: .5px solid var(--border-soft) !important; background: transparent !important; }
.box-header .box-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

/* ---- riquadri dei numeri ---- */
.small-box { overflow: hidden; }
.small-box h3 { font-weight: 700; letter-spacing: -.02em; }
.small-box .icon { opacity: .14; }
.small-box-footer { background: transparent !important; border-top: .5px solid var(--border-soft); color: var(--accent) !important; font-weight: 500; }

/* ---- pulsanti ---- */
.btn { border-radius: 12px !important; border: 0 !important; box-shadow: none !important; font-weight: 600; letter-spacing: -.005em; transform: none !important; background-image: none !important; }
.btn:active { opacity: .6; }
.btn-primary { background: var(--accent) !important; color: var(--accent-ink) !important; }
.btn-default { background: var(--surface-2) !important; color: var(--accent) !important; }
.btn-success { background: var(--ok) !important; color: #000 !important; }
.btn-danger { background: var(--bad-wash) !important; color: var(--bad) !important; }
.btn-warning { background: var(--warn) !important; color: #000 !important; }
.btn-info { background: var(--info-wash) !important; color: var(--info) !important; }
.btn.disabled, .btn[disabled] { opacity: .38 !important; }

/* ---- campi ---- */
.form-control, .input-group-addon { background: var(--surface-2) !important; border: 0 !important; border-radius: 10px !important; box-shadow: none !important; color: var(--text); }
.form-control:focus { box-shadow: 0 0 0 3px var(--accent-glow) !important; }
.input-group .form-control:not(:last-child), .input-group-addon:not(:last-child) { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.input-group .form-control:not(:first-child), .input-group-addon:not(:first-child) { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
label { font-weight: 500; }
.box-body label:not(.btn), .modal-body label:not(.btn) { color: var(--text-soft); font-size: 13px; }
.checkbox label, .fg-lista label, .fg-colonna { color: var(--text) !important; font-size: 15px !important; }

/* ---- interruttori al posto delle caselle ---- */
.checkbox { margin: 10px 0; }
.checkbox label { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-left: 0; flex-direction: row-reverse; }
.checkbox input[type=checkbox] {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; float: none !important; margin: 0 !important;
  width: 51px; height: 31px; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background .2s; border: 0; outline: 0; }
.checkbox input[type=checkbox]::before { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .2s; }
.checkbox input[type=checkbox]:checked { background: var(--ok); }
.checkbox input[type=checkbox]:checked::before { transform: translateX(20px); }

/* ---- tabelle: righe pulite con separatori sottili ---- */
.table, .dataTable { background: transparent !important; }
.table > thead > tr > th { background: var(--surface) !important; color: var(--text-soft) !important; font-weight: 600; font-size: 12.5px; text-transform: none; letter-spacing: 0; border-bottom: .5px solid var(--border) !important; }
.table > tbody > tr > td { border-top: .5px solid var(--border-soft) !important; }
.table-striped > tbody > tr:nth-of-type(odd), .table > tbody > tr { background: transparent !important; }
.table-hover > tbody > tr:hover { background: var(--surface-2) !important; }

/* ---- etichette ---- */
.label { border-radius: 999px !important; border: 0 !important; font-weight: 600; padding: .28em .7em; }

/* ---- schede (a segmenti) ---- */
.nav-tabs { border: 0 !important; background: var(--surface-2); border-radius: 10px; padding: 2px; display: inline-flex; flex-wrap: wrap; }
.nav-tabs > li > a { border: 0 !important; border-radius: 8px !important; color: var(--text) !important; font-weight: 500; padding: 6px 14px; margin: 0; background: transparent !important; }
.nav-tabs > li.active > a { background: var(--surface-3) !important; font-weight: 600; }

/* ---- finestre: fogli ---- */
.modal-backdrop.in { opacity: .45; }
.modal-content { border: 0 !important; border-radius: 16px !important; background: var(--surface) !important; box-shadow: var(--shadow-lg) !important; overflow: hidden; }
.modal-header { border-bottom: .5px solid var(--border) !important; text-align: center; }
.modal-header .modal-title { font-size: 17px; font-weight: 600; }
.modal-footer { border-top: .5px solid var(--border) !important; }
.dropdown-menu { border: 0 !important; border-radius: 14px !important; background: color-mix(in srgb, var(--surface-2) 86%, transparent) !important;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow-lg) !important; }
.alert, .callout { border: 0 !important; border-radius: 12px !important; }
.main-footer { background: transparent !important; border: 0 !important; color: var(--text-faint); }

/* ---- pagina di accesso ---- */
.login-page, .register-page { background: var(--bg) !important; background-image: none !important; }
.login-box-body, .register-box-body { background: var(--surface) !important; border: 0 !important; border-radius: 16px !important; box-shadow: none !important; }

/* ---- barra in basso del telefono, come le app ---- */
.app-tab { display: none; }
@media (max-width: 767px) {
  .content-header > h1 { font-size: 30px; }
  .app-tab {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
    border-top: .5px solid var(--border); }
  .app-tab a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-soft); font-size: 10.5px; font-weight: 500; text-decoration: none; }
  .app-tab a .fa { font-size: 21px; height: 24px; line-height: 24px; }
  .app-tab a.attiva { color: var(--accent); }
  .app-tab .tab-pallino { position: absolute; top: -3px; left: 54%; min-width: 18px; height: 18px; padding: 0 5px; line-height: 18px; text-align: center; border-radius: 999px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; }
  .content-wrapper { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .main-footer { display: none; }
  body.sidebar-open .app-tab { z-index: 1100; }
  /* la conversazione aperta prende tutto lo schermo, come Messaggi */
  body:has(.chat-app.aperta) .app-tab { display: none; }
  body:has(.chat-app.aperta) .content-wrapper { padding-bottom: 0; }
  .modal-dialog { margin: 0; position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-height: 92vh; display: flex; }
  .modal.fade .modal-dialog { transform: translateY(100%); transition: transform .28s cubic-bezier(.32, .72, 0, 1); }
  .modal.in .modal-dialog { transform: none; }
  .modal-content { width: 100%; border-radius: 16px 16px 0 0 !important; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
}

/* ---- rifiniture ---- */
.app-tab .sidebar-toggle::before, .app-tab .sidebar-toggle::after { display: none !important; content: none !important; }
.app-tab .sidebar-toggle { padding: 0 !important; background: none !important; float: none !important; border: 0 !important; height: auto !important; width: auto !important; line-height: normal !important; }
@media (max-width: 767px) {
  .main-header .navbar .sidebar-toggle { display: none !important; }
  .chat-app { height: calc(100vh - 232px); height: calc(100dvh - 232px); }
  .chat-app.aperta { height: calc(100vh - 150px); height: calc(100dvh - 150px); }
}
@media (max-width: 767px) { .modal-content { max-height: 92vh; max-height: 92dvh; } }

/* ---- menu laterale: sempre leggibile, in tutti e due i temi ---- */
.main-sidebar, .main-sidebar .user-panel .info, .main-sidebar .user-panel .info p, .main-sidebar .user-panel .info a,
.main-sidebar .sidebar-menu > li > a, .main-sidebar .sidebar-menu > li > a > span,
.main-sidebar .treeview-menu > li > a { color: var(--text) !important; }
.main-sidebar .sidebar-menu > li > a .fa, .main-sidebar .treeview-menu > li > a .fa { color: var(--accent) !important; opacity: 1 !important; }
.main-sidebar .sidebar-menu > li.header { color: var(--text-soft) !important; }
.main-sidebar .sidebar-menu > li.active > a, .main-sidebar .sidebar-menu > li.active > a > span,
.main-sidebar .sidebar-menu > li.active > a .fa, .main-sidebar .treeview-menu > li.active > a,
.main-sidebar .treeview-menu > li.active > a .fa { color: var(--accent-ink) !important; }
.main-sidebar .sidebar-menu > li:not(.active):hover > a { background: var(--surface-3) !important; }
.main-sidebar .user-panel { border-bottom: .5px solid var(--border-soft) !important; background: transparent !important; }
.main-sidebar .treeview-menu { background: transparent !important; }
:root[data-theme="light"] .main-header .logo, :root[data-theme="light"] .main-header .logo .logo-lg { color: var(--text) !important; }
@media (max-width: 767px) {
  /* griglia di icone del menu: la voce attiva è colorata solo nell'icona */
  .main-sidebar .sidebar-menu > li.active > a, .main-sidebar .sidebar-menu > li > a:hover { background: transparent !important; color: var(--accent) !important; }
  .main-sidebar .sidebar-menu > li.active > a > span { color: var(--accent) !important; }
  .main-sidebar .sidebar-menu > li.active > a > i { background: var(--accent) !important; color: var(--accent-ink) !important; }
}

/* ======================================================================
   TELEFONO (6 nov 2026): tabelle a schede, menu a elenco, casa a riquadri.
   Tutto qui dentro, il computer non cambia.
   ====================================================================== */
.cella-altro { display: none; }
@media (max-width: 767px) {
  html, body { overflow-x: hidden; }
  /* i campi sotto i 16px fanno ingrandire la pagina su iPhone */
  input.form-control, select.form-control, textarea.form-control, .dataTables_filter input { font-size: 16px !important; }

  /* --- testata --- */
  .main-header { position: sticky; top: 0; z-index: 1020; height: calc(54px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); display: flex; align-items: center;
    background: color-mix(in srgb, var(--bg) 78%, transparent) !important; -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--border) !important; box-shadow: none !important; }
  .main-header .logo { float: none !important; width: auto !important; height: 54px !important; line-height: 54px !important; padding: 0 0 0 16px !important; background: none !important; border: 0 !important; flex: none; }
  .main-header .navbar { flex: 1; min-height: 54px; margin: 0 !important; background: none !important; border: 0 !important; display: flex; justify-content: flex-end; }
  .main-header .navbar-custom-menu { float: none !important; border: 0 !important; }
  .main-header .navbar-custom-menu > .navbar-nav { margin: 0 8px 0 0 !important; display: flex; align-items: center; gap: 2px; }
  .main-header .navbar-custom-menu > .navbar-nav > li { border: 0 !important; float: none; }
  .main-header .navbar-custom-menu > .navbar-nav > li > a { padding: 0 9px !important; height: 54px; line-height: 54px !important; border: 0 !important; background: none !important; display: flex; align-items: center; }
  .main-header .navbar-custom-menu > .navbar-nav > li > a .fa { font-size: 19px; }
  .main-header .user-image { width: 30px !important; height: 30px !important; margin: 0 !important; }

  /* --- titolo e spazi --- */
  .content-wrapper { margin-left: 0 !important; margin-top: 0 !important; padding-top: 0 !important; }
  .wrapper { padding-top: 0 !important; }
  .content-header { padding: 16px 16px 6px !important; }
  .content-header > h1 { font-size: 32px; line-height: 1.1; letter-spacing: -.6px; font-weight: 800; }
  .content-header > h1 > .fa { display: none; }
  .content-header > h1 > small { display: block; margin: 5px 0 0; padding: 0; font-size: 14px; font-weight: 400; letter-spacing: 0; }
  .content-header > .breadcrumb { display: none; }
  .content { padding: 8px 12px 16px !important; }
  .content > .row { margin-left: 0; margin-right: 0; }
  .content .row > [class*="col-"] { padding-left: 0; padding-right: 0; }

  /* --- riquadri --- */
  .box { border: 0 !important; border-radius: 20px !important; margin-bottom: 12px; overflow: hidden; box-shadow: 0 1px 2px color-mix(in srgb, #000 8%, transparent) !important; }
  .box-header { padding: 13px 16px !important; }
  .box-body { padding: 12px 16px !important; }
  .box-body:has(> .table:not(.dataTable)), .box-body:has(> table:not(.dataTable)) { overflow-x: auto; }
  .box-title { font-size: 17px !important; font-weight: 700; }
  .help-block { font-size: 13.5px; }
  .btn { min-height: 40px; border-radius: 12px !important; }
  .btn-sm { min-height: 36px; }

  /* --- casa: riquadri a due colonne --- */
  .content > .row:has(> [class*="col-"] > .small-box) { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .content > .row:has(> [class*="col-"] > .small-box)::before, .content > .row:has(> [class*="col-"] > .small-box)::after { display: none; }
  .row > [class*="col-"]:has(> .small-box) { float: none; width: auto; min-width: 0; }
  .small-box { margin: 0 !important; height: 100%; display: flex; flex-direction: column; border-radius: 20px !important; overflow: hidden; position: relative; }
  .small-box .inner { padding: 14px 14px 8px !important; flex: 1; }
  .small-box .inner h3 { font-size: 30px !important; margin: 0 0 4px !important; letter-spacing: -.8px; white-space: nowrap; }
  .small-box .inner p { font-size: 13px !important; line-height: 1.25; margin: 0; }
  .small-box .icon { position: absolute; top: 12px; right: 12px; font-size: 18px !important; opacity: .55; }
  .small-box .icon .fa { font-size: 18px !important; position: static !important; }
  .small-box .small-box-footer { padding: 8px 14px 12px !important; font-size: 12.5px !important; background: none !important; border: 0 !important; text-align: left; }

  .carousel-inner img, .carousel-inner .item img { max-height: 260px; width: auto; margin: 0 auto; object-fit: contain; }

  /* --- tabelle: ogni riga è una scheda --- */
  .tabella-scorrevole { overflow: visible !important; border: 0 !important; margin: 0 -2px; background: none !important; box-shadow: none !important; }
  table.dataTable { display: block; width: 100% !important; border: 0 !important; background: none !important; margin: 0 !important; }
  table.dataTable thead { display: none; }
  table.dataTable tbody { display: block; }
  table.dataTable tbody tr { display: flex; flex-direction: column; background: var(--surface-2) !important; border-radius: 16px; margin: 0 0 10px; padding: 4px 14px; border: 0 !important; box-shadow: none; }
  table.dataTable tbody td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 9px 0 !important; border: 0 !important; border-bottom: .5px solid var(--border) !important; text-align: right; min-height: 38px; max-width: none !important; white-space: normal !important; overflow-wrap: anywhere; background: none !important; font-size: 15px; }
  table.dataTable tbody td::before { content: attr(data-titolo); flex: none; max-width: 42%; color: var(--text-soft); font-size: 13px; font-weight: 500; text-align: left; }
  table.dataTable tbody td[data-titolo=""]::before { display: none; }
  table.dataTable tbody td:empty, table.dataTable tbody td.cella-vuota { display: none; }
  table.dataTable tbody td img { max-height: 26px; width: auto; }
  table.dataTable tbody td.cella-testa { order: -1; display: block; text-align: left; font-size: 16px; font-weight: 600; line-height: 1.3; padding-top: 11px !important; }
  table.dataTable tbody td.cella-testa::before { display: none; }
  table.dataTable tbody td.cella-testa img { max-height: none; width: 56px !important; height: 56px !important; max-width: 56px !important; border-radius: 12px; object-fit: cover; float: left; margin: 0 12px 4px 0; background: #fff; }
  table.dataTable tbody td.cella-testa a { display: block; font-size: 13px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.dataTable tbody td.cella-extra { display: none; }
  table.dataTable tbody tr.aperta td.cella-extra { display: flex; }
  table.dataTable tbody tr.aperta td.cella-extra:empty, table.dataTable tbody tr.aperta td.cella-extra.cella-vuota { display: none; }
  table.dataTable tbody td.cella-altro { display: flex; justify-content: center; min-height: 40px; border-bottom: 0 !important; color: var(--accent-2, var(--accent)); font-weight: 600; font-size: 14px; }
  table.dataTable tbody td.cella-altro::before { display: none; }
  table.dataTable tbody tr td:nth-last-child(2):not(.cella-extra) { border-bottom: 0 !important; }
  table.dataTable tbody td.dataTables_empty { display: block; text-align: center; border: 0 !important; color: var(--text-soft); }
  table.dataTable tbody td.dataTables_empty::before { display: none; }
  .dataTables_length { display: none; }
  .dataTables_info { text-align: center; font-size: 13px; color: var(--text-soft); padding: 4px 0 !important; float: none !important; }
  .dataTables_paginate { float: none !important; text-align: center; }
  .dataTables_paginate .pagination > li > a, .dataTables_paginate .paginate_button { min-width: 40px; height: 40px; line-height: 40px !important; padding: 0 10px !important; }

  /* --- menu: elenco a gruppi, come le impostazioni del telefono --- */
  .main-sidebar { position: fixed !important; top: 0 !important; bottom: 0 !important; left: 0 !important; width: 100% !important; max-width: none !important; padding: 0 !important; z-index: 1050 !important; background: var(--bg) !important; transform: translateX(-100%); transition: transform .28s cubic-bezier(.32, .72, 0, 1); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  body.sidebar-open .main-sidebar { transform: none !important; }
  .main-sidebar .sidebar { padding: calc(14px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom)) !important; height: auto !important; background: none !important; }
  .main-sidebar .user-panel { display: flex; align-items: center; gap: 12px; padding: 12px 14px !important; margin: 0 0 8px; background: var(--surface) !important; border-radius: 16px; height: auto; }
  .main-sidebar .user-panel .image, .main-sidebar .user-panel .info { float: none !important; position: static !important; padding: 0 !important; width: auto; }
  .main-sidebar .user-panel .image img { width: 46px !important; height: 46px !important; max-width: 46px !important; }
  .main-sidebar .user-panel .info p { font-size: 17px; font-weight: 700; margin: 0 0 2px; }
  .main-sidebar .sidebar-menu { display: block !important; background: none !important; }
  .main-sidebar .sidebar-menu > li { background: var(--surface) !important; margin: 0 !important; border: 0 !important; width: 100% !important; float: none !important; text-align: left; }
  .main-sidebar .sidebar-menu > li.header { background: none !important; margin-top: 14px !important; padding: 8px 14px 6px !important; font-size: 12.5px !important; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; height: auto; white-space: normal; }
  .main-sidebar .sidebar-menu > li.header + li, .main-sidebar .user-panel + .sidebar-menu > li:first-child { border-radius: 14px 14px 0 0; }
  .main-sidebar .sidebar-menu > li:has(+ li.header), .main-sidebar .sidebar-menu > li:last-child { border-radius: 0 0 14px 14px; }
  .main-sidebar .sidebar-menu > li.header + li:has(+ li.header) { border-radius: 14px; }
  .main-sidebar .sidebar-menu > li > a { display: flex !important; flex-direction: row !important; align-items: center; gap: 12px; min-height: 50px; height: auto !important; padding: 7px 14px !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; background: none !important; text-align: left !important; font-size: 16px !important; }
  .main-sidebar .sidebar-menu > li + li:not(.header) > a { box-shadow: inset 52px -0 0 -52px transparent; border-top: .5px solid var(--border) !important; }
  .main-sidebar .sidebar-menu > li.header + li > a { border-top: 0 !important; }
  .main-sidebar .sidebar-menu > li > a > .fa:first-child { flex: none; width: 30px !important; height: 30px !important; min-width: 30px; line-height: 30px !important; margin: 0 !important; padding: 0 !important; font-size: 15px !important; text-align: center; border-radius: 8px; color: #fff !important; background: var(--accent) !important; box-shadow: none !important; display: block !important; }
  .main-sidebar .sidebar-menu > li > a > span:not(.pull-right-container) { display: block !important; flex: 1; position: static !important; width: auto !important; padding: 0 !important; background: none !important; opacity: 1 !important; font-size: 16px !important; }
  .main-sidebar .sidebar-menu > li > a > .pull-right-container { position: static !important; margin-left: auto; display: flex; align-items: center; }
  .main-sidebar .sidebar-menu > li > a .pull-right-container .label { position: static !important; float: none !important; margin: 0 !important; }
  .main-sidebar .sidebar-menu > li.active > a { background: none !important; }
  .main-sidebar .sidebar-menu > li.active > a > span:not(.pull-right-container) { color: var(--accent-2, var(--accent)) !important; font-weight: 700; }
  .main-sidebar .sidebar-menu > li.treeview > a .fa-angle-left { transform: rotate(180deg); transition: transform .2s; }
  .main-sidebar .sidebar-menu > li.treeview.menu-open > a .fa-angle-left { transform: rotate(90deg); }
  .main-sidebar .treeview-menu { padding: 0 0 6px 56px !important; margin: 0 !important; background: none !important; position: static !important; width: auto !important; box-shadow: none !important; float: none !important; }
  .main-sidebar .treeview-menu > li > a { padding: 9px 12px 9px 0 !important; font-size: 15px !important; background: none !important; border: 0 !important; display: block; }

  /* --- barra in basso --- */
  .app-tab { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .app-tab a { font-size: 10.5px; font-weight: 600; padding: 3px 0 !important; border-radius: 12px; }
  .app-tab a.attiva .fa { color: var(--accent); }
  .app-tab a:focus, .app-tab a:active { outline: none !important; box-shadow: none !important; }

  /* --- finestre dal basso --- */
  .modal-content { position: relative; }
  .modal-header { padding-top: 22px !important; }
  .modal-header::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: var(--border); }
  .modal-footer { position: sticky; bottom: 0; background: inherit; display: flex; gap: 8px; }
  .modal-footer .btn { flex: 1; margin: 0 !important; }
}

/* Dentro Telegram: la testata la fa Telegram, niente Esci né piè di pagina. */
body.in-telegram .main-footer, body.in-telegram .btn-esci { display: none !important; }

/* ---- tasti delle righe: stessi per prodotti e ordini ---- */
.tasti { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tasto { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 9px; border: 0; border-radius: 11px; font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer; text-decoration: none !important; transition: transform .12s ease, filter .12s ease, box-shadow .12s ease; }
.tasto .fa { font-size: 15px; }
.tasto span { display: none; }
.tasto-largo span { display: inline; }
.tasto em { font-style: normal; font-size: 12px; font-weight: 700; }
.tasto:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 3px 10px color-mix(in srgb, #000 18%, transparent); }
.tasto:active { transform: scale(.96); }
.tasto:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tasto-verde { background: #16a34a; color: #fff !important; }
.tasto-blu { background: color-mix(in srgb, #2563eb 15%, transparent); color: #2563eb !important; }
.tasto-neutro { background: var(--surface-3, rgba(127,127,127,.15)); color: var(--text) !important; }
.tasto-giallo { background: color-mix(in srgb, #d97706 17%, transparent); color: #b45309 !important; }
.tasto-rosso { background: color-mix(in srgb, #dc2626 13%, transparent); color: #dc2626 !important; }
:root:not([data-theme="light"]) .tasto-blu { color: #7fb0ff !important; }
:root:not([data-theme="light"]) .tasto-giallo { color: #fbbf24 !important; }
:root:not([data-theme="light"]) .tasto-rosso { color: #fb8080 !important; }
.tasto-spento { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
#bolla-tasto { position: fixed; z-index: 3000; left: 0; top: 0; max-width: 250px; padding: 9px 12px; border-radius: 12px; background: #16181d; color: #fff; font-size: 13px; line-height: 1.35; box-shadow: 0 8px 24px rgba(0,0,0,.3); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .1s ease, transform .1s ease; }
#bolla-tasto.su { opacity: 1; transform: none; }
#bolla-tasto b { display: block; margin-bottom: 1px; font-size: 13.5px; }
#bolla-tasto span { color: #c9ced8; }

@media (max-width: 767px) {
  table.dataTable tbody td:has(> .tasti) { display: block; order: -1; }
  table.dataTable tbody td:has(> .tasti)::before { display: none; }
  .tasti { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; white-space: normal; }
  .tasto { flex-direction: column; gap: 5px; height: 62px; padding: 6px 4px; border-radius: 14px; font-size: 11.5px; line-height: 1.15; }
  .tasto .fa { font-size: 19px; }
  .tasto span { display: block; text-align: center; overflow-wrap: anywhere; }
  .tasto em { position: absolute; top: 5px; right: 8px; font-size: 11px; }
  .tasto-largo { grid-column: 1 / -1; flex-direction: row; height: 46px; font-size: 15px; gap: 8px; }
  .tasto:hover { transform: none; box-shadow: none; }
}
