* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  :root {
    /* OPLAB BRANDING v3 - SD OPERIS */
    --sd-primary: #7CFF4F;
    --sd-secondary: #22B8FF;
    --sd-dark: #0f172a;
    --sd-text: #1f2937;

    --ph-colore-primario: #667eea;
    --ph-colore-secondario: #764ba2;
    --ph-header-gradient: linear-gradient(
      135deg,
      var(--ph-colore-primario) 0%,
      var(--ph-colore-secondario) 100%
    );
  }

  body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
  }
  
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
  }
  
  header {
    background: var(--ph-header-gradient);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
  }

  .app-header-branded .brand-block-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .brand-block-login {
    text-align: center;
  }

  .brand-logo {
    display: none;
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    object-fit: contain;
  }

  .brand-logo-header {
    width: 56px;
    height: 56px;
    margin: 0;
    flex-shrink: 0;
  }

  .brand-block-header.brand-senza-logo,
  .brand-block-login.brand-senza-logo {
    justify-content: center;
    text-align: center;
  }

  .brand-block-header.brand-senza-logo .brand-header-testi {
    text-align: center;
  }

  .app-header-branded h1 {
    font-size: 1.6rem;
    margin: 0;
  }

  .app-header-branded p {
    margin: 4px 0 0;
    opacity: 0.92;
  }

  .dashboard-brand-titolo {
    font-size: 1.1rem;
    color: var(--ph-colore-primario);
    margin-bottom: 14px;
    font-weight: 600;
  }

  .dashboard-section {
    margin-bottom: 24px;
  }

  .dashboard-section-title {
    font-size: 1.05rem;
    color: var(--ph-colore-primario);
    margin-bottom: 14px;
    font-weight: 600;
  }

  .dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
  }

  .dashboard-kpi-card {
    background: white;
    border-radius: 12px;
    padding: 18px 14px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-top: 3px solid var(--ph-colore-primario);
  }

  .dashboard-kpi-card-accent {
    border-top-color: var(--ph-colore-secondario);
  }

  .dashboard-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ph-colore-primario);
    line-height: 1.2;
    margin-bottom: 6px;
  }

  .dashboard-kpi-card-accent .dashboard-kpi-value {
    color: var(--ph-colore-secondario);
  }

  .dashboard-kpi-label {
    font-size: 0.82rem;
    color: #636e72;
    line-height: 1.3;
  }

  .dashboard-attivita-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dashboard-oggi-card {
    padding: 16px 18px;
  }

  .dashboard-oggi-title {
    margin-bottom: 8px;
  }

  .dashboard-oggi-count {
    font-size: 0.92rem;
    color: #636e72;
    margin-bottom: 10px;
  }

  .dashboard-oggi-count span {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ph-colore-primario);
    margin-right: 4px;
  }

  .dashboard-oggi-lista .dashboard-riga-titolo {
    font-weight: 600;
  }

  .dashboard-alert-lista {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .dashboard-alert-gruppo {
    margin-bottom: 12px;
  }

  .dashboard-alert-gruppo:last-child {
    margin-bottom: 0;
  }

  .dashboard-alert-gruppo-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 6px;
    padding: 0 2px;
  }

  .dashboard-alert-gruppo-critici {
    color: #c0392b;
  }

  .dashboard-alert-gruppo-attenzione {
    color: #d35400;
  }

  .dashboard-alert-gruppo-info {
    color: #2980b9;
  }

  .dashboard-riga-alert-critico {
    border-left: 4px solid #c0392b;
    background: #fdecea;
  }

  .dashboard-riga-alert-critico:hover {
    background: #fadbd8;
  }

  .dashboard-riga-alert-attenzione {
    border-left: 4px solid #e67e22;
    background: #fef5e7;
  }

  .dashboard-riga-alert-attenzione:hover {
    background: #fdebd0;
  }

  .dashboard-riga-alert-info {
    border-left: 4px solid #3498db;
    background: #ebf5fb;
  }

  .dashboard-riga-alert-info:hover {
    background: #d6eaf8;
  }

  .dashboard-attivita-card h4 {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: #2d3436;
  }

  .dashboard-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .dashboard-riga {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 3px solid var(--ph-colore-primario);
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .dashboard-riga:hover {
    background: #eef1ff;
  }

  .dashboard-riga-alert {
    border-left-color: #e17055;
    background: #fff8f6;
  }

  .dashboard-riga-alert:hover {
    background: #ffede8;
  }

  .dashboard-riga-stato {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background: #dfe6e9;
    color: #2d3436;
  }

  .dashboard-riga-main {
    flex: 1;
    min-width: 0;
  }

  .dashboard-riga-titolo {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2d3436;
    margin-bottom: 2px;
  }

  .dashboard-riga-meta {
    font-size: 0.8rem;
    color: #636e72;
  }

  .dashboard-riga-importo {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ph-colore-secondario);
    white-space: nowrap;
  }

  .dashboard-lista-vuota {
    font-size: 0.88rem;
    color: #636e72;
    padding: 8px 4px;
  }

  @media (max-width: 1100px) {
    .dashboard-kpi-grid {
      grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-attivita-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (min-width: 1200px) {
    .dashboard-attivita-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }

  @media (max-width: 768px) {
    .dashboard-kpi-grid {
      grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-attivita-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 480px) {
    .dashboard-kpi-grid {
      grid-template-columns: 1fr;
    }

    .dashboard-kpi-value {
      font-size: 1.5rem;
    }
  }
  
  header h1 {
    font-size: 1.6rem;
  }
  
  .subtitle {
    text-align: center;
    color: #636e72;
    margin-bottom: 20px;
  }
  
  .hidden {
    display: none !important;
  }

  .tab-admin-only-hidden,
  .tab-perm-hidden,
  .tab-perm-config-hidden {
    display: none !important;
  }
  
  .full-width {
    width: 100%;
  }
  
  .margin-top {
    margin-top: 15px;
  }
  
  hr {
    border: none;
    border-top: 1px solid #dfe6e9;
    margin: 18px 0;
  }
  
  /* LOGIN */
  .login-box {
    max-width: 400px;
    margin: 60px auto;
    background: white;
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  }
  
  .login-box-branded {
    border-top: 4px solid var(--ph-colore-primario);
  }

  /* OPLAB BRANDING v3 - SD OPERIS: login */
  .login-box-oplab-v3 {
    max-width: 440px;
    border-top: none;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow:
      0 12px 40px rgba(15, 23, 42, 0.1),
      0 0 0 1px rgba(15, 23, 42, 0.04);
  }

  .oplab-branding-v3-login {
    margin-bottom: 8px;
  }

  .oplab-login-logo-full {
    display: block;
    width: min(320px, 90vw);
    max-width: 320px;
    height: auto;
    margin: 0 auto 18px;
    object-fit: contain;
  }

  .oplab-login-brand-title {
    margin: 0 0 4px;
    text-align: center;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--sd-dark);
    line-height: 1.15;
  }

  .oplab-login-brand-sub {
    margin: 0 0 6px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--sd-secondary);
    line-height: 1.3;
  }

  .oplab-login-accesso {
    text-align: center;
    margin: 0 0 22px;
    color: #64748b;
    font-size: 0.92rem;
  }

  .login-box-oplab-v3 .btn {
    min-height: 48px;
    touch-action: manipulation;
  }

  .login-box-oplab-v3 input {
    font-size: 16px;
    width: 100%;
    min-height: 48px;
  }

  .oplab-branding-v3-fallback {
    display: none !important;
  }

  .login-box h2,
  #login-brand-titolo {
    text-align: center;
    margin-bottom: 10px;
    color: var(--ph-colore-primario);
  }
  
  .login-error {
    display: none;
    color: #d63031;
    text-align: center;
    margin-top: 15px;
  }
  
  /* USER BAR */
  .user-bar {
    background: #2d3436;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .user-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .google-stato-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
  }

  .btn-sync-google {
    font-size: 0.72rem;
    padding: 4px 10px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .btn-sync-google.btn-sync-icon-only {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0;
  }

  .btn-sync-google.btn-sync-icon-only .btn-sync-icon {
    font-size: 1rem;
    line-height: 1;
    display: block;
  }

  .btn-sync-google.is-syncing {
    opacity: 0.85;
    pointer-events: none;
  }

  .btn-sync-google.is-syncing .btn-sync-icon {
    animation: oplab-sync-spin 0.85s linear infinite;
  }

  @keyframes oplab-sync-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  .google-sync-toast {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(30, 30, 30, 0.92);
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: google-toast-in 0.2s ease-out;
  }

  .google-sync-toast-success {
    background: rgba(0, 150, 100, 0.95);
  }

  .google-sync-toast-warning {
    background: rgba(214, 48, 49, 0.92);
  }

  .google-sync-toast-info {
    background: rgba(45, 52, 54, 0.92);
  }

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

  .google-stato-indicatore {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    min-width: 140px;
  }

  .google-stato-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #b2bec3;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
  }

  .google-stato-indicatore[data-stato="online"] .google-stato-dot {
    background: #00b894;
    box-shadow: 0 0 8px rgba(0, 184, 148, 0.6);
  }

  .google-stato-indicatore[data-stato="syncing"] .google-stato-dot {
    background: #f39c12;
    animation: google-stato-pulse 1s ease-in-out infinite;
  }

  .google-stato-indicatore[data-stato="offline"] .google-stato-dot,
  .google-stato-indicatore[data-stato="error"] .google-stato-dot {
    background: #d63031;
    box-shadow: 0 0 6px rgba(214, 48, 49, 0.5);
  }

  @keyframes google-stato-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(1.15); }
  }

  .google-stato-testi {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
  }

  .google-stato-label {
    font-size: 0.82rem;
    font-weight: 600;
  }

  .google-stato-ultimo-sync {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
  }

  .google-stato-indicatore[data-stato="syncing"] .google-stato-label {
    color: #fdcb6e;
  }

  .google-stato-indicatore[data-stato="online"] .google-stato-label {
    color: #55efc4;
  }

  .google-stato-indicatore[data-stato="offline"] .google-stato-label,
  .google-stato-indicatore[data-stato="error"] .google-stato-label {
    color: #ff7675;
  }

  .google-stato-indicatore.google-stato-minimal {
    min-width: 0;
    padding: 3px 10px;
    gap: 5px;
    border-radius: 999px;
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .google-stato-indicatore.google-stato-minimal .google-stato-emoji {
    font-size: 0.72rem;
    line-height: 1;
  }

  .google-stato-indicatore.google-stato-minimal .google-stato-label {
    font-size: 0.78rem;
    font-weight: 600;
  }

  .google-stato-indicatore.google-stato-minimal[data-stato="online"] {
    background: rgba(0, 184, 148, 0.18);
    border-color: rgba(0, 184, 148, 0.45);
  }

  .google-stato-indicatore.google-stato-minimal[data-stato="online"] .google-stato-label {
    color: #00b894;
  }

  .google-stato-indicatore.google-stato-minimal[data-stato="syncing"] {
    background: rgba(253, 203, 110, 0.15);
    border-color: rgba(253, 203, 110, 0.45);
  }

  .google-stato-indicatore.google-stato-minimal[data-stato="syncing"] .google-stato-label {
    color: #f1c40f;
  }

  .google-stato-indicatore.google-stato-minimal[data-stato="offline"],
  .google-stato-indicatore.google-stato-minimal[data-stato="error"] {
    background: rgba(214, 48, 49, 0.15);
    border-color: rgba(214, 48, 49, 0.4);
  }

  .google-stato-indicatore.google-stato-minimal[data-stato="offline"] .google-stato-label,
  .google-stato-indicatore.google-stato-minimal[data-stato="error"] .google-stato-label {
    color: #e17055;
  }

  .user-bar-operator-line {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.02em;
  }

  body.ph-lab-solo-mode .user-bar-legacy-info {
    display: none !important;
  }

  body.ph-lab-solo-mode #user-bar.user-bar-lab-compact,
  body.ph-lab-solo-mode #user-bar.lab-sd-user-bar {
    padding: 5px 10px;
    margin-bottom: 0;
    min-height: 0;
    gap: 6px;
    border-radius: 8px;
  }

  body.ph-lab-solo-mode #user-bar .btn-user-bar-action {
    padding: 4px 10px;
    font-size: 0.74rem;
    line-height: 1.2;
    border-radius: 6px;
  }

  body.ph-lab-solo-mode #user-bar .google-stato-wrap {
    gap: 6px;
  }

  body.ph-lab-solo-mode #user-bar-home-anchor:empty {
    display: none;
  }
  
  /* CONFIG BOX */
  .config-box {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
  }
  
  /* TABS */
  .tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  
  .tab {
    padding: 12px 20px;
    background: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #636e72;
    transition: all 0.2s;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
  }
  
  .tab.active {
    background: var(--ph-colore-primario);
    color: white;
  }
  
  .tab:hover:not(.active) {
    background: #dfe6e9;
  }
  
  /* PANEL */
  .panel {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  }
  
  .panel.active {
    display: block;
  }
  
  /* CARD */
  .card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 14px;
    border-left: 4px solid #667eea;
  }
  
  .card h2,
  .card h3 {
    margin-bottom: 12px;
  }
  
  /* FORM */
  .form-group {
    margin-bottom: 15px;
  }
  
  label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.9rem;
  }
  
  input,
  select,
  textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
  }
  
  textarea {
    min-height: 80px;
    resize: vertical;
  }
  
  input:focus,
  select:focus,
  textarea:focus {
    outline: none;
    border-color: #667eea;
  }
  
  /* BUTTONS */
  .btn {
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
  }
  
  .btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
  }
  
  .btn-primary {
    background: var(--ph-colore-primario);
    color: var(--ph-testo-su-primario, #fff);
    color: white;
  }
  
  .btn-success {
    background: #00b894;
    color: white;
  }
  
  .btn-danger {
    background: #d63031;
    color: white;
  }
  
  .btn-warning {
    background: #fdcb6e;
    color: #2d3436;
  }
  
  .btn-whatsapp {
    background: #25d366;
    color: white;
  }
  
  .btn-contratto {
    background: #e17055;
    color: white;
  }

  .evento-azioni-rapide {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #dfe6e9;
  }

  .evento-azioni-rapide h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--ph-colore-primario);
    font-weight: 600;
  }

  .evento-azioni-rapide-grid {
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-azione-conferma {
    background: var(--ph-colore-primario);
    color: var(--ph-testo-su-primario, #fff);
  }

  .btn-azione-acconto {
    background: #fdcb6e;
    color: #2d3436;
  }

  .btn-azione-saldato {
    background: #00b894;
    color: #fff;
  }

  .btn-azione-annulla-evento {
    background: #d63031;
    color: #fff;
  }

  .modal-acconto-overlay {
    z-index: 1100;
  }

  .modal-box-small {
    max-width: 380px;
    width: 92%;
  }

  .modal-acconto-hint {
    font-size: 0.88rem;
    color: #636e72;
    margin-bottom: 12px;
  }

  .evento-dettaglio-pagamenti {
    background: #f8f9ff;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 0.9rem;
  }

  .evento-storico-movimenti {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #dfe6e9;
  }

  .evento-storico-movimenti h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: var(--ph-colore-primario);
    font-weight: 600;
  }

  .evento-storico-lista {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .evento-storico-lista li {
    font-size: 0.82rem;
    color: #636e72;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--ph-colore-secondario);
  }
  
  .btn-fornitore {
    background: #74b9ff;
    color: white;
  }
  
  .btn-small {
    padding: 7px 12px;
    font-size: 0.82rem;
  }
  
  .button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }
  
  /* GRID */
  .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  
  .grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
  }
  
  /* STATS */
  .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
  }
  
  .stat-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  }
  
  .stat-box .number {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
  }
  
  /* BADGES */
  .badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
  }
  
  .badge-preventivo {
    background: #ffeaa7;
    color: #b35c00;
  }

  .badge-confermato {
    background: #74b9ff;
    color: #0652dd;
  }

  .badge-saldato {
    background: #55efc4;
    color: #006b54;
  }

  .badge-chiuso {
    background: #dfe6e9;
    color: #636e72;
  }
  
  .badge-annullato {
    background: #ff7675;
    color: white;
  }

  .form-hint-stato {
    margin-top: 6px;
    font-size: 0.82rem;
    color: #636e72;
  }

  .evento-stato-form-row {
    margin-top: 4px;
  }
  
  /* PACCHETTI */
  .pacchetti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 15px;
  }
  
  .pacchetto-card {
    border: 2px solid #dfe6e9;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
  }
  
  .pacchetto-card:hover {
    border-color: #667eea;
  }
  
  .pacchetto-card.selected {
    border-color: #667eea;
    background: #f0f3ff;
  }
  
  .pacchetto-card h4 {
    color: #667eea;
    margin-bottom: 8px;
  }
  
  .pacchetto-readonly-box {
    margin-top: 16px;
    padding: 14px;
    background: #f8f9fc;
    border: 1px solid #dfe6e9;
    border-radius: 10px;
  }

  .pacchetto-readonly-titolo {
    margin-bottom: 12px;
    font-size: 1rem;
    color: #2d3436;
  }

  .pacchetto-readonly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
  }

  .listino-readonly input[readonly] {
    background: #eef1f6;
    color: #2d3436;
    cursor: not-allowed;
    border-color: #cfd8dc;
  }

  .pacchetto-inclusi-list {
    margin: 8px 0 0 18px;
    padding: 0;
    color: #2d3436;
    line-height: 1.45;
  }

  .pacchetto-inclusi-list li {
    margin-bottom: 4px;
  }

  .pacchetto-inclusi-vuoto {
    margin: 0;
    color: #636e72;
    font-style: italic;
  }

  .card-subtitle {
    margin: -4px 0 14px;
    font-size: 0.88rem;
    color: #636e72;
    line-height: 1.4;
  }

  .listino-extra-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .listino-cat-card {
    background: #f8f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
  }

  .listino-cat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
  }

  .listino-cat-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
  }

  .listino-cat-icon {
    font-size: 1.1rem;
  }

  .listino-voci {
    padding: 8px 10px 10px;
  }

  .listino-voce-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid #eef1f6;
  }

  .listino-voce-row:last-child {
    border-bottom: none;
  }

  .listino-voce-nome {
    font-weight: 500;
    color: #2d3436;
    font-size: 0.92rem;
  }

  .listino-prezzo-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 4px 10px;
    background: #eef1f6;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2d3436;
    white-space: nowrap;
  }

  .listino-prezzo-badge small {
    font-weight: 400;
    font-size: 0.72rem;
    color: #636e72;
  }

  .listino-voce-qta input {
    width: 72px;
    text-align: center;
    padding: 8px;
    border: 1px solid #b2bec3;
    border-radius: 6px;
    font-size: 0.95rem;
  }

  .listino-qta-label,
  .listino-totale-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #636e72;
    margin-bottom: 2px;
  }

  .listino-voce-totale {
    text-align: right;
    min-width: 72px;
  }

  .listino-voce-totale strong {
    color: #667eea;
    font-size: 0.95rem;
  }

  .listino-readonly-field {
    background: #eef1f6 !important;
    color: #2d3436;
    cursor: not-allowed;
    border-color: #cfd8dc;
  }

  .voci-personalizzate-vuoto {
    margin: 0 0 10px;
    padding: 12px;
    background: #f8f9fc;
    border-radius: 8px;
    color: #636e72;
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .extra-listino-riepilogo {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #dfe6e9;
  }

  @media (max-width: 720px) {
    .listino-voce-row {
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .listino-voce-totale {
      grid-column: 1 / -1;
      text-align: left;
    }
  }

  .contratto-dinamico {
    padding: 20px;
    font-size: 14px;
  }

  .contratto-dinamico-titolo {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.25rem;
  }

  .contratto-blocco-dinamico {
    margin-bottom: 8px;
  }

  .pacchetto-card .prezzo {
    font-size: 1.6rem;
    font-weight: 700;
    color: #00b894;
    margin-bottom: 6px;
  }
  
  /* RIGHE DINAMICHE */
  .dynamic-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #dfe6e9;
  }
  
  .dynamic-row input {
    padding: 8px;
  }
  
  .fornitore-card {
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
  }
  
  .fornitore-card input,
  .fornitore-card select {
    margin-bottom: 7px;
  }
  
  /* TOTALI */
  .total-card {
    background: #f0f3ff;
    border-left-color: #00b894;
  }
  
  .total-card span {
    color: #00b894;
  }
  
  .riepilogo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 8px;
    font-weight: 600;
  }
  
  /* MODAL */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 15px;
  }
  
  .modal-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    max-width: 700px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
  }
  
  .close-modal {
    position: absolute;
    right: 18px;
    top: 12px;
    cursor: pointer;
    font-size: 1.2rem;
  }
  
  /* MESSAGGI */
  .msg {
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 600;
  }
  
  .msg-success {
    background: #55efc4;
    color: #006b54;
  }
  
  .msg-error {
    background: #ff7675;
    color: white;
  }
  
  .msg-warning,
  .msg-info {
    background: #ffeaa7;
    color: #8a6d00;
  }
  
  /* TABELLE */
  table {
    width: 100%;
    border-collapse: collapse;
  }
  
  th,
  td {
    padding: 10px;
    border-bottom: 1px solid #dfe6e9;
    text-align: left;
  }
  
  /* PRINT */
  #contratto-stampa,
  #ordine-stampa-container {
    display: none;
  }
  
  @media print {
    body:not(.print-bolla-ordine) * {
      visibility: hidden;
    }
  
    body:not(.print-bolla-ordine) #ordine-stampa-container,
    body:not(.print-bolla-ordine) #ordine-stampa-container *,
    body:not(.print-bolla-ordine) #contratto-stampa,
    body:not(.print-bolla-ordine) #contratto-stampa * {
      visibility: visible;
    }
  
    body:not(.print-bolla-ordine) #ordine-stampa-container,
    body:not(.print-bolla-ordine) #contratto-stampa {
      display: block !important;
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
    }
  }

  /* Ordini fornitori — modal + bolla A4 */
  .ordini-evento-info {
    font-weight: 600;
    margin-bottom: 8px;
  }

  .ordini-fornitori-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
  }

  .ordine-fornitore-card {
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fafbfc;
  }

  .ordine-fornitore-card h4 {
    margin: 0 0 10px;
    font-size: 1rem;
  }

  .ordine-fornitore-card h4 small {
    font-weight: normal;
    color: #636e72;
  }

  .ordine-fornitore-actions {
    margin: 0;
  }

  .fornitore-ordine-row,
  .prodotto-ordine-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr auto 1.5fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
  }

  .prodotto-ordine-row {
    grid-template-columns: 1.2fr 1fr 1fr 0.8fr 0.8fr 1fr 1fr auto auto;
  }

  #config .config-pane[hidden] {
    display: none !important;
  }

  #config .config-pane:not(.active) {
    display: none !important;
  }

  .bolla-ordine-a4 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
    color: #000;
    background: #fff;
    width: 210mm;
    max-width: 210mm;
    height: 297mm;
    max-height: 297mm;
    margin: 0 auto;
    padding: 5mm 8mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    page-break-inside: avoid;
    page-break-after: avoid;
  }

  .bolla-top {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
  }

  .bolla-footer {
    flex: 0 0 auto;
    margin-top: 2mm;
  }

  .bolla-header {
    text-align: right;
    margin: 0 0 2px;
    padding: 0;
  }

  .bolla-logo-img {
    max-height: 42px;
    max-width: 160px;
    object-fit: contain;
  }

  .bolla-logo-testo {
    font-size: 18pt;
    font-weight: bold;
    line-height: 1.05;
  }

  .bolla-logo-testo small {
    color: #c0392b;
    font-size: 9pt;
  }

  .bolla-intestazione {
    background: #e0e0e0;
    text-align: center;
    font-size: 7.5pt;
    line-height: 1.2;
    padding: 2px 4px;
    margin: 0 0 2px;
  }

  .bolla-consegna {
    background: #d5d5d5;
    text-align: center;
    font-weight: bold;
    font-size: 10pt;
    padding: 3px 4px;
    margin: 0 0 3px;
    letter-spacing: 0.02em;
  }

  .bolla-tabella {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000;
    margin: 0 0 3px;
    flex: 0 0 auto;
    table-layout: fixed;
  }

  .bolla-tabella th,
  .bolla-tabella td {
    border: 1px solid #000;
    padding: 2px 4px;
    vertical-align: middle;
    box-sizing: border-box;
  }

  .bolla-riga-prodotto td,
  .bolla-riga-vuota td {
    height: 18px;
    min-height: 0;
    max-height: 18px;
    line-height: 1.1;
    font-size: 9pt;
    overflow: hidden;
  }

  .bolla-riga-vuota .bolla-col-desc,
  .bolla-riga-vuota .bolla-col-euro {
    height: 18px;
  }

  .bolla-riga-campo td {
    padding-top: 3px;
    padding-bottom: 3px;
    font-size: 9pt;
    line-height: 1.15;
  }

  .bolla-valore-campo {
    text-align: left;
    font-weight: normal;
  }

  .bolla-tabella th {
    font-weight: bold;
    text-align: center;
    background: #fff;
    font-size: 9pt;
    padding: 3px 4px;
  }

  .bolla-col-n {
    width: 8%;
    text-align: center;
  }

  .bolla-col-desc {
    width: 72%;
  }

  .bolla-col-euro {
    width: 20%;
    text-align: right;
  }

  .bolla-label {
    font-weight: bold;
  }

  .bolla-totale-row td {
    border-top: 2px solid #000;
  }

  .bolla-totale-label {
    text-align: right;
    padding-right: 8px;
  }

  .bolla-inviato {
    margin: 0 0 4px;
    font-size: 9pt;
    line-height: 1.2;
  }

  .bolla-modifiche div {
    margin-bottom: 6px;
    font-size: 9pt;
    line-height: 1.2;
  }

  .bolla-modifiche div:last-child {
    margin-bottom: 0;
  }
  
  /* MOBILE */
  @media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .dynamic-row {
      grid-template-columns: 1fr;
    }
  
    .user-bar {
      flex-direction: column;
      gap: 10px;
      text-align: center;
    }
  
    .button-group {
      flex-direction: column;
      align-items: stretch;
    }
  
    .btn {
      width: 100%;
    }
  
    .tabs {
      flex-direction: column;
    }
  
    .tab {
      width: 100%;
    }
  }
  /* ============================================================
   CONTRATTO STAMPA
   ============================================================ */

#contratto-stampa {
    display: none;
  }
  
  .contratto-a4 {
    width: 297mm;
    min-height: 210mm;
    padding: 8mm;
    background: white;
    color: #000;
    font-family: Arial, sans-serif;
    font-size: 14px;
  }
  
  .contratto-riga {
    display: flex;
    width: 100%;
  }
  
  .box {
    border: 1px solid #000;
    padding: 7px;
    min-height: 28px;
  }
  
  .box.grande,
  .box.intera {
    width: 100%;
  }
  
  .box.mezza {
    width: 50%;
  }
  
  .alto .box {
    margin-top: 10px;
  }
  
  .data-box {
    width: 45%;
    height: 70px;
  }
  
  .orario-box {
    width: 55%;
    height: 70px;
    display: flex;
    justify-content: space-between;
  }
  
  .titolo-data {
    font-size: 28px;
    font-weight: bold;
    margin-right: 30px;
  }
  
  .data-linea {
    font-size: 16px;
  }
  
  .orari-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    font-size: 12px;
  }
  
  .fascia-serale {
    color: red;
    font-weight: bold;
    width: 110px;
    font-size: 12px;
  }
  
  .rosso {
    color: red;
  }
  
  .avviso {
    font-size: 11px;
    text-align: center;
    font-weight: bold;
  }
  
  .catering-box {
    width: 50%;
    min-height: 90px;
  }
  
  .note-box {
    width: 100%;
    min-height: 70px;
  }
  
  .totale {
    text-align: right;
    font-weight: bold;
  }
  
  .firma {
    margin-top: 35px;
    border: 1px solid #000;
    padding: 18px;
    width: 60%;
    font-weight: bold;
  }
  
  @media print {
    body * {
      visibility: hidden !important;
    }
  
    #contratto-stampa,
    #contratto-stampa * {
      visibility: visible !important;
    }
  
    #contratto-stampa {
      display: block !important;
      position: absolute;
      left: 0;
      top: 0;
      width: 297mm;
    }
  
    @page {
      size: A4 landscape;
      margin: 5mm;
    }
    #contratto-stampa {
        display: none;
      }
      
      .contratto-a4 {
        width: 297mm;
        min-height: 210mm;
        padding: 8mm;
        background: white;
        color: #000;
        font-family: Arial, sans-serif;
        font-size: 13px;
      }
      
      .contratto-a4 table {
        width: 100%;
        border-collapse: collapse;
      }
      
      .contratto-a4 td {
        border: 1px solid #000;
        padding: 7px;
        vertical-align: top;
      }
      
      .contratto-a4 h2 {
        text-align: center;
        margin-bottom: 10px;
      }
      
      .firma {
        margin-top: 40px;
        border: 1px solid #000;
        padding: 20px;
        width: 60%;
        color: red;
        font-weight: bold;
      }
      
      @media print {
        body * {
          visibility: hidden !important;
        }
      
        #contratto-stampa,
        #contratto-stampa * {
          visibility: visible !important;
        }
      
        #contratto-stampa {
          display: block !important;
          position: absolute;
          left: 0;
          top: 0;
          width: 297mm;
        }
      
        @page {
          size: A4 landscape;
          margin: 5mm;
        }
      }
      #contratto-stampa {
        display: none;
      }
      
      .contratto-a4 {
        width: 297mm;
        min-height: 210mm;
        padding: 8mm;
        background: white;
        color: #000;
        font-family: Arial, sans-serif;
        font-size: 14px;
      }
      
      .contratto-a4 h1 {
        text-align: center;
        margin-bottom: 15px;
      }
      
      .contratto-a4 table {
        width: 100%;
        border-collapse: collapse;
      }
      
      .contratto-a4 td {
        border: 1px solid #000;
        padding: 8px;
      }
      
      .firma {
        color: red;
        font-weight: bold;
        border: 1px solid #000;
        padding: 20px;
        width: 60%;
      }
      
      @media print {
        body * {
          visibility: hidden !important;
        }
      
        #contratto-stampa,
        #contratto-stampa * {
          visibility: visible !important;
        }
      
        #contratto-stampa {
          display: block !important;
          position: absolute;
          left: 0;
          top: 0;
          width: 297mm;
        }
      
        @page {
          size: A4 landscape;
          margin: 5mm;
        }
      }
  .config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
  }

  .config-tab {
    padding: 10px 16px;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.95rem;
  }

  .config-tab.active {
    background: var(--ph-colore-primario);
    color: var(--ph-testo-su-primario, #fff);
    border-color: var(--ph-colore-primario);
  }

  #config .config-pane {
    display: none !important;
  }

  #config .config-pane.active {
    display: block !important;
  }

  .brand-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
  }

  .config-brand-anteprima {
    margin: 14px 0;
    padding: 24px 16px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .config-brand-avviso {
    color: #e17055;
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .config-listino-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  .config-listino-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
  }

  .config-listino-row[data-tipo="pacchetti"] {
    grid-template-columns: 1.5fr 1fr 0.8fr 0.8fr auto auto;
  }

  .config-listino-row[data-tipo="torte"] {
    grid-template-columns: 2fr 1fr auto;
  }

  .config-listino-row[data-tipo="catering"],
  .config-listino-row[data-tipo="panini"],
  .config-listino-row[data-tipo="extra"],
  .config-listino-row[data-tipo="spettacoli"] {
    grid-template-columns: 2fr 1fr auto auto;
  }

  .config-legacy-details summary {
    cursor: pointer;
    font-weight: 600;
  }

  .btn-secondary {
    background: #636e72;
    color: #fff;
  }

  .config-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .config-form-grid .wide {
    grid-column: 1 / -1;
  }

  .config-placeholder-card {
    border-left: 4px solid var(--ph-colore-primario);
  }

  .config-status-msg {
    margin-top: 12px;
    color: #636e72;
    font-size: 0.9rem;
  }

  .config-actions {
    margin-top: 20px;
  }

  .config-tools-actions {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
  }

  .config-backup-status {
    margin-top: 14px;
    font-size: 0.9rem;
    color: #636e72;
  }

  .pagamenti-evento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  @media (max-width: 700px) {
    .pagamenti-evento-grid,
    .config-form-grid {
      grid-template-columns: 1fr;
    }
  }

      .extra-contratto-card {
        background: #f8f9ff;
        border-left: 4px solid #667eea;
      }
      
      .extra-contratto-card h3 {
        margin-bottom: 18px;
        color: #2d3436;
      }
      
      .extra-contratto-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
        align-items: end;
      }
      
      .extra-contratto-grid .wide {
        grid-column: span 2;
      }
      
      .extra-contratto-grid input {
        height: 44px;
      }
      
      #preventivo-contratto {
        background: #eafaf1;
        font-weight: 700;
        color: #00b894;
      }
      
      @media (max-width: 900px) {
        .extra-contratto-grid {
          grid-template-columns: 1fr 1fr;
        }
      
        .extra-contratto-grid .wide {
          grid-column: span 2;
        }
      }
      
      @media (max-width: 600px) {
        .extra-contratto-grid {
          grid-template-columns: 1fr;
        }
      
        .extra-contratto-grid .wide {
          grid-column: span 1;
        }
      }
  }

  .extra-evento-row {
    grid-template-columns: 1fr 1.5fr 0.7fr 0.7fr auto;
  }

  .extra-categoria-select {
    min-width: 0;
  }

  .btn-whatsapp-modifica {
    background: #128c7e;
  }

  .config-template-label {
    display: block;
    font-weight: 600;
    margin: 12px 0 6px;
  }

  .config-template-label:first-of-type {
    margin-top: 0;
  }

  .config-template-wa {
    width: 100%;
    min-height: 180px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 10px 12px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    box-sizing: border-box;
    resize: vertical;
  }

  .config-template-wa:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
  }

  /* Stampa bolla ordine — 1 foglio A4, layout compatto modulo cartaceo */
  @media print {
    @page {
      size: A4 portrait;
      margin: 0;
    }

    body.print-bolla-ordine {
      margin: 0 !important;
      padding: 0 !important;
      width: 210mm !important;
      height: 297mm !important;
      overflow: hidden !important;
    }

    body.print-bolla-ordine > *:not(#ordine-stampa-container) {
      display: none !important;
    }

    body.print-bolla-ordine #ordine-stampa-container,
    body.print-bolla-ordine #ordine-stampa-container * {
      visibility: visible !important;
    }

    body.print-bolla-ordine #ordine-stampa-container {
      display: block !important;
      position: fixed !important;
      left: 0 !important;
      top: 0 !important;
      width: 210mm !important;
      height: 297mm !important;
      margin: 0 !important;
      padding: 0 !important;
      overflow: hidden !important;
      page-break-after: avoid !important;
      page-break-inside: avoid !important;
      background: #fff !important;
      box-sizing: border-box !important;
    }

    body.print-bolla-ordine .bolla-ordine-a4 {
      width: 210mm !important;
      height: 297mm !important;
      max-height: 297mm !important;
      min-height: 0 !important;
      margin: 0 !important;
      padding: 5mm 8mm !important;
      box-sizing: border-box !important;
      page-break-after: avoid !important;
      page-break-inside: avoid !important;
      overflow: hidden !important;
      background: #fff !important;
      display: flex !important;
      flex-direction: column !important;
    }

    body.print-bolla-ordine .bolla-top {
      margin: 0 !important;
      padding: 0 !important;
    }

    body.print-bolla-ordine .bolla-tabella {
      margin-top: 0 !important;
      page-break-inside: avoid !important;
    }

    body.print-bolla-ordine .bolla-riga-prodotto td,
    body.print-bolla-ordine .bolla-riga-vuota td {
      height: 18px !important;
      max-height: 18px !important;
      min-height: 0 !important;
      padding: 1px 3px !important;
    }

    body.print-bolla-ordine .bolla-footer,
    body.print-bolla-ordine .bolla-inviato,
    body.print-bolla-ordine .bolla-modifiche {
      page-break-inside: avoid !important;
    }
  }

  /* Modulo pubblico Laboratorio — isolamento totale dal gestionale Party House */
  html.public-laboratorio-boot body > *:not(#laboratorio-public-page):not(script),
  body.public-laboratorio-mode > *:not(#laboratorio-public-page):not(script),
  body.public-laboratorio-mode .ph-public-lab-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
  }

  html.public-laboratorio-boot #laboratorio-public-page,
  body.public-laboratorio-mode #laboratorio-public-page {
    display: block !important;
    visibility: visible !important;
    min-height: 100vh;
    width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
  }

  body.public-laboratorio-mode #laboratorio-public-page.hidden {
    display: block !important;
  }

  body.public-laboratorio-mode,
  html.public-laboratorio-boot body {
    background: #1a1d29;
    color: #e8eaef;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body.laboratorio-public-mode {
    background: #1a1d29;
    color: #e8eaef;
    min-height: 100vh;
  }

  body.laboratorio-public-mode .laboratorio-public-page {
    display: block;
    min-height: 100vh;
    padding: 0;
  }

  .laboratorio-public-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px 32px;
  }

  .laboratorio-public-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 20px 12px;
    border-radius: 12px;
    background: linear-gradient(
      135deg,
      #4a5568 0%,
      #2d3748 50%,
      #1a202c 100%
    );
    border: 1px solid rgba(102, 126, 234, 0.35);
  }

  .laboratorio-public-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px;
  }

  .laboratorio-public-subtitle {
    font-size: 0.88rem;
    color: #a0aec0;
    margin: 0;
  }

  .laboratorio-public-panel {
    background: #252836;
    border-radius: 12px;
    padding: 18px 16px;
    border: 1px solid #3d4458;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }

  .lab-ordine-form .lab-field {
    margin-bottom: 16px;
  }

  .lab-ordine-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e0;
    margin-bottom: 6px;
  }

  .lab-required {
    color: #fc8181;
  }

  .lab-ordine-form input[type="text"],
  .lab-ordine-form input[type="tel"],
  .lab-ordine-form input[type="number"],
  .lab-ordine-form input[type="datetime-local"],
  .lab-ordine-form input[type="file"],
  .lab-ordine-form select,
  .lab-ordine-form textarea {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid #4a5568;
    border-radius: 8px;
    background: #1a1d29;
    color: #f7fafc;
  }

  .lab-ordine-form input:focus,
  .lab-ordine-form select:focus,
  .lab-ordine-form textarea:focus {
    outline: none;
    border-color: var(--ph-colore-primario, #667eea);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
  }

  .lab-qty-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
  }

  .lab-qty-row input {
    flex: 1;
    text-align: center;
    font-weight: 600;
  }

  .lab-qty-btn {
    width: 48px;
    min-height: 48px;
    border: 1px solid #4a5568;
    border-radius: 8px;
    background: #2d3748;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
  }

  .lab-qty-btn:active {
    background: var(--ph-colore-primario, #667eea);
  }

  .lab-file-info {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 6px;
  }

  .lab-file-info-error {
    color: #fc8181;
  }

  .lab-form-message {
    font-size: 0.9rem;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
  }

  .lab-form-error {
    background: rgba(252, 129, 129, 0.15);
    border: 1px solid #fc8181;
    color: #feb2b2;
  }

  .lab-form-info {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid #667eea;
    color: #c3dafe;
  }

  .lab-submit-btn {
    margin-top: 8px;
    min-height: 48px;
    font-size: 1.05rem;
  }

  body.laboratorio-public-mode .btn-primary {
    background: var(--ph-colore-primario, #667eea);
    border: none;
  }

  .lab-loading-text {
    text-align: center;
    padding: 24px 8px;
    color: #a0aec0;
    font-size: 1rem;
  }

  .lab-weekend-notice {
    margin: 14px 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fffbeb;
    border: 1px solid #f6e05e;
    color: #744210;
    font-size: 0.92rem;
    line-height: 1.45;
    text-align: center;
  }

  .lab-weekend-notice.hidden {
    display: none;
  }

  .lab-success-message {
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.5;
    color: #9ae6b4;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(72, 187, 120, 0.12);
    border-radius: 8px;
    border: 1px solid #48bb78;
  }

  @media (min-width: 600px) {
    .laboratorio-public-wrap {
      padding-top: 28px;
    }
  }

  /* Laboratorio interno v2 — admin / operatore1 */
  .tab-lab-internal-hidden {
    display: none !important;
  }

  #tab-laboratorio {
    position: relative;
  }

  .tab-lab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
  }

  .tab-lab-has-badge {
    padding-right: 4px;
  }

  .lab-kpi-grid .dashboard-kpi-card:last-child .dashboard-kpi-value {
    color: #e53e3e;
  }

  .lab-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }

  .lab-filtri {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .lab-filtro-btn.active {
    background: var(--ph-colore-primario, #667eea);
    color: #fff;
    border-color: transparent;
  }

  .lab-ricerca {
    flex: 1 1 200px;
    max-width: 320px;
  }

  .lab-ricerca input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
  }

  .lab-tabella-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }

  .lab-ordini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
  }

  .lab-ordini-table th,
  .lab-ordini-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
  }

  .lab-ordini-table th {
    background: #f7fafc;
    font-weight: 600;
    white-space: nowrap;
  }

  .lab-ordini-table tbody tr.lab-ordini-row {
    cursor: pointer;
  }

  .lab-ordini-table tbody tr.lab-ordini-row:hover {
    background: #edf2f7;
  }

  .lab-badge-stato {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .lab-badge-nuovo {
    background: #ebf8ff;
    color: #2b6cb0;
  }

  .lab-badge-lavorazione,
  .lab-badge-lavorazione-evidenziato {
    background: #f6ad55;
    color: #7b341e;
    border: 1px solid #dd6b20;
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(221, 107, 32, 0.25);
  }

  .lab-badge-pronto {
    background: #c6f6d5;
    color: #276749;
  }

  .lab-badge-consegnato {
    background: #e2e8f0;
    color: #4a5568;
  }

  .lab-azioni-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .modal-lab-body {
    max-height: 60vh;
    overflow-y: auto;
  }

  .modal-lab-dl {
    display: grid;
    grid-template-columns: minmax(120px, 38%) 1fr;
    gap: 8px 14px;
    margin: 0 0 12px;
  }

  .modal-lab-dl dt {
    font-weight: 600;
    color: #4a5568;
    margin: 0;
  }

  .modal-lab-dl dd {
    margin: 0;
    word-break: break-word;
  }

  .modal-lab-stati {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
  }

  .modal-lab-allegato {
    margin-top: 8px;
  }

  .modal-lab-errore {
    color: #c53030;
    font-weight: 600;
    margin: 12px 0;
  }

  .lab-allegato-azioni {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
  }

  .lab-allegato-azioni a {
    color: var(--ph-colore-primario, #667eea);
    font-weight: 600;
    text-decoration: none;
  }

  .lab-allegato-azioni a:hover {
    text-decoration: underline;
  }

  .lab-allegato-sep {
    color: #a0aec0;
  }

  .lab-allegato-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .lab-config-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
  }

  .lab-config-tab-btn.active {
    background: var(--ph-colore-primario, #667eea);
    color: #fff;
  }

  .lab-config-editor {
    overflow-x: auto;
    margin-bottom: 12px;
  }

  .lab-config-table {
    width: 100%;
    border-collapse: collapse;
  }

  .lab-config-table th,
  .lab-config-table td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
  }

  .lab-config-table input {
    width: 100%;
    min-width: 80px;
  }

  .dashboard-lab-nuovi-card .dashboard-riga {
    cursor: pointer;
  }

  .dashboard-lab-nuovi-card .dashboard-riga:hover {
    background: #f7fafc;
  }

  .lab-stampa-card {
    margin-bottom: 16px;
  }

  .lab-stampa-title {
    margin: 0 0 12px;
    font-size: 1rem;
  }

  .lab-stampa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  .lab-stampa-periodo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }

  .lab-stampa-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #4a5568;
  }

  .lab-stampa-date {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
  }

  .lab-wa-mancante {
    font-size: 0.78rem;
    color: #a0aec0;
    font-style: italic;
  }

  .lab-wa-pronto {
    white-space: nowrap;
  }

  .modal-lab-wa {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
  }

  .lab-ordini-stampa-wrap {
    display: none;
  }

  /* ============================================================
     SD OPERIS OPLab — design system
     ============================================================ */
  .oplab-shell {
    /* OPLAB BRANDING v3 - SD OPERIS palette */
    --sd-primary: #7CFF4F;
    --sd-secondary: #22B8FF;
    --sd-dark: #0f172a;
    --sd-bg: #f0f9fb;
    --sd-card: #ffffff;
    --sd-border: #e2e8f0;
    --sd-text: #1f2937;
    --sd-text-muted: #64748b;
    --sd-header-bg: #071216;
    --sd-header-border: #0b1f24;
    --sd-sidebar-bg: #0b1f24;
    --sd-sidebar-width: 240px;
    --sd-radius: 16px;
    --sd-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --sd-shadow-hover: 0 8px 32px rgba(15, 23, 42, 0.1);
    --sd-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    font-family: var(--sd-font);
    color: var(--sd-text);
    background: var(--sd-bg);
    min-height: calc(100vh - 30px);
    display: none;
    flex-direction: column;
    border-radius: 0;
    margin: 0;
    padding: 0;
    max-width: none;
    width: 100%;
    box-shadow: none;
  }

  body.ph-lab-solo-mode .tabs,
  body.ph-lab-solo-mode .config-box,
  body.ph-lab-solo-mode #dashboard,
  body.ph-lab-solo-mode #app-header,
  body.ph-lab-solo-mode #user-bar-home-anchor {
    display: none !important;
  }

  body.ph-lab-solo-mode .container {
    max-width: none;
    padding: 0;
    margin: 0;
    width: 100%;
  }

  body.ph-lab-solo-mode #laboratorio.oplab-shell.panel {
    display: flex;
  }

  body.ph-lab-solo-mode.ph-lab-solo-app,
  body.ph-lab-solo-mode #app-page {
    background: var(--sd-bg);
    min-height: 100vh;
  }

  body.ph-lab-solo-mode #app-page > .container {
    padding: 0;
  }

  body.ph-lab-solo-mode #laboratorio.oplab-shell {
    min-height: 100vh;
  }

  #laboratorio.oplab-shell.panel.active {
    display: flex;
    padding: 0;
    background: var(--sd-bg);
    border-radius: 0;
    box-shadow: none;
  }

  #laboratorio.oplab-shell.panel:not(.active) {
    display: none !important;
  }

  .lab-v26-pro.oplab-shell {
    max-width: none;
    margin: 0;
  }

  .oplab-hero-header {
    width: 100%;
    min-height: 88px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 24px;
    background:
      radial-gradient(circle at 18% 50%, rgba(124, 255, 79, 0.14), transparent 42%),
      radial-gradient(circle at 72% 80%, rgba(34, 184, 255, 0.22), transparent 38%),
      linear-gradient(135deg, #0f172a 0%, #111827 48%, #0b1f24 100%);
    border-radius: 0;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    margin: 0;
    color: #e6fffa;
    border: none;
    border-bottom: 1px solid #0b1f24;
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.28);
    z-index: 20;
  }

  .oplab-hero-header::after {
    content: "";
    position: absolute;
    left: 28%;
    right: 0;
    bottom: 0;
    height: 90px;
    background: linear-gradient(
      110deg,
      transparent 0%,
      rgba(45, 212, 191, 0.12) 30%,
      rgba(34, 211, 238, 0.45) 48%,
      rgba(59, 130, 246, 0.45) 72%,
      transparent 100%
    );
    filter: blur(2px);
    opacity: 0.9;
    pointer-events: none;
  }

  /* OPLAB HEADER USE LOGO-HEADER v1.5 — header app */
  .oplab-hero-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    flex: 0 1 auto;
  }

  .oplab-brand-logo-header {
    display: block;
    width: auto;
    height: 58px;
    max-height: 58px;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
    flex-shrink: 1;
  }

  .oplab-brand-subtitle {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: rgba(34, 184, 255, 0.92);
    line-height: 1.2;
  }

  .oplab-hero-logo {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 35%;
    max-width: 35%;
    min-width: 0;
  }

  .oplab-hero-logo img,
  .oplab-header-logo img,
  .oplab-hero-logo .lab-sd-logo-img {
    display: block;
    width: auto;
    height: 90px;
    max-height: 90px;
    object-fit: contain;
    object-position: left center;
    border: none;
    background: transparent;
  }

  .oplab-hero-actions {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .oplab-hero-actions .lab-sd-user-slot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .oplab-hero-actions .lab-sd-user-slot:empty {
    display: none;
  }

  .oplab-hero-header .user-bar-legacy-info {
    display: none !important;
  }

  .oplab-hero-header .lab-sd-user-bar.user-bar,
  .oplab-hero-header .user-bar.lab-sd-user-bar {
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    font-size: 0.82rem;
    gap: 12px;
    min-height: 0;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    box-shadow: none;
  }

  .oplab-hero-header .lab-sd-user-bar .user-bar-actions {
    gap: 12px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .oplab-hero-header .lab-sd-user-bar .user-bar-operator-line {
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    color: #e2e8f0;
    padding-right: 12px;
    margin-right: 0;
    border-right: 1px solid rgba(94, 234, 212, 0.22);
  }

  .oplab-hero-header #btn-sync-google {
    width: 44px;
    min-width: 44px;
    height: 38px;
    padding: 0;
    font-size: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(20, 184, 166, 0.18);
    border: 1px solid rgba(94, 234, 212, 0.35);
    color: #5eead4;
    line-height: 1;
  }

  .oplab-hero-header #btn-sync-google .btn-sync-icon {
    display: none;
  }

  .oplab-hero-header #btn-sync-google::before {
    content: "↻";
    font-size: 22px;
    line-height: 1;
    color: #5eead4;
  }

  .oplab-hero-header #btn-sync-google.is-syncing::before {
    animation: oplab-sync-spin 0.85s linear infinite;
  }

  .oplab-hero-header #btn-sync-google:hover {
    background: rgba(20, 184, 166, 0.32);
  }

  .oplab-hero-header .btn-danger.btn-user-bar-action {
    background: #dc2626;
    border-color: #b91c1c;
    color: #fff;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    height: 38px;
  }

  .oplab-hero-header .btn-danger.btn-user-bar-action:hover {
    background: #b91c1c;
  }

  .lab-sd-user-slot {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .lab-sd-user-slot:empty {
    display: none;
  }

  /* OPLAB BRANDING v3 - indicatore sync minimal (solo stato colore) */
  .oplab-hero-header .google-stato-label,
  .oplab-hero-header .google-stato-ultimo-sync,
  .lab-sd-user-bar .google-stato-label,
  .lab-sd-user-bar .google-stato-ultimo-sync {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .oplab-hero-header .google-stato-indicatore.google-stato-minimal,
  .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal {
    min-width: 0;
    padding: 6px 10px;
    gap: 0;
  }

  .oplab-hero-header .google-stato-indicatore.google-stato-minimal .google-stato-emoji,
  .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal .google-stato-emoji {
    font-size: 0.85rem;
    line-height: 1;
  }

  .oplab-hero-header .google-stato-indicatore.google-stato-minimal[data-stato="online"],
  .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="online"] {
    background: rgba(0, 184, 148, 0.22);
    border-color: rgba(0, 184, 148, 0.5);
  }

  .oplab-hero-header .google-stato-indicatore.google-stato-minimal[data-stato="syncing"],
  .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="syncing"] {
    background: rgba(241, 196, 15, 0.2);
    border-color: rgba(241, 196, 15, 0.5);
  }

  .oplab-hero-header .google-stato-indicatore.google-stato-minimal[data-stato="offline"],
  .oplab-hero-header .google-stato-indicatore.google-stato-minimal[data-stato="error"],
  .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="offline"],
  .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="error"] {
    background: rgba(214, 48, 49, 0.2);
    border-color: rgba(214, 48, 49, 0.45);
  }

  .lab-sd-user-bar .btn-small {
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .oplab-body {
    display: flex;
    flex: 1;
    min-height: 0;
    align-items: stretch;
  }

  .oplab-sidebar {
    width: var(--sd-sidebar-width);
    flex-shrink: 0;
    background: var(--sd-sidebar-bg);
    border-right: 1px solid rgba(94, 234, 212, 0.12);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 16px;
  }

  .oplab-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 14px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(94, 234, 212, 0.12);
    flex-shrink: 0;
  }

  .oplab-sidebar-profile-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
      135deg,
      rgba(20, 184, 166, 0.35) 0%,
      rgba(14, 165, 233, 0.22) 100%
    );
    border: 1px solid rgba(94, 234, 212, 0.28);
    color: #e6fffa;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
  }

  .oplab-sidebar-profile-text {
    min-width: 0;
    flex: 1;
  }

  .oplab-sidebar-profile-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #e6fffa;
    line-height: 1.3;
    word-break: break-word;
  }

  .oplab-sidebar-profile-role {
    font-size: 12px;
    color: rgba(167, 243, 208, 0.88);
    line-height: 1.35;
    margin-top: 2px;
    word-break: break-word;
  }

  .oplab-sidebar-account-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid rgba(94, 234, 212, 0.12);
  }

  .oplab-sidebar-account-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    border-radius: 10px;
    font-size: 0.82rem;
  }

  .oplab-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }

  .oplab-nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(230, 255, 250, 0.75);
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
  }

  .oplab-nav-btn:hover {
    background: rgba(20, 184, 166, 0.12);
    color: #e6fffa;
  }

  .oplab-nav-btn.active {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.28) 0%, rgba(14, 165, 233, 0.18) 100%);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.25);
  }

  .oplab-nav-icon {
    font-size: 1.05rem;
    width: 1.4rem;
    text-align: center;
    flex-shrink: 0;
  }

  .oplab-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(94, 234, 212, 0.12);
  }

  .oplab-sidebar-actions .oplab-btn-action {
    width: 100%;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.82rem;
  }

  .oplab-sidebar-actions .btn-primary {
    background: var(--sd-primary);
    border-color: var(--sd-primary);
    color: #042f2e;
    font-weight: 600;
  }

  .oplab-sidebar-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(94, 234, 212, 0.25);
    color: #a7f3d0;
  }

  .oplab-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 20px 24px 28px;
    background: var(--sd-bg);
  }

  .lab-oplab-vista {
    animation: oplab-fade-in 0.2s ease-out;
  }

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

  .oplab-page-head {
    margin-bottom: 20px;
  }

  .oplab-page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sd-text);
    letter-spacing: -0.02em;
  }

  .oplab-page-sub {
    margin: 4px 0 0;
    font-size: 0.9rem;
    color: var(--sd-text-muted);
  }

  .oplab-stampe-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
  }

  .oplab-stampa-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 20px;
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow);
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
  }

  .oplab-stampa-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sd-shadow-hover);
    border-color: rgba(20, 184, 166, 0.35);
  }

  .oplab-stampa-card-icon {
    font-size: 1.5rem;
  }

  .oplab-stampa-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sd-text);
  }

  .oplab-stampa-card-desc {
    font-size: 0.82rem;
    color: var(--sd-text-muted);
    line-height: 1.4;
  }

  .oplab-impostazioni-card {
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow);
    padding: 28px 24px;
    max-width: 520px;
  }

  .oplab-impostazioni-desc {
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--sd-text-muted);
  }

  .oplab-impostazioni-btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 18px;
  }

  .oplab-legacy-vista-nav {
    display: none !important;
  }

  .oplab-shell .lab-pro-filtri-wrap {
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    padding: 14px 16px;
    box-shadow: var(--sd-shadow);
    margin-bottom: 20px;
  }

  .oplab-shell .lab-filtro-btn {
    border-radius: 999px;
    font-size: 0.78rem;
    padding: 5px 12px;
    border: 1px solid var(--sd-border);
    background: var(--sd-bg);
    color: var(--sd-text-muted);
    transition: all 0.15s ease;
  }

  .oplab-shell .lab-filtro-btn.active {
    background: var(--sd-primary);
    border-color: var(--sd-primary);
    color: #042f2e;
    font-weight: 600;
  }

  .oplab-shell .lab-ricerca input {
    border-radius: 10px;
    border: 1px solid var(--sd-border);
    padding: 8px 12px;
    font-size: 0.88rem;
  }

  .oplab-shell .lab-stampa-periodo-inline {
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    padding: 16px;
    box-shadow: var(--sd-shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .lab-pro-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 0;
  }

  .oplab-shell .lab-pro-kpi-card {
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    padding: 20px 18px;
    text-align: center;
    box-shadow: var(--sd-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .oplab-shell .lab-pro-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sd-shadow-hover);
  }

  .lab-pro-kpi-clickable {
    cursor: pointer;
    user-select: none;
  }

  .lab-pro-kpi-clickable:active {
    transform: translateY(0);
    box-shadow: var(--sd-shadow);
  }

  .lab-pro-kpi-clickable.active {
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.28);
  }

  .lab-pro-kpi-nuovi {
    border-color: #9ae6b4;
    background: #f0fff4;
  }

  .lab-pro-kpi-nuovi .lab-pro-kpi-value {
    color: #276749;
  }

  .lab-pro-kpi-preview {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(39, 103, 73, 0.18);
    text-align: left;
  }

  .lab-pro-kpi-preview-head {
    margin-bottom: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #276749;
  }

  .lab-pro-kpi-preview-item + .lab-pro-kpi-preview-item {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(39, 103, 73, 0.12);
  }

  .lab-pro-kpi-preview-nome {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    color: #22543d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .lab-pro-kpi-preview-ora {
    margin-top: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #38a169;
  }

  .lab-pro-kpi-preview-vuoto {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 500;
    color: #68d391;
    text-align: center;
    font-style: italic;
  }

  .oplab-shell .lab-pro-ricerca-wrap {
    flex: 1 1 100%;
    width: 100%;
    margin-bottom: 4px;
  }

  .oplab-shell .lab-pro-ricerca-input {
    width: 100%;
    box-sizing: border-box;
  }

  .lab-pro-card-body {
    margin-top: 8px;
  }

  .lab-pro-card-row {
    margin: 0 0 6px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #2d3748;
  }

  .lab-pro-card-lbl {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #718096;
    margin-bottom: 1px;
  }

  .lab-pro-card-val {
    display: block;
    font-weight: 600;
    color: #1a202c;
  }

  .lab-clienti-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .lab-clienti-page-head .btn {
    flex-shrink: 0;
    margin-top: 4px;
  }

  .lab-clienti-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }

  .lab-clienti-lista-panel,
  .lab-clienti-dettaglio-panel {
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    box-shadow: var(--sd-shadow);
    padding: 16px;
  }

  .lab-clienti-ricerca-wrap {
    margin-bottom: 14px;
  }

  .lab-clienti-ricerca-wrap .lab-pro-ricerca-input {
    width: 100%;
    box-sizing: border-box;
  }

  .lab-clienti-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
  }

  .lab-clienti-card {
    border: 1px solid var(--sd-border);
    border-radius: 12px;
    padding: 14px;
    background: var(--sd-bg);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .lab-clienti-card:hover,
  .lab-clienti-card-active {
    border-color: #4299e1;
    box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.18);
  }

  .lab-clienti-card-id {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #718096;
  }

  .lab-clienti-card-nome {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a202c;
  }

  .lab-clienti-card-tel {
    margin: 0 0 8px;
    font-size: 0.8rem;
    color: #4a5568;
  }

  .lab-clienti-card-meta {
    margin: 0 0 4px;
    font-size: 0.76rem;
    color: #4a5568;
  }

  .lab-clienti-card-meta span {
    font-weight: 700;
    color: #718096;
    margin-right: 4px;
  }

  .lab-clienti-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
  }

  .lab-clienti-badge {
    font-size: 0.68rem;
    padding: 3px 8px;
  }

  .lab-clienti-badge-fonte {
    font-size: 0.68rem;
    padding: 3px 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
  }

  .lab-badge-anagrafica {
    background: #e6fffa;
    color: #234e52;
    border: 1px solid #81e6d9;
  }

  .lab-badge-da-ordine {
    background: #fefcbf;
    color: #744210;
    border: 1px solid #f6e05e;
  }

  .lab-clienti-badges-fonte {
    margin-top: 8px;
    margin-bottom: 4px;
  }

  .lab-clienti-dettaglio-nota-ordine {
    margin: 10px 0 0;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: #744210;
    background: #fffff0;
    border: 1px solid #f6e05e;
    border-radius: 8px;
  }

  .lab-clienti-dettaglio-placeholder {
    margin: 0;
    color: #718096;
    font-size: 0.9rem;
    font-style: italic;
  }

  .lab-clienti-stato-vuoto {
    padding: 20px 16px;
    border-radius: 12px;
    background: #f7fafc;
    border: 1px dashed #cbd5e0;
    color: #4a5568;
    text-align: center;
  }

  .lab-clienti-stato-vuoto strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: #2d3748;
  }

  .lab-clienti-stato-vuoto p {
    margin: 0;
    font-size: 0.84rem;
    color: #718096;
  }

  .lab-clienti-dettaglio-nome {
    margin: 12px 0 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1a202c;
  }

  .lab-clienti-dettaglio-row {
    margin: 0 0 6px;
    font-size: 0.84rem;
    color: #2d3748;
  }

  .lab-clienti-dettaglio-row span {
    display: inline-block;
    min-width: 130px;
    font-weight: 700;
    color: #718096;
  }

  .lab-clienti-dettaglio-stats {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--sd-border);
  }

  .lab-clienti-badges-dettaglio {
    margin-top: 10px;
  }

  .lab-clienti-indietro {
    display: none;
  }

  .lab-clienti-storico-titolo {
    margin: 18px 0 10px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4a5568;
  }

  .lab-clienti-storico {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 420px);
    overflow-y: auto;
  }

  .lab-clienti-ordine-riga {
    border: 1px solid var(--sd-border);
    border-radius: 10px;
    padding: 12px;
    background: var(--sd-bg);
  }

  .lab-clienti-ordine-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }

  .lab-clienti-ordine-id {
    font-size: 0.9rem;
    color: #1a202c;
  }

  .lab-clienti-ordine-meta {
    margin: 0 0 4px;
    font-size: 0.78rem;
    color: #4a5568;
  }

  .lab-clienti-ordine-meta span {
    font-weight: 700;
    color: #718096;
    margin-right: 4px;
  }

  .lab-clienti-ordine-azioni {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }

  @media (max-width: 900px) {
    .lab-clienti-layout {
      grid-template-columns: 1fr;
    }

    .lab-clienti-grid {
      max-height: none;
    }

    .lab-clienti-indietro {
      display: inline-flex;
    }
  }

  .lab-pro-card-evidenziato {
    outline: 3px solid #48bb78;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(72, 187, 120, 0.28);
    animation: labCardEvidenziaPulse 0.9s ease 2;
  }

  @keyframes labCardEvidenziaPulse {
    0%,
    100% {
      box-shadow: 0 0 0 5px rgba(72, 187, 120, 0.28);
    }
    50% {
      box-shadow: 0 0 0 9px rgba(72, 187, 120, 0.14);
    }
  }

  .lab-pro-kpi-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    color: #2d3748;
  }

  .lab-pro-kpi-label {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #718096;
  }

  .lab-pro-kpi-ritardo .lab-pro-kpi-value {
    color: #c53030;
  }

  .lab-pro-kpi-ritardo {
    border-color: #feb2b2;
    background: #fff5f5;
  }

  .lab-pro-kpi-lavorazione {
    border-color: #f6ad55;
    background: #fffaf0;
  }

  .lab-pro-kpi-lavorazione .lab-pro-kpi-value {
    color: #c05621;
  }

  .lab-ordine-toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 36px));
    pointer-events: none;
  }

  .lab-ordine-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #1a202c;
    color: #f7fafc;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    animation: labOrdineToastIn 0.32s ease;
  }

  .lab-ordine-toast-out {
    animation: labOrdineToastOut 0.28s ease forwards;
  }

  @keyframes labOrdineToastIn {
    from {
      opacity: 0;
      transform: translateX(24px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes labOrdineToastOut {
    from {
      opacity: 1;
      transform: translateX(0);
    }
    to {
      opacity: 0;
      transform: translateX(24px);
    }
  }

  .lab-ordine-toast-icon {
    flex: 0 0 auto;
    font-size: 1.35rem;
    line-height: 1;
  }

  .lab-ordine-toast-body {
    flex: 1 1 auto;
    min-width: 0;
  }

  .lab-ordine-toast-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
  }

  .lab-ordine-toast-meta {
    margin-top: 3px;
    font-size: 0.8rem;
    color: #cbd5e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .lab-ordine-toast-apri {
    flex: 0 0 auto;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #48bb78;
    color: #fff;
    cursor: pointer;
  }

  .lab-ordine-toast-apri:hover {
    background: #38a169;
  }

  .lab-pro-sezione-titolo-lavorazione {
    color: #c05621;
    border-bottom-color: #f6ad55;
  }

  .lab-pro-card-lavorazione {
    border-color: #f6ad55;
    background: #fffaf0;
    box-shadow: 0 0 0 1px rgba(246, 173, 85, 0.35);
  }

  .lab-filtro-btn[data-lab-filtro="In lavorazione"].active {
    background: #ed8936;
    border-color: #dd6b20;
    color: #fff;
  }

  .lab-stato-btn-lavorazione:not(.lab-stato-btn-lavorazione-active) {
    border-color: #f6ad55;
    color: #c05621;
    background: #fffaf0;
  }

  .lab-stato-btn-lavorazione-active,
  .lab-stato-btn-lavorazione.btn-primary {
    background: #ed8936 !important;
    border-color: #dd6b20 !important;
    color: #fff !important;
  }

  .lab-pro-vista-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
  }

  .lab-vista-btn.active {
    background: var(--ph-colore-primario, #667eea);
    color: #fff;
    border-color: transparent;
  }

  .lab-pro-filtri-wrap {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    justify-content: flex-start;
    margin-bottom: 18px;
  }

  .lab-pro-filtri {
    flex: 1 1 auto;
  }

  .lab-pro-sezione {
    margin-bottom: 24px;
  }

  .lab-pro-sezione-titolo {
    margin: 0 0 12px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4a5568;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
  }

  .lab-pro-sezione-ritardi-titolo {
    color: #c53030;
    border-bottom-color: #fc8181;
  }

  .lab-pro-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .oplab-shell .lab-pro-card {
    position: relative;
    background: var(--sd-card);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    padding: 16px;
    box-shadow: var(--sd-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .oplab-shell .lab-pro-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--sd-shadow-hover);
  }

  .lab-pro-card {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }

  .lab-pro-card-ritardo {
    border-color: #fc8181;
    background: #fff5f5;
    box-shadow: 0 0 0 1px #fed7d7;
  }

  .lab-pro-badge-ritardo {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e53e3e;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
  }

  .lab-pro-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding-right: 72px;
  }

  .lab-pro-card-ritardo .lab-pro-card-head {
    padding-right: 88px;
  }

  .lab-pro-card-id {
    font-size: 1.05rem;
    color: #2d3748;
  }

  .lab-pro-card-cliente {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
  }

  .lab-pro-card-meta {
    margin: 0 0 4px;
    font-size: 0.85rem;
    color: #4a5568;
  }

  .lab-pro-card-meta span {
    color: #718096;
    font-weight: 600;
  }

  .lab-pro-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #edf2f7;
  }

  .lab-card-stato-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
  }

  .lab-card-stato-select {
    font-size: 0.82rem;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    min-width: 120px;
  }

  .lab-archivio-desc {
    margin: 0 0 12px;
    color: #718096;
    font-size: 0.9rem;
  }

  .lab-archivio-filtri {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 16px;
    align-items: flex-end;
  }

  .lab-archivio-data {
    flex: 0 1 160px;
  }

  .lab-archivio-ricerca {
    flex: 1 1 220px;
    min-width: 180px;
  }

  @media (max-width: 1100px) {
    .lab-pro-kpi-grid {
      grid-template-columns: repeat(3, 1fr);
    }

    .lab-pro-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

  @media (max-width: 1024px) {
    .oplab-shell {
      --sd-sidebar-width: 72px;
    }

    .oplab-nav-label {
      display: none;
    }

    .oplab-nav-btn {
      justify-content: center;
      padding: 12px 8px;
    }

    .oplab-sidebar-actions .oplab-btn-action {
      font-size: 0;
      padding: 10px;
    }

    .oplab-sidebar-actions .oplab-btn-action::after {
      font-size: 0.82rem;
    }

    .oplab-sidebar-actions .btn-primary.oplab-btn-action::after {
      content: "+";
      font-size: 1.1rem;
      font-weight: 700;
    }

    .oplab-main {
      padding: 16px 18px 24px;
    }

    .oplab-stampe-grid {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 1024px) {
    .oplab-hero-header {
      min-height: 80px;
      padding: 12px 18px;
      gap: 14px;
    }

    .oplab-brand-logo-header {
      height: 54px;
      max-height: 54px;
    }
  }

  @media (max-width: 768px) {
    .oplab-login-logo-full {
      max-width: 260px;
    }

    .oplab-hero-header:not(.oplab-header-premium) {
      min-height: auto;
      flex-direction: column;
      align-items: stretch;
      padding: 12px 14px;
      gap: 10px;
    }

    .oplab-hero-brand {
      gap: 10px;
    }

    .oplab-brand-subtitle {
      font-size: 0.72rem;
    }

    .oplab-hero-actions {
      width: 100%;
      justify-content: flex-end;
    }

    .oplab-hero-actions .lab-sd-user-slot,
    .oplab-hero-header .lab-sd-user-bar.user-bar,
    .oplab-hero-header .user-bar.lab-sd-user-bar {
      width: 100%;
      justify-content: flex-end;
      flex-wrap: wrap;
    }

    .oplab-body {
      flex-direction: column;
    }

    .oplab-sidebar {
      width: 100%;
      flex-direction: row;
      flex-wrap: wrap;
      padding: 10px 12px;
      border-right: none;
      border-bottom: 1px solid rgba(94, 234, 212, 0.12);
    }

    .oplab-sidebar-nav {
      flex-direction: row;
      flex-wrap: wrap;
      flex: 1 1 100%;
      gap: 6px;
    }

    .oplab-nav-btn {
      flex: 1 1 auto;
      min-width: calc(50% - 6px);
      justify-content: center;
    }

    .oplab-nav-label {
      display: inline;
      font-size: 0.78rem;
    }

    .oplab-sidebar-actions {
      flex-direction: row;
      flex: 1 1 100%;
      border-top: none;
      padding-top: 0;
      gap: 8px;
    }

    .oplab-sidebar-actions .oplab-btn-action {
      flex: 1;
      font-size: 0.82rem;
    }

    .oplab-sidebar-actions .oplab-btn-action::after {
      content: none;
    }

    .lab-pro-kpi-grid {
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }

    .lab-pro-grid {
      grid-template-columns: 1fr;
    }

    .oplab-page-title {
      font-size: 1.25rem;
    }
  }

  .lab-panel-interno {
    padding-top: 4px;
  }

  .lab-header-interno {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 1px solid #e2e8f0;
  }

  .lab-header-titolo {
    margin: 0 0 4px;
    font-size: 1.45rem;
    font-weight: 700;
    color: #2d3748;
  }

  .lab-header-sottotitolo {
    margin: 0;
    font-size: 0.92rem;
    color: #718096;
  }

  .lab-header-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  .lab-stampa-periodo-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
  }

  .lab-manuale-form .lab-manuale-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
  }

  .lab-manuale-note,
  .lab-manuale-file,
  .lab-cli-full {
    grid-column: 1 / -1;
  }

  .lab-man-cerca-cliente-wrap {
    grid-column: 1 / -1;
    position: relative;
  }

  .lab-cerca-cliente-risultati {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--sd-border);
    border-radius: 10px;
    box-shadow: var(--sd-shadow);
  }

  .lab-cerca-cliente-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #edf2f7;
    background: transparent;
    font-size: 0.84rem;
    color: #2d3748;
    cursor: pointer;
  }

  .lab-cerca-cliente-item:hover,
  .lab-cerca-cliente-item:focus {
    background: #ebf8ff;
    outline: none;
  }

  .lab-cerca-cliente-item:last-child {
    border-bottom: none;
  }

  .lab-cerca-cliente-vuoto {
    margin: 0;
    padding: 12px;
    font-size: 0.84rem;
    color: #718096;
    font-style: italic;
  }

  .modal-box-lab-nuovo {
    max-width: 720px;
  }

  .modal-box-lab-cliente {
    max-width: 680px;
  }

  .lab-mod-allegato-attuale {
    margin-bottom: 8px;
    font-size: 0.9rem;
  }

  .lab-mod-allegato-link a {
    font-weight: 600;
    color: var(--ph-colore-primario, #667eea);
  }

  .lab-mod-no-allegato {
    color: #718096;
    font-size: 0.88rem;
    margin: 0 0 8px;
  }

  .modal-lab-modifica-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
  }

  .config-admin-card .config-admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: 16px;
  }

  .config-admin-card .config-admin-header h3 {
    margin: 0 0 4px;
  }

  .config-admin-card .config-admin-header .card-subtitle {
    margin: 0;
  }

  .config-utenti-lista,
  .config-tenants-lista {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .config-utente-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }

  .config-utente-card-nuovo,
  .config-tenant-card-nuovo {
    border-color: var(--ph-colore-primario, #667eea);
    box-shadow: 0 0 0 1px rgba(102, 126, 234, 0.25);
  }

  .config-field-hint {
    font-size: 0.78rem;
    color: #718096;
    font-weight: 400;
  }

  .config-utente-sezione textarea[data-f="permessiJson"] {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.82rem;
    min-height: 88px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    resize: vertical;
  }

  .config-tenant-color-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .config-tenant-color-picker {
    width: 48px;
    height: 40px;
    padding: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
  }

  .config-tenant-color-hex {
    flex: 1;
    min-width: 120px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
  }

  .config-tenant-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
  }

  .config-tenant-preset-btn {
    font-size: 0.78rem;
  }

  .config-tenant-color-anteprima {
    margin-top: 8px;
    padding: 14px 16px;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  }

  .config-tenant-logo-memo {
    margin: 10px 0;
    padding: 10px 12px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #4a5568;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
  }

  .config-tenant-logo-preview-wrap {
    margin-top: 10px;
    padding: 12px;
    background: #1a202c;
    border-radius: 10px;
    text-align: center;
  }

  .config-tenant-logo-preview {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
  }

  .config-tenant-logo-preview.hidden {
    display: none;
  }

  .config-utente-card {
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fafafa;
  }

  .config-utente-card-v2 {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  }

  .config-utente-header-v2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
  }

  .config-utente-titoli {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .config-utente-titoli strong {
    font-size: 1.05rem;
  }

  .config-utente-ruolo {
    font-size: 0.82rem;
    color: #718096;
    font-weight: 600;
  }

  .config-utente-attivo {
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .config-utente-sezione {
    margin-bottom: 14px;
  }

  .config-utente-sezione h4,
  .config-permessi-sezione h5 {
    margin: 0 0 8px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4a5568;
  }

  .config-permessi-sezione {
    margin-bottom: 10px;
  }

  .config-utente-salva {
    margin-top: 8px;
  }

  .lab-config-v25-toolbar {
    margin-bottom: 12px;
  }

  .lab-config-table-v25 {
    font-size: 0.9rem;
  }

  .lab-config-table-v25 .lab-cfg-actions {
    white-space: nowrap;
  }

  .lab-config-table-v25 .lab-cfg-actions .btn {
    margin: 2px 0;
  }

  .lab-cfg-fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 12px 0;
  }

  .lab-cfg-fieldset legend {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 4px;
  }

  .login-forgot-wrap {
    display: block;
    text-align: center;
    margin: 14px 0 4px;
    padding: 0;
  }

  .btn-link-forgot {
    display: inline-block;
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ph-colore-primario, #667eea);
    text-decoration: underline;
    cursor: pointer;
    line-height: 1.4;
  }

  .btn-link-forgot:hover,
  .btn-link-forgot:focus {
    color: #4c51bf;
    text-decoration: underline;
    outline: none;
  }

  #login-page .login-forgot-wrap {
    visibility: visible;
    opacity: 1;
  }

  .btn-reset-pwd-badge {
    background: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
  }

  .btn-reset-pwd-badge-active {
    animation: reset-pwd-pulse 1.5s ease-in-out infinite;
  }

  @keyframes reset-pwd-pulse {
    0%,
    100% {
      box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    50% {
      box-shadow: 0 0 0 6px rgba(229, 62, 62, 0);
    }
  }

  .reset-password-lista {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
  }

  .reset-pwd-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
  }

  .reset-pwd-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .modal-box-small {
    max-width: 420px;
  }

  [data-lab-campo].hidden {
    display: none !important;
  }

  .config-permessi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px 12px;
    margin-bottom: 4px;
  }

  .config-perm-check {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 6px 8px;
    border-radius: 6px;
    background: #f7fafc;
    border: 1px solid #edf2f7;
    cursor: pointer;
    line-height: 1.3;
    color: #2d3748;
  }

  .config-perm-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
  }

  .config-utente-permessi .config-permessi-sezione + .config-permessi-sezione {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
  }

  .lab-stampa-excel {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 8pt;
    color: #111;
    padding: 8mm 10mm;
    margin: 0 auto;
  }

  .lab-stampa-a4 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11pt;
    color: #111;
    padding: 12mm 14mm;
    max-width: 210mm;
    margin: 0 auto;
  }

  .lab-stampa-a4 h1 {
    font-size: 18pt;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .lab-stampa-sub {
    margin: 0 0 16px;
    font-size: 11pt;
    color: #444;
  }

  .lab-stampa-giorno {
    margin-bottom: 14px;
    page-break-inside: avoid;
  }

  .lab-stampa-giorno h3 {
    font-size: 12pt;
    margin: 0 0 8px;
    padding-bottom: 4px;
    border-bottom: 2px solid #333;
  }

  .lab-stampa-ordine-card {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    page-break-inside: avoid;
  }

  .lab-stampa-ordine-card h4 {
    margin: 0 0 8px;
    font-size: 11pt;
  }

  .lab-stampa-dl {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 4px 10px;
    margin: 0;
  }

  .lab-stampa-dl dt {
    font-weight: 700;
    margin: 0;
  }

  .lab-stampa-dl dd {
    margin: 0;
    word-break: break-word;
  }

  .lab-stampa-tabella-excel {
    width: 100%;
    border-collapse: collapse;
    font-size: 7.5pt;
    margin-bottom: 10px;
  }

  .lab-stampa-tabella-excel th,
  .lab-stampa-tabella-excel td {
    border: 1px solid #333;
    padding: 3px 5px;
    text-align: left;
    vertical-align: top;
  }

  .lab-stampa-tabella-excel th {
    background: #e8e8e8;
    font-weight: 700;
    white-space: nowrap;
  }

  @media print {
    @page {
      size: A4 landscape;
      margin: 10mm;
    }

    body.print-lab-ordini,
    body.print-lab-excel {
      margin: 0 !important;
      padding: 0 !important;
      background: #fff !important;
    }

    body.print-lab-ordini > *:not(#lab-ordini-stampa-container),
    body.print-lab-excel > *:not(#lab-ordini-stampa-container) {
      display: none !important;
    }

    body.print-lab-ordini #lab-ordini-stampa-container,
    body.print-lab-ordini #lab-ordini-stampa-container *,
    body.print-lab-excel #lab-ordini-stampa-container,
    body.print-lab-excel #lab-ordini-stampa-container * {
      visibility: visible !important;
    }

    body.print-lab-ordini #lab-ordini-stampa-container,
    body.print-lab-excel #lab-ordini-stampa-container {
      display: block !important;
      position: static !important;
      width: auto !important;
      height: auto !important;
      overflow: visible !important;
      z-index: auto !important;
      background: #fff !important;
    }

    body.print-lab-excel .lab-stampa-excel {
      width: 100%;
      max-width: none;
      padding: 0;
    }

    body.print-lab-excel .lab-stampa-tabella-excel {
      page-break-inside: auto;
    }

    body.print-lab-excel .lab-stampa-giorno {
      page-break-inside: avoid;
    }
  }

/* ============================================================
   OPLAB BRANDING v3 - SD OPERIS: header layout override
   ============================================================ */
#laboratorio .oplab-hero-header {
  min-height: 84px !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 12px 20px !important;
  grid-template-columns: none !important;
  overflow: visible !important;
}

#laboratorio .oplab-hero-brand {
  flex: 0 1 auto !important;
  min-width: 0 !important;
}

@media (min-width: 769px) {
  #laboratorio .oplab-brand-logo-header {
    width: auto !important;
    height: 58px !important;
    max-height: 58px !important;
    object-fit: contain !important;
  }
}

#laboratorio .oplab-hero-actions {
  flex: 0 0 auto !important;
  margin-right: 8px !important;
  justify-content: flex-end !important;
}

/* ============================================================
   OPLAB MOBILE UX v1.2 — PWA-style mobile experience
   Desktop (>768px): invariato. Mobile: drawer, header compatto, KPI 2 col.
   ============================================================ */

.oplab-hamburger-btn {
  display: none;
}

.oplab-sidebar-overlay {
  display: none;
}


body.oplab-nav-lock {
  overflow: hidden;
}

@media (min-width: 769px) {
  #laboratorio .oplab-hamburger-btn,
  #laboratorio .oplab-sidebar-overlay {
    display: none !important;
  }

}

@media (max-width: 768px) {
  /* OPLAB HEADER USE LOGO-HEADER v1.5 — ☰ logo-header.png 🟢 */
  #laboratorio .oplab-hero-header {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    min-height: 82px !important;
    max-height: 82px !important;
    height: 82px !important;
    padding: 0 14px 0 12px !important;
    overflow: hidden !important;
    background:
      radial-gradient(circle at 12% 50%, rgba(124, 255, 79, 0.16), transparent 46%),
      radial-gradient(circle at 88% 40%, rgba(34, 184, 255, 0.18), transparent 42%),
      linear-gradient(135deg, #0b1220 0%, #0f172a 52%, #0b1f24 100%) !important;
  }

  #laboratorio .oplab-hero-header::after {
    opacity: 0.55;
    height: 82px;
  }

  #laboratorio .oplab-hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    order: 0;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    min-height: 42px;
    min-width: 42px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(124, 255, 79, 0.32);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.72);
    color: #f8fafc;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  }

  #laboratorio .oplab-hamburger-btn:active {
    background: rgba(34, 184, 255, 0.18);
  }

  #laboratorio .oplab-hero-brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
  }

  #laboratorio .mobile-brand-logo,
  #laboratorio .oplab-header-logo {
    width: 260px !important;
    max-width: 52vw !important;
    height: 54px !important;
    max-height: 54px !important;
    object-fit: contain !important;
    object-position: center center !important;
    display: block !important;
    flex-shrink: 1 !important;
    margin: 0 auto;
  }

  #laboratorio .oplab-hero-actions {
    order: 2;
    flex: 0 0 auto !important;
    width: auto !important;
    margin-right: 0 !important;
    justify-content: flex-end !important;
  }

  #laboratorio .oplab-hero-actions .lab-sd-user-slot,
  #laboratorio .oplab-hero-header .lab-sd-user-bar.user-bar,
  #laboratorio .oplab-hero-header .user-bar.lab-sd-user-bar {
    width: auto !important;
    flex-wrap: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    min-height: 0 !important;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .user-bar-legacy-info,
  #laboratorio .oplab-hero-header .lab-sd-user-bar .user-bar-operator-line,
  #laboratorio .oplab-hero-header .lab-sd-user-bar #btn-sync-google,
  #laboratorio .oplab-hero-header .lab-sd-user-bar .btn-danger,
  #laboratorio .oplab-hero-header .lab-sd-user-bar .btn-reset-pwd-badge {
    display: none !important;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .user-bar-actions {
    gap: 0 !important;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-wrap {
    margin: 0;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    border-width: 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    background: rgba(15, 23, 42, 0.55) !important;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal .google-stato-emoji {
    width: 16px !important;
    height: 16px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    border-radius: 50% !important;
    display: block !important;
    overflow: hidden !important;
    background: #d63031;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="online"] {
    border-color: rgba(0, 184, 148, 0.55) !important;
    background: rgba(0, 184, 148, 0.12) !important;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="online"] .google-stato-emoji {
    background: #00b894 !important;
    box-shadow: 0 0 10px rgba(0, 184, 148, 0.45);
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="syncing"] {
    border-color: rgba(241, 196, 15, 0.55) !important;
    background: rgba(241, 196, 15, 0.1) !important;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="syncing"] .google-stato-emoji {
    background: #f1c40f !important;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
    animation: oplab-sync-pulse 1s ease-in-out infinite;
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="offline"] .google-stato-emoji,
  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="error"] .google-stato-emoji {
    background: #d63031 !important;
    box-shadow: 0 0 8px rgba(214, 48, 49, 0.4);
  }

  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="offline"],
  #laboratorio .oplab-hero-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="error"] {
    border-color: rgba(214, 48, 49, 0.5) !important;
    background: rgba(214, 48, 49, 0.1) !important;
  }

  /* --- Priorità 1: sidebar drawer --- */
  #laboratorio .oplab-body {
    flex-direction: row !important;
    position: relative;
  }

  #laboratorio .oplab-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 240;
    background: rgba(15, 23, 42, 0.58);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  #laboratorio.oplab-mobile-nav-open .oplab-sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  #laboratorio .oplab-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 250;
    width: min(288px, 86vw) !important;
    max-width: 86vw;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    padding: 16px 14px !important;
    border-right: 1px solid rgba(94, 234, 212, 0.12) !important;
    border-bottom: none !important;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #laboratorio.oplab-mobile-nav-open .oplab-sidebar {
    transform: translateX(0);
  }

  #laboratorio .oplab-sidebar-nav {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }

  #laboratorio .oplab-nav-btn {
    min-height: 48px;
    flex: none !important;
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    border-radius: 12px;
  }

  #laboratorio .oplab-nav-label {
    display: inline !important;
    font-size: 0.9rem !important;
  }

  #laboratorio .oplab-sidebar-actions {
    flex-direction: column !important;
    border-top: 1px solid rgba(94, 234, 212, 0.12) !important;
    padding-top: 12px !important;
    margin-top: auto;
  }

  #laboratorio .oplab-sidebar-actions .oplab-btn-action {
    min-height: 48px;
    font-size: 0.88rem !important;
    flex: none !important;
  }

  #laboratorio .oplab-sidebar-actions .oplab-btn-action::after {
    content: none !important;
  }

  #laboratorio .oplab-sidebar-profile {
    padding: 8px 10px 14px;
  }

  #laboratorio .oplab-sidebar-account-actions .btn {
    min-height: 48px;
    font-size: 0.88rem;
  }

  #laboratorio .oplab-main {
    width: 100%;
    padding: 12px 14px 20px !important;
  }

  /* --- FIX 4: dashboard KPI 2 colonne --- */
  #laboratorio .oplab-kpi-desktop-only {
    display: none !important;
  }

  #laboratorio .lab-pro-kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  #laboratorio .oplab-shell .lab-pro-kpi-card,
  #laboratorio .lab-pro-kpi-card {
    width: 100%;
    min-height: 68px;
    padding: 12px 14px !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 14px;
  }

  #laboratorio .lab-pro-kpi-value {
    font-size: 1.45rem !important;
    line-height: 1.1;
  }

  #laboratorio .lab-pro-kpi-label {
    font-size: 0.68rem !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-top: 4px;
    line-height: 1.25;
  }

  #laboratorio .lab-pro-kpi-nuovi {
    min-height: auto;
    text-align: left;
  }

  #laboratorio .lab-pro-kpi-preview-ora {
    font-size: 0.72rem;
    line-height: 1.35;
    word-break: break-word;
  }

  #laboratorio .oplab-page-head {
    margin-bottom: 14px;
  }

  #laboratorio .oplab-page-sub {
    font-size: 0.84rem;
  }

  /* --- Priorità 4: touch targets --- */
  #laboratorio .btn,
  #laboratorio .oplab-nav-btn,
  #laboratorio .oplab-stampa-card,
  #laboratorio .lab-pro-filtri .btn,
  #laboratorio .lab-pro-filtri button,
  #laboratorio .lab-clienti-card,
  #laboratorio .lab-pro-card,
  #laboratorio .oplab-btn-action {
    min-height: 48px;
    touch-action: manipulation;
  }

  #laboratorio .btn-small {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .login-box-oplab-v3 .btn {
    min-height: 48px;
    touch-action: manipulation;
  }

  /* --- Priorità 5: form mobile --- */
  #laboratorio input,
  #laboratorio select,
  #laboratorio textarea,
  #laboratorio .lab-pro-ricerca-input,
  .modal-box-lab-nuovo input,
  .modal-box-lab-nuovo select,
  .modal-box-lab-nuovo textarea,
  .modal-box-lab-cliente input,
  .modal-box-lab-cliente select,
  .modal-box-lab-cliente textarea,
  .login-box-oplab-v3 input {
    font-size: 16px !important;
    max-width: 100%;
  }

  #laboratorio select,
  .modal-box-lab-nuovo select,
  .modal-box-lab-cliente select {
    min-height: 48px;
  }

  #laboratorio .lab-manuale-form .form-group,
  .modal-box-lab-nuovo .form-group {
    width: 100%;
  }

  /* --- Priorità 6: tabelle scroll --- */
  #laboratorio .oplab-table-scroll,
  #laboratorio .lab-ordini-stampa-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  #laboratorio table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* --- Priorità 7: look app --- */
  #laboratorio.oplab-shell {
    --sd-radius: 14px;
  }

  #laboratorio .lab-pro-grid {
    gap: 12px !important;
  }

  #laboratorio .lab-pro-card,
  #laboratorio .lab-clienti-card,
  #laboratorio .oplab-stampa-card {
    border-radius: 14px;
  }

  #laboratorio .lab-pro-filtri-wrap {
    gap: 8px;
    margin-bottom: 12px;
  }

  #laboratorio .lab-clienti-layout {
    gap: 12px;
  }

  #laboratorio .modal-box-lab-nuovo,
  #laboratorio .modal-box-lab-cliente {
    max-width: calc(100vw - 24px);
    margin: 12px;
  }
}

@keyframes oplab-sync-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(0.92);
  }
}

/* OPLAB HEADER USE LOGO-HEADER v1.5 — sync dot desktop + schermi piccoli */
@media (min-width: 769px) {
  #laboratorio .oplab-hero-header.oplab-header-premium {
    min-height: 84px !important;
    padding: 14px 22px !important;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .oplab-brand-logo-header {
    height: 58px !important;
    max-height: 58px !important;
    max-width: none !important;
    object-position: left center !important;
    margin: 0;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .oplab-hero-brand {
    justify-content: flex-start !important;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border-width: 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal .google-stato-emoji {
    width: 16px !important;
    height: 16px !important;
    font-size: 0 !important;
    border-radius: 50% !important;
    display: block !important;
    background: #d63031;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="online"] .google-stato-emoji {
    background: #00b894 !important;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="syncing"] .google-stato-emoji {
    background: #f1c40f !important;
    animation: oplab-sync-pulse 1s ease-in-out infinite;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="offline"] .google-stato-emoji,
  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal[data-stato="error"] .google-stato-emoji {
    background: #d63031 !important;
  }

  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar #btn-sync-google,
  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .btn-danger {
    display: inline-flex !important;
  }
}

@media (max-width: 390px) {
  #laboratorio .oplab-hero-header {
    gap: 8px !important;
    padding: 0 10px 0 8px !important;
  }

  #laboratorio .oplab-hamburger-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }
}

/* DEBUG HEADER MOBILE — logo-header.png: larghezza guida, no altezza fissa */
@media (max-width: 768px) {
  #laboratorio .oplab-hero-header {
    overflow: visible !important;
  }

  #laboratorio .header-brand,
  #laboratorio .mobile-brand,
  #laboratorio .oplab-hero-brand {
    flex: 1 1 40% !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: visible !important;
    justify-content: center !important;
  }

  #laboratorio .header-brand img,
  #laboratorio .mobile-brand img,
  #laboratorio .oplab-header-logo,
  #laboratorio .oplab-brand-logo-header {
    width: 220px !important;
    max-width: 220px !important;
    height: auto !important;
    max-height: none !important;
    min-width: 0 !important;
    object-fit: contain !important;
    display: block !important;
    flex-shrink: 0 !important;
    margin: 0 auto;
    transform: none !important;
    zoom: 1 !important;
  }
}

@media (max-width: 390px) {
  #laboratorio .header-brand img,
  #laboratorio .mobile-brand img,
  #laboratorio .oplab-header-logo,
  #laboratorio .oplab-brand-logo-header {
    width: min(220px, 58vw) !important;
    max-width: min(220px, 58vw) !important;
  }
}

/* ============================================================
   OPLAB RESPONSIVE SEPARATION v1
   Mobile (<=768) e desktop (>=769) con regole indipendenti.
   ============================================================ */

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* --- MOBILE: header compatto --- */
@media (max-width: 768px) {
  #laboratorio .oplab-mobile-header.oplab-hero-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  #laboratorio .oplab-mobile-header .oplab-hero-brand.oplab-mobile-brand {
    flex: 1 1 auto !important;
    justify-content: center !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  #laboratorio .oplab-mobile-header .oplab-header-actions-slot {
    flex: 0 0 auto !important;
    justify-content: flex-end !important;
  }

  #laboratorio .oplab-mobile-header .lab-sd-user-bar .user-bar-operator-line,
  #laboratorio .oplab-mobile-header .lab-sd-user-bar .user-bar-legacy-info,
  #laboratorio .oplab-mobile-header .lab-sd-user-bar #btn-sync-google,
  #laboratorio .oplab-mobile-header .lab-sd-user-bar .btn-danger,
  #laboratorio .oplab-mobile-header .lab-sd-user-bar .btn-reset-pwd-badge {
    display: none !important;
  }

  #laboratorio .oplab-mobile-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal {
    display: inline-flex !important;
  }

  /* --- MOBILE: drawer profilo completo --- */
  #laboratorio .oplab-mobile-drawer-profile {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 12px 10px 14px !important;
    margin-bottom: 4px !important;
    border-bottom: 1px solid rgba(94, 234, 212, 0.12) !important;
    flex-shrink: 0 !important;
  }

  #laboratorio .oplab-mobile-drawer-profile .oplab-sidebar-profile-text {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  #laboratorio .oplab-mobile-drawer-profile .oplab-sidebar-profile-name {
    display: block !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    color: #e6fffa !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }

  #laboratorio .oplab-mobile-drawer-profile .oplab-sidebar-profile-role {
    display: block !important;
    font-size: 13px !important;
    color: rgba(167, 243, 208, 0.9) !important;
    line-height: 1.35 !important;
    margin-top: 2px !important;
    word-break: break-word !important;
  }

  #laboratorio .oplab-mobile-drawer-profile .oplab-sidebar-profile-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }
}

/* --- DESKTOP: header con logo valorizzato, no operatore --- */
@media (min-width: 769px) {
  #laboratorio.oplab-shell {
    --sd-sidebar-width: 240px;
  }

  #laboratorio .oplab-nav-label {
    display: inline !important;
  }

  #laboratorio .oplab-nav-btn {
    justify-content: flex-start !important;
    padding: 10px 12px !important;
  }

  #laboratorio .oplab-desktop-header.oplab-hero-header {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    min-height: 88px !important;
    padding: 14px 24px !important;
  }

  #laboratorio .oplab-desktop-header .oplab-hero-brand.oplab-desktop-brand {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: min(520px, 58vw) !important;
    pointer-events: none !important;
  }

  #laboratorio .oplab-desktop-header .oplab-desktop-brand .oplab-brand-logo-header,
  #laboratorio .oplab-desktop-header .oplab-desktop-brand .oplab-header-logo {
    width: auto !important;
    height: 64px !important;
    max-height: 64px !important;
    min-height: 58px !important;
    object-fit: contain !important;
    object-position: center center !important;
    display: block !important;
    margin: 0 auto !important;
  }

  #laboratorio .oplab-desktop-header .oplab-header-actions-slot {
    position: relative !important;
    z-index: 3 !important;
    margin-left: auto !important;
    flex: 0 0 auto !important;
  }

  #laboratorio .oplab-desktop-header .lab-sd-user-bar .user-bar-operator-line,
  #laboratorio .oplab-desktop-header .lab-sd-user-bar .user-bar-legacy-info {
    display: none !important;
  }

  #laboratorio .oplab-desktop-header .lab-sd-user-bar #btn-sync-google,
  #laboratorio .oplab-desktop-header .lab-sd-user-bar .btn-danger {
    display: inline-flex !important;
  }

  #laboratorio .oplab-desktop-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal {
    display: inline-flex !important;
  }

  /* --- DESKTOP: sidebar profilo completo --- */
  #laboratorio .oplab-desktop-sidebar-profile {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 4px 8px 14px !important;
    margin-bottom: 2px !important;
    border-bottom: 1px solid rgba(94, 234, 212, 0.12) !important;
    flex-shrink: 0 !important;
  }

  #laboratorio .oplab-desktop-sidebar-profile .oplab-sidebar-profile-text {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  #laboratorio .oplab-desktop-sidebar-profile .oplab-sidebar-profile-name {
    display: block !important;
    font-weight: 700 !important;
    font-size: 0.92rem !important;
    color: #e6fffa !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }

  #laboratorio .oplab-desktop-sidebar-profile .oplab-sidebar-profile-role {
    display: block !important;
    font-size: 12px !important;
    color: rgba(167, 243, 208, 0.88) !important;
    line-height: 1.35 !important;
    margin-top: 2px !important;
    word-break: break-word !important;
  }

  #laboratorio .oplab-desktop-sidebar-profile .oplab-sidebar-profile-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }
}

/* ============================================================
   OPLAB FIX LOGO DESKTOP + PROFILE MOBILE v1
   ============================================================ */

@media (min-width: 769px) {
  #laboratorio .oplab-desktop-header.oplab-hero-header {
    min-height: 90px !important;
    max-height: 90px !important;
    padding: 12px 24px !important;
    justify-content: space-between !important;
  }

  #laboratorio .oplab-desktop-header .oplab-hero-brand.oplab-desktop-brand,
  #laboratorio .oplab-desktop-brand,
  #laboratorio .oplab-desktop-header .oplab-hero-brand {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: visible !important;
    max-width: none !important;
    width: auto !important;
    pointer-events: auto !important;
  }

  #laboratorio .oplab-desktop-brand img,
  #laboratorio .oplab-desktop-header .oplab-brand-logo-header,
  #laboratorio .oplab-desktop-header .oplab-header-logo {
    width: 360px !important;
    max-width: 360px !important;
    height: auto !important;
    max-height: 72px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }

  #laboratorio .oplab-desktop-header .oplab-header-actions-slot {
    flex: 0 0 auto !important;
    margin-left: 0 !important;
  }
}

@media (max-width: 768px) {
  #laboratorio .oplab-sidebar {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
  }

  #laboratorio .oplab-mobile-drawer-profile,
  #laboratorio .oplab-sidebar-profile {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 18px 22px !important;
    margin-bottom: 18px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
  }

  #laboratorio .oplab-mobile-drawer-profile .oplab-sidebar-profile-text {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 120px !important;
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  #laboratorio .oplab-sidebar-profile-name,
  #laboratorio .oplab-sidebar-profile-role,
  #laboratorio .oplab-profile-name,
  #laboratorio .oplab-profile-role {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    overflow: visible !important;
    font-size: initial !important;
    color: #ffffff !important;
  }

  #laboratorio .oplab-sidebar-profile-name,
  #laboratorio .oplab-profile-name {
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
  }

  #laboratorio .oplab-sidebar-profile-role,
  #laboratorio .oplab-profile-role {
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.72) !important;
    margin-top: 3px !important;
  }
}

/* ============================================================
   OPLAB DESKTOP HEADER FINAL v1 — solo desktop (>=769px)
   ============================================================ */

@media (min-width: 769px) {
  #laboratorio .oplab-desktop-header.oplab-hero-header,
  #laboratorio .oplab-desktop-header {
    min-height: 100px !important;
    max-height: none !important;
  }

  #laboratorio .oplab-desktop-brand img,
  #laboratorio .oplab-desktop-header .oplab-brand-logo-header,
  #laboratorio .oplab-desktop-header .oplab-header-logo {
    width: 520px !important;
    max-width: 520px !important;
    height: 86px !important;
    max-height: 86px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }

  #laboratorio .oplab-desktop-brand,
  #laboratorio .oplab-desktop-header .oplab-hero-brand.oplab-desktop-brand,
  #laboratorio .oplab-desktop-header .oplab-hero-brand {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
    min-width: 520px !important;
    max-width: none !important;
    width: auto !important;
    pointer-events: auto !important;
  }

  /* Header destro: solo pallino sync */
  #laboratorio .oplab-desktop-header .lab-sd-user-bar #btn-sync-google,
  #laboratorio .oplab-desktop-header .lab-sd-user-bar .btn-danger,
  #laboratorio .oplab-desktop-header .lab-sd-user-bar .btn-reset-pwd-badge,
  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar #btn-sync-google,
  #laboratorio .oplab-hero-header.oplab-header-premium .lab-sd-user-bar .btn-danger {
    display: none !important;
  }

  #laboratorio .oplab-desktop-header .lab-sd-user-bar .google-stato-indicatore.google-stato-minimal {
    display: inline-flex !important;
  }

  /* Sidebar: + Nuovo ordine, poi Aggiorna / Esci */
  #laboratorio .oplab-sidebar {
    display: flex !important;
    flex-direction: column !important;
  }

  #laboratorio .oplab-sidebar-profile {
    order: 0;
  }

  #laboratorio .oplab-sidebar-nav {
    order: 1;
    flex: 1 1 auto;
  }

  #laboratorio .oplab-sidebar-actions {
    order: 2;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(94, 234, 212, 0.12);
  }

  #laboratorio .oplab-sidebar-account-actions,
  #laboratorio .oplab-sidebar-account-actions-panel {
    order: 3;
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding-top: 8px;
    border-top: none;
  }

  #laboratorio .oplab-sidebar-account-actions .btn,
  #laboratorio .oplab-sidebar-account-actions-panel .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    border-radius: 10px;
    font-size: 0.82rem;
  }
}/* PATCH PARTY HOUSE UI MODERNIZATION v1 */

body.ph-feste-mode {
  background: #f0f4f8;
  overflow-x: hidden;
}

body.ph-feste-mode #app-page {
  max-width: none;
  padding: 0;
  margin: 0;
}

body.ph-feste-mode .ph-feste-user-bar-legacy {
  display: none !important;
}

body.ph-lab-solo-mode #ph-feste-shell,
body.ph-feste-lab-active #ph-feste-shell {
  display: none !important;
}

.ph-feste-shell {
  --ph-sidebar-bg: #0f172a;
  --ph-sidebar-border: rgba(255, 255, 255, 0.08);
  --ph-sidebar-text: rgba(248, 250, 252, 0.82);
  --ph-sidebar-text-active: #ffffff;
  --ph-sidebar-width: 260px;
  --ph-bg: #f0f4f8;
  --ph-card: #ffffff;
  --ph-border: #e2e8f0;
  --ph-text: #1e293b;
  --ph-text-muted: #64748b;
  --ph-radius: 16px;
  --ph-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --ph-shadow-hover: 0 8px 32px rgba(15, 23, 42, 0.1);
  --ph-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  display: flex;
  min-height: 100vh;
  width: 100%;
  font-family: var(--ph-font);
  color: var(--ph-text);
  background: var(--ph-bg);
  position: relative;
}

.ph-feste-sidebar {
  width: var(--ph-sidebar-width);
  flex-shrink: 0;
  background: var(--ph-sidebar-bg);
  border-right: 1px solid var(--ph-sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 12px;
  gap: 8px;
  z-index: 120;
}

@media (min-width: 769px) {
  .ph-feste-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
}

.ph-feste-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--ph-sidebar-border);
  flex-shrink: 0;
}

.ph-sidebar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

.ph-sidebar-brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f8fafc;
  line-height: 1.3;
  word-break: break-word;
}

.ph-sidebar-brand-sub {
  font-size: 0.78rem;
  color: rgba(203, 213, 225, 0.85);
  margin-top: 2px;
  line-height: 1.35;
}

.ph-feste-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.ph-feste-nav-btn.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ph-sidebar-text);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

.ph-feste-nav-btn.tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ph-sidebar-text-active);
}

.ph-feste-nav-btn.tab.active {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--ph-colore-primario) 35%, transparent) 0%,
    color-mix(in srgb, var(--ph-colore-secondario) 22%, transparent) 100%
  );
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.ph-feste-nav-icon {
  font-size: 1.05rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}

.ph-feste-nav-label {
  flex: 1;
}

.ph-feste-sidebar-lab {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 4px;
}

.ph-feste-sidebar-separator {
  height: 1px;
  margin: 6px 8px 10px;
  background: var(--ph-sidebar-border);
}

.ph-feste-nav-btn-lab {
  opacity: 0.92;
}

.ph-feste-sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 6px 6px;
  margin-top: 0;
  border-top: 1px solid var(--ph-sidebar-border);
  flex-shrink: 0;
}

.ph-feste-sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
}

.ph-feste-profile-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--ph-colore-primario) 45%, #1e293b) 0%,
    color-mix(in srgb, var(--ph-colore-secondario) 30%, #1e293b) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-size: 1rem;
  font-weight: 700;
}

.ph-feste-profile-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #f8fafc;
  line-height: 1.3;
}

.ph-feste-profile-role {
  font-size: 0.75rem;
  color: rgba(203, 213, 225, 0.88);
  margin-top: 2px;
}

.ph-feste-sidebar-account-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ph-feste-sidebar-account-actions .btn {
  width: 100%;
  justify-content: center;
  min-height: 42px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.ph-feste-sidebar-sync {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
}

.ph-feste-sidebar-exit {
  font-weight: 600;
}

.ph-feste-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px 32px;
}

.ph-feste-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  padding: 20px 22px;
  border-radius: var(--ph-radius);
  background: var(--ph-header-gradient);
  box-shadow: var(--ph-shadow);
  border: 1px solid color-mix(in srgb, var(--ph-colore-primario) 18%, transparent);
}

.ph-feste-page-head-text {
  min-width: 0;
}

.ph-feste-page-title {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 1.72rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.ph-feste-page-sub {
  margin: 6px 0 0;
  font-size: 0.94rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.86);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.ph-feste-page-status .google-stato-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ph-feste-page-status .google-stato-indicatore.google-stato-minimal {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
  font-size: 0.78rem;
  color: #fff;
}

.ph-feste-page-status .google-stato-label,
.ph-feste-page-status .google-stato-ultimo-sync {
  color: rgba(255, 255, 255, 0.92);
}

.ph-feste-page-status #btn-sync-google {
  display: none;
}

.ph-feste-main .panel {
  display: none;
  animation: ph-feste-fade-in 0.2s ease-out;
}

.ph-feste-main .panel.active {
  display: block;
}

@keyframes ph-feste-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ph-dash-brand {
  margin-bottom: 22px;
  padding: 20px 22px;
  background: var(--ph-card);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  box-shadow: var(--ph-shadow);
  border-left: 4px solid var(--ph-colore-primario);
}

.ph-dash-brand-name {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ph-text);
  letter-spacing: -0.03em;
}

.ph-dash-brand-sub {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--ph-text-muted);
  letter-spacing: -0.01em;
}

.ph-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.ph-kpi-card {
  background: var(--ph-card);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  padding: 18px 16px;
  box-shadow: var(--ph-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ph-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ph-shadow-hover);
}

.ph-kpi-card-accent {
  border-color: color-mix(in srgb, var(--ph-colore-secondario) 35%, var(--ph-border));
}

.ph-kpi-icon {
  font-size: 1.25rem;
  margin-bottom: 8px;
  opacity: 0.9;
}

.ph-kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ph-colore-primario);
  line-height: 1.2;
  margin-bottom: 4px;
}

.ph-kpi-card-accent .ph-kpi-value {
  color: var(--ph-colore-secondario);
}

.ph-kpi-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ph-text);
  margin-bottom: 2px;
}

.ph-kpi-desc {
  font-size: 0.74rem;
  color: var(--ph-text-muted);
  line-height: 1.35;
}

.ph-dash-section {
  margin-bottom: 24px;
}

.ph-dash-card {
  background: var(--ph-card);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  padding: 20px;
  box-shadow: var(--ph-shadow);
}

.ph-dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ph-dash-card-title {
  margin: 0 0 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ph-text);
  letter-spacing: -0.02em;
}

.ph-dash-card-head .ph-dash-card-title {
  margin-bottom: 0;
}

.ph-dash-oggi-badge {
  font-size: 0.82rem;
  color: var(--ph-text-muted);
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
}

.ph-dash-oggi-badge span {
  font-weight: 700;
  color: var(--ph-colore-primario);
}

.ph-dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.ph-dash-card-wide {
  grid-column: 1 / -1;
}

.ph-dash-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ph-dash-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--ph-border);
  border-radius: 12px;
  border-left: 3px solid var(--ph-colore-primario);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.ph-dash-item.ph-dash-item-clickable {
  cursor: pointer;
}

.ph-dash-item.ph-dash-item-clickable:hover {
  background: #f1f5f9;
  box-shadow: var(--ph-shadow);
}

.ph-dash-item-body {
  flex: 1;
  min-width: 0;
}

.ph-dash-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ph-text);
  margin-bottom: 4px;
}

.ph-dash-item-meta {
  font-size: 0.8rem;
  color: var(--ph-text-muted);
  line-height: 1.45;
}

.ph-dash-item-importo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ph-colore-secondario);
  white-space: nowrap;
  align-self: center;
}

.ph-dash-item-apri {
  align-self: center;
  flex-shrink: 0;
  min-height: 36px;
  border-radius: 8px;
  background: var(--ph-colore-primario);
  border-color: var(--ph-colore-primario);
}

.ph-dash-item-oggi-orario {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ph-colore-primario);
  margin-bottom: 2px;
}

.ph-dash-alert-gruppo {
  margin-bottom: 14px;
}

.ph-dash-alert-gruppo:last-child {
  margin-bottom: 0;
}

.ph-dash-alert-gruppo-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
  padding: 0 2px;
}

.ph-dash-alert-gruppo-critici { color: #dc2626; }
.ph-dash-alert-gruppo-attenzione { color: #ea580c; }
.ph-dash-alert-gruppo-info { color: #2563eb; }

.ph-dash-item-alert-critico {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.ph-dash-item-alert-attenzione {
  border-left-color: #ea580c;
  background: #fff7ed;
}

.ph-dash-item-alert-info {
  border-left-color: #2563eb;
  background: #eff6ff;
}

.ph-feste-main .card {
  border-radius: var(--ph-radius);
  border: 1px solid var(--ph-border);
  box-shadow: var(--ph-shadow);
}

.ph-feste-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--ph-sidebar-bg);
  color: #fff;
  font-size: 1.35rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.ph-feste-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 110;
}

body.ph-feste-nav-lock {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .ph-dash-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-only,
  .ph-feste-hamburger.mobile-only {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ph-feste-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }

  .ph-feste-sidebar-footer {
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
  }

  .ph-feste-shell.ph-feste-mobile-nav-open .ph-feste-sidebar {
    transform: translateX(0);
  }

  .ph-feste-shell.ph-feste-mobile-nav-open .ph-feste-sidebar-overlay {
    display: block;
  }

  .ph-feste-main {
    padding: 72px 16px 24px;
  }

  .ph-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .ph-feste-sidebar-account-actions .btn,
  .ph-feste-nav-btn.tab {
    min-height: 48px;
  }

  .ph-dash-item-apri {
    min-height: 48px;
    min-width: 48px;
  }
}

@media (max-width: 480px) {
  .ph-kpi-grid {
    grid-template-columns: 1fr;
  }
}
