﻿/* ==========================================================================
   SpedizioniPallet Base Styles
   Glassmorphism Design System
   ========================================================================== */

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

/* Hide ALL scrollbars globally */
* {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Utility: Hidden */
.is-hidden {
    display: none !important;
    visibility: hidden !important;
}

/* Material Symbols base styling */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400;
}

/* Filled icon variant for active states */
.material-symbols-outlined.filled,
.active .material-symbols-outlined,
.nav-item.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400;
}

/* ==========================================================================
   GLASS PANELS & CARDS - EXACT TEMPLATE STYLE (COPIED FROM TEMPLATE)
   ========================================================================== */

/* EXACT from template CSS */
.glass-panel {
    background: rgba(235, 228, 215, 0.65);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(180, 160, 130, 0.3);
    box-shadow: 0 4px 12px -4px rgba(140, 120, 90, 0.15);
    border-radius: var(--radius-2xl);
    padding: 0.7rem; /* p-8 default */
    margin-bottom: 0.75rem;
}

/* Glass Panel for Filters - customizable */
.glass-panel-filtri {
/*     background: rgba(235, 228, 215, 0.65);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(180, 160, 130, 0.3);
    box-shadow: 0 4px 12px -4px rgba(140, 120, 90, 0.15);
    border-radius: var(--radius-2xl); */
    padding: 0.7rem;
    margin-bottom: 0.75rem;
}

/* EXACT from template CSS */
.glass-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.85) 0%, rgba(240, 230, 210, 0.7) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1.5px solid rgba(255, 255, 255, 0.95);
    border-left: 1.5px solid rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(180, 160, 130, 0.2);
    border-right: 1px solid rgba(180, 160, 130, 0.2);
    box-shadow:
        0 12px 24px -6px rgba(40, 35, 25, 0.1),
        0 4px 8px -4px rgba(40, 35, 25, 0.05),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* EXACT from template CSS */
.glass-card:hover {
    transform: translateY(-4px) scale(1.01);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 235, 215, 0.8) 100%);
    box-shadow:
        0 20px 40px -8px rgba(40, 35, 25, 0.15),
        0 8px 16px -6px rgba(40, 35, 25, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.glass-card-static {
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   GLASS PANEL TABLE LAYOUT (header/body/footer structure)
   ========================================================================== */

/* Wrapper for table panels - uses flexbox for sticky footer */
.glass-panel-table {
    display: flex;
    flex-direction: column;
    min-height: 400px;
    /* Height is managed by content, footer stays at bottom */
}

/* Header: title left, buttons right */
.glass-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(210, 180, 140, 0.3);
    flex-shrink: 0;
}

.glass-panel-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.glass-panel-header-title .icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(139, 64, 32, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-panel-header-title .icon-box .material-symbols-outlined {
    color: var(--color-terracotta);
    font-size: 22px;
}

.glass-panel-header-title h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* Results count badge in header */
.glass-panel-header-title .results-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 9999px;
    background: rgba(75, 202, 117, 0.562);
    color: var(--color-success);
    font-size: 12px;
    font-weight: 700;
    margin-left: 0.5rem;
}

.glass-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Body: scrollable table area with sticky thead */
.glass-panel-body {
    flex: 1;
    overflow: auto;
    margin: 1rem -0.7rem;
    padding: 0 0.7rem 0.7rem 0.7rem;
    position: relative;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.glass-panel-body::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* Sticky table header */
.glass-panel-body table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.glass-panel-body table thead th {
    padding: 0.75rem 1rem;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
}

/* ==========================================================================
   TABLE COLUMN ALIGNMENT - Global Rules
   ==========================================================================

   First column:  LEFT aligned
   Last column:   RIGHT aligned (hide text if contains action buttons)
   Middle cols:   LEFT by default (text), use .col-currency for right, .col-center for badges/checks

   These rules apply to BOTH thead th AND tbody td for consistency
   ========================================================================== */

/* Default: all columns left aligned */
.glass-panel-body table thead th,
.glass-panel-body table tbody td {
    text-align: left;
}

/* First column: left with extra padding */
.glass-panel-body table thead th:first-child,
.glass-panel-body table tbody td:first-child {
    text-align: left;
    padding-left: 1.5rem;
}

/* Last column: right aligned with extra padding */
.glass-panel-body table thead th:last-child,
.glass-panel-body table tbody td:last-child {
    text-align: right;
    padding-right: 1.5rem;
}

/* Hide text in last column header when it contains action buttons */
.glass-panel-body table thead th:last-child:has(~ tbody td .action-buttons),
.glass-panel-body table thead th.col-actions {
    font-size: 0;
    color: transparent;
}

/* Column type modifiers - apply to th, td inherits alignment */
/* Currency columns: right aligned */
.glass-panel-body table th.col-currency,
.glass-panel-body table td.col-currency,
.glass-panel-body table .col-currency {
    text-align: right !important;
}

/* Center columns: for badges, checks, status */
.glass-panel-body table th.col-center,
.glass-panel-body table td.col-center,
.glass-panel-body table .col-center {
    text-align: center !important;
}

/* Action buttons column */
.glass-panel-body table td .action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Footer: pagination centered */
.glass-panel-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(210, 180, 140, 0.3);
    flex-shrink: 0;
    margin-bottom:0.5rem;
}

.glass-panel-footer-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Hide DataTables pagination in its original location (inside wrapper)
   Use direct child selector so it doesn't affect moved pagination */
.glass-panel-body .dataTables_wrapper > .dataTables_paginate {
    display: none !important;
}

/* DataTables pagination inside footer - must override hide with higher specificity */
.glass-panel-footer-pagination.glass-panel-footer-pagination .dataTables_paginate {
    display: flex !important;
    align-items: center;
    gap: 0.25rem;
    margin: 0 !important;
    padding: 0 !important;
}

.glass-panel-footer-pagination .dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0.75rem;
    cursor: pointer;
    outline: none;
    text-decoration: none;
    letter-spacing: 0.02em;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(240, 235, 225, 0.8));
    border: 1px solid rgba(200, 190, 170, 0.8);
    border-bottom: 2px solid rgba(170, 160, 140, 0.8);
    box-shadow: 0 4px 6px -1px rgba(60, 50, 40, 0.1);
    color: var(--color-text-secondary);
}

.glass-panel-footer-pagination .dataTables_paginate .paginate_button:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--color-accent);
    color: var(--color-text-primary);
}

.glass-panel-footer-pagination .dataTables_paginate .paginate_button.current {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
    color: white !important;
    font-weight: 700;
}

.glass-panel-footer-pagination .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Card with no hover effect */
.glass-card-flat {
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   FORM INPUTS - EXACT TEMPLATE STYLE (COPIED FROM TEMPLATE)
   Template: glass-input w-full pl-11 pr-4 py-3 text-sm font-semibold
   ========================================================================== */
.glass-input {
    width: 100%;
    /* Template: py-3 = padding-top/bottom 0.75rem, px-4 = padding-left/right 1rem */
    padding: 0.75rem 1rem;
    /* Glass input with visible background */
background: rgb(255 255 255 / 54%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(160, 140, 110, 0.25);
    border-radius: 1rem;
    color: #2c2c24;
    /* Template: text-sm font-semibold = 0.875rem 600 */
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(255, 255, 255, 0.5);
}

.glass-input::placeholder {
    /* Template: placeholder-sandy-beige-400 = approx #db9a55 but template shows #6b6b5a */
    color: #6b6b5a;
}

.glass-input:hover {
    border-color: rgba(160, 140, 110, 0.5);
}

.glass-input:focus {
    /* EXACT from template CSS */
    background: rgba(255, 255, 255, 0.9);
    border-color: #1a2e3b;
    box-shadow: 0 0 0 3px rgba(26, 46, 59, 0.15);
}

/* Remove focus ring for template compatibility */
.glass-input:focus-visible {
    outline: none;
}

.glass-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--glass-hover-bg);
}

.glass-input.error {
    border-color: var(--color-error);
}

.glass-input.error:focus {
    box-shadow: 0 0 0 3px var(--color-error-light);
}

/* Required field glow pulse effect */
.required-glow {
    position: relative;
}

.required-glow .glass-input,
.required-glow .select2-selection,
.glass-input.required-glow {
    border-color: var(--color-error) !important;
    animation: requiredBorderPulse 2s ease-in-out infinite;
}

/* For select2 specifically */
.required-glow .select2-selection--single {
    border-color: var(--color-error) !important;
    animation: requiredBorderPulse 2s ease-in-out infinite;
    border-radius: var(--radius-md) !important;
}

@keyframes requiredBorderPulse {
    0%, 100% {
        border-color: var(--color-error);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0), inset 0 0 0 0 rgba(220, 53, 69, 0);
    }
    50% {
        border-color: rgba(220, 53, 69, 1);
        box-shadow: 0 0 8px 2px rgba(220, 53, 69, 0.4), inset 0 0 4px rgba(220, 53, 69, 0.1);
    }
}

/* Express badge pulse animation */
.express-badge {
    position: relative;
    overflow: hidden;
}

@keyframes expressPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(255, 107, 53, 0.6);
        transform: scale(1.02);
    }
}

/* Input with icon - EXACT Template Style
   Template: <span class="material-symbols-outlined absolute left-4 top-1/2 -translate-y-1/2 text-sandy-beige-600 text-[20px]">
   Template input: pl-11 (padding-left: 2.75rem)
*/
.input-with-icon {
    position: relative;
}

.input-with-icon .glass-input {
    /* Template: pl-11 = 2.75rem */
    padding-left: 2.75rem;
}

.input-with-icon .input-icon {
    /* Template: absolute left-4 top-1/2 -translate-y-1/2 */
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    /* Subtle, transparent icons */
    color: rgba(120, 100, 80, 0.35);
    /* Template: text-[20px] */
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

/* Select with icon - combines select-wrapper and input-with-icon */
.select-wrapper {
    position: relative;
}

.select-wrapper select.glass-input {
    appearance: none;
    cursor: pointer;
    padding-right: 2.75rem;
}

.select-wrapper .select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #ab6726;
    pointer-events: none;
    font-size: 1.25rem;
}

/* When select-wrapper has input-with-icon class, apply left padding and icon position */
.select-wrapper.input-with-icon select.glass-input {
    padding-left: 2.75rem;
    padding-right: 2.75rem;
}

/* Icon position inside select-wrapper with input-with-icon */
.select-wrapper.input-with-icon .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(120, 100, 80, 0.35);
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

/* Input with action (like password toggle) */
.input-with-action {
    position: relative;
}

.input-with-action .glass-input {
    padding-right: 2.875rem;
}

.input-with-action .input-action,
.input-with-action .password-toggle {
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.375rem;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-with-action .input-action:hover,
.input-with-action .password-toggle:hover {
    color: var(--color-text);
    background: var(--glass-hover-bg);
}

/* Form labels - EXACT Template Style
   Template: text-xs font-bold uppercase tracking-wide text-sandy-beige-800 ml-1
*/
.form-label {
    display: block;
    /* Template: ml-1 = 0.25rem */
    margin-left: 0.25rem;
    margin-bottom: 0.5rem;
    /* Template: text-xs = 0.75rem */
    font-size: 0.75rem;
    /* Template: font-bold = 700 */
    font-weight: 700;
    /* Template: uppercase */
    text-transform: uppercase;
    /* Template: tracking-wide = 0.025em */
    letter-spacing: 0.025em;
    /* Template: text-sandy-beige-800 = #613610 */
    color: #613610;
}

/* Form groups */
.form-group {
    margin-bottom: 1.25rem;
}

/* Form hint/error text */
.form-hint {
    margin-top: 0.375rem;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.form-error {
    margin-top: 0.375rem;
    font-size: var(--font-size-xs);
    color: var(--color-error);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}


.select2-selection__arrow{
    display:none;
}
/* =====================================================
   CRUD Page Structure
   ===================================================== */

/* CRUD Page Container - fills available viewport */
.crud-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height, 64px) - 2rem);
    padding: 0;
    gap: 1rem;
}

/* Entity Header - compact info bar at top */
.entity-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    /* background: var(--glass-panel-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px); */
   /*  border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl); */
    flex-shrink: 0;
}

.entity-header-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent-light);
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.entity-header-icon .material-symbols-outlined {
    font-size: 24px;
    color: var(--color-terracotta);
}

.entity-header-content {
    flex: 1;
    min-width: 0;
}

.entity-header-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.entity-header-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0.25rem 0 0 0;
}

.entity-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Glass Card Form - fullscreen form container */
.glass-card-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--glass-panel-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 0; /* Critical for flex overflow to work */
}

.glass-card-form-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-glass-subtle);
    flex-shrink: 0;
    background: var(--glass-panel-bg);
}

.glass-card-form-header .material-symbols-outlined {
    color: var(--color-terracotta);
    font-size: 20px;
}

.glass-card-form-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.glass-card-form-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.glass-card-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-glass-subtle);
    background: var(--glass-panel-bg);
    flex-shrink: 0;
}

/* ==========================================================================
   GLASS CARD HERO - Gradient header with footer section
   Reusable entity header component with route visualization
   ========================================================================== */
.glass-card-hero {
    background: var(--glass-panel-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Hero Header - Gradient section */
.glass-card-hero-header {
    background: linear-gradient(135deg, var(--color-accent) 0%, #7e7d85 100%);
    padding: 1.5rem 2rem;
    color: white;
}

.glass-card-hero-header .hero-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.glass-card-hero-header .hero-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.glass-card-hero-header .hero-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.glass-card-hero-header .hero-icon .material-symbols-outlined {
    font-size: 2rem;
    color: white;
}

.glass-card-hero-header .hero-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.glass-card-hero-header .hero-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.glass-card-hero-header .hero-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.glass-card-hero-header .hero-meta {
    opacity: 0.9;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.glass-card-hero-header .hero-meta .material-symbols-outlined {
    font-size: 16px;
    vertical-align: middle;
}

.glass-card-hero-header .hero-meta-separator {
    margin: 0 0.5rem;
}

.glass-card-hero-header .hero-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.glass-card-hero-header .hero-actions .glass-button {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.glass-card-hero-header .hero-actions .glass-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Hero Footer - Route visualization / additional info */
.glass-card-hero-footer {
    padding: 1.5rem 2rem;
    background: var(--glass-card-bg);
    border-top: 1px solid var(--border-glass-subtle);
}

/* Route visualization specific styles */
.glass-card-hero-footer .route-visualization {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.glass-card-hero-footer .route-point {
    flex: 1;
    display: flex;
    gap: 1rem;
}

.glass-card-hero-footer .route-point.end {
    justify-content: flex-end;
}

.glass-card-hero-footer .route-point.end .route-point-content {
    text-align: right;
}

.glass-card-hero-footer .route-point-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.glass-card-hero-footer .route-point-icon.pickup {
    background: var(--color-success-light);
}

.glass-card-hero-footer .route-point-icon.pickup .material-symbols-outlined {
    color: var(--color-success);
}

.glass-card-hero-footer .route-point-icon.delivery {
    background: rgba(185, 110, 75, 0.15);
}

.glass-card-hero-footer .route-point-icon.delivery .material-symbols-outlined {
    color: var(--color-terracotta);
}

.glass-card-hero-footer .route-point-content {
    min-width: 0;
    flex: 1;
}

.glass-card-hero-footer .route-point-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.glass-card-hero-footer .route-point-label.pickup {
    color: var(--color-success);
}

.glass-card-hero-footer .route-point-label.delivery {
    color: var(--color-terracotta);
}

.glass-card-hero-footer .route-point-name {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.glass-card-hero-footer .route-point-address {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.glass-card-hero-footer .route-point-datetime {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.glass-card-hero-footer .route-point-datetime .material-symbols-outlined {
    font-size: 14px;
    vertical-align: middle;
}

/* Route arrow/connector */
.glass-card-hero-footer .route-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    min-width: 120px;
}

.glass-card-hero-footer .route-connector-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.glass-card-hero-footer .route-connector-line::before,
.glass-card-hero-footer .route-connector-line::after {
    content: '';
    flex: 1;
    height: 2px;
}

.glass-card-hero-footer .route-connector-line::before {
    background: linear-gradient(90deg, var(--color-success), var(--color-accent));
}

.glass-card-hero-footer .route-connector-line::after {
    background: linear-gradient(90deg, var(--color-accent), var(--color-terracotta));
}

.glass-card-hero-footer .route-connector-arrow {
    color: var(--color-accent);
    font-size: 2rem;
}

.glass-card-hero-footer .route-connector-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .glass-card-hero-header {
        padding: 1rem 1.25rem;
    }

    .glass-card-hero-header .hero-icon {
        width: 48px;
        height: 48px;
    }

    .glass-card-hero-header .hero-icon .material-symbols-outlined {
        font-size: 1.5rem;
    }

    .glass-card-hero-header .hero-title {
        font-size: 1.25rem;
    }

    .glass-card-hero-footer {
        padding: 1rem 1.25rem;
    }

    .glass-card-hero-footer .route-visualization {
        flex-direction: column;
        gap: 1.5rem;
    }

    .glass-card-hero-footer .route-point {
        width: 100%;
    }

    .glass-card-hero-footer .route-point.end {
        justify-content: flex-start;
    }

    .glass-card-hero-footer .route-point.end .route-point-content {
        text-align: left;
    }

    .glass-card-hero-footer .route-connector {
        flex-direction: row;
        min-width: unset;
        width: 100%;
        padding: 0;
    }

    .glass-card-hero-footer .route-connector-line {
        flex-direction: column;
        width: auto;
        flex: 1;
    }

    .glass-card-hero-footer .route-connector-line::before,
    .glass-card-hero-footer .route-connector-line::after {
        width: 100%;
        height: 2px;
    }
}

/* Form Sections - logical groupings within form body */
.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
    margin-bottom: 0rem;
    padding-bottom: 0.1rem;
    border-bottom: 1px solid var(--border-glass-subtle);
}

.form-section-title .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-terracotta);
}

/* CRUD Form - wrapper for full-height form */
.crud-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* =====================================================
   End CRUD Page Structure
   ===================================================== */

/* Select - EXACT Template Style */
.glass-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    /* EXACT Template: same as glass-input */
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(160, 140, 110, 0.3);
    border-radius: 1rem;
    color: #2c2c24;
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    appearance: none;
    transition: all 0.2s;
    outline: none;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.03),
        0 1px 2px rgba(0, 0, 0, 0.03);
}

.glass-select:hover {
    border-color: rgba(160, 140, 110, 0.5);
}

.glass-select:focus {
    /* EXACT Template focus state */
    background: rgba(255, 255, 255, 0.9);
    border-color: #1a2e3b;
    box-shadow: 0 0 0 3px rgba(26, 46, 59, 0.15);
}

/* Checkbox */
.glass-checkbox {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
}

.glass-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border-input);
    border-radius: var(--radius-md);
    background: var(--glass-card-bg);
    cursor: pointer;
    appearance: none;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.glass-checkbox input[type="checkbox"]:hover {
    border-color: var(--color-terracotta);
}

.glass-checkbox input[type="checkbox"]:checked {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.glass-checkbox input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px var(--color-terracotta-light);
}

.glass-checkbox span {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* Textarea - EXACT Template Style */
.glass-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    /* EXACT Template: same as glass-input */
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(160, 140, 110, 0.3);
    border-radius: 1rem;
    color: #2c2c24;
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    transition: all 0.2s;
    outline: none;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.03),
        0 1px 2px rgba(0, 0, 0, 0.03);
    resize: vertical;
    min-height: 100px;
}

.glass-textarea::placeholder {
    color: #6b6b5a;
}

.glass-textarea:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: #1a2e3b;
    box-shadow: 0 0 0 3px rgba(26, 46, 59, 0.15);
}

/* ==========================================================================
   BUTTONS - EXACT TEMPLATE STYLE
   ========================================================================== */

/* Base glass-button - EXACT Template style
   Also applies to .btn, button and input[type] for Bootstrap/HTML compatibility */
.glass-button,
.btn,
button:not(.filter-chip):not(.paginate_button):not([class*="swal"]):not(.btn-close):not(.select2-selection__clear),
input[type="button"]:not(.filter-chip):not(.paginate_button),
input[type="submit"],
input[type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
   /*  padding: 0.5rem 1rem; */
    font-size: var(--font-size-sm);
    font-weight: 700;
    font-family: var(--font-sans);
    border-radius: 0.75rem;
    cursor: pointer;
    outline: none;
    text-decoration: none;
    letter-spacing: 0.02em;
    /* Template glass-button gradient */
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(240,235,225,0.8));
    border: 1px solid rgba(200, 190, 170, 0.8);
    border-bottom: 2px solid rgba(170, 160, 140, 0.8);
    box-shadow: 0 4px 6px -1px rgba(60, 50, 40, 0.1);
    color: #4a4a3a;
    transition: all 0.1s;
}

.glass-button:hover,
.btn:hover,
button:not(.filter-chip):not(.paginate_button):not([class*="swal"]):not(.btn-close):not(.select2-selection__clear):hover,
input[type="button"]:not(.filter-chip):not(.paginate_button):hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
    color: #1a2e3b;
    background: linear-gradient(to bottom, rgba(255,255,255,0.95), rgba(250,245,235,0.9));
}

.glass-button:active,
.btn:active,
button:not(.filter-chip):not(.paginate_button):not([class*="swal"]):not(.btn-close):not(.select2-selection__clear):active,
input[type="button"]:not(.filter-chip):not(.paginate_button):active,
input[type="submit"]:active,
input[type="reset"]:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
}

.glass-button:disabled,
.btn:disabled,
button:not(.filter-chip):not(.paginate_button):not([class*="swal"]):not(.btn-close):not(.select2-selection__clear):disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==========================================================================
   GLASS SEARCH INPUT - For table headers
   ========================================================================== */
.glass-search {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.glass-search-input {
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(240,235,225,0.8));
    border: 1px solid rgba(200, 190, 170, 0.8);
    border-radius: 0.75rem;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    transition: all 0.2s ease;
    width: 180px;
    height: 36px;
}

.glass-search-input::placeholder {
    color: var(--color-text-muted);
}

.glass-search-input:focus {
    outline: none;
    border-color: var(--color-terracotta);
    box-shadow: 0 0 0 3px rgba(139, 64, 32, 0.1);
    width: 220px;
}

.glass-search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    font-size: 1.125rem !important;
}

.glass-search-input:focus + .glass-search-icon,
.glass-search:focus-within .glass-search-icon {
    color: var(--color-terracotta);
}

/* ==========================================================================
   EMPTY STATE - For tables and lists
   ========================================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    color: var(--color-text-muted);
}

.empty-state-icon .material-symbols-outlined {
    font-size: 2.5rem !important;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    max-width: 300px;
}

/* DataTables empty state override */
.dataTables_empty {
    padding: 0 !important;
    background: transparent !important;
}

/* Primary button - EXACT Template: deep-blue-accent gradient (like "Sign In to Account")
   Also applies to Bootstrap .btn-primary */
.glass-button-primary,
.btn-primary {
    background: linear-gradient(to bottom, #1a2e3b, #112230);
    border: none;
    border-top: 1px solid rgba(26, 46, 59, 0.6);
    border-bottom: none;
    color: white;
    box-shadow: 0 8px 20px rgba(26, 46, 59, 0.3), 0 0 0 1px rgba(26, 46, 59, 0.2);
}

.glass-button-primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(to bottom, #244055, #1a2e3b);
    box-shadow: 0 10px 30px rgba(26, 46, 59, 0.5);
    transform: translateY(-2px);
    color: white;
}

.glass-button-primary:active:not(:disabled),
.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(26, 46, 59, 0.3);
}

/* Success button - Green for confirmations */
.glass-button-success,
.btn-success {
    background: linear-gradient(to bottom, var(--color-success), #365536);
    border: none;
    border-top: 1px solid rgba(64, 102, 64, 0.6);
    color: white;
    box-shadow: 0 8px 20px rgba(64, 102, 64, 0.3), 0 0 0 1px rgba(64, 102, 64, 0.2);
}

.glass-button-success:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
    background: linear-gradient(to bottom, #4d7a4d, var(--color-success));
    box-shadow: 0 10px 30px rgba(64, 102, 64, 0.5);
    transform: translateY(-2px);
    color: white;
}

.glass-button-success:active:not(:disabled),
.btn-success:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(64, 102, 64, 0.3);
}

/* Terracotta button - Alternative primary */
.glass-button-terracotta {
    background: linear-gradient(to right, #8b4020, #7a3318);
    border: none;
    color: white;
    box-shadow: 0 6px 16px rgba(139, 64, 32, 0.3);
}

.glass-button-terracotta:hover:not(:disabled) {
    background: linear-gradient(to right, #7a3318, #6d320e);
    box-shadow: 0 8px 24px rgba(139, 64, 32, 0.4);
    transform: translateY(-2px);
    color: white;
}

/* Secondary button - Template glass-button base
   Also applies to Bootstrap .btn-secondary */
.glass-button-secondary,
.btn-secondary {
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(240,235,225,0.8));
    border: 1px solid rgba(200, 190, 170, 0.8);
    border-bottom: 2px solid rgba(170, 160, 140, 0.8);
    box-shadow: 0 4px 6px -1px rgba(60, 50, 40, 0.1);
    color: #4a4a3a;
}

.glass-button-secondary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
    color: #1a2e3b;
    background: linear-gradient(to bottom, rgba(255,255,255,0.95), rgba(250,245,235,0.9));
}

/* Danger button - Template terracotta gradient style
   Also applies to Bootstrap .btn-danger */
.glass-button-danger,
.btn-danger {
    background: linear-gradient(to right, var(--color-error), var(--color-error-hover));
    border: none;
    color: white;
    box-shadow: 0 6px 16px rgba(139, 64, 32, 0.25);
}

.glass-button-danger:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    background: linear-gradient(to right, var(--color-error-hover), #6d320e);
    box-shadow: 0 8px 24px rgba(139, 64, 32, 0.35);
    transform: translateY(-2px);
    color: white;
}

/* Success button - Also applies to Bootstrap .btn-success */
.glass-button-success,
.btn-success {
    background: linear-gradient(to bottom, var(--color-success), var(--color-success-hover));
    border: none;
    color: white;
    box-shadow: 0 6px 16px rgba(64, 102, 64, 0.25);
}

.glass-button-success:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
    background: linear-gradient(to bottom, var(--color-success-hover), #2f4c2f);
    box-shadow: 0 8px 24px rgba(64, 102, 64, 0.35);
    transform: translateY(-2px);
    color: white;
}

/* Warning button - Also applies to Bootstrap .btn-warning */
.glass-button-warning,
.btn-warning {
    background: linear-gradient(to bottom, var(--color-warning), var(--color-warning-hover));
    border: none;
    color: white;
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.25);
}

.glass-button-warning:hover:not(:disabled),
.btn-warning:hover:not(:disabled) {
    background: linear-gradient(to bottom, var(--color-warning-hover), #9a5504);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.35);
    transform: translateY(-2px);
    color: white;
}

/* Info button - Accent theme - Also applies to Bootstrap .btn-info */
.glass-button-info,
.btn-info {
    background: linear-gradient(to bottom, var(--color-accent), var(--color-accent-hover));
    border: none;
    color: white;
    box-shadow: 0 6px 16px rgba(26, 46, 59, 0.25);
}

.glass-button-info:hover:not(:disabled),
.btn-info:hover:not(:disabled) {
    background: linear-gradient(to bottom, var(--color-accent-hover), #0d1820);
    box-shadow: 0 8px 24px rgba(26, 46, 59, 0.35);
    transform: translateY(-2px);
    color: white;
}

/* Ghost button */
.glass-button-ghost {
    background: transparent;
    border: none;
    border-bottom: none;
    box-shadow: none;
    color: var(--color-text-secondary);
    padding: 0.5rem 1rem;
}

.glass-button-ghost:hover:not(:disabled) {
    background: var(--glass-hover-bg);
    color: var(--color-text);
}

/* Outline buttons */
.glass-button-outline-primary {
    background: transparent;
    border: 1.5px solid var(--color-accent);
    border-bottom-width: 1.5px;
    box-shadow: none;
    color: var(--color-accent);
}

.glass-button-outline-primary:hover:not(:disabled) {
    background: var(--color-accent-light);
    color: var(--color-accent);
}

.glass-button-outline-terracotta {
    background: transparent;
    border: 1.5px solid var(--color-terracotta);
    border-bottom-width: 1.5px;
    box-shadow: none;
    color: var(--color-terracotta);
}

.glass-button-outline-terracotta:hover:not(:disabled) {
    background: var(--color-terracotta-light);
    color: var(--color-terracotta);
}

/* Icon button */
.glass-button-icon {
    padding: 0.625rem;
    border-radius: 0.75rem;
}

/* Button sizes */
.glass-button-xs {
    padding: 0.375rem 0.75rem;
    font-size: var(--font-size-xs);
    border-radius: 0.5rem;
}

.glass-button-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
}

/* Suggestion buttons for address modal */
.suggestion-btn {
    background: var(--glass-bg);
    border: 1px solid var(--border-glass);
    transition: all 0.2s ease;
}

.suggestion-btn:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    transform: translateX(4px);
}

/* Shake animation for warning alerts */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Pulse animation for suggestion warning */
@keyframes suggestionPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 15px 5px rgba(255, 193, 7, 0.6); }
}

#suggestionsList .glass-alert {
    animation: shake 0.5s ease-in-out, suggestionPulse 2s ease-in-out infinite;
}

.glass-button-lg {
    padding: 1rem 2rem;
    font-size: var(--font-size-base);
    border-radius: 0.75rem;
}

.glass-button-xl {
    padding: 1.25rem 2.5rem;
    font-size: var(--font-size-lg);
}

/* Full width button */
.glass-button-full {
    width: 100%;
}

/* Button with icon left */
.glass-button .material-symbols-outlined {
    font-size: 1.125rem;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--glass-hover-bg);
    color: var(--color-text);
}

.nav-item.active {
    background: var(--glass-active-bg);
    color: var(--color-accent);
}

.nav-item .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}

.nav-item .nav-label {
    margin-left: 0.75rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */
.glass-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

.glass-alert-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.glass-alert-content {
    flex: 1;
}

.glass-alert-success {
    background: var(--color-success-light);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.glass-alert-warning {
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    color: var(--color-warning);
}

.glass-alert-error {
    background: var(--color-error-light);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.glass-alert-info {
    background: var(--color-info-light);
    border: 1px solid var(--color-info);
    color: var(--color-info);
}

/* ==========================================================================
   DIVIDERS
   ========================================================================== */
.glass-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.glass-divider::before,
.glass-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-divider);
}

/* ==========================================================================
   LINKS
   ========================================================================== */
.glass-link {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.glass-link:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* ==========================================================================
   SOCIAL BUTTONS
   ========================================================================== */
.social-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    background: var(--glass-card-bg);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--border-input);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.social-button:hover {
    background: var(--glass-hover-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.social-button svg,
.social-button i {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn {
    animation: fadeIn var(--transition-slow) ease-out;
}

.animate-slideUp {
    animation: slideUp var(--transition-slow) ease-out;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header-title {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.page-header-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   GLASS TABLE
   ========================================================================== */
.glass-table-container {
    background: var(--glass-card-bg);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
}

.glass-table thead {
    background: var(--glass-hover-bg);
}

.glass-table th {
    padding: 1rem;
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.glass-table td {
    padding: 1rem;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.glass-table tbody tr {
    transition: background var(--transition-fast);
}

.glass-table tbody tr:hover {
    background: var(--glass-hover-bg);
}

.glass-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table responsive wrapper */
.table-responsive-glass {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* DataTables Glass Style */
.dataTable.border-separate,
table.border-separate.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 0.75rem !important;
}

.dataTable tbody tr,
table.dataTable tbody tr {
    background: var(--datatable-row-bg) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 1rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 0 1.5px var(--datatable-row-border), var(--shadow-card) !important;
}

/* Ensure all glass-panel-table DataTables have card-style rows */
.glass-panel-table table.dataTable tbody tr {
    background: var(--datatable-row-bg) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 1rem !important;
    box-shadow: 0 0 0 1.5px var(--datatable-row-border), var(--shadow-card) !important;
}

.dataTable tbody tr:hover,
table.dataTable tbody tr:hover,
.glass-panel-table table.dataTable tbody tr:hover {
    background: var(--datatable-row-hover-bg) !important;
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px var(--datatable-row-border), var(--shadow-card-hover) !important;
}

.dataTable tbody tr td,
table.dataTable tbody tr td,
.glass-panel-table table.dataTable tbody tr td {
    border: none !important;
    padding: 4px 6px 4px 6px;
    font-weight:600 !important;
    font-size:14px !important;
}

.dataTable tbody tr td:first-child,
table.dataTable tbody tr td:first-child,
.glass-panel-table table.dataTable tbody tr td:first-child {
    font-weight: bolder;
    border-top-left-radius: 1rem !important;
    border-bottom-left-radius: 1rem !important;
}

.dataTable tbody tr td:last-child,
table.dataTable tbody tr td:last-child,
.glass-panel-table table.dataTable tbody tr td:last-child {
    border-top-right-radius: 1rem !important;
    border-bottom-right-radius: 1rem !important;
}

/* ==========================================================================
   EXPLORER VIEW (File Manager Style)
   ========================================================================== */
.explorer-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1rem;
}

.explorer-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
}

.explorer-nav {
    display: flex;
    gap: 0.25rem;
}

.explorer-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.explorer-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.5);
    color: var(--color-text);
}

.explorer-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.explorer-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    overflow: hidden;
}

.explorer-breadcrumb .breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.explorer-breadcrumb .breadcrumb-item:hover {
    background: rgba(255, 255, 255, 0.5);
}

.explorer-breadcrumb .breadcrumb-item.active {
    color: var(--color-text);
    font-weight: 600;
    cursor: default;
}

.explorer-breadcrumb .breadcrumb-item.active:hover {
    background: transparent;
}

.explorer-breadcrumb .breadcrumb-separator {
    color: var(--color-text-muted);
}

.explorer-actions {
    display: flex;
    gap: 0.5rem;
}

/* Explorer Grid */
.explorer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
    flex: 1;
    overflow-y: auto;
    align-content: start;
}

/* Explorer Item (Folder or File) */
.explorer-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.75rem;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
}

.explorer-item:hover {
    background: var(--glass-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.explorer-item.selected {
    background: rgba(var(--color-terracotta-rgb), 0.15);
    border: 2px solid var(--color-terracotta);
}

.explorer-item-icon {
    font-size: 48px;
    margin-bottom: 0.5rem;
    transition: transform 0.2s ease;
}

.explorer-item:hover .explorer-item-icon {
    transform: scale(1.1);
}

/* Folder Icon */
.explorer-item.folder .explorer-item-icon {
    color: #f0b429;
}

/* File Icons */
.explorer-item.file .explorer-item-icon {
    color: var(--color-text-secondary);
}

.explorer-item.file.pdf .explorer-item-icon {
    color: #dc3545;
}

.explorer-item.file.image .explorer-item-icon {
    color: #28a745;
}

.explorer-item.file.missing {
    border: 2px dashed var(--color-danger);
    background: rgba(var(--color-danger-rgb), 0.05);
}

.explorer-item.file.missing .explorer-item-icon {
    color: var(--color-danger);
    opacity: 0.6;
}

.explorer-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.explorer-item-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* Empty state */
.explorer-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

.explorer-empty .material-symbols-outlined {
    font-size: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Footer con azioni (sotto la card) */
.explorer-item-footer {
    width: 100%;
    display: none;
    justify-content: center;
    padding-top: 0.5rem;
    margin-top: auto;
    border-top: 1px solid var(--border-glass);
}

.explorer-item:hover .explorer-item-footer {
    display: flex;
}

.explorer-item-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--border-glass);
    background: var(--glass-card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}

.explorer-item-action:hover {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
    color: white;
}

.explorer-item-action.danger {
    color: var(--color-error);
}

.explorer-item-action.danger:hover {
    background: var(--color-error);
    border-color: var(--color-error);
    color: white;
}

/* Dropzone styling */
.explorer-item.dropzone-active {
    background: rgba(40, 167, 69, 0.15);
    border: 2px dashed #28a745;
}

/* ==========================================================================
   TABLE FOOTER (count left, pagination right - same line)
   ========================================================================== */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(210, 180, 140, 0.3);
    gap: 1rem;
    flex-wrap: nowrap;
}

.table-footer-count {
    font-size: 13px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.table-footer-count strong {
    font-weight: 700;
    color: var(--color-text);
}

.table-footer-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 1;
}

/* Force DataTables pagination inside container to display inline */
.table-footer-pagination .dataTables_paginate {
    display: flex !important;
    align-items: center;
    gap: 0.25rem;
    margin: 0 !important;
    padding: 0 !important;
}

.table-footer-pagination .dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(210, 180, 140, 0.3);
    color: var(--color-text-secondary);
}

.table-footer-pagination .dataTables_paginate .paginate_button:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.table-footer-pagination .dataTables_paginate .paginate_button.current {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
    color: white;
    font-weight: 700;
}

.table-footer-pagination .dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.table-footer-pagination .dataTables_paginate .paginate_button .material-symbols-outlined {
    font-size: 18px;
}

/* ==========================================================================
   PILL BADGES (evita conflitto con Bootstrap .badge)
   ========================================================================== */
.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.pill-badge .material-symbols-outlined {
    font-size: 12px;
}

.pill-badge.success {
    background: var(--badge-success-bg);
    color: var(--badge-success-color);
    border: 1px solid var(--badge-success-border);
}

.pill-badge.warning {
    background: var(--badge-warning-bg);
    color: var(--badge-warning-color);
    border: 1px solid var(--badge-warning-border);
}

.pill-badge.danger {
    background: var(--badge-danger-bg);
    color: var(--badge-danger-color);
    border: 1px solid var(--badge-danger-border);
}

.pill-badge.primary {
    background: var(--badge-primary-bg);
    color: var(--badge-primary-color);
    border: 1px solid var(--badge-primary-border);
}

.pill-badge.secondary {
    background: var(--badge-secondary-bg);
 
    border: 1px solid var(--badge-secondary-border);
}

.pill-badge.info {
    background: var(--badge-info-bg);
    color: var(--badge-info-color);
    border: 1px solid var(--badge-info-border);
}

/* ==========================================================================
   FILTER CHIPS (for compact filters)
   ========================================================================== */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Glassmorphism style */
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--color-text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px -2px rgba(140, 120, 90, 0.12);
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--color-text-primary);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px -2px rgba(140, 120, 90, 0.18);
    transform: translateY(-1px);
}

/* Active state - pressed/inset effect */
.filter-chip.active {
    background: rgba(139, 64, 32, 0.12);
    color: var(--color-terracotta);
    border: 1px solid rgba(139, 64, 32, 0.25);
    border-top: 1px solid rgba(139, 64, 32, 0.35);
    border-left: 1px solid rgba(139, 64, 32, 0.35);
    border-bottom: 1px solid rgba(139, 64, 32, 0.15);
    border-right: 1px solid rgba(139, 64, 32, 0.15);
    box-shadow: inset 0 2px 4px rgba(139, 64, 32, 0.18),
                inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.filter-chip.active:hover {
    background: rgba(139, 64, 32, 0.18);
    border-color: rgba(139, 64, 32, 0.35);
}

.filter-chip .material-symbols-outlined {
    font-size: 28px;
}

/* Filter Select Compatto */
.filter-select {
    appearance: none;
    padding: 12px 28px 12px 12px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.6);
    color: var(--color-text-muted);
    border: 1px solid rgba(210, 180, 140, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    min-width: 100px;
}

.filter-select:hover,
.filter-select:focus {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 4px 12px rgba(26, 46, 59, 0.1);
}

.filter-select.has-value {
    background: var(--badge-primary-bg);
    color: var(--badge-primary-color);
    border-color: var(--badge-primary-border);
}

/* ==========================================================================
   FILTER BAR UTILITIES
   ========================================================================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.filter-bar-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.filter-label-icon {
    font-size: 18px;
    color: #8b7355;
}

.filter-label-text {
   font-size: 13px;
    font-weight: 500;
   
    letter-spacing: 0.05em;
   
}

.filter-separator {
    height: 24px;
    width: 1px;
    background: rgba(210, 180, 140, 0.4);
    flex-shrink: 0;
}

/* Reset button sempre a destra */
.filter-reset-btn {
    margin-left: auto !important;
    flex-shrink: 0;
}

.filter-reset-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9999px;
    background: var(--color-terracotta);
    color: white;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
}

/* Filter field labels */
.filter-field-label {
    font-size: 12px;
    color: #5c5c4f;
    font-weight: 500;
    flex-shrink: 0;
}

/* Filter date range group */
.filter-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Filter flex field with growing select */
.filter-field-flex {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.filter-select-grow {
    flex: 1;
}

/* Filter action buttons group */
.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Filter Date Input */
.filter-date-input {
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border: 1px solid rgba(210, 180, 140, 0.4);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--color-text);
    width: 120px;
    transition: all 0.2s ease;
}

.filter-date-input:focus {
    outline: none;
    border-color: var(--color-terracotta);
    box-shadow: 0 0 0 3px rgba(139, 64, 32, 0.15);
    background: rgba(255, 255, 255, 0.9);
}

.filter-date-input::placeholder {
    color: var(--color-text-muted);
    font-size: 11px;
}

/* Select wrapper with icon */
.filter-select-wrapper {
    position: relative;
}

.filter-select-wrapper .filter-select-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #8b7355;
    pointer-events: none;
}

/* ==========================================================================
   AVATAR UTILITIES (for tables)
   ========================================================================== */

/* Simple avatar class for DataTables */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(139, 64, 32, 0.15), rgba(139, 64, 32, 0.25));
    color: var(--color-terracotta);
    border: 1.5px solid rgba(139, 64, 32, 0.3);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 11px;
}

.avatar-company {
    background: linear-gradient(135deg, rgba(26, 46, 59, 0.15), rgba(26, 46, 59, 0.25));
    color: #1a2e3b;
    border-color: rgba(26, 46, 59, 0.3);
}

.avatar-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    border-width: 2px;
    border-style: solid;
}

.avatar-circle-sm {
    width: 32px;
    height: 32px;
    font-size: 11px;
}

.avatar-circle-lg {
    width: 48px;
    height: 48px;
    font-size: 15px;
}

.avatar-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

/* Avatar color palette - use data-color attribute or classes */
.avatar-circle[data-color="terracotta"],
.avatar-circle.avatar-terracotta {
    background: rgba(139, 64, 32, 0.15);
    color: #8b4020;
    border-color: rgba(139, 64, 32, 0.4);
}

.avatar-circle[data-color="green"],
.avatar-circle.avatar-green {
    background: rgba(64, 102, 64, 0.15);
    color: #406640;
    border-color: rgba(64, 102, 64, 0.4);
}

.avatar-circle[data-color="blue"],
.avatar-circle.avatar-blue {
    background: rgba(26, 46, 59, 0.15);
    color: #1a2e3b;
    border-color: rgba(26, 46, 59, 0.4);
}

.avatar-circle[data-color="orange"],
.avatar-circle.avatar-orange {
    background: rgba(217, 119, 6, 0.15);
    color: #b86305;
    border-color: rgba(217, 119, 6, 0.4);
}

.avatar-circle[data-color="beige"],
.avatar-circle.avatar-beige {
    background: rgba(139, 115, 85, 0.15);
    color: #8b7355;
    border-color: rgba(139, 115, 85, 0.4);
}

.avatar-circle[data-color="brown"],
.avatar-circle.avatar-brown {
    background: rgba(128, 96, 80, 0.15);
    color: #805040;
    border-color: rgba(128, 96, 80, 0.4);
}

/* ==========================================================================
   ACTION BUTTONS (for tables)
   ========================================================================== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--glass-hover-bg);
    color: var(--color-text);
    border-color: var(--border-input);
}

.action-btn-view:hover {
    color: var(--color-info);
    border-color: var(--color-info);
}

.action-btn-edit:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.action-btn-delete:hover {
    color: var(--color-error);
    border-color: var(--color-error);
}

.action-btn .material-symbols-outlined {
    font-size: 1.125rem;
}

/* ==========================================================================
   TABS
   ========================================================================== */
.glass-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.glass-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.glass-tab:hover {
    color: var(--color-text);
    background: var(--glass-hover-bg);
}

.glass-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.glass-tab .material-symbols-outlined {
    font-size: 1.25rem;
}

/* ==========================================================================
   FILTERS ROW
   ========================================================================== */
.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--glass-hover-bg);
    border-radius: var(--radius-lg);
}

.filter-group {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-text-muted);
}

.filter-group .glass-select,
.filter-group .glass-input {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm);
}

/* ==========================================================================
   GLASS BADGES
   ========================================================================== */
.badge-glass {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(160, 140, 110, 0.3);
    color: var(--color-text);
}

.badge-glass-primary {
    background: linear-gradient(135deg, var(--color-terracotta), #a0522d);
    border: none;
    color: white;
}

.badge-glass-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: white;
}

.badge-glass-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: white;
}

.badge-glass-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
}

.badge-glass-info {
    background: linear-gradient(135deg, #1a2e3b, #112230);
    border: none;
    color: white;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: var(--color-text-muted);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    max-width: 300px;
    margin: 0 auto 1.5rem;
}

/* ==========================================================================
   CARD SECTIONS
   ========================================================================== */
.glass-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.glass-card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.glass-card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.glass-card-body {
    padding: 1.5rem;
}

.glass-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--glass-hover-bg);
}

/* ==========================================================================
   FORM ROW (multiple inputs in a row)
   ========================================================================== */
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row > .form-group {
    flex: 1;
    min-width: 200px;
}

/* ==========================================================================
   DROPZONE
   ========================================================================== */
.glass-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-lg);
    background: var(--glass-input-bg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.glass-dropzone:hover {
    border-color: var(--color-accent);
    background: var(--glass-hover-bg);
}

.glass-dropzone.dragover {
    border-color: var(--color-accent);
    background: var(--color-accent-light);
}

.glass-dropzone-icon {
    font-size: 2.5rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.glass-dropzone-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-align: center;
}

.glass-dropzone-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* ==========================================================================
   STICKY TOOLBAR (bottom action bar)
   ========================================================================== */
.sticky-toolbar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width, 240px);
    right: 0;
    padding: 0.75rem 1.5rem;
    background: var(--glass-panel-bg);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: var(--z-sticky);
    animation: slideUp var(--transition-normal) ease-out;
}

@media (max-width: 991.98px) {
    .sticky-toolbar {
        left: 0;
    }
}

/* Spacer to prevent content from being hidden behind toolbar */
.sticky-toolbar-spacer {
    height: 60px;
}

/* ==========================================================================
   INFO GRID (for detail views)
   ========================================================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: var(--font-size-base);
    color: var(--color-text);
}

/* ==========================================================================
   TOGGLE CARD (for toggleable options)
   ========================================================================== */
.toggle-card,
.role-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.toggle-card:hover,
.role-card:hover {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(180, 160, 130, 0.4);
    box-shadow: 0 4px 16px rgba(40, 35, 25, 0.08);
}

.toggle-card.checked,
.role-card.checked {
    background: linear-gradient(135deg, rgba(var(--color-success-rgb, 76, 175, 80), 0.12) 0%, rgba(var(--color-success-rgb, 76, 175, 80), 0.06) 100%);
    border-color: var(--color-success);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.15), inset 0 0 0 1px rgba(76, 175, 80, 0.1);
}

.toggle-card.checked .toggle-card-title,
.toggle-card.checked .role-info label,
.role-card.checked .toggle-card-title,
.role-card.checked .role-info label {
    color: var(--color-success);
}

/* Hide the native checkbox */
.toggle-card input[type="checkbox"],
.role-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Glass Toggle Switch */
.glass-toggle {
    position: relative;
    width: 3rem;
    height: 1.625rem;
    flex-shrink: 0;
}

.glass-toggle .toggle-track {
    position: absolute;
    inset: 0;
    background: rgba(180, 160, 130, 0.3);
    border-radius: 9999px;
    transition: all var(--transition-normal);
    border: 1px solid rgba(180, 160, 130, 0.2);
}

.glass-toggle .toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: white;
    border-radius: 9999px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all var(--transition-normal);
}

/* Checked state for toggle */
.toggle-card.checked .glass-toggle .toggle-track,
.role-card.checked .glass-toggle .toggle-track,
.toggle-card.checked .toggle-track,
.role-card.checked .toggle-track {
    background: var(--color-success);
    border-color: var(--color-success);
}

.toggle-card.checked .glass-toggle .toggle-track::after,
.role-card.checked .glass-toggle .toggle-track::after,
.toggle-card.checked .toggle-track::after,
.role-card.checked .toggle-track::after {
    transform: translateX(1.375rem);
    background: white;
}

/* Legacy toggle-track support (without .glass-toggle wrapper) */
.toggle-card > .toggle-track,
.role-card > .toggle-track {
    position: relative;
    width: 3rem;
    height: 1.625rem;
    flex-shrink: 0;
    background: rgba(180, 160, 130, 0.3);
    border-radius: 9999px;
    transition: all var(--transition-normal);
    border: 1px solid rgba(180, 160, 130, 0.2);
}

.toggle-card > .toggle-track::after,
.role-card > .toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: white;
    border-radius: 9999px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: all var(--transition-normal);
}

/* Toggle Card Info */
.toggle-card-info,
.role-info {
    flex: 1;
    min-width: 0;
}

.toggle-card-title,
.role-info label {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin-bottom: 0.125rem;
    display: block;
    cursor: pointer;
}

.toggle-card-description,
.role-info p {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* ==========================================================================
   PAGE HEADER BAR
   ========================================================================== */
.page-header-bar {
    padding: 1rem 0;
    background: transparent;
    border-bottom: 1px solid rgba(180, 160, 130, 0.15);
}

.page-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.page-actions {
    align-items: center;
}

.page-body {
    padding-top: 1.5rem;
    padding-right: 0.5rem;
}

/* ==========================================================================
   GLASS MODAL (Confirm/Alert)
   ========================================================================== */
.glass-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(40, 35, 25, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.glass-modal {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: glassModalIn 0.2s ease-out;
}

/* Bootstrap Modal Integration
   When glass-modal is used as modal-content inside Bootstrap modal,
   the max-width should be controlled by modal-dialog, not modal-content.
   This ensures proper centering with modal-dialog-centered. */
.modal-dialog .modal-content.glass-modal {
    max-width: none;
    margin: 0;
}

/* Glass Modal Sizes
   -------------------------------------------------------------------------
   Usage: Add size class to .glass-modal element (or .modal-content with Bootstrap)

   Size conventions:
   - .glass-modal-sm:  Small (320px) - confirmations, alerts
   - .glass-modal-md:  Medium (480px) - simple forms, default
   - .glass-modal-lg:  Large (640px) - forms with more fields
   - .glass-modal-xl:  Extra large (900px) - complex forms, data tables
   - .glass-modal-xxl: Double XL (1200px) - dashboards, side-by-side content
   - .glass-modal-fullscreen: Nearly full screen (95vw x 90vh) - data grids, multi-panel views

   Example: <div class="modal-content glass-modal glass-modal-xl">
   ------------------------------------------------------------------------- */
.glass-modal.glass-modal-sm { max-width: 320px; }
.glass-modal.glass-modal-md { max-width: 480px; }
.glass-modal.glass-modal-lg { max-width: 640px; }
.glass-modal.glass-modal-xl { max-width: 900px; }
.glass-modal.glass-modal-xxl { max-width: 1200px; }
.glass-modal.glass-modal-fullscreen {
    max-width: 95vw;
    width: 95vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* Fullscreen modal body should fill available space and scroll */
.glass-modal.glass-modal-fullscreen .modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Fullscreen modal header/footer fixed */
.glass-modal.glass-modal-fullscreen .modal-header,
.glass-modal.glass-modal-fullscreen .modal-footer {
    flex-shrink: 0;
}

@keyframes glassModalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.glass-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(180, 160, 130, 0.2);
}

.glass-modal-icon {
    font-size: 1.75rem;
    color: var(--color-primary);
}

.glass-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.glass-modal-body {
    padding: 1.5rem 1.75rem;
}

.glass-modal-body p {
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--color-text-muted);
    line-height: 1.6;
}

.glass-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid rgba(180, 160, 130, 0.2);
    background: rgba(235, 228, 215, 0.3);
}

/* ==========================================================================
   APP LAYOUT SHELL
   ========================================================================== */

/* Layout container - fixed viewport, no body scroll */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
      
    /* background: radial-gradient(at 80% 0%, hsl(211.54deg 17.35% 32.33% / 86%) 0px, transparent 50%), radial-gradient(at 0% 50%, hsl(25deg 70% 45% / 48%) 0px, transparent 50%), radial-gradient(at 80% 50%, hsl(40deg 37.04% 70.22%) 0px, transparent 50%), radial-gradient(at 0% 100%, hsl(88deg 11.81% 34.64% / 75%) 0px, #2b050569 50%), radial-gradient(at 80% 100%, hsla(25, 70%, 40%, 0.08) 0px, transparent 50%), radial-gradient(at 0% 0%, hsl(40deg 14.02% 77.28% / 93%) 0px, transparent 50%) */
    background: radial-gradient(at 80% 0%, hsl(0deg 0% 100% / 86%) 0px, transparent 50%), radial-gradient(at 0% 50%, hsl(25deg 5.67% 32.82% / 6%) 0px, transparent 50%), radial-gradient(at 80% 50%, hsl(40deg 37.04% 70.22%) 0px, transparent 50%), radial-gradient(at 0% 100%, hsl(88deg 40.03% 90.29% / 75%) 0px, #ffffff69 50%), radial-gradient(at 80% 100%, hsla(25, 70%, 40%, 0.08) 0px, transparent 50%), radial-gradient(at 0% 0%, hsl(40deg 14.02% 77.28% / 93%) 0px, transparent 50%);
}

/* ==========================================================================
   SIDEBAR - EXACT TEMPLATE STYLE
   ========================================================================== */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width-expanded);
    background: transparent;
    border-right: none;
    display: flex;
    flex-direction: column;
    z-index: var(--z-fixed);
    transition: width var(--transition-slow), transform var(--transition-slow);
    padding: 1rem;
    padding-bottom: 1.5rem;
    padding-right: 0rem;
}

/* Inner sidebar container - EXACT Template glass-panel */
.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    /* Template: bg-sandy-beige-100/65 backdrop-blur-[32px] */
    background: var(--sidebar-glass-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    /* Template: border border-white/60 border-t-white/90 border-l-white/90 */
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-left-color: rgba(255, 255, 255, 0.9);
    /* Template: rounded-[2rem] */
    border-radius: 2rem;
    /* Template: shadow-glass */
    box-shadow: 0 8px 32px rgba(44, 44, 36, 0.08);
    overflow: hidden;
}

/* Sidebar Header with Logo and Toggle */
.app-sidebar-header {
    padding: 1.25rem 1rem 0.75rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.app-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

/* Template: w-10 h-10 bg-gradient-to-br from-deep-blue-accent to-[#8d5e2a] rounded-xl */
.app-sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(to bottom right, #1a2e3b, #8d5e2a);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Template: shadow-md inset border */
    box-shadow: 0 4px 12px rgba(26, 46, 59, 0.3),
                inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.app-sidebar-logo-icon .material-symbols-outlined {
    font-size: 1.375rem;
    color: white;
}

.app-sidebar-logo-icon img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.app-sidebar-logo-text {
    display: flex;
    flex-direction: column;
}

/* Template: text-[17px] font-bold tracking-tight */
.app-sidebar-logo-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* Template: text-[11px] font-semibold text-terracotta uppercase tracking-wider */
.app-sidebar-logo-subtitle {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-terracotta);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Sidebar Navigation - Template: flex-1 overflow-y-auto py-2 px-3 */
.app-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    /* Enable scroll on the nav section only */
    min-height: 0;
}

/* Custom scrollbar - thin and subtle */
.app-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.app-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(139, 64, 32, 0.15);
    border-radius: 9999px;
}

.app-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 64, 32, 0.3);
}

/* Section titles - Template: text-[10px] font-bold uppercase tracking-widest */
.app-sidebar-section {
    margin-bottom: 0.25rem;
}

.app-sidebar-section-title {
    padding: 1.25rem 0.875rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-disabled);
}

/* Nav items - EXACT Template style */
/* Template: py-3 px-4, gap-3, text-sm font-semibold, rounded-xl */
.app-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.125rem;
    
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
  
    font-weight: 600;
}

/* Template: hover:bg-white/60 hover:text-terracotta */
.app-nav-item:hover {
    background: var(--sidebar-item-hover);
    color: var(--color-terracotta);
}

/* Template: bg-sandy-beige-200/25 text-terracotta shadow-sm with inset border */
.app-nav-item.active {
    background: var(--sidebar-item-active);
    color: var(--color-terracotta);
    box-shadow: 0 4px 12px rgba(139, 64, 32, 0.1),
                inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* Template expanded parent: bg-white/40 text-terracotta */
.app-nav-item.expanded {
    background: var(--sidebar-expanded-bg);
    color: var(--color-terracotta);
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Template: w-[22px] h-[22px] */
.app-nav-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.375rem;
    height: 1.375rem;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.app-nav-item:hover .app-nav-item-icon,
.app-nav-item.active .app-nav-item-icon,
.app-nav-item.expanded .app-nav-item-icon {
    opacity: 1;
    color: var(--color-terracotta);
}

.app-nav-item-icon .material-symbols-outlined {
    font-size: 1.375rem;
}

.app-nav-item-label {
    flex: 1;
}

/* Arrow - Template uses expand_more icon */
.app-nav-item-arrow {
    font-size: 1.125rem !important;
    color: var(--color-text-muted);
    transition: transform 0.2s ease;
    opacity: 0.5;
}

.app-nav-item:hover .app-nav-item-arrow {
    opacity: 0.7;
}

.app-nav-item.expanded .app-nav-item-arrow {
    transform: rotate(180deg);
    color: var(--color-terracotta);
    opacity: 1;
}

/* Submenu container - EXACT Template: bg-white/30 rounded-2xl pb-2 shadow-sm border border-white/40 */
.app-nav-submenu {
    display: none;
    margin-top: 0;
    padding: 0.5rem 0 0.5rem 0;
    /* Template: bg-white/30 */
    background: var(--sidebar-submenu-bg);
    /* Template: border border-white/40 */
    border: 1px solid var(--sidebar-submenu-border);
    border-top: none;
    /* Template: rounded-2xl but connected to parent so bottom only */
    border-radius: 0 0 1rem 1rem;
    /* Template: shadow-sm */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.app-nav-submenu.open,
.app-nav-submenu.expanded {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* Template submenu items: pl-5 with vertical line */
.app-nav-subitem {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    /* Template: text-xs font-medium */
    font-size: 0.75rem;
    font-weight: 500;
 
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}

/* Template: vertical line w-px bg-sandy-beige-300/40 */
.app-nav-subitem::before {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--sidebar-line-color);
}

/* Template: horizontal dash w-[5px] h-px */
.app-nav-subitem::after {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 1px;
    background: rgba(160, 140, 110, 0.4);
    transition: background 0.15s ease;
}

/* First item - no line at top */
.app-nav-subitem:first-child::before {
    top: 50%;
}

/* Last item - no line at bottom */
.app-nav-subitem:last-child::before {
    bottom: 50%;
}

/* Template hover: text-terracotta */
.app-nav-subitem:hover {
    color: var(--color-terracotta);
}

.app-nav-subitem:hover::after {
    background: var(--color-terracotta);
}

/* Template active: bg-deep-blue-accent/5 rounded-l-lg border-r-2 border-deep-blue-accent text-deep-blue-accent font-bold */
.app-nav-subitem.active {
    color: var(--color-terracotta);
    font-weight: 700;
    background: rgba(139, 64, 32, 0.05);
    border-radius: 0.5rem 0 0 0.5rem;
    border-right: 2px solid var(--color-terracotta);
    margin-right: 0;
}

.app-nav-subitem.active::after {
    background: var(--color-terracotta);
}

/* Nested submenu - Level 3 if needed */
.app-nav-nested {
    display: none;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.25rem 0 0.25rem 1rem;
}

.app-nav-nested.open {
    display: flex;
}

.app-nav-nested-item {
    display: block;
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
    padding-left: 1.5rem;
}

.app-nav-nested-item::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--sidebar-line-color);
}

.app-nav-nested-item::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    width: 4px;
    height: 1px;
    background: rgba(160, 140, 110, 0.4);
}

.app-nav-nested-item:hover {
    color: var(--color-terracotta);
}

.app-nav-nested-item.active {
    color: var(--color-terracotta);
    font-weight: 700;
    background: rgba(139, 64, 32, 0.05);
    border-radius: 0.5rem 0 0 0.5rem;
    border-right: 2px solid var(--color-terracotta);
}

/* Submenu parent item (for nested menus) */
.app-nav-subitem-parent {
    cursor: pointer;
    justify-content: space-between;
}

.app-nav-subitem-parent:hover {
    color: var(--color-terracotta);
}

/* Nested submenu container - Level 3 */
.app-nav-submenu-nested {
    display: none;
    padding: 0.25rem 0 0.25rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-left: 1px solid var(--sidebar-line-color);
    margin-left: 2.5rem;
    margin-right: 0.5rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

.app-nav-submenu-nested.open {
    display: block;
}

.app-nav-subitem-nested {
    display: block;
    padding: 0.4rem 0.75rem 0.4rem 1rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}

.app-nav-subitem-nested::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--sidebar-line-color);
}

.app-nav-subitem-nested::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 4px;
    height: 1px;
    background: rgba(160, 140, 110, 0.4);
}

.app-nav-subitem-nested:first-child::before {
    top: 50%;
}

.app-nav-subitem-nested:last-child::before {
    bottom: 50%;
}

.app-nav-subitem-nested:hover {
    color: var(--color-terracotta);
}

.app-nav-subitem-nested:hover::after {
    background: var(--color-terracotta);
}

.app-nav-subitem-nested.active {
    color: var(--color-terracotta);
    font-weight: 700;
}

/* Sidebar Footer - EXACT Template glass-card style */
.app-sidebar-footer {
    margin-top: auto;
    padding: 0.75rem;
    padding-top: 0.5rem;
}

/* Template: glass-card with specific gradient and borders */
.app-sidebar-profile {
    display: grid !important;
    grid-template-columns: 40px 1fr 24px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    /* EXACT Template glass-card gradient */
    background: var(--profile-card-gradient);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    /* Template borders */
    border-top: 1.5px solid var(--profile-card-border-top);
    border-left: 1.5px solid var(--profile-card-border-top);
    border-bottom: 1px solid var(--profile-card-border-bottom);
    border-right: 1px solid var(--profile-card-border-bottom);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 12px 24px -6px rgba(40, 35, 25, 0.1),
                0 4px 8px -4px rgba(40, 35, 25, 0.05),
                inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* Hide original dropdown - we use floating profile menu instead to avoid overflow issues */
.app-sidebar-profile > .app-dropdown-menu {
    display: none !important;
}

.app-sidebar-profile:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 235, 215, 0.85) 100%);
    box-shadow: 0 20px 40px -8px rgba(40, 35, 25, 0.15),
                0 8px 16px -6px rgba(40, 35, 25, 0.08),
                inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* Avatar with gradient border */
.app-sidebar-profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    overflow: hidden;
    padding: 2px;
    background: var(--profile-avatar-gradient);
    box-shadow: 0 4px 8px rgba(139, 64, 32, 0.2);
}

.app-sidebar-profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 9999px;
    object-fit: cover;
    object-position: top center;
    display: block;
}

/* Info section */
.app-sidebar-profile-info {
    min-width: 0;
    overflow: hidden;
}

.app-sidebar-profile-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.app-sidebar-profile-role {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-profile-sede {
    font-size: 0.625rem;
    color: var(--color-terracotta);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

.app-sidebar.collapsed .app-sidebar-profile-sede {
    display: none;
}

/* Menu dots */
.app-sidebar-profile-menu {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-sidebar-profile-menu .material-symbols-outlined {
    font-size: 1.25rem;
}

/* ==========================================================================
   HEADER - GLASSMORPHISM STYLE (matches sidebar)
   ========================================================================== */
.app-header {
    flex-shrink: 0;
    height: var(--header-height);
    background: transparent;
    padding: 1rem 1.5rem 0 1.5rem;
    z-index: var(--z-sticky);
}

/* Inner header container - EXACT same glass style as sidebar */
.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 120%;
    padding: 0 1.5rem;
    /* Template: bg-sandy-beige-100/65 backdrop-blur-[32px] */
    background: var(--sidebar-glass-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    /* Template: border border-white/60 border-t-white/90 border-l-white/90 */
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-left-color: rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(180, 160, 130, 0.3);
    /* Template: rounded-[2rem] */
    border-radius: 2rem;
    /* Template: shadow-glass */
    box-shadow: 0 4px 12px -4px rgba(140, 120, 90, 0.15);
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-header-toggle {
    display: none;
    padding: 0.625rem;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    color: var(--color-text);
    cursor: pointer;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.app-header-toggle:hover {
    background: var(--glass-hover-bg);
    border-color: var(--border-input);
}

.app-header-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    color: var(--color-text);
    cursor: pointer;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.app-header-back-btn:hover {
    background: var(--glass-hover-bg);
    border-color: var(--border-input);
    transform: translateX(-2px);
}

.app-header-back-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

.app-header-greeting {
    display: flex;
    flex-direction: column;
}

.app-header-greeting-text {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.app-header-greeting-sub {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

/* .app-header-center removed - search moved to right as icon button */

.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* Header icon buttons - Template style */
.app-header-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--radius-xl);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.app-header-icon-btn:hover {
    background: var(--glass-hover-bg);
    border-color: var(--border-input);
    color: var(--color-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.app-header-icon-btn .material-symbols-outlined {
    font-size: 1.375rem;
}

.app-header-badge {
    position: absolute;
    top: 0.125rem;
    right: 0.125rem;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.375rem;
    font-size: 0.625rem;
    font-weight: 700;
    background: var(--color-terracotta);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(139, 64, 32, 0.35);
}

/* Sede button in header */
.app-header-sede-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-xl);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.app-header-sede-btn:hover {
    background: var(--glass-hover-bg);
    color: var(--color-text);
    border-color: var(--border-input);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.app-header-sede-btn .material-symbols-outlined {
    font-size: 1.125rem;
    color: var(--color-terracotta);
}

.app-header-sede-text {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .app-header-sede-text {
        display: none;
    }

    .app-header-sede-btn {
        padding: 0.625rem;
    }
}

/* Profile dropdown trigger */
.app-header-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.875rem 0.5rem 0.5rem;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.app-header-profile:hover {
    background: var(--glass-hover-bg);
    border-color: var(--border-input);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.app-header-profile-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 2px solid var(--color-terracotta-light);
}

.app-header-profile-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.app-header-profile-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
}

.app-header-profile-role {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   MAIN CONTENT
   ========================================================================== */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width-expanded);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    transition: margin-left var(--transition-slow);
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto; /* Allow vertical scrolling */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Container fluid dentro app-content deve occupare lo spazio disponibile */
.app-content > .container-fluid {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Importante per flex shrink */
/*     overflow: hidden; */
}

/* Glass panel principale che contiene la tabella deve crescere */
.app-content > .container-fluid > .glass-panel:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    margin-bottom:0px !important;
}

/* Il wrapper della tabella deve crescere e scrollare */
.app-content .overflow-x-auto {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* DataTables wrapper deve espandersi */
.app-content .dataTables_wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-left:  0.5rem;
    padding-right:  0.5rem;
}

/* La tabella stessa cresce */
.app-content .dataTables_wrapper table {
    flex: 1;
}

/* Paginazione fissa in fondo */
.app-content .dataTables_wrapper .dataTables_paginate,
.app-content #pagination-container {
    margin-top: auto;
    flex-shrink: 0;
}

/* Page title / breadcrumb area */
.app-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.app-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.app-breadcrumb a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.app-breadcrumb a:hover {
    color: var(--color-accent);
}

.app-breadcrumb-separator {
    color: var(--color-text-disabled);
}

.app-breadcrumb-current {
    color: var(--color-text);
    font-weight: 500;
}

.app-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.app-back-link:hover {
    color: var(--color-accent);
}

/* ==========================================================================
   DROPDOWNS
   ========================================================================== */
.app-dropdown {
    position: relative;
    display: inline-block;
}

/* Profile dropdown needs grid layout, not inline-block */
.app-sidebar-profile.app-dropdown {
    display: grid !important;
    grid-template-columns: 40px 1fr 24px !important;
}

.app-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--glass-panel-bg);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass-raised);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.app-dropdown.open .app-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.app-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.app-dropdown-item:hover {
    background: var(--glass-hover-bg);
    color: var(--color-text);
}

.app-dropdown-item .material-symbols-outlined {
    font-size: 1.25rem;
    color: var(--color-text-muted);
}

.app-dropdown-divider {
    height: 1px;
    background: var(--border-glass-subtle);
    margin: 0.375rem 0;
}

/* ==========================================================================
   NOTIFICATION PANEL
   ========================================================================== */
.app-notification-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--glass-panel-bg);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glass-raised);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.app-dropdown.open .app-notification-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.app-notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass-subtle);
}

.app-notification-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
}

.app-notification-list {
    max-height: 360px;
    overflow-y: auto;
}

.app-notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass-subtle);
    transition: background var(--transition-fast);
}

.app-notification-item:hover {
    background: var(--glass-hover-bg);
}

.app-notification-item:last-child {
    border-bottom: none;
}

.app-notification-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-notification-icon.success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.app-notification-icon.warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.app-notification-icon.error {
    background: var(--color-error-light);
    color: var(--color-error);
}

.app-notification-icon.info {
    background: var(--color-info-light);
    color: var(--color-info);
}

.app-notification-content {
    flex: 1;
    min-width: 0;
}

.app-notification-text {
    font-size: var(--font-size-sm);
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.app-notification-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.app-notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
}

/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .app-header-toggle {
        display: flex;
    }

    .app-header-profile-info {
        display: none;
    }

    /* Overlay when sidebar is open */
    .app-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-fixed) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .app-sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 575.98px) {
    .app-content {
        padding: 1rem;
    }

    .app-notification-panel {
        width: calc(100vw - 2rem);
        right: -1rem;
    }
}

/* ==========================================================================
   SIDEBAR COLLAPSE BAR - Clean bottom toggle
   ========================================================================== */
.app-sidebar-collapse-bar {
    width: 100%;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(var(--color-terracotta-rgb), 0.05);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
    opacity: 0.6;
}

.app-sidebar-collapse-bar:hover {
    opacity: 1;
    background: rgba(var(--color-terracotta-rgb), 0.12);
    color: var(--color-terracotta);
}

.app-sidebar-collapse-bar .material-symbols-outlined {
    font-size: 18px;
    transition: transform 0.3s ease;
}

/* Rotate arrow when collapsed */
.app-sidebar.collapsed .app-sidebar-collapse-bar .material-symbols-outlined,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-collapse-bar .material-symbols-outlined {
    transform: rotate(180deg);
}

/* When collapsed, the bar becomes a small centered button */
.app-sidebar.collapsed .app-sidebar-collapse-bar,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-collapse-bar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0.5rem auto 0;
}

/* ==========================================================================
   SIDEBAR COLLAPSED STATE (desktop)
   Use both .collapsed class AND html.sidebar-is-collapsed for instant load
   ========================================================================== */
.app-sidebar.collapsed,
html.sidebar-is-collapsed .app-sidebar {
    width: var(--sidebar-width);
}

/* Hide text elements when collapsed */
.app-sidebar.collapsed .app-sidebar-logo-text,
.app-sidebar.collapsed .app-nav-item-label,
.app-sidebar.collapsed .app-nav-item-badge,
.app-sidebar.collapsed .app-nav-item-arrow,
.app-sidebar.collapsed .app-sidebar-section-title,
.app-sidebar.collapsed .app-sidebar-profile-info,
.app-sidebar.collapsed .app-sidebar-profile-menu,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-logo-text,
html.sidebar-is-collapsed .app-sidebar .app-nav-item-label,
html.sidebar-is-collapsed .app-sidebar .app-nav-item-badge,
html.sidebar-is-collapsed .app-sidebar .app-nav-item-arrow,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-section-title,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-profile-info,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-profile-menu {
    display: none;
}

/* Header adjustments when collapsed */
.app-sidebar.collapsed .app-sidebar-header,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-header {
    padding: 1rem 0.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-sidebar.collapsed .app-sidebar-logo,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-logo {
    justify-content: center;
}

.app-sidebar.collapsed .app-sidebar-logo-icon,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-logo-icon {
    width: 36px;
    height: 36px;
}


/* Nav items centered */
.app-sidebar.collapsed .app-nav-item,
html.sidebar-is-collapsed .app-sidebar .app-nav-item {
    justify-content: center;
    padding: 0.75rem;
    position: relative;
}

.app-sidebar.collapsed .app-nav-item-icon,
html.sidebar-is-collapsed .app-sidebar .app-nav-item-icon {
    margin-right: 0;
}

/* Nav group container for hover functionality */
.app-nav-group {
    position: relative;
}

/* Hide submenus in collapsed state - they will be shown as floating elements via JS */
.app-sidebar.collapsed .app-nav-submenu,
html.sidebar-is-collapsed .app-sidebar .app-nav-submenu {
    display: none !important;
}

/* ==========================================================================
   FLOATING SUBMENU - Created dynamically via JS when sidebar is collapsed
   These are appended to body, not inside the sidebar
   ========================================================================== */
/* Shared glassmorphism style for floating menus */
.sidebar-floating-submenu,
.sidebar-floating-profile {
    position: fixed;
    /* Glassmorphism - same as sidebar */
    background: var(--sidebar-glass-bg);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-left-color: rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(44, 44, 36, 0.12),
                0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0.5rem;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.sidebar-floating-submenu {
    min-width: 200px;
    max-width: 260px;
    transform: translateX(-4px);
    /* No gap - attached to sidebar with invisible bridge */
    margin-left: -4px;
    padding-left: calc(0.5rem + 4px);
}

.sidebar-floating-submenu::before {
    /* Invisible bridge to prevent hover gap */
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    width: 16px;
    height: 100%;
}

.sidebar-floating-submenu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar-floating-submenu .floating-submenu-title {
    padding: 0.5rem 0.75rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-terracotta);
    border-bottom: 1px solid rgba(139, 64, 32, 0.15);
    margin-bottom: 0.25rem;
}

.sidebar-floating-submenu a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.sidebar-floating-submenu a:hover {
    background: rgba(var(--color-terracotta-rgb), 0.12);
    color: var(--color-terracotta);
}

.sidebar-floating-submenu a.active {
    background: rgba(var(--color-terracotta-rgb), 0.15);
    color: var(--color-terracotta);
}

/* Floating profile dropdown */
.sidebar-floating-profile {
    min-width: 180px;
    transform: translateX(-4px);
    margin-left: -4px;
    padding-left: calc(0.5rem + 4px);
}

.sidebar-floating-profile::before {
    /* Invisible bridge */
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    width: 16px;
    height: 100%;
}

.sidebar-floating-profile.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar-floating-profile a,
.sidebar-floating-profile button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s ease;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.sidebar-floating-profile a:hover,
.sidebar-floating-profile button:hover {
    background: rgba(var(--color-terracotta-rgb), 0.1);
    color: var(--color-terracotta);
}

.sidebar-floating-profile .material-symbols-outlined {
    font-size: 1.125rem;
}

.sidebar-floating-profile hr {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid var(--border-glass-subtle);
}

.sidebar-floating-profile button[style*="color: var(--color-error)"],
.sidebar-floating-profile .logout-btn {
    color: var(--color-error) !important;
}

.sidebar-floating-profile button[style*="color: var(--color-error)"]:hover,
.sidebar-floating-profile .logout-btn:hover {
    background: rgba(196, 96, 74, 0.1) !important;
    color: var(--color-error) !important;
}

/* Nested submenu support in floating menus */
.sidebar-floating-submenu .floating-nested-parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.sidebar-floating-submenu .floating-nested-parent .material-symbols-outlined {
    font-size: 14px;
    opacity: 0.6;
}

.sidebar-floating-submenu .floating-nested-submenu {
    padding-left: 0.75rem;
    margin-left: 0.5rem;
    border-left: 2px solid var(--border-glass-subtle);
}

/* Footer adjustments when collapsed */
.app-sidebar.collapsed .app-sidebar-footer,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-footer {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-sidebar.collapsed .app-sidebar-profile,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-profile {
    padding: 0.5rem;
    cursor: pointer;
    width: 100%;
}

.app-sidebar.collapsed .app-sidebar-profile-avatar,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-profile-avatar {
    width: 36px;
    height: 36px;
}

/* Hide the dropdown menu in collapsed state - we use floating instead */
.app-sidebar.collapsed .app-sidebar-profile > .app-dropdown-menu,
html.sidebar-is-collapsed .app-sidebar .app-sidebar-profile > .app-dropdown-menu {
    display: none !important;
}

/* Main content margin */
.app-sidebar.collapsed + .app-main,
html.sidebar-is-collapsed .app-sidebar + .app-main {
    margin-left: var(--sidebar-width);
}

/* Tooltip for nav items when collapsed */
.app-sidebar.collapsed .app-nav-item[data-toggle="submenu"]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-text);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-left: 12px;
    pointer-events: none;
    z-index: 999;
}

.app-sidebar.collapsed .app-nav-item[data-toggle="submenu"]:hover::after {
    opacity: 0;
    visibility: hidden;
}

/* ==========================================================================
   BOOTSTRAP OVERRIDES
   Ensure Bootstrap components use our glassmorphism design system
   ========================================================================== */

/* Override Bootstrap buttons - TEMPLATE glass-button style */
.btn {
    font-weight: 700;
    border-radius: 0.5rem !important;
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    transition: all var(--transition-normal);
    /* Template glass-button base */
    background: var(--glass-card-bg) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 64, 32, 0.2) !important;
    color: var(--color-terracotta) !important;
}

.btn:hover {
    background: rgba(139, 64, 32, 0.05) !important;
    border-color: var(--color-terracotta) !important;
}

.btn-primary {
    /* Template: filled terracotta button */
   background: linear-gradient(to bottom, #1a2e3b, #112230) !important;
    border-top: 1px solid rgba(26, 46, 59, 0.6);

    color: white !important;
    box-shadow: 0 8px 20px rgba(26, 46, 59, 0.3), 0 0 0 1px rgba(26, 46, 59, 0.2) !important;
}

.btn-primary:hover {
     background: linear-gradient(to bottom, #315c79, #112230) !important;
    border-color: var(--color-terracotta-hover) !important;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--glass-card-bg) !important;
    border: 1px solid rgba(139, 64, 32, 0.2) !important;
    color: var(--color-terracotta) !important;
}

.btn-secondary:hover {
    background: rgba(139, 64, 32, 0.05) !important;
    border-color: var(--color-terracotta) !important;
}

.btn-danger {
    background: var(--glass-card-bg) !important;
    border: 1px solid rgba(196, 96, 74, 0.3) !important;
    color: var(--color-error) !important;
}

.btn-danger:hover {
    background: rgba(196, 96, 74, 0.1) !important;
    border-color: var(--color-error) !important;
}

.btn-success {
    background: var(--glass-card-bg) !important;
    border: 1px solid rgba(64, 102, 64, 0.3) !important;
    color: var(--color-success) !important;
}

.btn-success:hover {
    background: rgba(64, 102, 64, 0.1) !important;
    border-color: var(--color-success) !important;
}

.btn-warning {
    background: var(--glass-card-bg) !important;
    border: 1px solid rgba(217, 119, 6, 0.3) !important;
    color: var(--color-warning) !important;
}

.btn-warning:hover {
    background: rgba(217, 119, 6, 0.1) !important;
    border-color: var(--color-warning) !important;
}

.btn-info {
    background: var(--glass-card-bg) !important;
    border: 1px solid rgba(26, 46, 59, 0.3) !important;
    color: var(--color-accent) !important;
}

.btn-info:hover {
    background: rgba(26, 46, 59, 0.1) !important;
    border-color: var(--color-accent) !important;
}

.btn-outline-primary {
    background: transparent !important;
    border: 1px solid rgba(139, 64, 32, 0.2) !important;
    color: var(--color-terracotta) !important;
}

.btn-outline-primary:hover {
    background: rgba(139, 64, 32, 0.05) !important;
    border-color: var(--color-terracotta) !important;
}

/* Override Bootstrap card styles */
.card {
    background: var(--glass-card-bg) !important;
    border: 1px solid var(--border-glass-subtle) !important;
    border-radius: var(--radius-2xl) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04) !important;
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border-glass-subtle) !important;
    padding: 1.25rem 1.5rem;
}

.card-body {
    background: transparent !important;
    padding: 1.5rem;
}

.card-footer {
    background: var(--glass-hover-bg) !important;
    border-top: 1px solid var(--border-glass-subtle) !important;
}

/* Override Bootstrap form controls */
.form-control,
.form-select {
    background: var(--glass-card-bg) !important;
    border: 1px solid var(--border-glass-subtle) !important;
    border-radius: var(--radius-xl) !important;
    color: var(--color-text) !important;
    padding: 0.75rem 1rem;
    font-size: var(--font-size-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-terracotta) !important;
    box-shadow: 0 0 0 3px var(--color-terracotta-light) !important;
    background: var(--glass-card-bg) !important;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
    margin-top: 0.25rem;
}

/* Override Bootstrap table styles */
.table {
    color: var(--color-text) !important;
}

.table thead th {
    background: var(--glass-hover-bg) !important;
    border-bottom: 1px solid var(--border-glass-subtle) !important;
    color: var(--color-text-muted) !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    padding: 0.875rem 1rem !important;
}

.table td {
    border-bottom: 1px solid var(--border-glass-subtle) !important;
    vertical-align: middle !important;
    padding: 0.875rem 1rem !important;
    font-size: var(--font-size-sm);
}

.table tbody tr:hover {
    background: var(--sidebar-item-hover) !important;
}

/* Override Bootstrap modal */
.modal-content {
    background: var(--glass-panel-bg) !important;
    border: 1px solid var(--border-glass-subtle) !important;
    border-radius: var(--radius-2xl) !important;
    box-shadow: var(--shadow-glass-raised) !important;
}

.modal-header {
    border-bottom: 1px solid var(--border-glass-subtle) !important;
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 700;
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-glass-subtle) !important;
    padding: 1rem 1.5rem;
    background: var(--glass-hover-bg);
}

.btn-close {
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* ==========================================================================
   EXPORT MODAL
   ========================================================================== */
.modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139, 64, 32, 0.15) 0%, rgba(139, 64, 32, 0.08) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.modal-header-icon .material-symbols-outlined {
    font-size: 22px;
    color: var(--color-terracotta);
}

.modal-header {
    display: flex;
    align-items: center;
}

.export-modal-subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button.export-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-glass-subtle);
    border-radius: 12px;
    background: var(--glass-card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.export-option:hover {
    background: var(--glass-hover-bg);
    border-color: var(--border-input);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.export-option:active {
    transform: translateY(0);
}

.export-option-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.export-option-icon .material-symbols-outlined {
    font-size: 24px;
}

.export-option-icon.excel {
    background: linear-gradient(135deg, rgba(33, 115, 70, 0.15) 0%, rgba(33, 115, 70, 0.08) 100%);
}

.export-option-icon.excel .material-symbols-outlined {
    color: #217346;
}

.export-option-icon.pdf {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.15) 0%, rgba(220, 53, 69, 0.08) 100%);
}

.export-option-icon.pdf .material-symbols-outlined {
    color: #dc3545;
}

.export-option-icon.print {
    background: linear-gradient(135deg, rgba(0, 123, 255, 0.15) 0%, rgba(0, 123, 255, 0.08) 100%);
}

.export-option-icon.print .material-symbols-outlined {
    color: #007bff;
}

.export-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.export-option-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--color-text);
}

.export-option-desc {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Override Bootstrap nav tabs */
.nav-tabs {
    border-bottom: 1px solid var(--border-glass-subtle) !important;
}

.nav-tabs .nav-link {
    color: var(--color-text-muted) !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    background: transparent !important;
    font-weight: 500;
    padding: 0.875rem 1.25rem;
}

.nav-tabs .nav-link:hover {
    color: var(--color-text) !important;
    border-color: transparent !important;
    border-bottom-color: var(--border-input) !important;
}

.nav-tabs .nav-link.active {
    color: var(--color-terracotta) !important;
    background: transparent !important;
    border-color: transparent !important;
    border-bottom-color: var(--color-terracotta) !important;
    font-weight: 600;
}

/* ==========================================================================
   GLASS HORIZONTAL TABS
   ========================================================================== */
.glass-horizontal-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.glass-horizontal-tab {
    /* Copia esatta di glass-button */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 700;
    font-family: var(--font-sans);
    border-radius: 0.75rem;
    cursor: pointer;
    outline: none;
    text-decoration: none;
    letter-spacing: 0.02em;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(240,235,225,0.8));
    border: 1px solid rgba(200, 190, 170, 0.8);
    border-bottom: 2px solid rgba(170, 160, 140, 0.8);
    box-shadow: 0 4px 6px -1px rgba(60, 50, 40, 0.1);
    color: #4a4a3a;
    transition: all 0.1s;
    white-space: nowrap;
}

.glass-horizontal-tab:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,1), rgba(245,240,230,0.9));
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(60, 50, 40, 0.15);
    text-decoration: none;
    color: #4a4a3a;
}

.glass-horizontal-tab:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
}

.glass-horizontal-tab.active {
    /* Stile identico a glass-button-primary */
    background: linear-gradient(to bottom, #1a2e3b, #112230);
    border: none;
    border-top: 1px solid rgba(26, 46, 59, 0.6);
    border-bottom: none;
    color: white !important;
    box-shadow: 0 8px 20px rgba(26, 46, 59, 0.3), 0 0 0 1px rgba(26, 46, 59, 0.2);
}

/* Badge contatore dentro i tab */
.glass-horizontal-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 9999px;
    background: rgba(139, 115, 85, 0.15);
    color: #6b5c4a;
    font-size: 0.75rem;
    font-weight: 700;
}

.glass-horizontal-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ==========================================================================
   GLASS VERTICAL NAV (stile uguale a glass-horizontal-tab)
   ========================================================================== */
.glass-vertical-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.glass-vertical-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 700;
    font-family: var(--font-sans);
    border-radius: 0.75rem;
    cursor: pointer;
    outline: none;
    text-decoration: none;
    letter-spacing: 0.02em;
    background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(240,235,225,0.8));
    border: 1px solid rgba(200, 190, 170, 0.8);
    border-bottom: 2px solid rgba(170, 160, 140, 0.8);
    box-shadow: 0 4px 6px -1px rgba(60, 50, 40, 0.1);
    color: #4a4a3a;
    transition: all 0.1s;
}

.glass-vertical-nav .nav-link:hover {
    background: linear-gradient(to bottom, rgba(255,255,255,1), rgba(245,240,230,0.9));
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(60, 50, 40, 0.15);
    text-decoration: none;
    color: #4a4a3a;
}

.glass-vertical-nav .nav-link:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.08);
}

.glass-vertical-nav .nav-link.active {
    background: linear-gradient(to bottom, #1a2e3b, #112230);
    border: none;
    border-top: 1px solid rgba(26, 46, 59, 0.6);
    border-bottom: none;
    color: white !important;
    box-shadow: 0 8px 20px rgba(26, 46, 59, 0.3), 0 0 0 1px rgba(26, 46, 59, 0.2);
}

.glass-vertical-nav .nav-link .material-symbols-outlined {
    font-size: 1.25rem;
}

.glass-vertical-nav .nav-link.active .material-symbols-outlined {
    color: white;
}

/* Layout per nav verticale fissa + contenuto scrollabile */
.main-setting {
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.main-setting-pane {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 0.5rem;
}

.main-setting-pane::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   ENTITY HEADER - Enhanced glassmorphism design
   ========================================================================== */
.entity-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
/*     background: linear-gradient(135deg, rgba(255, 255, 255, 0.7) 0%, rgba(245, 240, 230, 0.5) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(180, 160, 130, 0.25);
    border-radius: var(--radius-2xl);
    box-shadow: 0 4px 16px -4px rgba(140, 120, 90, 0.12),
                0 2px 4px -2px rgba(0, 0, 0, 0.04); */
}

.entity-header-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    min-width: 0;
}

.entity-header-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

.entity-avatar {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--color-terracotta) 0%, #c4673d 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px -2px rgba(139, 64, 32, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 0.05em;
}

/* Logo wrapper with upload button */
.entity-logo-wrapper {
    position: relative;
    flex-shrink: 0;
}

.entity-logo {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.entity-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 6px;
}

/* Upload button overlay */
.entity-logo-upload {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-terracotta) 0%, #c4673d 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid white;
    box-shadow: 0 2px 8px -2px rgba(139, 64, 32, 0.4);
}

.entity-logo-upload:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px -2px rgba(139, 64, 32, 0.5);
}

.entity-logo-upload .material-symbols-outlined {
    font-size: 16px;
}

/* When no logo - show dashed upload area */
.entity-logo-wrapper .entity-avatar + input + .entity-logo-upload {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(245, 240, 230, 0.9) 100%);
    color: var(--color-terracotta);
    border: 2px dashed var(--color-terracotta);
    box-shadow: none;
}

.entity-logo-wrapper .entity-avatar + input + .entity-logo-upload:hover {
    background: var(--color-terracotta);
    color: white;
    border-style: solid;
}

.entity-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.entity-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.entity-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
    line-height: 1.2;
}

/* Status badge with icon */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge .material-symbols-outlined {
    font-size: 14px;
}

.status-badge.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.25));
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-badge.inactive {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.25));
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Entity meta info row */
.entity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.entity-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.entity-meta-item .material-symbols-outlined {
    font-size: 16px;
    opacity: 0.7;
}

.entity-meta-link {
    text-decoration: none;
    color: var(--color-terracotta);
    transition: all 0.2s;
}

.entity-meta-link:hover {
    color: #a0522d;
    text-decoration: underline;
}

.entity-meta-link .material-symbols-outlined {
    opacity: 1;
}

/* Entity type tags */
.entity-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.entity-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(139, 115, 85, 0.1);
    color: var(--color-text-secondary);
    border: 1px solid rgba(139, 115, 85, 0.15);
}

.entity-tag .material-symbols-outlined {
    font-size: 12px;
}

.entity-tag.cliente {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.2);
}

.entity-tag.vettore {
    background: rgba(139, 64, 32, 0.1);
    color: var(--color-terracotta);
    border-color: rgba(139, 64, 32, 0.2);
}

.entity-tag.subvettore {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
    border-color: rgba(168, 85, 247, 0.2);
}

.entity-tag.trasportatore {
    background: rgba(234, 179, 8, 0.12);
    color: #a16207;
    border-color: rgba(234, 179, 8, 0.25);
}

.entity-tag.circuito {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.2);
}

.entity-tag.magazzino {
    background: rgba(6, 182, 212, 0.1);
    color: #0e7490;
    border-color: rgba(6, 182, 212, 0.2);
}

/* Entity stats - glass cards */
.entity-stats {
    display: flex;
    gap: 0.5rem;
}

.entity-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    min-width: 60px;
}

.entity-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.15rem;
}

.entity-stat-icon .material-symbols-outlined {
    font-size: 16px;
    color: var(--color-terracotta);
    opacity: 0.8;
}

.entity-stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.1;
}

.entity-stat-label {
    font-size: 0.625rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Entity action buttons */
.entity-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.entity-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.8);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.entity-action-btn:hover {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px -2px rgba(139, 64, 32, 0.35);
}

.entity-action-btn.pec {
    color: #0e7490;
}

.entity-action-btn.pec:hover {
    background: #0e7490;
    border-color: #0e7490;
    color: white;
}

.entity-action-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .entity-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .entity-header-side {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .entity-stats {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   SCROLLABLE CONTENT PANELS
   ========================================================================== */
/* Main settings pane (vertical pills right content) - scroll when content is too tall */
.main-setting-pane {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.main-setting-pane::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   TAB LAYOUT FOR GLASS PANELS
   ========================================================================== */

/* All tab panes hidden by default */
.tab-content > .tab-pane:not(.active) {
    display: none !important;
}

/* Tab content needs position relative for absolute children */
#animated-tabContent {
    position: relative;
}

/* Glass-panel-table tabs use absolute positioning to respect parent bounds */
.tab-content > .tab-pane.glass-panel-table.active.show {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Body inside glass-panel-table scrolls */
.tab-pane.glass-panel-table > .glass-panel-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* Header and footer stay fixed */
.tab-pane.glass-panel-table > .glass-panel-header,
.tab-pane.glass-panel-table > .glass-panel-footer {
    flex-shrink: 0;
}

/* Override Bootstrap alerts */
.alert {
    border-radius: var(--radius-xl) !important;
    border: 1px solid !important;
    padding: 1rem 1.25rem;
}

.alert-success {
    background: var(--color-success-light) !important;
    border-color: var(--color-success) !important;
    color: var(--color-success) !important;
}

.alert-danger {
    background: var(--color-error-light) !important;
    border-color: var(--color-error) !important;
    color: var(--color-error) !important;
}

.alert-warning {
    background: var(--color-warning-light) !important;
    border-color: var(--color-warning) !important;
    color: var(--color-warning) !important;
}

.alert-info {
    background: var(--color-terracotta-light) !important;
    border-color: var(--color-terracotta) !important;
    color: var(--color-terracotta) !important;
}

/* Fix dropdown menus */
.dropdown-menu {
    background: var(--glass-panel-bg) !important;
    border: 1px solid var(--border-glass-subtle) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-glass-raised) !important;
    padding: 0.5rem;
}

.dropdown-item {
    color: var(--color-text-secondary) !important;
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.875rem;
    font-size: var(--font-size-sm);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--sidebar-item-hover) !important;
    color: var(--color-text) !important;
}

.dropdown-divider {
    border-color: var(--border-glass-subtle);
}

/* Input groups */
.input-group .form-control {
    border-radius: var(--radius-xl) !important;
}

.input-group-text {
    background: var(--glass-card-bg) !important;
    border: 1px solid var(--border-glass-subtle) !important;
    color: var(--color-text-muted);
}

/* Pagination */
.pagination .page-link {
    background: var(--glass-card-bg);
    border: 1px solid var(--border-glass-subtle);
    color: var(--color-text);
    border-radius: var(--radius-lg) !important;
    margin: 0 0.125rem;
}

.pagination .page-link:hover {
    background: var(--glass-hover-bg);
    border-color: var(--border-input);
}

.pagination .page-item.active .page-link {
    background: var(--color-terracotta);
    border-color: var(--color-terracotta);
}

/* Progress bars */
.progress {
    background: var(--glass-hover-bg);
    border-radius: var(--radius-full);
}

.progress-bar {
    background: var(--color-terracotta);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    margin-bottom: 0;
}

.breadcrumb-item a {
    color: var(--color-text-muted);
}

.breadcrumb-item.active {
    color: var(--color-text);
}

/* Fix links color - Override Bootstrap's --bs-link-color */
a {
    color: var(--color-terracotta) !important;
    text-decoration: none !important;
    --bs-link-color-rgb: 139, 64, 32;
    --bs-link-opacity: 1;
}

a:hover {
    color: var(--color-terracotta-hover) !important;
    --bs-link-hover-color-rgb: 122, 51, 24;
}

/* Reset Bootstrap link variables globally */
:root {
    --bs-link-color: var(--color-terracotta);
    --bs-link-hover-color: var(--color-terracotta-hover);
    --bs-link-color-rgb: 139, 64, 32;
    --bs-link-hover-color-rgb: 122, 51, 24;
}

/* ==========================================================================
   FLATPICKR - Glassmorphism Theme
   ========================================================================== */

/* Calendar Container */
.flatpickr-calendar {
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    font-family: var(--font-sans) !important;
    padding: 0.5rem !important;
    width: 350px !important;
    min-width: 320px !important;
}

.flatpickr-calendar.open {
    animation: flatpickr-fade-in 0.2s ease-out;
}

@keyframes flatpickr-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header - Month/Year Navigation */
.flatpickr-months {
    background: transparent !important;
    padding: 0.5rem !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 0.5rem !important;
}

.flatpickr-months .flatpickr-month {
    background: transparent !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
}

.flatpickr-current-month {
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: var(--color-text) !important;
    padding: 0 !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.25rem 0.5rem !important;
    font-weight: 500 !important;
    color: var(--color-text) !important;
    cursor: pointer !important;
    transition: all var(--transition-fast) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    padding-right: 1.75rem !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: var(--color-terracotta) !important;
}

.flatpickr-current-month .numInputWrapper {
    width: 70px !important;
}

.flatpickr-current-month input.cur-year {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.25rem 0.5rem !important;
    font-weight: 500 !important;
    color: var(--color-text) !important;
    font-size: 1rem !important;
    transition: all var(--transition-fast) !important;
}

.flatpickr-current-month input.cur-year:hover,
.flatpickr-current-month input.cur-year:focus {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: var(--color-terracotta) !important;
    outline: none !important;
}

/* Year arrows */
.numInputWrapper span {
    border: none !important;
    background: rgba(255, 255, 255, 0.6) !important;
    border-radius: var(--radius-sm) !important;
}

.numInputWrapper span:hover {
    background: var(--color-terracotta) !important;
}

.numInputWrapper span:hover svg {
    stroke: white !important;
}

.numInputWrapper span svg {
    stroke: var(--color-text-secondary) !important;
}

/* Navigation Arrows */
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    position: static !important;
    height: 36px !important;
    width: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    padding: 0 !important;
    transition: all var(--transition-fast) !important;
    cursor: pointer !important;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    background: var(--color-terracotta) !important;
    border-color: var(--color-terracotta) !important;
    color: white !important;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
    fill: white !important;
}

.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
    fill: var(--color-text-secondary) !important;
    width: 14px !important;
    height: 14px !important;
}

/* Material icons for arrows */
.flatpickr-months .flatpickr-prev-month .material-symbols-outlined,
.flatpickr-months .flatpickr-next-month .material-symbols-outlined {
    font-size: 20px !important;
    color: var(--color-text-secondary) !important;
    transition: color var(--transition-fast) !important;
}

.flatpickr-months .flatpickr-prev-month:hover .material-symbols-outlined,
.flatpickr-months .flatpickr-next-month:hover .material-symbols-outlined {
    color: white !important;
}

/* Weekdays Header */
.flatpickr-weekdays {
    background: transparent !important;
    padding: 0.5rem 0 !important;
    margin-bottom: 0.25rem !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.flatpickr-weekday {
    color: var(--color-text-muted) !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    background: transparent !important;
}

/* Days Grid */
.flatpickr-days {
    width: 100% !important;
}

.dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    padding: 0.25rem 0 !important;
}

/* Day Cells */
.flatpickr-day {
    color: var(--color-text) !important;
    font-weight: 500 !important;
    border-radius: var(--radius-md) !important;
    margin: 2px !important;
    max-width: 38px !important;
    height: 38px !important;
    line-height: 38px !important;
    transition: all var(--transition-fast) !important;
    border: 1px solid transparent !important;
}

.flatpickr-day:hover {
    background: rgba(139, 64, 32, 0.1) !important;
    border-color: var(--color-terracotta) !important;
}

.flatpickr-day.today {
    background: rgba(139, 64, 32, 0.15) !important;
    border-color: var(--color-terracotta) !important;
    color: var(--color-terracotta) !important;
    font-weight: 700 !important;
}

.flatpickr-day.today:hover {
    background: rgba(139, 64, 32, 0.25) !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--color-terracotta) !important;
    border-color: var(--color-terracotta) !important;
    color: white !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(139, 64, 32, 0.3) !important;
}

.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--color-text-muted) !important;
    opacity: 0.5 !important;
}

.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    opacity: 0.7 !important;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--color-text-muted) !important;
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    background: transparent !important;
}

/* Range selection */
.flatpickr-day.inRange {
    background: rgba(139, 64, 32, 0.1) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--color-terracotta) !important;
    color: white !important;
}

/* Custom Buttons Container */
.flatpickr-buttons {
    display: flex !important;
    gap: 0.5rem !important;
    padding: 0.75rem !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    margin-top: 0.5rem !important;
    justify-content: space-between !important;
}

/* Clear and Today Buttons */
.flatpickr-clear-btn,
.flatpickr-today-btn {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    cursor: pointer !important;
    transition: all var(--transition-fast) !important;
    font-family: var(--font-sans) !important;
}

.flatpickr-clear-btn {
    background: rgba(255, 255, 255, 0.6) !important;
    color: var(--color-text-secondary) !important;
}

.flatpickr-clear-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: var(--color-error) !important;
    color: var(--color-error) !important;
}

.flatpickr-today-btn {
    background: rgba(139, 64, 32, 0.1) !important;
    color: var(--color-terracotta) !important;
    border-color: var(--color-terracotta) !important;
}

.flatpickr-today-btn:hover {
    background: var(--color-terracotta) !important;
    color: white !important;
}

.flatpickr-clear-btn .material-symbols-outlined,
.flatpickr-today-btn .material-symbols-outlined {
    font-size: 18px !important;
}

/* Time Picker Styles */
.flatpickr-time {
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: transparent !important;
    padding: 0.75rem !important;
    margin-top: 0.5rem !important;
}

.flatpickr-time input {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    color: var(--color-text) !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
}

.flatpickr-time input:hover,
.flatpickr-time input:focus {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: var(--color-terracotta) !important;
    outline: none !important;
}

.flatpickr-time .flatpickr-time-separator {
    color: var(--color-text-secondary) !important;
    font-weight: 600 !important;
}

.flatpickr-time .flatpickr-am-pm {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    color: var(--color-text) !important;
    font-weight: 500 !important;
}

.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time .flatpickr-am-pm:focus {
    background: var(--color-terracotta) !important;
    color: white !important;
}

/* Input styling when active */
.flatpickr-input.active {
    border-color: var(--color-terracotta) !important;
    box-shadow: 0 0 0 3px rgba(139, 64, 32, 0.15) !important;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .flatpickr-calendar {
        min-width: 290px !important;
        padding: 0.35rem !important;
    }

    .flatpickr-day {
        max-width: 34px !important;
        height: 34px !important;
        line-height: 34px !important;
    }

    .flatpickr-buttons {
        flex-direction: column !important;
    }

    .flatpickr-clear-btn,
    .flatpickr-today-btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ==========================================================================
   JSON EDITOR - Glassmorphism Theme
   ========================================================================== */

/* Main container */
.jsoneditor {
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: var(--radius-lg) !important;
    font-family: var(--font-sans) !important;
}

/* Remove default borders */
.jsoneditor,
.jsoneditor-menu,
.jsoneditor-outer,
.jsoneditor-tree,
.jsoneditor-contextmenu,
.jsoneditor-contextmenu .jsoneditor-menu {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Menu bar */
.jsoneditor-menu {
    background: rgba(139, 64, 32, 0.1) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.jsoneditor-menu > button,
.jsoneditor-menu > .jsoneditor-modes > button {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    color: var(--color-text) !important;
    opacity: 1 !important;
    transition: all var(--transition-fast) !important;
}

.jsoneditor-menu > button:hover,
.jsoneditor-menu > .jsoneditor-modes > button:hover {
    background: var(--color-terracotta) !important;
    border-color: var(--color-terracotta) !important;
}

/* Tree view container */
.jsoneditor-outer {
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
}

.jsoneditor-tree {
    background: transparent !important;
    color: var(--color-text) !important;
}

/* Tree nodes */
.jsoneditor-tree button.jsoneditor-button {
    background: rgba(139, 64, 32, 0.15) !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
}

.jsoneditor-tree button.jsoneditor-button:hover {
    background: var(--color-terracotta) !important;
}

/* Expand/collapse buttons */
.jsoneditor-tree button.jsoneditor-button.jsoneditor-collapsed {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B4020' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 12px !important;
}

.jsoneditor-tree button.jsoneditor-button.jsoneditor-expanded {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B4020' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 12px !important;
}

/* Field names (keys) */
.jsoneditor-field {
    color: var(--color-terracotta) !important;
    font-weight: 600 !important;
}

/* Values */
.jsoneditor-value.jsoneditor-string {
    color: #059669 !important; /* Green for strings */
}

.jsoneditor-value.jsoneditor-number {
    color: #2563eb !important; /* Blue for numbers */
}

.jsoneditor-value.jsoneditor-boolean {
    color: #7c3aed !important; /* Purple for booleans */
}

.jsoneditor-value.jsoneditor-null {
    color: var(--color-text-muted) !important;
}

/* Array/Object info */
.jsoneditor-readonly {
    color: var(--color-text-muted) !important;
    font-style: italic !important;
}

/* Selection highlight */
.jsoneditor-selected,
.jsoneditor-selected .jsoneditor-field,
.jsoneditor-selected .jsoneditor-value {
    background: rgba(139, 64, 32, 0.15) !important;
}

.jsoneditor-highlight,
.jsoneditor-highlight .jsoneditor-field,
.jsoneditor-highlight .jsoneditor-value {
    background: rgba(139, 64, 32, 0.1) !important;
}

/* Hover effect on rows */
tr.jsoneditor-highlight,
tr.jsoneditor-selected {
    background: rgba(139, 64, 32, 0.08) !important;
}

/* Scrollbar for jsoneditor */
.jsoneditor-tree-inner {
    padding: 0.5rem !important;
}

/* Code/text mode */
.jsoneditor-text-mode .jsoneditor-text,
.ace_editor {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    background: rgba(255, 255, 255, 0.4) !important;
}

/* Context menu */
.jsoneditor-contextmenu {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(12px) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
}

.jsoneditor-contextmenu .jsoneditor-menu li button {
    color: var(--color-text) !important;
    padding: 0.5rem 1rem !important;
}

.jsoneditor-contextmenu .jsoneditor-menu li button:hover {
    background: rgba(139, 64, 32, 0.1) !important;
    color: var(--color-terracotta) !important;
}

/* Search box */
.jsoneditor-search input {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.25rem 0.5rem !important;
    color: var(--color-text) !important;
}

.jsoneditor-search input:focus {
    border-color: var(--color-terracotta) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(139, 64, 32, 0.15) !important;
}

/* Navigation path */
.jsoneditor-navigation-bar {
    background: rgba(255, 255, 255, 0.4) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Status bar */
.jsoneditor-statusbar {
    background: rgba(255, 255, 255, 0.4) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: var(--color-text-secondary) !important;
}

/* Vertical lines for tree structure */
.jsoneditor-tree .jsoneditor-tree-inner table.jsoneditor-tree td {
    border-left-color: rgba(139, 64, 32, 0.2) !important;
}

/* Drag area */
.jsoneditor-dragarea {
    background: rgba(139, 64, 32, 0.1) !important;
    border-radius: 2px !important;
}

/* Error styling */
.jsoneditor-text-errors {
    background: rgba(239, 68, 68, 0.1) !important;
    border-radius: var(--radius-md) !important;
}

.jsoneditor-text-errors td.jsoneditor-line {
    color: var(--color-error) !important;
}

/* ==========================================================================
   SELECT2 - Glassmorphism Theme (GLOBAL)
   ========================================================================== */

/* Select2 Container - Stili globali */
.select2-container--default .select2-selection--single {
    height: 38px;
   /*  border: 1px solid var(--border-input); */
    /* border-radius: var(--radius-md); */
    background: var(--glass-input-bg);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single:hover {
    border-color: var(--color-terracotta);
    background: var(--glass-hover-bg);
}

.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--color-terracotta);
    box-shadow: 0 0 0 3px rgba(26, 23, 80, 0.1);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--color-text);
    line-height: 36px;
    padding-left: 12px;
    padding-right: 32px;
}

/* Select2 dentro input-with-icon - padding per icona */
.input-with-icon .select2-container {
    width: 100% !important;
}

.input-with-icon .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 2.5rem;
}

/* === VALIDAZIONE INDIRIZZO IN TEMPO REALE === */

/* Animazione spinning per icona di caricamento */
@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
}

/* Stati validazione input */
.input-with-icon.validation-valid .glass-input {
    border-color: var(--color-success) !important;
    padding-right: 2.5rem;
}

.input-with-icon.validation-invalid .glass-input {
    border-color: var(--color-danger) !important;
    padding-right: 2.5rem;
}

.input-with-icon.validation-warning .glass-input {
    border-color: var(--color-warning) !important;
    padding-right: 2.5rem;
}

/* Icona validazione inline */
.validation-icon {
    pointer-events: none;
    z-index: 10;
}

/* === OVERLAY VALIDAZIONE INDIRIZZO === */
.address-validation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: var(--radius-lg);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.validation-overlay-content {
    text-align: center;
    padding: 2rem;
}

.validation-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Spinner per stato "validating" */
.validation-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid var(--border-glass);
    border-top-color: var(--color-terracotta);
    border-radius: 50%;
    animation: spinValidation 1s linear infinite;
}

@keyframes spinValidation {
    to { transform: rotate(360deg); }
}

/* Checkmark animato per successo */
.validation-checkmark {
    width: 100px;
    height: 100px;
}

.checkmark-svg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: var(--color-success);
    stroke-miterlimit: 10;
    box-shadow: 0 0 0 rgba(76, 175, 80, 0.4);
    animation: checkmarkPulse 0.4s ease-in-out 0.4s forwards, checkmarkScale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--color-success);
    fill: none;
    animation: checkmarkStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    animation: checkmarkStroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes checkmarkStroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes checkmarkScale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes checkmarkPulse {
    0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
    100% { box-shadow: 0 0 0 20px rgba(76, 175, 80, 0); }
}

/* Messaggi */
.validation-message {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.success-message {
    color: var(--color-success);
    font-size: 1.5rem;
    animation: bounceIn 0.5s ease 0.8s both;
}

.error-message {
    color: var(--color-danger);
}

.validation-address {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin: 0;
    max-width: 300px;
    animation: fadeIn 0.3s ease 1s both;
}

.validation-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Icona errore */
.validation-error-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(244, 67, 54, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: shakeError 0.5s ease;
}

.validation-error-icon .material-symbols-outlined {
    font-size: 48px;
    color: var(--color-danger);
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--color-text-muted);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--color-text-muted) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--color-terracotta) transparent;
}

/* Select2 Clear Button (X) - Globale */
.select2-container--default .select2-selection--single .select2-selection__clear {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    margin: 0;
    padding: 0;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

/* Select2 Dropdown - Stili globali glassmorphism */
.select2-container--default .select2-dropdown {
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1060 !important; /* Above Bootstrap modal (1050) */
}

/* Dropdown posizionato sotto la combo con piccolo gap */
.select2-container--open .select2-dropdown--below {
    margin-top: 25px;
}

.select2-container--default .select2-results__options {
    padding: 6px;
    max-height: 280px;
}

.select2-container--default .select2-results__option {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.select2-container--default .select2-results__option:last-child {
    margin-bottom: 0;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--color-terracotta-light);
    color: var(--color-terracotta);
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--color-terracotta);
    color: #fff;
    font-weight: 600;
}

.select2-container--default .select2-results__option[aria-selected=true]:hover {
    background: var(--color-terracotta-hover);
}

/* Select2 Search Box dentro dropdown */
.select2-container--default .select2-search--dropdown {
    padding: 8px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    background: var(--glass-input-bg);
    color: var(--color-text);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--color-terracotta);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 23, 80, 0.1);
}

/* ==========================================================================
   SELECT2 - Stili specifici per Filter Bar
   ========================================================================== */

/* Filter wrapper: dimensioni piÃ¹ compatte */
.filter-select-wrapper .select2-container {
    min-width: 140px;
}

.filter-select-wrapper .select2-container--default .select2-selection--single {
    height: 36px;
}

.filter-select-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    padding-left: 10px;
    padding-right: 28px;
    font-size: 13px;
}

/* Has value state per filtri */
.filter-select-wrapper .select2-container.has-value .select2-selection--single {
    border-color: var(--color-terracotta);
    background: var(--color-terracotta-light);
}

.filter-select-wrapper .select2-container.has-value .select2-selection__rendered {
    color: var(--color-terracotta);
    font-weight: 600;
}

/* Nasconde l'icona freccia default del select wrapper quando Select2 Ã¨ attivo */
.filter-select-wrapper:has(.select2-container) .filter-select-icon {
    display: none;
}

/* ==========================================================================
   FLATPICKR - Quick Buttons
   ========================================================================== */

.flatpickr-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid var(--border-glass-subtle);
}

.flatpickr-quick-buttons button {
    flex: 1 1 calc(33.333% - 3px);
    min-width: 50px;
    padding: 4px 6px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid var(--border-glass-subtle);
    border-radius: 4px;
    background: var(--glass-card-bg, #f8f8f8);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.flatpickr-quick-buttons button:hover {
    background: rgba(139, 64, 32, 0.1);
    border-color: var(--color-terracotta);
    color: var(--color-terracotta);
}

.flatpickr-quick-buttons button.btn-clear {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.flatpickr-quick-buttons button.btn-clear:hover {
    background: rgba(220, 53, 69, 0.15);
    border-color: #dc3545;
}

/* ==========================================================================
   FILTER DATE PICKER - Spedizioni
   ========================================================================== */

/* Date picker wrapper */
.filter-date-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-date-icon {
    position: absolute;
    left: 10px;
    font-size: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
    z-index: 1;
}

.filter-date-arrow {
    font-size: 16px;
    color: var(--color-text-muted);
    margin: 0 4px;
}

/* Filter date input */
.filter-input.filter-date {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-glass-subtle);
    border-radius: 10px;
    background: var(--glass-card-bg);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    width: 120px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.filter-input.filter-date:hover {
    border-color: var(--color-terracotta-light, rgba(139, 64, 32, 0.4));
    background: rgba(255, 255, 255, 0.9);
}

.filter-input.filter-date:focus,
.filter-input.filter-date.active {
    outline: none;
    border-color: var(--color-terracotta);
    box-shadow: 0 0 0 2px rgba(139, 64, 32, 0.1);
}

/* Has value state */
.filter-input.filter-date.has-value {
    color: var(--color-terracotta);
    font-weight: 600;
    border-color: var(--color-terracotta);
    background: rgba(139, 64, 32, 0.05);
}

.filter-date-wrapper:has(.has-value) .filter-date-icon {
    color: var(--color-terracotta);
}

/* ==========================================================================
   ROUTE CELL - Spedizioni Table
   ========================================================================== */

.route-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
}

.route-point {
    display: flex;
    align-items: center;
    gap: 8px;
}

.route-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.route-dot.start {
    background: var(--color-success);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.route-dot.end {
    background: var(--color-terracotta);
    box-shadow: 0 0 0 3px rgba(139, 64, 32, 0.2);
}

.route-text {
    font-size: 13px;
    color: var(--color-text);
    font-weight: 500;
}

.route-line {
    width: 1px;
    height: 12px;
    background: var(--border-glass-subtle);
    margin-left: 3.5px;
}

/* Detail cell (ritiro/consegna) */
.detail-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0;
}

.detail-main {
    font-weight: 500;
    color: var(--color-text);
    font-size: 0.875rem;
    line-height: 1.3;
}

.detail-locality {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    line-height: 1.2;
    margin-top: 1px;
}

.detail-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-orari {
    font-size: 0.7rem;
    padding: 1px 6px;
    background: var(--glass-card-bg);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}

/* Mini badge per info secondarie (tipo, data inserimento) */
.mini-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    background: var(--glass-hover-bg);
    border: 1px solid var(--border-glass-subtle);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* Amount cell */
.amount-cell {
    font-weight: 700;
    color: var(--color-terracotta);
}

/* ==========================================================================
   WIZARD STEPPER - Shipment Creation Wizard
   ========================================================================== */

/* Wizard Container */
.wizard-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 80px); /* Altezza viewport meno header */
    overflow: hidden;
}

/* Wizard Stepper Nav - Container con pulsanti laterali */
.wizard-stepper-nav {
  
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1rem;
    margin-bottom: 1rem;
}

/* Pulsanti navigazione wizard */
.wizard-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    background: var(--glass-card-bg);
    border: 1px solid var(--border-divider);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: auto;
}

.wizard-nav-btn:hover:not(:disabled) {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 46, 59, 0.2);
}

.wizard-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wizard-nav-btn .material-symbols-outlined {
    font-size: 1rem;
}

/* Nascondi label pulsanti su schermi piccoli */
.wizard-nav-btn-label {
    display: none;
}

@media (min-width: 768px) {
    .wizard-nav-btn-label {
        display: inline;
    }

    .wizard-nav-btn {
        padding: 0.35rem 0.75rem;
    }
}

.wizard-nav-back {
    justify-content: flex-start;
}

.wizard-nav-next {
    justify-content: flex-end;
}

.wizard-nav-confirm {
    justify-content: flex-end;
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

.wizard-nav-confirm:hover:not(:disabled) {
    background: var(--color-success-hover, #1a8754);
    border-color: var(--color-success-hover, #1a8754);
}

/* Wizard Stepper - Horizontal Step Indicator */
.wizard-stepper {
    display: flex;
      max-height: 60px;
    align-items: center;
    justify-content: justify;
    padding: 0.35rem 0.75rem;
     
}

.wizard-stepper-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
  
}

/* Individual Step */
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.wizard-step:hover .wizard-step-circle {
    transform: scale(1.05);
}

/* Step Circle */
.wizard-step-circle {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.7rem;
    border: 2px solid var(--border-input);
    background: var(--bg-glass);
    color: var(--color-text-muted);
    transition: all var(--transition-normal);
}

.wizard-step-circle .material-symbols-outlined {
    font-size: 0.9rem;
}

/* Step Label - nascosta di default, visibile solo su schermi grandi */
.wizard-step-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    color: var(--color-text-muted);
    white-space: nowrap;
    transition: color var(--transition-normal);
    display: none;
}

@media (min-width: 992px) {
    .wizard-step-label {
        display: block;
    }
}

/* Step Connector Line */
.wizard-step-connector {
    flex: 1;
    height: 2px;
    background: var(--border-input);
    border-radius: 1px;
    margin: 0 0.25rem;
    margin-bottom: 0;
    transition: background var(--transition-slow);
    position: relative;
    overflow: hidden;
}

@media (min-width: 992px) {
    .wizard-step-connector {
        margin-bottom: 1rem;
    }
}

.wizard-step-connector::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--color-success);
    transition: width var(--transition-slow);
}

/* Step States */

/* Completed Step */
.wizard-step.completed .wizard-step-circle {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
}

.wizard-step.completed .wizard-step-label {
    color: var(--color-success);
}

.wizard-step.completed + .wizard-step-connector::after {
    width: 100%;
}

/* Active Step */
.wizard-step.active .wizard-step-circle {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
    box-shadow: 0 0 0 4px rgba(26, 46, 59, 0.2);
}

.wizard-step.active .wizard-step-label {
    color: var(--color-accent);
}

/* Pending/Disabled Step */
.wizard-step.pending {
    opacity: 0.6;
    cursor: not-allowed;
}

.wizard-step.pending:hover .wizard-step-circle {
    transform: none;
}

/* ==========================================================================
   WIZARD CONTENT LAYOUT
   ========================================================================== */

.wizard-content-wrapper {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    overflow-y: auto;

}

/* Main Panel */
.wizard-main-panel {
    flex: 1;
    min-width: 0;
}

.wizard-main-panel .tab-content {
    display: none;
    width: 100%;
}

.wizard-main-panel .tab-content.active,
.wizard-main-panel .tab-content[style*="display: block"] {
    display: block;
}

.wizard-main-panel .glass-card-form {
    width: 100%;
}

/* Sidebar */
.wizard-sidebar {
    width: 320px;
    flex-shrink: 0;
}

.wizard-sidebar .glass-card {
    position: sticky;
    top: 1.5rem;
}

/* Sidebar Sections */
.wizard-sidebar-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-divider);
}

.wizard-sidebar-section:last-child {
    border-bottom: none;
}

.wizard-sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.wizard-sidebar-section-content {
    font-size: 0.875rem;
    color: var(--color-text);
}

.wizard-sidebar-section-content p {
    margin: 0.25rem 0;
}

.wizard-sidebar-section-content .text-success {
    color: var(--color-success);
    font-weight: 500;
}

/* Scrollable section for services */
.wizard-sidebar-scrollable {
    max-height: 150px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.wizard-sidebar-scrollable::-webkit-scrollbar {
    width: 4px;
}
.spedizione-wizard-page{
    padding: 0rem;
}
.wizard-sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.wizard-sidebar-scrollable::-webkit-scrollbar-thumb {
    background: var(--border-input);
    border-radius: 2px;
}

/* Sidebar Total */
.wizard-sidebar-total {
    background: var(--color-accent);
    color: white;
    padding: 1rem;
    width: 320px;
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.wizard-sidebar-total-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.wizard-sidebar-total-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Imponibile value - smaller than total */
#Importo_IMPONIBILE {
    font-size: 1.75rem;
}

/* ==========================================================================
   WIZARD FOOTER - Navigation
   ========================================================================== */

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--glass-panel-bg);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border-radius: var(--radius-xl);
    border: var(--border-glass);
    box-shadow: var(--shadow-glass);
/*     margin-top: 1.5rem; */
}

/* Sticky Footer Wrapper - allineato al contenuto principale */
.wizard-footer-sticky {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    background: transparent;
}

.wizard-footer-sticky-inner {
    max-width: 1400px;
    margin: 0 auto;
    margin-top: 0;
}

.wizard-footer-total {
    text-align: center;
}

.wizard-footer-total-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.wizard-footer-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
}

/* ==========================================================================
   SERVICE CARDS - Selectable Options
   ========================================================================== */

.service-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.service-card {
    position: relative;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--glass-card-bg);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.service-card:hover {
    background: var(--glass-hover-bg);
    border-color: rgba(26, 46, 59, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

/* Hidden checkbox */
.service-card input[type="checkbox"],
.service-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Selected state */
.service-card:has(:checked) {
    background: rgba(26, 46, 59, 0.08);
    border-color: var(--color-accent);
}

.service-card:has(:checked) .service-card-check {
    opacity: 1;
    transform: scale(1);
}

/* Card Header */
.service-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.service-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-terracotta-light);
    color: var(--color-terracotta);
}

.service-card-icon .material-symbols-outlined {
    font-size: 1.5rem;
}

.service-card-icon.blue {
    background: rgba(26, 46, 59, 0.1);
    color: var(--color-accent);
}

.service-card-icon.green {
    background: var(--color-success-light);
    color: var(--color-success);
}

.service-card-icon.orange {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

/* Check indicator */
.service-card-check {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--border-input);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    opacity: 0.5;
    transform: scale(0.9);
    transition: all var(--transition-normal);
}

.service-card:has(:checked) .service-card-check {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.service-card-check .material-symbols-outlined {
    font-size: 1rem;
}

/* Card Content */
.service-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    margin: 0;
}

.service-card-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.4;
    /* Truncate to 1 line */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all var(--transition-normal);
}

.service-card:hover .service-card-description {
    /* Show full text on hover */
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

/* Card Footer - Price */
.service-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    margin-top: auto;
    border-top: 1px solid var(--border-divider);
}

.service-card-price-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.service-card-price {
    font-weight: 700;
    color: var(--color-accent);
}

/* ==========================================================================
   ARTICOLO CARD - Pallet Items (Glassmorphism) - Layout 2 righe
   ========================================================================== */

.articolo-card-glass {
    position: relative;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    background: var(--glass-card-bg);
    border: var(--border-glass);
    box-shadow: var(--shadow-card);
}

.articolo-card-glass:hover {
    box-shadow: var(--shadow-card-hover);
}

/* Delete Button - posizionato in alto a destra */
.articolo-delete-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-error-light);
    color: var(--color-error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 5;
}

.articolo-delete-btn:hover {
    background: var(--color-error);
    color: white;
    transform: scale(1.05);
}

.articolo-delete-btn .material-symbols-outlined {
    font-size: 1.125rem;
}

/* Riga 1: Dimensioni (4 colonne) */
.articolo-dimensions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.articolo-dimension .glass-label {
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
}

.articolo-dimension .glass-input {
    text-align: center;
    font-weight: 500;
}

/* Riga 2: QuantitÃ , Merce, Note */
.articolo-details-row {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    gap: 1rem;
    align-items: end;
}

.articolo-quantity {
    min-width: 140px;
}

/* Quantity Control */
.articolo-quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-input);
    background: var(--glass-input-bg);
}

.articolo-quantity-control .qty-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: none;
    background: var(--glass-panel-bg);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.articolo-quantity-control .qty-btn:hover {
    background: var(--color-accent);
    color: white;
}

.articolo-quantity-control .qty-btn .material-symbols-outlined {
    font-size: 1.125rem;
}

.articolo-quantity-control .qty-input {
    width: 3.5rem;
    height: 2.5rem;
    text-align: center;
    border: none;
    border-radius: 0;
    font-weight: 600;
    font-size: 1rem;
    -moz-appearance: textfield;
    appearance: textfield;
}

.articolo-quantity-control .qty-input::-webkit-outer-spin-button,
.articolo-quantity-control .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Merce select wrapper */
.articolo-merce .select-wrapper {
    position: relative;
}

/* Add Article Button */
.add-articolo-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    margin-top: 1rem;
}

.add-articolo-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(26, 46, 59, 0.03);
}

.add-articolo-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 992px) {
    .articolo-dimensions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .articolo-details-row {
        grid-template-columns: 1fr 1fr;
    }

    .articolo-quantity {
        grid-column: 1 / -1;
    }
}

@media (max-width: 576px) {
    .articolo-card-glass {
        padding: 1rem;
        padding-top: 2.5rem; /* Spazio per delete button */
    }

    .articolo-dimensions-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .articolo-details-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .articolo-quantity {
        min-width: unset;
    }

    .articolo-quantity-control {
        width: 100%;
        justify-content: center;
    }

    .articolo-quantity-control .qty-input {
        flex: 1;
        max-width: 80px;
    }
}

/* ==========================================================================
   WIZARD INFO CARDS - Address/Referent Display
   ========================================================================== */

.wizard-info-card {
    padding: 1rem;
 
}

.wizard-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.wizard-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wizard-info-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.wizard-info-value {
    font-weight: 500;
    color: var(--color-text);
}

/* ==========================================================================
   WIZARD SUMMARY CARDS - Final Review Step
   ========================================================================== */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

.summary-card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--glass-card-bg);
    border: var(--border-glass);
}

.summary-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.summary-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text);
    margin: 0;
}

.summary-card-edit {
    font-size: 0.875rem;
    color: var(--color-accent);
    text-decoration: underline;
    cursor: pointer;
}

.summary-card-content {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.summary-card-content p {
    margin: 0.25rem 0;
}

.summary-card-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    color: var(--color-text-secondary);
}

.summary-card-detail .material-symbols-outlined {
    font-size: 1rem;
    color: var(--color-terracotta);
}

.summary-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-card-title .material-symbols-outlined {
    font-size: 1.25rem;
    color: var(--color-terracotta);
}

.summary-card-edit {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.summary-card-edit .material-symbols-outlined {
    font-size: 0.875rem;
}

/* Total Card */
.summary-total-card {
    grid-column: 1 / -1;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--glass-card-bg);
    border: var(--border-glass);
}

.summary-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.summary-total-row.final,
.summary-total-row.summary-total-final {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--border-divider);
    font-size: 1.25rem;
    font-weight: 700;
}

.summary-total-row.final .summary-total-value,
.summary-total-row.summary-total-final .summary-total-value {
    color: var(--color-accent);
}

/* ==========================================================================
   WIZARD RESPONSIVE
   ========================================================================== */

@media (max-width: 1200px) {
    .wizard-sidebar {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .wizard-content-wrapper {
        flex-direction: column;
    }

    .wizard-sidebar {
        width: 100%;
        order: -1;
    }

    .wizard-sidebar .glass-card {
        position: static;
    }

    .wizard-stepper {
        overflow-x: auto;
        padding: 1rem;
    }

    .wizard-stepper-inner {
        min-width: 600px;
    }

    .wizard-stepper-nav {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .wizard-nav-btn {
        min-width: 100px;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .wizard-nav-btn-label {
        display: none;
    }
}

@media (max-width: 576px) {
    .wizard-step-label {
        font-size: 0.65rem;
    }

    .wizard-step-circle {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }

    .wizard-stepper-nav {
        padding: 0 0.5rem;
    }

    .wizard-nav-btn {
        min-width: 50px;
        padding: 0.5rem 0.75rem;
    }

    .wizard-footer {
        flex-direction: column;
        gap: 1rem;
    }

    .wizard-footer .glass-button {
        width: 100%;
    }

    .wizard-footer-sticky {
        left: 0;
        padding: 0.75rem 1rem;
    }

    .service-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   STATS ROW - Statistiche in riga
   ========================================================================== */
.stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 160px;
    max-width: 220px;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    background: var(--glass-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.stat-icon .material-symbols-outlined {
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: rgba(var(--color-accent-rgb), 0.12);
    color: var(--color-accent);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ==========================================================================
   GLASS BADGES - Badge inline per tabelle
   ========================================================================== */
.glass-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--glass-hover-bg);
    color: var(--color-text);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.glass-badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.25);
}

.glass-badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.25);
}

.glass-badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border-color: rgba(59, 130, 246, 0.25);
}

.glass-badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.25);
}

.glass-badge-pending {
    background: rgba(148, 163, 184, 0.12);
    color: #64748b;
    border-color: rgba(148, 163, 184, 0.25);
}

/* ==========================================================================
   GLASS CHIPS - Etichette informative
   ========================================================================== */
.glass-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: var(--glass-hover-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
}

.glass-chip-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
}

.glass-chip-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ==========================================================================
   GLASS PANEL TOOLBAR - Barra azioni tra header e body
   ========================================================================== */
.glass-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    /* background: var(--glass-hover-bg); */
    border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   GLASS INPUT GROUP - Input con icona
   ========================================================================== */
.glass-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
}

.glass-input-group .material-symbols-outlined {
    font-size: 1.125rem;
    color: var(--color-text-muted);
}

.glass-input-group .glass-input,
.glass-input-group .glass-select {
    border: none;
    background: transparent;
    padding: 0;
    min-height: auto;
}

/* ==========================================================================
   ROW STATES - Stati per le righe DataTable
   ========================================================================== */
.row-selected {
    background: rgba(59, 130, 246, 0.08) !important;
    box-shadow: 0 0 0 1.5px rgba(59, 130, 246, 0.3), var(--shadow-card) !important;
}

.row-completed {
    background: rgba(16, 185, 129, 0.06) !important;
}

.row-pending {
    background: rgba(245, 158, 11, 0.06) !important;
}

/* ==========================================================================
   DUAL PANEL LAYOUT - Layout a due colonne
   ========================================================================== */
.dual-panel-container {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

.dual-panel-container > .glass-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

@media (max-width: 1200px) {
    .dual-panel-container {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .stats-row {
        flex-direction: column;
    }

    .stat-card {
        max-width: none;
    }
}

/* ==========================================================================
   DATATABLE LOADING STATE - Stile caricamento globale
   ========================================================================== */

/* Table wrapper needs relative positioning for overlay */
.dataTables_wrapper {
    position: relative !important;
}

/* Processing indicator overlay - centrato sulla tabella */
.dataTables_processing {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    margin-top: 20px !important; /* Offset per l'header della tabella */
    padding: 1.25rem 2rem !important;
    background: rgba(235, 228, 215, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: 0 8px 32px rgba(140, 120, 90, 0.25) !important;
    z-index: 100 !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

/* Quando DataTables mostra il processing (display: block), convertiamo a flex */
.dataTables_processing[style*="display: block"],
.dataTables_processing[style*="display:block"] {
    display: flex !important;
}

/* Hide default text, we'll use our custom one */
.dataTables_processing > div {
    display: none !important;
}

/* Custom loading spinner */
.dataTables_processing::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(180, 160, 130, 0.3);
    border-top-color: var(--color-terracotta);
    border-radius: 50%;
    animation: dt-spinner 0.8s linear infinite;
}

/* Loading text */
.dataTables_processing::after {
    content: 'Caricamento...';
    display: block;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text);
    letter-spacing: 0.025em;
}

/* Spinner animation */
@keyframes dt-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Dim table while loading */
.dataTables_wrapper.processing tbody {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
